1
0
mirror of https://github.com/dguglielmi/sunny-overlay.git synced 2025-12-06 20:22:38 +01:00

x11-drivers/xf86-video-qxl: Port to EAPI 7, apply patches from Fedora/Upstream

This commit is contained in:
2020-04-05 15:29:51 +02:00
parent a8df991ab0
commit 9593d45818
16 changed files with 638 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
From 922ec516beaae0c0735bbd46d470908f243e3605 Mon Sep 17 00:00:00 2001
From: Jeremy White <jwhite@codeweavers.com>
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 <jwhite@codeweavers.com>
Acked-by: Victor Toso <victortoso@redhat.com>
---
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

View File

@@ -0,0 +1,43 @@
From 505a8bb0cd82e2a50fcf18ed4647788adacef6ee Mon Sep 17 00:00:00 2001
From: Jonathon Jongsma <jjongsma@redhat.com>
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 <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
---
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

View File

@@ -0,0 +1,71 @@
From 64cb597c7f7fa1493aea95aa3656e2cae66728d2 Mon Sep 17 00:00:00 2001
From: Jonathon Jongsma <jjongsma@redhat.com>
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 <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
---
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

View File

@@ -0,0 +1,33 @@
From 78abd5221f7efd87383aa357590efff083449aa3 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
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 <ajax@redhat.com>
---
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

View File

@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
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;

View File

@@ -0,0 +1,40 @@
From 52c421c650f8813665b31890df691b31fabc366a Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
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 <X11/extensions/dpmsconst.h>
-#else
-#define DPMS_SERVER
-#include <X11/extensions/dpms.h>
-#endif
#include <cursorstr.h>
#include "qxl.h"
--
2.24.1

View File

@@ -0,0 +1,53 @@
From cf2254c13497049a8dbc73a3b031f4cd43403ab1 Mon Sep 17 00:00:00 2001
From: Victor Toso <me@victortoso.com>
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 <victortoso@redhat.com>
---
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

View File

@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau@redhat.com>
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

View File

@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau@redhat.com>
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

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau@redhat.com>
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

View File

@@ -0,0 +1,74 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau@redhat.com>
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")

View File

@@ -0,0 +1,48 @@
From 542fa8305a2e48956add10df8c13d348713aee95 Mon Sep 17 00:00:00 2001
From: Oliver Henshaw <oliver.henshaw@gmail.com>
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

View File

@@ -0,0 +1,57 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
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)
{