diff --git a/0001-configure-Simplify-fragile-libdrm-detection.patch b/0001-configure-Simplify-fragile-libdrm-detection.patch new file mode 100644 index 0000000000000000000000000000000000000000..3ad5643fcadc937ed54b9b81c7682fe230b1012b --- /dev/null +++ b/0001-configure-Simplify-fragile-libdrm-detection.patch @@ -0,0 +1,41 @@ +From 58b60cdad9fb201eb097777d6f1d17b5ccd9403a Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Wed, 10 Feb 2021 14:49:48 -0500 +Subject: [PATCH] configure: Simplify fragile libdrm detection + +libdrm 2.4.46 always installs qxl_drm.h +--- + configure.ac | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/configure.ac b/configure.ac +index e367558..d3e5f50 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -76,11 +76,6 @@ AC_CHECK_DECL(XSERVER_LIBPCIACCESS, + [#include "xorg-server.h"]) + CFLAGS="$save_CFLAGS" + +-save_CFLAGS="$CFLAGS" +-CFLAGS="$XORG_CFLAGS" +-AC_CHECK_HEADER(qxl_drm.h,[QXL_DRM=yes],[QXL_DRM=no],[#include ]) +-CFLAGS="$save_CFLAGS" +- + AC_ARG_ENABLE(kms, + AS_HELP_STRING([--disable-kms], + [Disable KMS support [[default=enabled]]]), +@@ -88,10 +83,9 @@ AC_ARG_ENABLE(kms, + [DRM_MODE=yes]) + + # Checks for libraries. +-if test "x$QXL_DRM" = xyes && test "x$DRM_MODE" = xyes; then ++if test "x$DRM_MODE" = xyes; then + # require support for kms cursor hotspot + PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.46]) +- + else + DRM_MODE=no + fi +-- +2.26.2 + diff --git a/0001-worst-hack-of-all-time-to-qxl-driver.patch b/0001-worst-hack-of-all-time-to-qxl-driver.patch new file mode 100644 index 0000000000000000000000000000000000000000..c6c76670d14957fbaa828e08b3c263fb07bb410e --- /dev/null +++ b/0001-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/0002-Xspice-Use-print-instead-of-print.patch b/0002-Xspice-Use-print-instead-of-print.patch new file mode 100644 index 0000000000000000000000000000000000000000..68a242b061fa622fa439dc7de364e1b93309f501 --- /dev/null +++ b/0002-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/0003-Xspice-Remove-extra-space-before-assignment.patch b/0003-Xspice-Remove-extra-space-before-assignment.patch new file mode 100644 index 0000000000000000000000000000000000000000..53cd10b7d2071f260630c5b4c884eeb874e2be06 --- /dev/null +++ b/0003-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/0004-Xspice-Fix-Python3-str-vs-bytes-confusion.patch b/0004-Xspice-Fix-Python3-str-vs-bytes-confusion.patch new file mode 100644 index 0000000000000000000000000000000000000000..36e20d5c2a0b15f8832e2cf3913c3bcc1b8af9f1 --- /dev/null +++ b/0004-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/0005-Xspice-Adjust-shebang-to-explicitly-mention-python3.patch b/0005-Xspice-Adjust-shebang-to-explicitly-mention-python3.patch new file mode 100644 index 0000000000000000000000000000000000000000..4a3a4730594a61cf0676312ed0b4ab74a132c6fd --- /dev/null +++ b/0005-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/0006-qxl-call-provider-init.patch b/0006-qxl-call-provider-init.patch new file mode 100644 index 0000000000000000000000000000000000000000..b8cd7c0bcf1b0927ea282231e4256532cd3c0c10 --- /dev/null +++ b/0006-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/fix-build-error-with-xserver.patch b/fix-build-error-with-xserver.patch new file mode 100644 index 0000000000000000000000000000000000000000..9c87ae79f881f0f2a3468f893be93c945b70e066 --- /dev/null +++ b/fix-build-error-with-xserver.patch @@ -0,0 +1,101 @@ +From 4b083ede3c4a827a84295ff223e34ee3c2e581b2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= + +Date: Sat, 28 Aug 2021 15:38:40 +0200 +Subject: [PATCH] Fix a build error with Xorg master +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use xf86ReturnOptValBool() in get_bool_option() instead of +options[option_index].value.bool to fix a compiler error with +current Xorg xserver master branch. + +Also use xf86GetOptValInteger() in get_int_option() and +xf86GetOptValString() in get_str_option() for consistency. + +The change causes a slight performance drop during option parsing +because the passed-in index_value is no longer used as an index +into the options array. + +Instead, it's used as a token now for the standard option getter +functions which works since the index_value to the get_*_option() +functions are identical to the value of options[n].token in the +passed-in OptionInfoRec array. + +Also rename "int option_index" to "int token" for clarity in all +three functions. + +Signed-off-by: Zolt谩n B枚sz枚rm茅nyi +--- + src/qxl_option_helpers.c | 13 +++++++------ + src/qxl_option_helpers.h | 6 +++--- + 2 files changed, 10 insertions(+), 9 deletions(-) + +diff --git a/src/qxl_option_helpers.c b/src/qxl_option_helpers.c +index 2aba677..7707b7c 100644 +--- a/src/qxl_option_helpers.c ++++ b/src/qxl_option_helpers.c +@@ -10,31 +10,32 @@ + + #include "qxl_option_helpers.h" + +-int get_int_option(OptionInfoPtr options, int option_index, ++int get_int_option(OptionInfoPtr options, int token, + const char *env_name) + { ++ int value; + if (env_name && getenv(env_name)) { + return atoi(getenv(env_name)); + } +- return options[option_index].value.num; ++ return xf86GetOptValInteger(options, token, &value) ? value : 0; + } + +-const char *get_str_option(OptionInfoPtr options, int option_index, ++const char *get_str_option(OptionInfoPtr options, int token, + const char *env_name) + { + if (getenv(env_name)) { + return getenv(env_name); + } +- return options[option_index].value.str; ++ return xf86GetOptValString(options, token); + } + +-int get_bool_option(OptionInfoPtr options, int option_index, ++int get_bool_option(OptionInfoPtr options, int token, + const char *env_name) + { + const char* value = getenv(env_name); + + if (!value) { +- return options[option_index].value.bool; ++ return xf86ReturnOptValBool(options, token, FALSE); + } + if (strcmp(value, "0") == 0 || + strcasecmp(value, "off") == 0 || +diff --git a/src/qxl_option_helpers.h b/src/qxl_option_helpers.h +index 7c54c72..66d0a17 100644 +--- a/src/qxl_option_helpers.h ++++ b/src/qxl_option_helpers.h +@@ -4,13 +4,13 @@ + #include + #include + +-int get_int_option(OptionInfoPtr options, int option_index, ++int get_int_option(OptionInfoPtr options, int token, + const char *env_name); + +-const char *get_str_option(OptionInfoPtr options, int option_index, ++const char *get_str_option(OptionInfoPtr options, int token, + const char *env_name); + +-int get_bool_option(OptionInfoPtr options, int option_index, ++int get_bool_option(OptionInfoPtr options, int token, + const char *env_name); + + #endif // OPTION_HELPERS_H +-- +GitLab + diff --git a/xf86-video-qxl-0.1.5.tar.bz2 b/xf86-video-qxl-0.1.5.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..17641e9be4baebc1da21c7ac51df0a6a52366d5b Binary files /dev/null and b/xf86-video-qxl-0.1.5.tar.bz2 differ diff --git a/xorg-x11-drv-qxl-0.1.5-1.an8.src.rpm b/xorg-x11-drv-qxl-0.1.5-1.an8.src.rpm new file mode 100644 index 0000000000000000000000000000000000000000..29d527e13438d5f4b58b8e43703331027643c9e7 Binary files /dev/null and b/xorg-x11-drv-qxl-0.1.5-1.an8.src.rpm differ diff --git a/xorg-x11-drv-qxl.spec b/xorg-x11-drv-qxl.spec new file mode 100644 index 0000000000000000000000000000000000000000..ab451bfa32fd963feabeec93c7b89038807a2e0b --- /dev/null +++ b/xorg-x11-drv-qxl.spec @@ -0,0 +1,109 @@ +%define anolis_release 1 +%global tarball xf86-video-qxl +%global moduledir %(pkg-config xorg-server --variable=moduledir ) +%global driverdir %{moduledir}/drivers + +%undefine _hardened_build + +%define with_xspice 1 + + +Summary: Xorg X11 qxl video driver +Name: xorg-x11-drv-qxl + +Version: 0.1.5 + +Release: %{anolis_release}%{?dist} +URL: http://www.x.org +Source0: http://xorg.freedesktop.org/releases/individual/driver/%{tarball}-%{version}.tar.bz2 +Patch1: 0001-worst-hack-of-all-time-to-qxl-driver.patch +Patch2: 0002-Xspice-Use-print-instead-of-print.patch +Patch3: 0003-Xspice-Remove-extra-space-before-assignment.patch +Patch4: 0004-Xspice-Fix-Python3-str-vs-bytes-confusion.patch +# This shebang patch is currently downstream-only +Patch5: 0005-Xspice-Adjust-shebang-to-explicitly-mention-python3.patch +Patch6: 0006-qxl-call-provider-init.patch +# https://gitlab.freedesktop.org/xorg/driver/xf86-video-qxl/-/merge_requests/5 +Patch7: 0001-configure-Simplify-fragile-libdrm-detection.patch +Patch8: fix-build-error-with-xserver.patch + +License: MIT + + +BuildRequires: make +BuildRequires: pkgconfig +BuildRequires: git-core +BuildRequires: xorg-x11-server-devel >= 1.1.0 +BuildRequires: spice-protocol >= 0.12.1 +BuildRequires: libdrm-devel >= 2.4.46 + +%if %{with_xspice} +BuildRequires: spice-server-devel >= 0.8.0 +%endif +BuildRequires: glib2-devel +BuildRequires: libtool +BuildRequires: libudev-devel +BuildRequires: libXfont2-devel +BuildRequires: libXext-devel + +Requires: Xorg %(xserver-sdk-abi-requires ansic) +Requires: Xorg %(xserver-sdk-abi-requires videodrv) + +%description +X.Org X11 qxl video driver. + +%if %{with_xspice} +%package -n xorg-x11-server-Xspice +Summary: XSpice is an X server that can be accessed by a Spice client +Requires: Xorg %(xserver-sdk-abi-requires ansic) +Requires: Xorg %(xserver-sdk-abi-requires videodrv) +Requires: xorg-x11-server-Xorg + +%description -n xorg-x11-server-Xspice +XSpice is both an X and a Spice server. +%endif + +%prep +%autosetup -S git_am -n %{tarball}-%{version} + + +%build +autoreconf -ivf +%if %{with_xspice} +%define enable_xspice --enable-xspice +%endif +%configure --disable-static %{?enable_xspice} +make %{?_smp_mflags} + +%install +make install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p' + +find $RPM_BUILD_ROOT -regex ".*\.la$" | xargs rm -f -- + +%if %{with_xspice} +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/X11 +install -p -m 644 examples/spiceqxl.xorg.conf.example \ + $RPM_BUILD_ROOT%{_sysconfdir}/X11/spiceqxl.xorg.conf +rm -f $RPM_BUILD_ROOT/usr/share/doc/xf86-video-qxl/spiceqxl.xorg.conf.example +%if !%{with_xspice} +rm -f $RPM_BUILD_ROOT%{_sysconfdir}/X11/spiceqxl.xorg.conf +%endif +%endif + + +%files +%doc COPYING README +%{driverdir}/qxl_drv.so + +%if %{with_xspice} +%files -n xorg-x11-server-Xspice +%doc COPYING README.xspice README examples/spiceqxl.xorg.conf.example +%config(noreplace) %{_sysconfdir}/X11/spiceqxl.xorg.conf +%{_bindir}/Xspice +%{driverdir}/spiceqxl_drv.so +%endif + + +%changelog +* Thu Apr 21 2022 mgb01105731 - 0.1.5-1 +- Init from upstream version 0.1.5