From 9593d45818ceba0c7237f3b0077a88f6e045a291 Mon Sep 17 00:00:00 2001 From: David Guglielmi Date: Sun, 5 Apr 2020 15:29:51 +0200 Subject: [PATCH] x11-drivers/xf86-video-qxl: Port to EAPI 7, apply patches from Fedora/Upstream --- x11-drivers/xf86-video-qxl/Manifest | 16 ++++ ...ong-standing-led-state-bug-in-xspice.patch | 43 +++++++++++ ...5-make-output-name-numbering-1-based.patch | 43 +++++++++++ ...utput-names-match-modesetting-driver.patch | 71 ++++++++++++++++++ ...alidate-the-atom-for-enum-properties.patch | 33 +++++++++ ...deo-qxl-0.1.5-qxl-call-provider-init.patch | 26 +++++++ ...nclude-only-the-dpms-headers-we-need.patch | 40 ++++++++++ ...ze-prev-field-while-dup-surface-list.patch | 53 +++++++++++++ ...hebang-to-explicitly-mention-python3.patch | 19 +++++ ...e-fix-python3-str-vs-bytes-confusion.patch | 26 +++++++ ...remove-extra-space-before-assignment.patch | 31 ++++++++ ....5-xspice-use-print-instead-of-print.patch | 74 +++++++++++++++++++ ...e-vt-when-shutting-down-this-xserver.patch | 48 ++++++++++++ ...worst-hack-of-all-time-to-qxl-driver.patch | 57 ++++++++++++++ x11-drivers/xf86-video-qxl/metadata.xml | 11 +++ .../xf86-video-qxl-0.1.5.ebuild | 47 ++++++++++++ 16 files changed, 638 insertions(+) create mode 100644 x11-drivers/xf86-video-qxl/Manifest create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-correct-a-long-standing-led-state-bug-in-xspice.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-make-output-name-numbering-1-based.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-make-output-names-match-modesetting-driver.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-modesetting-validate-the-atom-for-enum-properties.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-call-provider-init.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-include-only-the-dpms-headers-we-need.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-initialize-prev-field-while-dup-surface-list.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-adjust-shebang-to-explicitly-mention-python3.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-fix-python3-str-vs-bytes-confusion.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-remove-extra-space-before-assignment.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-use-print-instead-of-print.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-avoid-crashing-xserver-on-previous-active-vt-when-shutting-down-this-xserver.patch create mode 100644 x11-drivers/xf86-video-qxl/files/xf86-video-qxl-worst-hack-of-all-time-to-qxl-driver.patch create mode 100644 x11-drivers/xf86-video-qxl/metadata.xml create mode 100644 x11-drivers/xf86-video-qxl/xf86-video-qxl-0.1.5.ebuild diff --git a/x11-drivers/xf86-video-qxl/Manifest b/x11-drivers/xf86-video-qxl/Manifest new file mode 100644 index 0000000..e6884fd --- /dev/null +++ b/x11-drivers/xf86-video-qxl/Manifest @@ -0,0 +1,16 @@ +AUX xf86-video-qxl-0.1.5-correct-a-long-standing-led-state-bug-in-xspice.patch 1497 BLAKE2B b62207b2675f9c7de950bdd8e81a0fc80623a15dd32411965c0f61d1b64914bc7a0e935eef565b4179c2eb25a1f56d35f2066a212b1ed755de06c240712b913a SHA512 64acbefcb476c64906997434f8ca38bf80e8d3565efd5b4266f1e2793578d0874e389e422dec243842ea89a3486dfa05cddcf7ee54052f7485c61f9dc8b215a6 +AUX xf86-video-qxl-0.1.5-make-output-name-numbering-1-based.patch 1686 BLAKE2B 89d1c5178737eb86020e17e187b593be7cf808b0ab04d02f093a728cfbfbc2b19cac6f321f7c5a53da03d784caac08165f3a903c99e90fdc02d01a1781ebb4d1 SHA512 33264146fa6b904bbd03c1b740c2f186d5577726ad113a2b96a4126680eeb69bf88acf9f5fbbae8ab795c47279e272df71d010a70e0bde4cdf25f7b505fc5cd3 +AUX xf86-video-qxl-0.1.5-make-output-names-match-modesetting-driver.patch 1902 BLAKE2B 9bd8f8b66554bfc1b2e5c2cd2fafcde29da0d9ddb0cde71333ba9b2ff89837c2888451b0acd00a6ffb7efa83fc81d3514e85be4b5c84bb7dcbd8083ada9d6a1a SHA512 b2b640e92bdff24a4ae64f4703928711492803b118481e8cc4836aa511e672884f969c57dcffc50bb1d5448e1bc5452890a6a25c5a560dcf37ba138ba29652d3 +AUX xf86-video-qxl-0.1.5-modesetting-validate-the-atom-for-enum-properties.patch 1159 BLAKE2B 1c642bbb745286f2add32de55b1ec54c6b20f5098252e7554364e41c3d3a3b317a1058c0e3732e938cc8d2f3a70a60e6f1e2fceefd7ce2b055dcf0f1df713d93 SHA512 11cbfc2a616a8eda85f8d81d6a8e06641cffeedc12af9c6567dcb17f743814bf1ac812b5a0b8fc578474050dd42d65369e84c231812affcac0e0f76e173414a3 +AUX xf86-video-qxl-0.1.5-qxl-call-provider-init.patch 842 BLAKE2B 484bcf33461bd12080b3c886178a84be2a6fd5705d6f3979e9a5434a5b62886cbfb859a656938095ba468335686e4248b0c75d7ec2d0c3cffde07940f080273c SHA512 d2e06fe500b1f60c2af91e1525e3b79c54ddd14f3a4b1112edd2cc183f89791ec7196ba6a95e7ef4916df14337aec0377cda625f411aad8c9bf509997b956491 +AUX xf86-video-qxl-0.1.5-qxl-include-only-the-dpms-headers-we-need.patch 1314 BLAKE2B f1b31d98bea1bd07270e3ea89ff79529377909950c41112c0bab75debbc5a99e2e894134b1ae711e92b47fcf10095fa978c34f12d64c713bfdb750d284419755 SHA512 935fe680545d8777005fc27f926567e3f62410402ac8c1aa7a6cc7bacd19c5305d779ea2db35a3fc69d0743485d6b17427886d286b5ff5c19ff4697d3965ed72 +AUX xf86-video-qxl-0.1.5-qxl-initialize-prev-field-while-dup-surface-list.patch 1753 BLAKE2B cf6d4858644ff1c1cb1c2ac77915b0343428b3b5ead7331003296ac4e7e383197e4768725564802eaa5eda6e47802981f776bfde0d066cdb3659b14433a61130 SHA512 e9d967d7bd4106fe4716ea0cf08a17d9ae49341cd4e4f1d08091560d9aacab92fc60c739215aeccb035a6ec0c0370171ae0576e9b8a97e71dc24849264e6b0cf +AUX xf86-video-qxl-0.1.5-xspice-adjust-shebang-to-explicitly-mention-python3.patch 489 BLAKE2B 366b628bbe31a1e9f8bc8c23d59bbe407a03313843ea88556510ad4f7a6f8ff870aae7d170c2d40a61b359c136b82055aa2df9a96e85631c359fbf26658e3df2 SHA512 803b32d2f5208fa8c8a3b19a15efc7a7100d60ff785035239147771b19484f6af23395ec3083b7662b1c4b463d2f94bc4ddab5e1fa1290687d405b33f5aa27d6 +AUX xf86-video-qxl-0.1.5-xspice-fix-python3-str-vs-bytes-confusion.patch 972 BLAKE2B 0d48046084a4ba9d308c4ae2843905a01ac92c2652e3b1c26d3206d270fb7dd75d5ac85c070530e1b4ec69d3d8ccc5d2ee8d59f0cc3ab7c6c1e9452af10340bc SHA512 4a850b955558362e40be4e5076de9f2f4c79366de4cfff10ec0087ac1a8a06e316ff59fea2113a8ece5d7655ad25e7d667d964c1ae89e406dc2e06081482691d +AUX xf86-video-qxl-0.1.5-xspice-remove-extra-space-before-assignment.patch 995 BLAKE2B 7f35517440451d28f9d3e35351304fd115a2c65b81de987efb69bae937e0732846f3ad53351627463a68f501d78a1c310e97c3a8b79af1446333a675329b3b12 SHA512 17ad91adb5700bc6b1908083b0e5a1646e726415c0fc0dfca994a92ebdbec7f0140ed2274354ea8e0775148810bd3e22a9afc0c7ccf7c5f687583f48e2e8e8ec +AUX xf86-video-qxl-0.1.5-xspice-use-print-instead-of-print.patch 2648 BLAKE2B ae4ba15afd77deeecadb7463593c78e1a72c50ef8e7b197876c3adaa5eeb0282cf7e5cfd96939e564b400c11d2b7a1afa1a850529541955cb64bebc20e779795 SHA512 5b9dd8921d418105f5b764faaaf262121a971baa74578a98cc725233fda30530aa9b3074b9975b3817f67cbd0c0b1b2f7b3ae9906b18572d893ce9d41560d8b6 +AUX xf86-video-qxl-avoid-crashing-xserver-on-previous-active-vt-when-shutting-down-this-xserver.patch 1670 BLAKE2B 9166cca4add57335b2ca7c1414731b6eea24e6eeb7d34aa282e3bbe7e0b6e34600697776bd6f1738ebb647ee76b4d2296e472bd9668a3dc8b6b6b36c9ce722a5 SHA512 b6b5db8d6d7051ea84416f957a4d9307ecfab3d31c0a9c99b065fed1544c5a8e966fb1d89e9a6f1da638e555a8eb4ee35baaa13fbc1a21864246e88088ccf412 +AUX xf86-video-qxl-worst-hack-of-all-time-to-qxl-driver.patch 1854 BLAKE2B 2db33a6e491390544601107cfa3d6077c194510facde6523121fbd4f4feaf99b55ef81da02d9cb21779412edca56b179307ea6300999f273147cad1eef17659f SHA512 68d01dcc6963bbe26ba5cb2a6ba464ec01c26eda6ce564303b723fcf77797a32123aa203ec6f5cea137d16c41b4bee250deda2275094b64e411c07a4587c2cfe +DIST xf86-video-qxl-0.1.5.tar.bz2 508266 BLAKE2B ca0fd43830a393d9bb1f5a6ba306f26e07a0b90233fa44f3fbe7a5f21026f1bd6960254db9cd75d947b3c42f6cc8cd3b7cfd71afc2c0a74bd84c60eafcf7e150 SHA512 7510b2d037b3e978df6063b29e2406f3d1270695a239f29fdaec9b1dc65a30ab10cb959f15eb336f78e93aa708d41c64c5ea43803958feffc64542229605b782 +EBUILD xf86-video-qxl-0.1.5.ebuild 1776 BLAKE2B bc26cd6624f11dd57ae5c3ee1a752601b1cacbfd2ab064e58842aebfc39dd532a0af04de5bcef210d52032b1e107a979ec517b34751c77ea0599edf1b6376ff1 SHA512 82b6b88d3009807b538818e749fc93458439bfcd29229c06f7d5296e9b21507a2621d74be1c544c1c9bab87c268e82e011c80355e07032a55079766755641b4e +MISC metadata.xml 292 BLAKE2B def2312773a7e6872be5d2de2184f3bbdd74caaa32bd0a8c1a85955f11e4a56a7a045431fb582eb121c5fbd5aa3f9d59a137af4973870c08c012abd7d45cdf72 SHA512 d09afd5c8c1c5180f73d6b482e84904cd015f8c302a076e059caa504cfd0029049e75a9f70aff5d4cbf1c36cfd8afdd1c4751ad78bd9e21d6aee6c8e574f8078 diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-correct-a-long-standing-led-state-bug-in-xspice.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-correct-a-long-standing-led-state-bug-in-xspice.patch new file mode 100644 index 0000000..61fc2b4 --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-correct-a-long-standing-led-state-bug-in-xspice.patch @@ -0,0 +1,43 @@ +From 922ec516beaae0c0735bbd46d470908f243e3605 Mon Sep 17 00:00:00 2001 +From: Jeremy White +Date: Fri, 5 Apr 2019 09:38:31 -0500 +Subject: [PATCH] Correct a long standing led state bug in XSpice. + +The CtrlProc for our keyboard driver incorrectly mapped +the device private to a SpiceKbd* intead of to a InputInfoPtr. + +That resulted in led state being written into the driver name +for our driver structure, instead of into the led state. + +That, in turn, led to a cool bug where if you pressed caps lock, +the two second sync timer in the spice server would cause it to +attempt to correct the state by pressing caps lock to get the +states to match. Since the states will never match, the caps +lock effectively cycles on and off every two seconds. + +Signed-off-by: Jeremy White +Acked-by: Victor Toso +--- + src/spiceqxl_inputs.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/spiceqxl_inputs.c b/src/spiceqxl_inputs.c +index b39eeae..5625309 100644 +--- a/src/spiceqxl_inputs.c ++++ b/src/spiceqxl_inputs.c +@@ -138,9 +138,11 @@ static void xspice_keyboard_control(DeviceIntPtr device, KeybdCtrl *ctrl) + }; + + XSpiceKbd *kbd; ++ InputInfoPtr pInfo; + int i; + +- kbd = device->public.devicePrivate; ++ pInfo = device->public.devicePrivate; ++ kbd = pInfo->private; + kbd->ledstate = 0; + for (i = 0; i < ArrayLength(bits); i++) { + if (ctrl->leds & bits[i].xbit) { +-- +2.24.1 + diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-make-output-name-numbering-1-based.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-make-output-name-numbering-1-based.patch new file mode 100644 index 0000000..a5cd557 --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-make-output-name-numbering-1-based.patch @@ -0,0 +1,43 @@ +From 505a8bb0cd82e2a50fcf18ed4647788adacef6ee Mon Sep 17 00:00:00 2001 +From: Jonathon Jongsma +Date: Mon, 12 Nov 2018 14:06:13 -0600 +Subject: [PATCH] Make output name numbering 1-based + +The QXL driver names its outputs starting at 0 (e.g. Virtual-0, +Virtual-1, etc). This code was presumably copy/pasted from a different +driver, and is not necessary for the QXL driver. Other drivers simply +use the kernel connector_type_id which starts at 1. For example, the +modesetting driver changed from 0-based names to 1-based names for the +same reason in xserver commit 139e36dd. + +This will help to make it easier to identify which xrandr outputs belong +to which drm connector without requiring as many driver-specific +special-cases. + +This change might effect custom xorg configurations that references a +specific output name. But the same change was made in modesetting driver +despite that possibility. + +Signed-off-by: Jonathon Jongsma +Acked-by: Frediano Ziglio +--- + src/qxl_drmmode.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/qxl_drmmode.c b/src/qxl_drmmode.c +index a2f84b1..a814859 100644 +--- a/src/qxl_drmmode.c ++++ b/src/qxl_drmmode.c +@@ -765,8 +765,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num) + } + } + +- /* need to do smart conversion here for compat with non-kms ATI driver */ +- snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id - 1); ++ snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id); + + + output = xf86OutputCreate (pScrn, &drmmode_output_funcs, name); +-- +2.24.1 + diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-make-output-names-match-modesetting-driver.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-make-output-names-match-modesetting-driver.patch new file mode 100644 index 0000000..ebf6d3a --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-make-output-names-match-modesetting-driver.patch @@ -0,0 +1,71 @@ +From 64cb597c7f7fa1493aea95aa3656e2cae66728d2 Mon Sep 17 00:00:00 2001 +From: Jonathon Jongsma +Date: Mon, 12 Nov 2018 14:06:14 -0600 +Subject: [PATCH] Make output names match modesetting driver + +The xrandr output name used by the QXL driver is based on the drm +connector type, but the names do not match the kernel names (see +/drivers/gpu/drm/drm_connector.c) or the modesetting driver names (see +hw/xfree86/drivers/modesetting/drmmode_display.c). Making these more +consistent will require less driver-specific special-case code if a user +wants to match an xrandr output to a drm connector. + +Note that this patch should not actually change any behavior, since the +QXL driver only uses the 'Virtual' connector type, so this is done only +for consistency. + +Signed-off-by: Jonathon Jongsma +Acked-by: Frediano Ziglio +--- + src/qxl_drmmode.c | 35 +++++++++++++++++++---------------- + 1 file changed, 19 insertions(+), 16 deletions(-) + +diff --git a/src/qxl_drmmode.c b/src/qxl_drmmode.c +index a814859..8ebc708 100644 +--- a/src/qxl_drmmode.c ++++ b/src/qxl_drmmode.c +@@ -720,22 +720,25 @@ static int subpixel_conv_table[7] = { 0, SubPixelUnknown, + SubPixelVerticalBGR, + SubPixelNone }; + +-const char *output_names[] = { "None", +- "VGA", +- "DVI", +- "DVI", +- "DVI", +- "Composite", +- "S-video", +- "LVDS", +- "CTV", +- "DIN", +- "DisplayPort", +- "HDMI", +- "HDMI", +- "TV", +- "eDP", +- "Virtual" ++const char *output_names[] = { ++ "None", ++ "VGA", ++ "DVI-I", ++ "DVI-D", ++ "DVI-A", ++ "Composite", ++ "SVIDEO", ++ "LVDS", ++ "Component", ++ "DIN", ++ "DP", ++ "HDMI", ++ "HDMI-B", ++ "TV", ++ "eDP", ++ "Virtual", ++ "DSI", ++ "DPI", + }; + + static void +-- +2.24.1 + diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-modesetting-validate-the-atom-for-enum-properties.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-modesetting-validate-the-atom-for-enum-properties.patch new file mode 100644 index 0000000..df67173 --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-modesetting-validate-the-atom-for-enum-properties.patch @@ -0,0 +1,33 @@ +From 78abd5221f7efd87383aa357590efff083449aa3 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 13 Jun 2017 09:29:28 -0400 +Subject: [PATCH] modesetting: Validate the atom for enum properties + +The client could have said anything here, and if what they said doesn't +actually name an atom NameForAtom() will return NULL, and strcmp() will +be unhappy about that. + +[copied from xserver d4995a3936ae283b9080fdaa0905daa669ebacfc] + +Signed-off-by: Adam Jackson +--- + src/qxl_drmmode.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/qxl_drmmode.c b/src/qxl_drmmode.c +index 3c288f9..ff164cd 100644 +--- a/src/qxl_drmmode.c ++++ b/src/qxl_drmmode.c +@@ -622,7 +622,8 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property, + if (value->type != XA_ATOM || value->format != 32 || value->size != 1) + return FALSE; + memcpy(&atom, value->data, 4); +- name = NameForAtom(atom); ++ if (!(name = NameForAtom(atom))) ++ return FALSE; + + /* search for matching name string, then set its value down */ + for (j = 0; j < p->mode_prop->count_enums; j++) { +-- +2.24.1 + diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-call-provider-init.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-call-provider-init.patch new file mode 100644 index 0000000..b8cd7c0 --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-call-provider-init.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Wed, 8 Mar 2017 10:50:56 +1000 +Subject: [PATCH] qxl: call provider init + +This prevents crashes when multiple QXL devices are configured in a VM. + +https://bugzilla.redhat.com/show_bug.cgi?id=1428340 +--- + src/qxl_drmmode.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/qxl_drmmode.c b/src/qxl_drmmode.c +index 3c288f9..41de92f 100644 +--- a/src/qxl_drmmode.c ++++ b/src/qxl_drmmode.c +@@ -937,6 +937,9 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp) + for (i = 0; i < drmmode->mode_res->count_connectors; i++) + drmmode_output_init(pScrn, drmmode, i); + ++#if XF86_CRTC_VERSION >= 5 ++ xf86ProviderSetup(pScrn, NULL, "qxl"); ++#endif + xf86InitialConfiguration(pScrn, TRUE); + + return TRUE; diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-include-only-the-dpms-headers-we-need.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-include-only-the-dpms-headers-we-need.patch new file mode 100644 index 0000000..c36018c --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-include-only-the-dpms-headers-we-need.patch @@ -0,0 +1,40 @@ +From 52c421c650f8813665b31890df691b31fabc366a Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Wed, 5 Feb 2020 12:55:01 -0500 +Subject: [PATCH] qxl: Include only the dpms headers we need + +dpms.h is provided by libXext, but nothing in our configure.ac is +verifying that we have libXext's headers. Fortunately we only need the +definitions in dpmsconst.h (which dpms.h included for us), which is in +xorgproto and thus implied by having an xserver DDK to build against. + +And we're even trying to include dpmsconst.h when we think we have it, +meaning when HAVE_XEXTPROTO_71 is defined, but while many other drivers +define that macro in their configure.ac, we for no particularly good +reason do not. Oops. But since xextproto is about ten years old by now +we can probably just safely include it unconditionally. +--- + src/qxl_drmmode.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/src/qxl_drmmode.c b/src/qxl_drmmode.c +index 8ebc708..337bbd7 100644 +--- a/src/qxl_drmmode.c ++++ b/src/qxl_drmmode.c +@@ -36,13 +36,7 @@ + #include "qxl_drmmode.h" + #include "X11/Xatom.h" + #include "xf86DDC.h" +-/* DPMS */ +-#ifdef HAVE_XEXTPROTO_71 + #include +-#else +-#define DPMS_SERVER +-#include +-#endif + #include + + #include "qxl.h" +-- +2.24.1 + diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-initialize-prev-field-while-dup-surface-list.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-initialize-prev-field-while-dup-surface-list.patch new file mode 100644 index 0000000..160ac2c --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-qxl-initialize-prev-field-while-dup-surface-list.patch @@ -0,0 +1,53 @@ +From cf2254c13497049a8dbc73a3b031f4cd43403ab1 Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Tue, 23 Oct 2018 13:48:58 +0200 +Subject: [PATCH] qxl: Initialize prev field while dup surface list +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Otherwise we will can hit a segfault qxl_surface_kill() + + │717 void + │718 qxl_surface_kill (qxl_surface_t *surface) + │719 { + │720 struct evacuated_surface_t *ev = surface->evacuated; + │721 + │722 if (ev) + │723 { + │724 /* server side surface is already destroyed (via reset), don't + │725 * resend a destroy. Just mark surface as not to be recreated */ + │726 ev->pixmap = NULL;│ + │727 if (ev->image)│ + │728 pixman_image_unref (ev->image); + │729 if (ev->next) + │730 ev->next->prev = ev->prev; + │731 if (ev->prev) +>│732 ev->prev->next = ev->next; + │733 free(ev); + │734 surface->evacuated = NULL; + │735 return; + │736 } + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1641793 + +Signed-off-by: Victor Toso +--- + src/qxl_surface_ums.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/qxl_surface_ums.c b/src/qxl_surface_ums.c +index 2c16ede..19cbd36 100644 +--- a/src/qxl_surface_ums.c ++++ b/src/qxl_surface_ums.c +@@ -792,6 +792,7 @@ qxl_surface_cache_evacuate_all (surface_cache_t *cache) + + unlink_surface (s); + ++ evacuated->prev = NULL; + evacuated->next = evacuated_surfaces; + if (evacuated_surfaces) + evacuated_surfaces->prev = evacuated; +-- +2.24.1 + diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-adjust-shebang-to-explicitly-mention-python3.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-adjust-shebang-to-explicitly-mention-python3.patch new file mode 100644 index 0000000..4a3a473 --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-adjust-shebang-to-explicitly-mention-python3.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christophe Fergeau +Date: Thu, 17 May 2018 15:31:05 +0200 +Subject: [PATCH] Xspice: Adjust shebang to explicitly mention python3 + +--- + scripts/Xspice | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/Xspice b/scripts/Xspice +index 927dcb1..78d0794 100755 +--- a/scripts/Xspice ++++ b/scripts/Xspice +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + + """ + Xspice diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-fix-python3-str-vs-bytes-confusion.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-fix-python3-str-vs-bytes-confusion.patch new file mode 100644 index 0000000..36e20d5 --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-fix-python3-str-vs-bytes-confusion.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christophe Fergeau +Date: Wed, 8 Feb 2017 17:07:56 +0100 +Subject: [PATCH] Xspice: Fix Python3 str() vs bytes() confusion + +With python3, without universal_newlines=True, Popen().stdout.read() +will return a byte array, while find(str) expects to operate on a +string. +I've checked that this still works with python2 as well. +--- + scripts/Xspice | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/Xspice b/scripts/Xspice +index 41fd80c..927dcb1 100755 +--- a/scripts/Xspice ++++ b/scripts/Xspice +@@ -135,7 +135,7 @@ def agents_new_enough(args): + return False + + for f in [args.vdagent_exec, args.vdagentd_exec]: +- if Popen(args=[f, '-h'], stdout=PIPE).stdout.read().find('-S') == -1: ++ if Popen(args=[f, '-h'], stdout=PIPE, universal_newlines=True).stdout.read().find('-S') == -1: + return False + return True + diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-remove-extra-space-before-assignment.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-remove-extra-space-before-assignment.patch new file mode 100644 index 0000000..53cd10b --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-remove-extra-space-before-assignment.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christophe Fergeau +Date: Wed, 8 Feb 2017 17:07:39 +0100 +Subject: [PATCH] Xspice: Remove extra space before assignment + +--- + scripts/Xspice | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/scripts/Xspice b/scripts/Xspice +index 30d10fa..41fd80c 100755 +--- a/scripts/Xspice ++++ b/scripts/Xspice +@@ -211,7 +211,7 @@ signal.signal(signal.SIGTERM, cleanup) + atexit.register(cleanup) + + if args.auto: +- temp_dir = tempfile.mkdtemp(prefix="Xspice-") ++ temp_dir = tempfile.mkdtemp(prefix="Xspice-") + cleanup_dirs.append(temp_dir) + + args.config = temp_dir + "/xorg.conf" +@@ -275,7 +275,7 @@ if args.vdagent_enabled: + os.unlink(f) + + if not temp_dir: +- temp_dir = tempfile.mkdtemp(prefix="Xspice-") ++ temp_dir = tempfile.mkdtemp(prefix="Xspice-") + cleanup_dirs.append(temp_dir) + + # Auto generate temporary files for vdagent diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-use-print-instead-of-print.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-use-print-instead-of-print.patch new file mode 100644 index 0000000..68a242b --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-0.1.5-xspice-use-print-instead-of-print.patch @@ -0,0 +1,74 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christophe Fergeau +Date: Wed, 8 Feb 2017 15:23:56 +0100 +Subject: [PATCH] Xspice: Use print("") instead of print "" + +This allows Xspice to run when using python3 instead of python2 +--- + scripts/Xspice | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/scripts/Xspice b/scripts/Xspice +index ada99d1..30d10fa 100755 +--- a/scripts/Xspice ++++ b/scripts/Xspice +@@ -34,7 +34,7 @@ def which(x): + candidate = os.path.join(p, x) + if os.path.exists(candidate): + return candidate +- print 'Warning: failed to find executable %s' % x ++ print('Warning: failed to find executable %s' % x) + return None + + if 'XSPICE_ENABLE_GDB' in os.environ: +@@ -128,10 +128,10 @@ args, xorg_args = parser.parse_known_args(sys.argv[1:]) + def agents_new_enough(args): + for f in [args.vdagent_exec, args.vdagentd_exec]: + if not f: +- print 'please specify path to vdagent/vdagentd executables' ++ print('please specify path to vdagent/vdagentd executables') + return False + if not os.path.exists(f): +- print 'error: file not found ', f ++ print('error: file not found ', f) + return False + + for f in [args.vdagent_exec, args.vdagentd_exec]: +@@ -169,11 +169,11 @@ def tls_files(args): + # and it isn't supplied spice will still abort, and Xorg with it. + for key, filename in tls_files(args).items(): + if not os.path.exists(filename): +- print "missing %s - %s does not exist" % (key, filename) ++ print("missing %s - %s does not exist" % (key, filename)) + sys.exit(1) + + def error(msg, exit_code=1): +- print "Xspice: %s" % msg ++ print("Xspice: %s" % msg) + sys.exit(exit_code) + + if not args.xorg: +@@ -319,7 +319,7 @@ for arg in xorg_args: + if arg.startswith(":"): + display = arg + if not display: +- print "Error: missing display on line (i.e. :3)" ++ print("Error: missing display on line (i.e. :3)") + raise SystemExit + os.environ ['DISPLAY'] = display + +@@ -343,7 +343,7 @@ time.sleep(2) + + retpid,rc = os.waitpid(xorg.pid, os.WNOHANG) + if retpid != 0: +- print "Error: X server is not running" ++ print("Error: X server is not running") + else: + if args.vdagent_enabled and args.vdagent_launch: + # XXX use systemd --user for this? +@@ -361,4 +361,4 @@ else: + xorg.wait() + except KeyboardInterrupt: + # Catch Ctrl-C as that is the common way of ending this script +- print "Keyboard Interrupt" ++ print("Keyboard Interrupt") diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-avoid-crashing-xserver-on-previous-active-vt-when-shutting-down-this-xserver.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-avoid-crashing-xserver-on-previous-active-vt-when-shutting-down-this-xserver.patch new file mode 100644 index 0000000..7bddb87 --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-avoid-crashing-xserver-on-previous-active-vt-when-shutting-down-this-xserver.patch @@ -0,0 +1,48 @@ +From 542fa8305a2e48956add10df8c13d348713aee95 Mon Sep 17 00:00:00 2001 +From: Oliver Henshaw +Date: Tue, 29 Nov 2016 15:42:06 +0000 +Subject: [PATCH] Avoid crashing xserver on previous active VT when shutting + down this xserver + +Need to relinquish the DRM master before the xserver calls VT_SETMODE with +VT.mode=VT_AUTO. Otherwise no other process may claim the drm master until the +xserver process exits. This can cause a crash if xf86CloseConsole switches to +the VT that was active when it was started, and a xserver on the old active VT +tries to call drmSetMaster. + +(Cargo cult drmDropMaster call from qxl_enter_vt_kms and qxl_leave_vt_kms. + +I don't think there are potential problems from the driver assuming the xserver +has ownership of the drm master after qxl_close_screen_kms, but I don't know +the code at all. Possibly something needs to be done to make sure no more DRM +events are dispatched after this. + +So please look at this with a critical eye. + +The "#ifdef XF86_PDEV_SERVER_FD" code path is completely untested.) +--- + src/qxl_kms.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/qxl_kms.c b/src/qxl_kms.c +index c31c62d..5fc27ba 100644 +--- a/src/qxl_kms.c ++++ b/src/qxl_kms.c +@@ -106,6 +106,15 @@ qxl_close_screen_kms (CLOSE_SCREEN_ARGS_DECL) + Bool result; + + qxl_drmmode_uevent_fini(pScrn, &qxl->drmmode); ++ ++#ifdef XF86_PDEV_SERVER_FD ++ if (!(qxl->platform_dev && ++ (qxl->platform_dev->flags & XF86_PDEV_SERVER_FD))) ++#endif ++ { ++ drmDropMaster(qxl->drm_fd); ++ } ++ + pScreen->CloseScreen = qxl->close_screen; + + result = pScreen->CloseScreen (CLOSE_SCREEN_ARGS); +-- +2.6.6 diff --git a/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-worst-hack-of-all-time-to-qxl-driver.patch b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-worst-hack-of-all-time-to-qxl-driver.patch new file mode 100644 index 0000000..c6c7667 --- /dev/null +++ b/x11-drivers/xf86-video-qxl/files/xf86-video-qxl-worst-hack-of-all-time-to-qxl-driver.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Tue, 26 Nov 2013 10:45:26 +1000 +Subject: [PATCH] worst hack of all time to qxl driver + +--- + src/qxl_surface.c | 30 ++++++++++++++++++++++++++++-- + 1 file changed, 28 insertions(+), 2 deletions(-) + +diff --git a/src/qxl_surface.c b/src/qxl_surface.c +index 6a7e275..bb59f9e 100644 +--- a/src/qxl_surface.c ++++ b/src/qxl_surface.c +@@ -770,8 +770,9 @@ qxl_surface_composite (qxl_surface_t *dest, + qxl->bo_funcs->bo_decref(qxl, derefs[i]); + } + +-Bool +-qxl_surface_put_image (qxl_surface_t *dest, ++ ++static Bool ++qxl_surface_put_image_for_reals (qxl_surface_t *dest, + int x, int y, int width, int height, + const char *src, int src_pitch) + { +@@ -814,6 +815,31 @@ qxl_surface_put_image (qxl_surface_t *dest, + return TRUE; + } + ++#define HACK_THE_PLANET 1 ++Bool ++qxl_surface_put_image (qxl_surface_t *dest, ++ int x, int y, int width, int height, ++ const char *src, int src_pitch) ++{ ++#ifdef HACK_THE_PLANET ++ Bool use_hack = FALSE; ++ ++ /* worst heuristic ever - should really block the gnome-shell issue for now */ ++ if (width == pixman_image_get_width(dest->host_image) && height < pixman_image_get_height(dest->host_image)) ++ use_hack = TRUE; ++ ++ if (use_hack) { ++ int gross = rand() % height; ++ int h2 = height - gross; ++ if (gross > 0) ++ qxl_surface_put_image_for_reals(dest, x, y, width, gross, src, src_pitch); ++ qxl_surface_put_image_for_reals(dest, x, y + gross, width, h2, src + (gross * src_pitch), src_pitch); ++ return TRUE; ++ } else ++#endif ++ return qxl_surface_put_image_for_reals(dest, x, y, width, height, src, src_pitch); ++} ++ + void + qxl_get_formats (int bpp, SpiceSurfaceFmt *format, pixman_format_code_t *pformat) + { diff --git a/x11-drivers/xf86-video-qxl/metadata.xml b/x11-drivers/xf86-video-qxl/metadata.xml new file mode 100644 index 0000000..6377116 --- /dev/null +++ b/x11-drivers/xf86-video-qxl/metadata.xml @@ -0,0 +1,11 @@ + + + + +x11@gentoo.org +X11 + + +Build the xspice driver + + diff --git a/x11-drivers/xf86-video-qxl/xf86-video-qxl-0.1.5.ebuild b/x11-drivers/xf86-video-qxl/xf86-video-qxl-0.1.5.ebuild new file mode 100644 index 0000000..446a3e8 --- /dev/null +++ b/x11-drivers/xf86-video-qxl/xf86-video-qxl-0.1.5.ebuild @@ -0,0 +1,47 @@ +# Copyright 2020 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6,7,8} ) +inherit python-r1 xorg-3 + +DESCRIPTION="QEMU QXL paravirt video driver" + +KEYWORDS="~amd64 ~x86" +IUSE="xspice" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +RDEPEND=" + xspice? ( + app-emulation/spice + ${PYTHON_DEPS} + ) + x11-base/xorg-server[-minimal] + >=x11-libs/libdrm-2.4.46" +DEPEND="${RDEPEND} + >=app-emulation/spice-protocol-0.12.0 + x11-base/xorg-proto" + +PATCHES=( + "${FILESDIR}/${PN}-worst-hack-of-all-time-to-qxl-driver.patch" # From Fedora + "${FILESDIR}/${P}-xspice-use-print-instead-of-print.patch" # Python 3 support from master + "${FILESDIR}/${P}-xspice-remove-extra-space-before-assignment.patch" # Python 3 support from master + "${FILESDIR}/${P}-xspice-fix-python3-str-vs-bytes-confusion.patch" # Python 3 support from master + "${FILESDIR}/${P}-xspice-adjust-shebang-to-explicitly-mention-python3.patch" # Python 3 support from master + "${FILESDIR}/${P}-modesetting-validate-the-atom-for-enum-properties.patch" # From master + "${FILESDIR}/${P}-qxl-call-provider-init.patch" # From master + "${FILESDIR}/${P}-make-output-name-numbering-1-based.patch" # From master + "${FILESDIR}/${P}-make-output-names-match-modesetting-driver.patch" # From master + "${FILESDIR}/${P}-qxl-initialize-prev-field-while-dup-surface-list.patch" # From master + "${FILESDIR}/${P}-correct-a-long-standing-led-state-bug-in-xspice.patch" # From master + "${FILESDIR}/${P}-qxl-include-only-the-dpms-headers-we-need.patch" # From master + "${FILESDIR}/${PN}-avoid-crashing-xserver-on-previous-active-vt-when-shutting-down-this-xserver.patch" # Upstream bug 99102 +) + +src_configure() { + XORG_CONFIGURE_OPTIONS=( + $(use_enable xspice) + ) + xorg-3_src_configure +}