RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/xorg-x11-server#eaf442296937a83e622ce4995c5f33122bcd6f02
This commit is contained in:
Troy Dawson 2020-10-15 14:12:16 -07:00
parent b285b8047e
commit 6c2dd5fc20
60 changed files with 6408 additions and 0 deletions

36
.gitignore vendored
View File

@ -0,0 +1,36 @@
xorg-server-1.9.1.tar.bz2
/xorg-server-20101125.tar.xz
/xorg-server-20101201.tar.xz
/xorg-server-1.10.0.tar.bz2
/xorg-server-20110418.tar.xz
/xorg-server-20110510.tar.xz
/xorg-server-20110818.tar.xz
/xorg-server-1.11.0.tar.bz2
/xorg-server-1.11.1.tar.bz2
/xorg-server-20111109.tar.xz
/xorg-server-20120103.tar.xz
/xorg-server-20120124.tar.xz
/xorg-server-20120215.tar.xz
/xorg-server-1.12.0.tar.bz2
/xorg-server-1.12.1.tar.bz2
/xorg-server-1.12.2.tar.bz2
/xorg-server-1.12.3.tar.bz2
/xorg-server-20120717.tar.xz
/xorg-server-20120726.tar.xz
/xorg-server-20120808.tar.xz
/xorg-server-20120822.tar.xz
/xorg-server-1.13.0.tar.bz2
/xorg-server-1.13.1.tar.bz2
/xorg-server-20130109.tar.xz
/xorg-server-20130215.tar.xz
/xorg-server-1.14.0.tar.bz2
/xorg-server-1.14.1.tar.bz2
/xorg-server-1.14.1.901.tar.bz2
/xorg-server-1.14.2.tar.bz2
/xorg-server-1.14.3.tar.bz2
/xorg-server-1.14.99.3.tar.bz2
/xorg-server-1.14.99.901.tar.bz2
/xorg-server-1.14.99.902.tar.bz2
*.bz2
*.xz
/xorg-x11-server-1.15.0-1.fc21.src.rpm

View File

@ -0,0 +1,41 @@
From 38ae53c94a88c7bd5877c72a12582b60865e07ff Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 17 Apr 2014 15:50:44 +0200
Subject: [PATCH] Fedora hack: Make the suid-root wrapper start the server with
root rights
Do NOT upstream.
Since most display managers are not ready yet to start Xorg in way which will
keep it working without root-rights, see:
https://fedoraproject.org/wiki/Changes/XorgWithoutRootRights
Just keep starting X as root for now, but do it through the wrapper, by
overriding the needs_root_rights = -1 (auto) default and setting it to 1.
We set a special environment variable when starting X in a way where root
rights are not needed (from gdm and startx) and keep the upstream
needs_root_rights = -1 (auto) default in that case.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
hw/xfree86/xorg-wrapper.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
index 4c37cfc..ae5d27f 100644
--- a/hw/xfree86/xorg-wrapper.c
+++ b/hw/xfree86/xorg-wrapper.c
@@ -198,6 +198,9 @@ int main(int argc, char *argv[])
int needs_root_rights = -1;
char *const empty_envp[1] = { NULL, };
+ if (getenv("XORG_RUN_AS_USER_OK") == NULL)
+ needs_root_rights = 1;
+
progname = argv[0];
parse_config(&allowed, &needs_root_rights);
--
2.4.3

View File

@ -0,0 +1,61 @@
From 4b6fce5975c2f931a0478cf4deeec97529b05eb6 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Tue, 8 Sep 2020 10:01:55 +0200
Subject: [PATCH xserver 01/16] Revert "linux: Fix platform device probe for
DT-based PCI"
This reverts commit 249a12c54a9316b089bd22683c011519348496df.
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1068
---
config/udev.c | 27 +--------------------------
1 file changed, 1 insertion(+), 26 deletions(-)
diff --git a/config/udev.c b/config/udev.c
index b00d90237..14409549b 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -464,31 +464,6 @@ config_udev_fini(void)
#ifdef CONFIG_UDEV_KMS
-/* Find the last occurrence of the needle in haystack */
-static char *strrstr(const char *haystack, const char *needle)
-{
- char *prev, *last, *tmp;
-
- prev = strstr(haystack, needle);
- if (!prev)
- return NULL;
-
- last = prev;
- tmp = prev + 1;
-
- while (tmp) {
- last = strstr(tmp, needle);
- if (!last)
- return prev;
- else {
- prev = last;
- tmp = prev + 1;
- }
- }
-
- return last;
-}
-
static void
config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path, const char *syspath,
int major, int minor,
@@ -503,7 +478,7 @@ config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path
attribs->minor = minor;
value = udev_device_get_property_value(udev_device, "ID_PATH");
- if (value && (str = strrstr(value, "pci-"))) {
+ if (value && (str = strstr(value, "pci-"))) {
attribs->busid = XNFstrdup(str);
attribs->busid[3] = ':';
}
--
2.28.0

View File

@ -0,0 +1,293 @@
From 471289fa1dc359555ceed6302f7d9605ab6be3ea Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Mon, 2 Apr 2018 16:49:02 -0400
Subject: [PATCH] autobind GPUs to the screen
This is a modified version of a patch we've been carry-ing in Fedora and
RHEL for years now. This patch automatically adds secondary GPUs to the
master as output sink / offload source making e.g. the use of
slave-outputs just work, with requiring the user to manually run
"xrandr --setprovideroutputsource" before he can hookup an external
monitor to his hybrid graphics laptop.
There is one problem with this patch, which is why it was not upstreamed
before. What to do when a secondary GPU gets detected really is a policy
decission (e.g. one may want to autobind PCI GPUs but not USB ones) and
as such should be under control of the Desktop Environment.
Unconditionally adding autobinding support to the xserver will result
in races between the DE dealing with the hotplug of a secondary GPU
and the server itself dealing with it.
However we've waited for years for any Desktop Environments to actually
start doing some sort of autoconfiguration of secondary GPUs and there
is still not a single DE dealing with this, so I believe that it is
time to upstream this now.
To avoid potential future problems if any DEs get support for doing
secondary GPU configuration themselves, the new autobind functionality
is made optional. Since no DEs currently support doing this themselves it
is enabled by default. When DEs grow support for doing this themselves
they can disable the servers autobinding through the servers cmdline or a
xorg.conf snippet.
Signed-off-by: Dave Airlie <airlied@gmail.com>
[hdegoede@redhat.com: Make configurable, fix with nvidia, submit upstream]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
hw/xfree86/common/xf86Config.c | 19 +++++++++++++++++++
hw/xfree86/common/xf86Globals.c | 2 ++
hw/xfree86/common/xf86Init.c | 20 ++++++++++++++++++++
hw/xfree86/common/xf86Priv.h | 1 +
hw/xfree86/common/xf86Privstr.h | 1 +
hw/xfree86/common/xf86platformBus.c | 4 ++++
hw/xfree86/man/Xorg.man | 7 +++++++
hw/xfree86/man/xorg.conf.man | 6 ++++++
randr/randrstr.h | 3 +++
randr/rrprovider.c | 22 ++++++++++++++++++++++
10 files changed, 85 insertions(+)
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 2c1d335..d7d7c2e 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -643,6 +643,7 @@ typedef enum {
FLAG_DRI2,
FLAG_USE_SIGIO,
FLAG_AUTO_ADD_GPU,
+ FLAG_AUTO_BIND_GPU,
FLAG_MAX_CLIENTS,
FLAG_IGLX,
FLAG_DEBUG,
@@ -699,6 +700,8 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE},
{FLAG_AUTO_ADD_GPU, "AutoAddGPU", OPTV_BOOLEAN,
{0}, FALSE},
+ {FLAG_AUTO_BIND_GPU, "AutoBindGPU", OPTV_BOOLEAN,
+ {0}, FALSE},
{FLAG_MAX_CLIENTS, "MaxClients", OPTV_INTEGER,
{0}, FALSE },
{FLAG_IGLX, "IndirectGLX", OPTV_BOOLEAN,
@@ -779,6 +782,22 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
}
xf86Msg(from, "%sutomatically adding GPU devices\n",
xf86Info.autoAddGPU ? "A" : "Not a");
+
+ if (xf86AutoBindGPUDisabled) {
+ xf86Info.autoBindGPU = FALSE;
+ from = X_CMDLINE;
+ }
+ else if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_BIND_GPU)) {
+ xf86GetOptValBool(FlagOptions, FLAG_AUTO_BIND_GPU,
+ &xf86Info.autoBindGPU);
+ from = X_CONFIG;
+ }
+ else {
+ from = X_DEFAULT;
+ }
+ xf86Msg(from, "%sutomatically binding GPU devices\n",
+ xf86Info.autoBindGPU ? "A" : "Not a");
+
/*
* Set things up based on the config file information. Some of these
* settings may be overridden later when the command line options are
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index e890f05..7b27b4c 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -131,6 +131,7 @@ xf86InfoRec xf86Info = {
#else
.autoAddGPU = FALSE,
#endif
+ .autoBindGPU = TRUE,
};
const char *xf86ConfigFile = NULL;
@@ -191,6 +192,7 @@ Bool xf86FlipPixels = FALSE;
Gamma xf86Gamma = { 0.0, 0.0, 0.0 };
Bool xf86AllowMouseOpenFail = FALSE;
+Bool xf86AutoBindGPUDisabled = FALSE;
#ifdef XF86VIDMODE
Bool xf86VidModeDisabled = FALSE;
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index ea42ec9..ec255b6 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -76,6 +76,7 @@
#include "xf86DDC.h"
#include "xf86Xinput.h"
#include "xf86InPriv.h"
+#include "xf86Crtc.h"
#include "picturestr.h"
#include "randrstr.h"
#include "glxvndabi.h"
@@ -237,6 +238,19 @@ xf86PrivsElevated(void)
return PrivsElevated();
}
+static void
+xf86AutoConfigOutputDevices(void)
+{
+ int i;
+
+ if (!xf86Info.autoBindGPU)
+ return;
+
+ for (i = 0; i < xf86NumGPUScreens; i++)
+ RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]),
+ xf86ScrnToScreen(xf86Screens[0]));
+}
+
static void
TrapSignals(void)
{
@@ -770,6 +784,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
for (i = 0; i < xf86NumGPUScreens; i++)
AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
+ xf86AutoConfigOutputDevices();
+
xf86VGAarbiterWrapFunctions();
if (sigio_blocked)
input_unlock();
@@ -1278,6 +1294,10 @@ ddxProcessArgument(int argc, char **argv, int i)
xf86Info.iglxFrom = X_CMDLINE;
return 0;
}
+ if (!strcmp(argv[i], "-noautoBindGPU")) {
+ xf86AutoBindGPUDisabled = TRUE;
+ return 1;
+ }
/* OS-specific processing */
return xf86ProcessArgument(argc, argv, i);
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 4fe2b5f..6566622 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -46,6 +46,7 @@
extern _X_EXPORT const char *xf86ConfigFile;
extern _X_EXPORT const char *xf86ConfigDir;
extern _X_EXPORT Bool xf86AllowMouseOpenFail;
+extern _X_EXPORT Bool xf86AutoBindGPUDisabled;
#ifdef XF86VIDMODE
extern _X_EXPORT Bool xf86VidModeDisabled;
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index 21c2e1f..6c71863 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -98,6 +98,7 @@ typedef struct {
Bool autoAddGPU;
const char *debug;
+ Bool autoBindGPU;
} xf86InfoRec, *xf86InfoPtr;
/* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index cef47da..913a324 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -49,6 +49,7 @@
#include "Pci.h"
#include "xf86platformBus.h"
#include "xf86Config.h"
+#include "xf86Crtc.h"
#include "randrstr.h"
int platformSlotClaimed;
@@ -665,6 +666,9 @@ xf86platformAddDevice(int index)
}
/* attach unbound to 0 protocol screen */
AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
+ if (xf86Info.autoBindGPU)
+ RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]),
+ xf86ScrnToScreen(xf86Screens[0]));
RRResourcesChanged(xf86Screens[0]->pScreen);
RRTellChanged(xf86Screens[0]->pScreen);
diff --git a/hw/xfree86/man/Xorg.man b/hw/xfree86/man/Xorg.man
index 13a9dc3..745f986 100644
--- a/hw/xfree86/man/Xorg.man
+++ b/hw/xfree86/man/Xorg.man
@@ -283,6 +283,13 @@ is a comma separated list of directories to search for
server modules. This option is only available when the server is run
as root (i.e, with real-uid 0).
.TP 8
+.B \-noautoBindGPU
+Disable automatically setting secondary GPUs up as output sinks and offload
+sources. This is equivalent to setting the
+.B AutoBindGPU
+xorg.conf(__filemansuffix__) file option. To
+.B false.
+.TP 8
.B \-nosilk
Disable Silken Mouse support.
.TP 8
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 9589262..8d51e06 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -672,6 +672,12 @@ Enabled by default.
If this option is disabled, then no GPU devices will be added from the udev
backend. Enabled by default. (May need to be disabled to setup Xinerama).
.TP 7
+.BI "Option \*qAutoBindGPU\*q \*q" boolean \*q
+If enabled then secondary GPUs will be automatically set up as output-sinks and
+offload-sources. Making e.g. laptop outputs connected only to the secondary
+GPU directly available for use without needing to run
+"xrandr --setprovideroutputsource". Enabled by default.
+.TP 7
.BI "Option \*qLog\*q \*q" string \*q
This option controls whether the log is flushed and/or synced to disk after
each message.
diff --git a/randr/randrstr.h b/randr/randrstr.h
index f94174b..092d726 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -1039,6 +1039,9 @@ RRProviderLookup(XID id, RRProviderPtr *provider_p);
extern _X_EXPORT void
RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider);
+extern _X_EXPORT void
+RRProviderAutoConfigGpuScreen(ScreenPtr pScreen, ScreenPtr masterScreen);
+
/* rrproviderproperty.c */
extern _X_EXPORT void
diff --git a/randr/rrprovider.c b/randr/rrprovider.c
index e4bc2bf..e04c18f 100644
--- a/randr/rrprovider.c
+++ b/randr/rrprovider.c
@@ -485,3 +485,25 @@ RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider)
WriteEventsToClient(client, 1, (xEvent *) &pe);
}
+
+void
+RRProviderAutoConfigGpuScreen(ScreenPtr pScreen, ScreenPtr masterScreen)
+{
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
+ rrScrPrivPtr masterPriv = rrGetScrPriv(masterScreen);
+ RRProviderPtr provider = pScrPriv->provider;
+ RRProviderPtr master_provider = masterPriv->provider;
+
+ if (!provider || !master_provider)
+ return;
+
+ if ((provider->capabilities & RR_Capability_SinkOutput) &&
+ (master_provider->capabilities & RR_Capability_SourceOutput)) {
+ pScrPriv->rrProviderSetOutputSource(pScreen, provider, master_provider);
+ RRInitPrimeSyncProps(pScreen);
+ }
+
+ if ((provider->capabilities & RR_Capability_SourceOffload) &&
+ (master_provider->capabilities & RR_Capability_SinkOffload))
+ pScrPriv->rrProviderSetOffloadSink(pScreen, provider, master_provider);
+}
--
2.16.2

View File

@ -0,0 +1,116 @@
From 3d78af269556f554c517801d0de481ba56d4e603 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 29 Aug 2019 14:18:28 +0200
Subject: [PATCH xserver 01/24] dix: Add GetCurrentClient helper
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Request-handlers as registered in the requestVector array, always get
passed the clientPtr for the client which sent the request.
But the implementation of many request-handlers typically consists of
a generic handler calling implementation specific callbacks and / or
various helpers often multiple levels deep and in many cases the clientPtr
does not get passed to the callbacks / helpers.
This means that in some places where we would like to have access to the
current-client, we cannot easily access it and fixing this would require
a lot of work and often would involve ABI breakage.
This commit adds a GetCurrentClient helper which can be used as a
shortcut to get access to the clienPtr for the currently being processed
request without needing a lot of refactoring and ABI breakage.
Note using this new GetCurrentClient helper is only safe for code
which only runs from the main thread, this new variable MUST NOT be used
by code which runs from signal handlers or from the input-thread.
The specific use-case which resulted in the creation of this patch is adding
support for emulation of randr / vidmode resolution changes to Xwayland.
This emulation will not actually change the monitor resolution instead it
will scale any window with a size which exactly matches the requested
resolution to fill the entire monitor. The main use-case for this is
games which are hard-coded to render at a specific resolution and have
sofar relied on randr / vidmode to change the monitor resolution when going
fullscreen.
To make this emulation as robust as possible (e.g. avoid accidentally scaling
windows from other apps) we want to make the emulated resolution a per client
state. But e.g. the RRSetCrtc function does not take a client pointer; and is
a (used) part of the Xorg server ABI (note the problem is not just limited
to RRSetCrtc).
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 834a467af978ac7a24ed17b8c8e58b6cddb4faf9)
---
dix/dispatch.c | 23 ++++++++++++++++++++++-
include/dix.h | 1 +
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/dix/dispatch.c b/dix/dispatch.c
index a33bfaa9e..2b1cf1a74 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -148,6 +148,7 @@ xConnSetupPrefix connSetupPrefix;
PaddingInfo PixmapWidthPaddingInfo[33];
static ClientPtr grabClient;
+static ClientPtr currentClient; /* Client for the request currently being dispatched */
#define GrabNone 0
#define GrabActive 1
@@ -176,6 +177,23 @@ volatile char isItTimeToYield;
#define SAME_SCREENS(a, b) (\
(a.pScreen == b.pScreen))
+ClientPtr
+GetCurrentClient(void)
+{
+ if (in_input_thread()) {
+ static Bool warned;
+
+ if (!warned) {
+ ErrorF("[dix] Error GetCurrentClient called from input-thread\n");
+ warned = TRUE;
+ }
+
+ return NULL;
+ }
+
+ return currentClient;
+}
+
void
SetInputCheck(HWEventQueuePtr c0, HWEventQueuePtr c1)
{
@@ -474,9 +492,12 @@ Dispatch(void)
result = BadLength;
else {
result = XaceHookDispatch(client, client->majorOp);
- if (result == Success)
+ if (result == Success) {
+ currentClient = client;
result =
(*client->requestVector[client->majorOp]) (client);
+ currentClient = NULL;
+ }
}
if (!SmartScheduleSignalEnable)
SmartScheduleTime = GetTimeInMillis();
diff --git a/include/dix.h b/include/dix.h
index b6e2bcfde..d65060cb6 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -148,6 +148,7 @@ typedef struct _TimeStamp {
} TimeStamp;
/* dispatch.c */
+extern _X_EXPORT ClientPtr GetCurrentClient(void);
extern _X_EXPORT void SetInputCheck(HWEventQueuePtr /*c0 */ ,
HWEventQueuePtr /*c1 */ );
--
2.26.2

View File

@ -0,0 +1,152 @@
From acf5a0100c98a040e5e07a79ecf4a83627da770e Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 23 Mar 2017 12:54:07 +0100
Subject: [PATCH xserver] xf86: dri2: Use va_gl as vdpau_driver for Intel i965
GPUs
The modesetting driver (which now often is used with Intel GPUs),
relies on dri2_probe_driver_name() to get the dri and vdpau driver
names, before this commit it would always assign the same name to
the 2 names. But the vdpau driver for i965 GPUs should be va_gl
(i915 does not support vdpau at all).
This commit modifies the used lookup table and dri2_probe_driver_name()
to set the vdpau_driver to va_gl for i965 GPUs, it leaves the 2
names the same for all other GPUs.
Note this commit adds a FIXME comment for a memory leak in
dri2_probe_driver_name(), that leak was already present and fixing
it falls outside of the scope of this commit.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1413733
Cc: kwizart@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
hw/xfree86/dri2/dri2.c | 31 +++++++++++++--------
hw/xfree86/dri2/pci_ids/pci_id_driver_map.h | 21 +++++++-------
2 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 6619e3aa7..1f8ad14bc 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -1437,14 +1437,18 @@ get_prime_id(void)
#include "pci_ids/pci_id_driver_map.h"
-static char *
-dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info)
+static void
+dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info,
+ const char **dri_driver_ret,
+ const char **vdpau_driver_ret)
{
#ifdef WITH_LIBDRM
int i, j;
- char *driver = NULL;
drmDevicePtr dev;
+ *dri_driver_ret = NULL;
+ *vdpau_driver_ret = NULL;
+
/* For non-PCI devices and drmGetDevice fail, just assume that
* the 3D driver is named the same as the kernel driver. This is
* currently true for vc4 and msm (freedreno).
@@ -1456,12 +1460,14 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info)
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[DRI2] Couldn't drmGetVersion() on non-PCI device, "
"no driver name found.\n");
- return NULL;
+ return;
}
- driver = strndup(version->name, version->name_len);
+ /* FIXME this gets leaked */
+ *dri_driver_ret = strndup(version->name, version->name_len);
+ *vdpau_driver_ret = *dri_driver_ret;
drmFreeVersion(version);
- return driver;
+ return;
}
for (i = 0; driver_map[i].driver; i++) {
@@ -1469,13 +1475,15 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info)
continue;
if (driver_map[i].num_chips_ids == -1) {
- driver = strdup(driver_map[i].driver);
+ *dri_driver_ret = driver_map[i].driver;
+ *vdpau_driver_ret = driver_map[i].vdpau_driver;
goto out;
}
for (j = 0; j < driver_map[i].num_chips_ids; j++) {
if (driver_map[i].chip_ids[j] == dev->deviceinfo.pci->device_id) {
- driver = strdup(driver_map[i].driver);
+ *dri_driver_ret = driver_map[i].driver;
+ *vdpau_driver_ret = driver_map[i].vdpau_driver;
goto out;
}
}
@@ -1487,9 +1495,9 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info)
dev->deviceinfo.pci->vendor_id, dev->deviceinfo.pci->device_id);
out:
drmFreeDevice(&dev);
- return driver;
#else
- return NULL;
+ *dri_driver_ret = NULL;
+ *vdpau_driver_ret = NULL;
#endif
}
@@ -1610,7 +1618,8 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
if (info->driverName) {
ds->driverNames[0] = info->driverName;
} else {
- ds->driverNames[0] = ds->driverNames[1] = dri2_probe_driver_name(pScreen, info);
+ dri2_probe_driver_name(pScreen, info,
+ &ds->driverNames[0], &ds->driverNames[1]);
if (!ds->driverNames[0])
return FALSE;
}
diff --git a/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h b/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h
index da7ea1c1e..7036d1003 100644
--- a/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h
+++ b/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h
@@ -66,21 +66,22 @@ static const int vmwgfx_chip_ids[] = {
static const struct {
int vendor_id;
const char *driver;
+ const char *vdpau_driver;
const int *chip_ids;
int num_chips_ids;
} driver_map[] = {
- { 0x8086, "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) },
- { 0x8086, "i965", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) },
+ { 0x8086, "i915", "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) },
+ { 0x8086, "i965", "va_gl", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) },
#ifndef DRIVER_MAP_GALLIUM_ONLY
- { 0x1002, "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids) },
- { 0x1002, "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids) },
+ { 0x1002, "radeon", "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids) },
+ { 0x1002, "r200", "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids) },
#endif
- { 0x1002, "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids) },
- { 0x1002, "r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) },
- { 0x1002, "radeonsi", radeonsi_chip_ids, ARRAY_SIZE(radeonsi_chip_ids) },
- { 0x10de, "nouveau", NULL, -1 },
- { 0x1af4, "virtio_gpu", virtio_gpu_chip_ids, ARRAY_SIZE(virtio_gpu_chip_ids) },
- { 0x15ad, "vmwgfx", vmwgfx_chip_ids, ARRAY_SIZE(vmwgfx_chip_ids) },
+ { 0x1002, "r300", "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids) },
+ { 0x1002, "r600","r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) },
+ { 0x1002, "radeonsi", "radeonsi", radeonsi_chip_ids, ARRAY_SIZE(radeonsi_chip_ids) },
+ { 0x10de, "nouveau", "nouveau", NULL, -1 },
+ { 0x1af4, "virtio_gpu", "virtio_gpu", virtio_gpu_chip_ids, ARRAY_SIZE(virtio_gpu_chip_ids) },
+ { 0x15ad, "vmwgfx", "vmwgfx", vmwgfx_chip_ids, ARRAY_SIZE(vmwgfx_chip_ids) },
{ 0x0000, NULL, NULL, 0 },
};
--
2.19.0

View File

@ -0,0 +1,52 @@
From aa2f34d80ef3118eae0cce73b610c36cdcb978fe Mon Sep 17 00:00:00 2001
From: Ben Skeggs <bskeggs@redhat.com>
Date: Sat, 22 Apr 2017 02:26:28 +1000
Subject: [PATCH xserver] xfree86: use modesetting driver by default on GeForce
8 and newer
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
---
hw/xfree86/common/xf86pciBus.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 8158c2b62..78d1c947d 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -37,6 +37,7 @@
#include <unistd.h>
#include <X11/X.h>
#include <pciaccess.h>
+#include <xf86drm.h>
#include "os.h"
#include "Pci.h"
#include "xf86.h"
@@ -1190,6 +1191,25 @@ xf86VideoPtrToDriverList(struct pci_device *dev,
int idx = 0;
#if defined(__linux__) || defined(__NetBSD__)
+ char busid[32];
+ int fd;
+
+ snprintf(busid, sizeof(busid), "pci:%04x:%02x:%02x.%d",
+ dev->domain, dev->bus, dev->dev, dev->func);
+
+ /* 'modesetting' is preferred for GeForce 8 and newer GPUs */
+ fd = drmOpenWithType("nouveau", busid, DRM_NODE_RENDER);
+ if (fd >= 0) {
+ uint64_t args[] = { 11 /* NOUVEAU_GETPARAM_CHIPSET_ID */, 0 };
+ int ret = drmCommandWriteRead(fd, 0 /* DRM_NOUVEAU_GETPARAM */,
+ &args, sizeof(args));
+ drmClose(fd);
+ if (ret == 0) {
+ if (args[1] == 0x050 || args[1] >= 0x80)
+ break;
+ }
+ }
+
driverList[idx++] = "nouveau";
#endif
driverList[idx++] = "nv";
--
2.12.2

View File

@ -0,0 +1,40 @@
From 39cb95e959fab97a7e255dda1a1599b096fb0f7e Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Tue, 8 Sep 2020 10:03:11 +0200
Subject: [PATCH xserver 02/16] Revert "linux: Fix platform device PCI
detection for complex bus topologies"
This reverts commit 5c96eb5f44e62a4cfe835023cde304eb5795b8fd.
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1068
---
config/udev.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/config/udev.c b/config/udev.c
index 14409549b..8c6c4b666 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -470,7 +470,7 @@ config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path
config_odev_probe_proc_ptr probe_callback)
{
struct OdevAttributes *attribs = config_odev_allocate_attributes();
- const char *value, *str;
+ const char *value;
attribs->path = XNFstrdup(path);
attribs->syspath = XNFstrdup(syspath);
@@ -478,8 +478,8 @@ config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path
attribs->minor = minor;
value = udev_device_get_property_value(udev_device, "ID_PATH");
- if (value && (str = strstr(value, "pci-"))) {
- attribs->busid = XNFstrdup(str);
+ if (value && !strncmp(value, "pci-", 4)) {
+ attribs->busid = XNFstrdup(value);
attribs->busid[3] = ':';
}
--
2.28.0

View File

@ -0,0 +1,119 @@
From 14e9b030449611a7a80f640129138c49ab46774e Mon Sep 17 00:00:00 2001
From: Robert Mader <robert.mader@posteo.de>
Date: Mon, 22 Jan 2018 22:02:32 +0100
Subject: [PATCH xserver 02/24] xwayland: Add wp_viewport wayland extension
support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This commit adds support for the wayland wp_viewport extension, note
nothing uses this yet.
This is a preparation patch for adding support for fake mode-changes through
xrandr for apps which want to change the resolution when going fullscreen.
[hdegoede@redhat.com: Split the code for the extension out into its own patch]
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 47bba4625339592d08b375bcd8e51029c0000850)
---
hw/xwayland/Makefile.am | 9 ++++++++-
hw/xwayland/meson.build | 3 +++
hw/xwayland/xwayland.c | 3 +++
hw/xwayland/xwayland.h | 2 ++
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index bc1cb8506..49aae3d8b 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -71,7 +71,9 @@ Xwayland_built_sources += \
xdg-output-unstable-v1-protocol.c \
xdg-output-unstable-v1-client-protocol.h \
linux-dmabuf-unstable-v1-client-protocol.h \
- linux-dmabuf-unstable-v1-protocol.c
+ linux-dmabuf-unstable-v1-protocol.c \
+ viewporter-client-protocol.h \
+ viewporter-protocol.c
if XWAYLAND_EGLSTREAM
Xwayland_built_sources += \
@@ -120,6 +122,11 @@ linux-dmabuf-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linu
linux-dmabuf-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
+viewporter-protocol.c: $(WAYLAND_PROTOCOLS_DATADIR)/stable/viewporter/viewporter.xml
+ $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@
+viewporter-client-protocol.h: $(WAYLAND_PROTOCOLS_DATADIR)/stable/viewporter/viewporter.xml
+ $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
+
wayland-eglstream-client-protocol.h : $(WAYLAND_EGLSTREAM_DATADIR)/wayland-eglstream.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
wayland-eglstream-controller-client-protocol.h : $(WAYLAND_EGLSTREAM_DATADIR)/wayland-eglstream-controller.xml
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 36bf2133a..4a8d171bb 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -21,6 +21,7 @@ tablet_xml = join_paths(protodir, 'unstable', 'tablet', 'tablet-unstable-v2.xml'
kbgrab_xml = join_paths(protodir, 'unstable', 'xwayland-keyboard-grab', 'xwayland-keyboard-grab-unstable-v1.xml')
xdg_output_xml = join_paths(protodir, 'unstable', 'xdg-output', 'xdg-output-unstable-v1.xml')
dmabuf_xml = join_paths(protodir, 'unstable', 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml')
+viewporter_xml = join_paths(protodir, 'stable', 'viewporter', 'viewporter.xml')
client_header = generator(scanner,
output : '@BASENAME@-client-protocol.h',
@@ -43,12 +44,14 @@ srcs += client_header.process(tablet_xml)
srcs += client_header.process(kbgrab_xml)
srcs += client_header.process(xdg_output_xml)
srcs += client_header.process(dmabuf_xml)
+srcs += client_header.process(viewporter_xml)
srcs += code.process(relative_xml)
srcs += code.process(pointer_xml)
srcs += code.process(tablet_xml)
srcs += code.process(kbgrab_xml)
srcs += code.process(xdg_output_xml)
srcs += code.process(dmabuf_xml)
+srcs += code.process(viewporter_xml)
xwayland_glamor = []
eglstream_srcs = []
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index d02934cd5..98592025a 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -925,6 +925,9 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface, 1);
xwl_screen_init_xdg_output(xwl_screen);
}
+ else if (strcmp(interface, "wp_viewporter") == 0) {
+ xwl_screen->viewporter = wl_registry_bind(registry, id, &wp_viewporter_interface, 1);
+ }
#ifdef XWL_HAS_GLAMOR
else if (xwl_screen->glamor) {
xwl_glamor_init_wl_registry(xwl_screen, registry, id, interface,
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index b9495b313..91ae21eeb 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -48,6 +48,7 @@
#include "xwayland-keyboard-grab-unstable-v1-client-protocol.h"
#include "xdg-output-unstable-v1-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
+#include "viewporter-client-protocol.h"
struct xwl_format {
uint32_t format;
@@ -151,6 +152,7 @@ struct xwl_screen {
struct zwp_pointer_constraints_v1 *pointer_constraints;
struct zwp_xwayland_keyboard_grab_manager_v1 *wp_grab;
struct zxdg_output_manager_v1 *xdg_output_manager;
+ struct wp_viewporter *viewporter;
uint32_t serial;
#define XWL_FORMAT_ARGB8888 (1 << 0)
--
2.26.2

View File

@ -0,0 +1,133 @@
From af4c84ce8855e84c0ad89b929bc972e884f0b8e3 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Tue, 8 Sep 2020 10:03:33 +0200
Subject: [PATCH xserver 03/16] Revert "linux: Make platform device probe less
fragile"
This reverts commit 74b7427c41b4e4104af7abf70a996c086d3d7628.
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1068
---
config/udev.c | 17 +++++------------
hw/xfree86/os-support/linux/lnx_platform.c | 20 ++++++++++++++++++--
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/config/udev.c b/config/udev.c
index 8c6c4b666..3a73189e2 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -56,7 +56,7 @@ static struct udev_monitor *udev_monitor;
#ifdef CONFIG_UDEV_KMS
static void
-config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path, const char *syspath,
+config_udev_odev_setup_attribs(const char *path, const char *syspath,
int major, int minor,
config_odev_probe_proc_ptr probe_callback);
#endif
@@ -128,7 +128,7 @@ device_added(struct udev_device *udev_device)
LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n", path);
- config_udev_odev_setup_attribs(udev_device, path, syspath, major(devnum),
+ config_udev_odev_setup_attribs(path, syspath, major(devnum),
minor(devnum), NewGPUDeviceRequest);
return;
}
@@ -322,7 +322,7 @@ device_removed(struct udev_device *device)
LogMessage(X_INFO, "config/udev: removing GPU device %s %s\n",
syspath, path);
- config_udev_odev_setup_attribs(device, path, syspath, major(devnum),
+ config_udev_odev_setup_attribs(path, syspath, major(devnum),
minor(devnum), DeleteGPUDeviceRequest);
/* Retry vtenter after a drm node removal */
systemd_logind_vtenter();
@@ -465,24 +465,17 @@ config_udev_fini(void)
#ifdef CONFIG_UDEV_KMS
static void
-config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path, const char *syspath,
+config_udev_odev_setup_attribs(const char *path, const char *syspath,
int major, int minor,
config_odev_probe_proc_ptr probe_callback)
{
struct OdevAttributes *attribs = config_odev_allocate_attributes();
- const char *value;
attribs->path = XNFstrdup(path);
attribs->syspath = XNFstrdup(syspath);
attribs->major = major;
attribs->minor = minor;
- value = udev_device_get_property_value(udev_device, "ID_PATH");
- if (value && !strncmp(value, "pci-", 4)) {
- attribs->busid = XNFstrdup(value);
- attribs->busid[3] = ':';
- }
-
/* ownership of attribs is passed to probe layer */
probe_callback(attribs);
}
@@ -523,7 +516,7 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback)
else if (!check_seat(udev_device))
goto no_probe;
- config_udev_odev_setup_attribs(udev_device, path, syspath, major(devnum),
+ config_udev_odev_setup_attribs(path, syspath, major(devnum),
minor(devnum), probe_callback);
no_probe:
udev_device_unref(udev_device);
diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index e62306219..70374ace8 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -23,13 +23,13 @@
static Bool
get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
{
+ drmSetVersion sv;
drmVersionPtr v;
+ char *buf;
int fd;
int err = 0;
Bool paused, server_fd = FALSE;
- LogMessage(X_INFO, "Platform probe for %s\n", attribs->syspath);
-
fd = systemd_logind_take_fd(attribs->major, attribs->minor, path, &paused);
if (fd != -1) {
if (paused) {
@@ -48,6 +48,18 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
if (fd == -1)
return FALSE;
+ sv.drm_di_major = 1;
+ sv.drm_di_minor = 4;
+ sv.drm_dd_major = -1; /* Don't care */
+ sv.drm_dd_minor = -1; /* Don't care */
+
+ err = drmSetInterfaceVersion(fd, &sv);
+ if (err) {
+ xf86Msg(X_ERROR, "%s: failed to set DRM interface version 1.4: %s\n",
+ path, strerror(-err));
+ goto out;
+ }
+
/* for a delayed probe we've already added the device */
if (delayed_index == -1) {
xf86_add_platform_device(attribs, FALSE);
@@ -57,6 +69,10 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
if (server_fd)
xf86_platform_devices[delayed_index].flags |= XF86_PDEV_SERVER_FD;
+ buf = drmGetBusid(fd);
+ xf86_platform_odev_attributes(delayed_index)->busid = XNFstrdup(buf);
+ drmFreeBusid(buf);
+
v = drmGetVersion(fd);
if (!v) {
xf86Msg(X_ERROR, "%s: failed to query DRM version\n", path);
--
2.28.0

View File

@ -0,0 +1,160 @@
From a86c70ed7e9c2b4e8e2f93beddbc51c0cdad57f2 Mon Sep 17 00:00:00 2001
From: Robert Mader <robert.mader@posteo.de>
Date: Tue, 2 Jul 2019 12:03:12 +0200
Subject: [PATCH xserver 03/24] xwayland: Use buffer_damage instead of surface
damage if available
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When a viewport is set, damage will only work properly when using
wl_surface_damage_buffer instead of wl_surface_damage.
When no viewport is set, there should be no difference between
surface and buffer damage.
This is a preparation patch for using viewport to add support for fake
mode-changes through xrandr for apps which want to change the resolution
when going fullscreen.
Changes by Hans de Goede <hdegoede@redhat.com>:
-Split the damage changes out into their own patch
-Add xwl_surface_damage helper
-Also use buffer_damage / the new helper for the present and cursor code
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 7c6f17790d3aedb164481264b0f05a8a14103731)
---
hw/xwayland/xwayland-cursor.c | 12 ++++++------
hw/xwayland/xwayland-present.c | 10 +++++-----
hw/xwayland/xwayland.c | 29 +++++++++++++++++++++++------
hw/xwayland/xwayland.h | 3 +++
4 files changed, 37 insertions(+), 17 deletions(-)
diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index 66720bcc0..cbc715061 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -165,9 +165,9 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
xwl_seat->x_cursor->bits->yhot);
wl_surface_attach(xwl_cursor->surface,
xwl_shm_pixmap_get_wl_buffer(pixmap), 0, 0);
- wl_surface_damage(xwl_cursor->surface, 0, 0,
- xwl_seat->x_cursor->bits->width,
- xwl_seat->x_cursor->bits->height);
+ xwl_surface_damage(xwl_seat->xwl_screen, xwl_cursor->surface, 0, 0,
+ xwl_seat->x_cursor->bits->width,
+ xwl_seat->x_cursor->bits->height);
xwl_cursor->frame_cb = wl_surface_frame(xwl_cursor->surface);
wl_callback_add_listener(xwl_cursor->frame_cb, &frame_listener, xwl_cursor);
@@ -217,9 +217,9 @@ xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *xwl_tablet_tool)
xwl_seat->x_cursor->bits->yhot);
wl_surface_attach(xwl_cursor->surface,
xwl_shm_pixmap_get_wl_buffer(pixmap), 0, 0);
- wl_surface_damage(xwl_cursor->surface, 0, 0,
- xwl_seat->x_cursor->bits->width,
- xwl_seat->x_cursor->bits->height);
+ xwl_surface_damage(xwl_seat->xwl_screen, xwl_cursor->surface, 0, 0,
+ xwl_seat->x_cursor->bits->width,
+ xwl_seat->x_cursor->bits->height);
xwl_cursor->frame_cb = wl_surface_frame(xwl_cursor->surface);
wl_callback_add_listener(xwl_cursor->frame_cb, &frame_listener, xwl_cursor);
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 6076f6498..ef75ad2ef 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -497,11 +497,11 @@ xwl_present_flip(WindowPtr present_window,
/* Realign timer */
xwl_present_reset_timer(xwl_present_window);
- wl_surface_damage(xwl_window->surface,
- damage_box->x1 - present_window->drawable.x,
- damage_box->y1 - present_window->drawable.y,
- damage_box->x2 - damage_box->x1,
- damage_box->y2 - damage_box->y1);
+ xwl_surface_damage(xwl_window->xwl_screen, xwl_window->surface,
+ damage_box->x1 - present_window->drawable.x,
+ damage_box->y1 - present_window->drawable.y,
+ damage_box->x2 - damage_box->x1,
+ damage_box->y2 - damage_box->y1);
wl_surface_commit(xwl_window->surface);
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 98592025a..f7fcd1e32 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -805,6 +805,16 @@ xwl_destroy_window(WindowPtr window)
return ret;
}
+void xwl_surface_damage(struct xwl_screen *xwl_screen,
+ struct wl_surface *surface,
+ int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ if (wl_surface_get_version(surface) >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)
+ wl_surface_damage_buffer(surface, x, y, width, height);
+ else
+ wl_surface_damage(surface, x, y, width, height);
+}
+
static void
xwl_window_post_damage(struct xwl_window *xwl_window)
{
@@ -841,13 +851,15 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
*/
if (RegionNumRects(region) > 256) {
box = RegionExtents(region);
- wl_surface_damage(xwl_window->surface, box->x1, box->y1,
- box->x2 - box->x1, box->y2 - box->y1);
+ xwl_surface_damage(xwl_screen, xwl_window->surface, box->x1, box->y1,
+ box->x2 - box->x1, box->y2 - box->y1);
} else {
box = RegionRects(region);
- for (i = 0; i < RegionNumRects(region); i++, box++)
- wl_surface_damage(xwl_window->surface, box->x1, box->y1,
- box->x2 - box->x1, box->y2 - box->y1);
+ for (i = 0; i < RegionNumRects(region); i++, box++) {
+ xwl_surface_damage(xwl_screen, xwl_window->surface,
+ box->x1, box->y1,
+ box->x2 - box->x1, box->y2 - box->y1);
+ }
}
xwl_window_create_frame_callback(xwl_window);
@@ -906,8 +918,13 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
struct xwl_screen *xwl_screen = data;
if (strcmp(interface, "wl_compositor") == 0) {
+ uint32_t request_version = 1;
+
+ if (version >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)
+ request_version = WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION;
+
xwl_screen->compositor =
- wl_registry_bind(registry, id, &wl_compositor_interface, 1);
+ wl_registry_bind(registry, id, &wl_compositor_interface, request_version);
}
else if (strcmp(interface, "wl_shm") == 0) {
xwl_screen->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 91ae21eeb..1244d2e91 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -382,6 +382,9 @@ struct xwl_output {
void xwl_window_create_frame_callback(struct xwl_window *xwl_window);
void xwl_sync_events (struct xwl_screen *xwl_screen);
+void xwl_surface_damage(struct xwl_screen *xwl_screen,
+ struct wl_surface *surface,
+ int32_t x, int32_t y, int32_t width, int32_t height);
void xwl_screen_roundtrip (struct xwl_screen *xwl_screen);
--
2.26.2

View File

@ -0,0 +1,35 @@
From b28c882889cbea9be3748d3dee1b21ba6eb90b66 Mon Sep 17 00:00:00 2001
From: Arthur Williams <taaparthur@gmail.com>
Date: Fri, 25 Sep 2020 04:52:57 +0000
Subject: [PATCH xserver 04/16] include: Increase the number of max. input
devices to 256.
Extending the decade old f0124ed93, to increase the number of input
devices from 40 to 256. 40 translates at most 9 MD, while 256 will allow
63 MD. It is an arbitrary number, but people are hitting the current
limit under reasonable conditions.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64793
Signed-off-by: Arthur Williams <taaparthur@gmail.com>
(cherry picked from commit fe439596b99db65bbae35eff1ea0b79db167f8d6)
---
include/misc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/misc.h b/include/misc.h
index 14920c3c3..9b422e53b 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -91,7 +91,7 @@ OF THIS SOFTWARE.
#define LIMITCLIENTS 256 /* Must be a power of 2 and <= MAXCLIENTS */
#define MAXEXTENSIONS 128
#define MAXFORMATS 8
-#define MAXDEVICES 40 /* input devices */
+#define MAXDEVICES 256 /* input devices */
#define GPU_SCREEN_OFFSET 256
/* 128 event opcodes for core + extension events, excluding GE */
--
2.28.0

View File

@ -0,0 +1,207 @@
From c0595515c65571d6304530c51331013381eea1dd Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 26 Jun 2019 16:46:54 +0200
Subject: [PATCH xserver 04/24] xwayland: Add fake output modes to xrandr
output mode lists
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is a preparation patch for adding support for apps which want to
change the resolution when they go fullscreen because they are hardcoded
to render at a specific resolution, e.g. 640x480.
Follow up patches will fake the mode-switch these apps want by using
WPviewport to scale there pixmap to cover the entire output.
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 0d656d796071fb637e4969ea800855fe5d1c9728)
---
hw/xwayland/xwayland-output.c | 112 ++++++++++++++++++++++++++++++++--
hw/xwayland/xwayland.c | 17 ++++++
hw/xwayland/xwayland.h | 1 +
3 files changed, 124 insertions(+), 6 deletions(-)
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index ae646c663..4036ba681 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -208,14 +208,110 @@ update_screen_size(struct xwl_output *xwl_output, int width, int height)
update_desktop_dimensions();
}
+/* From hw/xfree86/common/xf86DefModeSet.c with some obscure modes dropped */
+const int32_t xwl_output_fake_modes[][2] = {
+ /* 4:3 (1.33) */
+ { 2048, 1536 },
+ { 1920, 1440 },
+ { 1600, 1200 },
+ { 1440, 1080 },
+ { 1400, 1050 },
+ { 1280, 1024 }, /* 5:4 (1.25) */
+ { 1280, 960 },
+ { 1152, 864 },
+ { 1024, 768 },
+ { 800, 600 },
+ { 640, 480 },
+ { 320, 240 },
+ /* 16:10 (1.6) */
+ { 2560, 1600 },
+ { 1920, 1200 },
+ { 1680, 1050 },
+ { 1440, 900 },
+ { 1280, 800 },
+ { 720, 480 }, /* 3:2 (1.5) */
+ { 640, 400 },
+ { 320, 200 },
+ /* 16:9 (1.77) */
+ { 5120, 2880 },
+ { 4096, 2304 },
+ { 3840, 2160 },
+ { 3200, 1800 },
+ { 2880, 1620 },
+ { 2560, 1440 },
+ { 2048, 1152 },
+ { 1920, 1080 },
+ { 1600, 900 },
+ { 1368, 768 },
+ { 1280, 720 },
+ { 1024, 576 },
+ { 864, 486 },
+ { 720, 400 },
+ { 640, 350 },
+};
+
+/* Build an array with RRModes the first mode is the actual output mode, the
+ * rest are fake modes from the xwl_output_fake_modes list. We do this for apps
+ * which want to change resolution when they go fullscreen.
+ * When an app requests a mode-change, we fake it using WPviewport.
+ */
+static RRModePtr *
+output_get_rr_modes(struct xwl_output *xwl_output,
+ int32_t width, int32_t height,
+ int *count)
+{
+ struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
+ RRModePtr *rr_modes;
+ int i;
+
+ rr_modes = xallocarray(ARRAY_SIZE(xwl_output_fake_modes) + 1, sizeof(RRModePtr));
+ if (!rr_modes)
+ goto err;
+
+ /* Add actual output mode */
+ rr_modes[0] = xwayland_cvt(width, height, xwl_output->refresh / 1000.0, 0, 0);
+ if (!rr_modes[0])
+ goto err;
+
+ *count = 1;
+
+ if (!xwl_screen_has_resolution_change_emulation(xwl_screen))
+ return rr_modes;
+
+ /* Add fake modes */
+ for (i = 0; i < ARRAY_SIZE(xwl_output_fake_modes); i++) {
+ /* Skip actual output mode, already added */
+ if (xwl_output_fake_modes[i][0] == width &&
+ xwl_output_fake_modes[i][1] == height)
+ continue;
+
+ /* Skip modes which are too big, avoid downscaling */
+ if (xwl_output_fake_modes[i][0] > width ||
+ xwl_output_fake_modes[i][1] > height)
+ continue;
+
+ rr_modes[*count] = xwayland_cvt(xwl_output_fake_modes[i][0],
+ xwl_output_fake_modes[i][1],
+ xwl_output->refresh / 1000.0, 0, 0);
+ if (!rr_modes[*count])
+ goto err;
+
+ (*count)++;
+ }
+
+ return rr_modes;
+err:
+ FatalError("Failed to allocate memory for list of RR modes");
+}
+
static void
apply_output_change(struct xwl_output *xwl_output)
{
struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
struct xwl_output *it;
- int mode_width, mode_height;
+ int mode_width, mode_height, count;
int width = 0, height = 0, has_this_output = 0;
- RRModePtr randr_mode;
+ RRModePtr *randr_modes;
Bool need_rotate;
/* Clear out the "done" received flags */
@@ -234,12 +330,16 @@ apply_output_change(struct xwl_output *xwl_output)
mode_height = xwl_output->width;
}
- randr_mode = xwayland_cvt(mode_width, mode_height,
- xwl_output->refresh / 1000.0, 0, 0);
- RROutputSetModes(xwl_output->randr_output, &randr_mode, 1, 1);
- RRCrtcNotify(xwl_output->randr_crtc, randr_mode,
+ /* Build a fresh modes array using the current refresh rate */
+ randr_modes = output_get_rr_modes(xwl_output, mode_width, mode_height, &count);
+ RROutputSetModes(xwl_output->randr_output, randr_modes, count, 1);
+ RRCrtcNotify(xwl_output->randr_crtc, randr_modes[0],
xwl_output->x, xwl_output->y,
xwl_output->rotation, NULL, 1, &xwl_output->randr_output);
+ /* RROutputSetModes takes ownership of the passed in modes, so we only
+ * have to free the pointer array.
+ */
+ free(randr_modes);
xorg_list_for_each_entry(it, &xwl_screen->output_list, link) {
/* output done event is sent even when some property
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index f7fcd1e32..ffd4809df 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -154,6 +154,23 @@ xwl_screen_get(ScreenPtr screen)
return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key);
}
+static Bool
+xwl_screen_has_viewport_support(struct xwl_screen *xwl_screen)
+{
+ return wl_compositor_get_version(xwl_screen->compositor) >=
+ WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION &&
+ xwl_screen->viewporter != NULL;
+}
+
+Bool
+xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen)
+{
+ /* Resolution change emulation is only supported in rootless mode and
+ * it requires viewport support.
+ */
+ return xwl_screen->rootless && xwl_screen_has_viewport_support(xwl_screen);
+}
+
static void
xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow,
const char *debug_msg)
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 1244d2e91..200e18a8d 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -391,6 +391,7 @@ void xwl_screen_roundtrip (struct xwl_screen *xwl_screen);
Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen);
struct xwl_screen *xwl_screen_get(ScreenPtr screen);
+Bool xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen);
void xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *tool);
void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
--
2.26.2

View File

@ -0,0 +1,71 @@
From 8c3c8bda2c44fb3d62b954b02b08e3b1771ef5bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
Date: Tue, 25 Aug 2020 17:26:56 +0200
Subject: [PATCH xserver 05/16] glamor: Fix glamor_poly_fill_rect_gl
xRectangle::width/height handling
(Using GLSL 1.30 or newer)
The width/height members of xRectangle are unsigned, but they were
being interpreted as signed when converting to floating point for the
vertex shader, producing incorrect drawing for values > 32767.
v2:
* Use separate GL_UNSIGNED_SHORT vertex attribute for width/height.
(Eric Anholt)
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 032af35657aa95c6bbdb74ff8c72e535b9b56cfa)
---
glamor/glamor_rects.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/glamor/glamor_rects.c b/glamor/glamor_rects.c
index 6cbb040c1..ae4fe8bcc 100644
--- a/glamor/glamor_rects.c
+++ b/glamor/glamor_rects.c
@@ -27,8 +27,10 @@
static const glamor_facet glamor_facet_polyfillrect_130 = {
.name = "poly_fill_rect",
.version = 130,
- .vs_vars = "attribute vec4 primitive;\n",
- .vs_exec = (" vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n"
+ .source_name = "size",
+ .vs_vars = "attribute vec2 primitive;\n"
+ "attribute vec2 size;\n",
+ .vs_exec = (" vec2 pos = size * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n"
GLAMOR_POS(gl_Position, (primitive.xy + pos))),
};
@@ -81,9 +83,14 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1);
- glVertexAttribPointer(GLAMOR_VERTEX_POS, 4, GL_SHORT, GL_FALSE,
+ glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE,
4 * sizeof (short), vbo_offset);
+ glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+ glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 1);
+ glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_UNSIGNED_SHORT, GL_FALSE,
+ 4 * sizeof (short), vbo_offset + 2 * sizeof (short));
+
memcpy(v, prect, nrect * sizeof (xRectangle));
glamor_put_vbo_space(screen);
@@ -156,8 +163,11 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
bail:
glDisable(GL_SCISSOR_TEST);
- if (glamor_priv->glsl_version >= 130)
+ if (glamor_priv->glsl_version >= 130) {
+ glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 0);
+ glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
+ }
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
return ret;
--
2.28.0

View File

@ -0,0 +1,139 @@
From 19e725dd368e25c057770530cdd622234303003e Mon Sep 17 00:00:00 2001
From: Robert Mader <robert.mader@posteo.de>
Date: Mon, 22 Jan 2018 17:57:38 +0100
Subject: [PATCH xserver 05/24] xwayland: Use RandR 1.2 interface (rev 2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This adds the RandR 1.2 interface to xwayland and allows modes
advertised by the compositor to be set in an undistructive manner.
With this patch, applications that try to set the resolution will usually
succeed and work while other apps using the same xwayland
instance are not affected at all.
The RandR 1.2 interface will be needed to implement fake-mode-setting and
already makes applications work much cleaner and predictive when a mode
was set.
[hdegoede@redhat.com: Make crtc_set only succeed if the mode matches
the desktop resolution]
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit e89872f51aa834fa9d94a4ca4822f03b0341ab4f)
---
hw/xwayland/xwayland-output.c | 81 +++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 4036ba681..633ebb89e 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -524,12 +524,80 @@ xwl_randr_get_info(ScreenPtr pScreen, Rotation * rotations)
return TRUE;
}
+#ifdef RANDR_10_INTERFACE
static Bool
xwl_randr_set_config(ScreenPtr pScreen,
Rotation rotation, int rate, RRScreenSizePtr pSize)
{
return FALSE;
}
+#endif
+
+#if RANDR_12_INTERFACE
+static Bool
+xwl_randr_screen_set_size(ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth, CARD32 mmHeight)
+{
+ return TRUE;
+}
+
+static Bool
+xwl_randr_crtc_set(ScreenPtr pScreen,
+ RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y,
+ Rotation rotation,
+ int numOutputs, RROutputPtr * outputs)
+{
+ struct xwl_output *xwl_output = crtc->devPrivate;
+
+ if (!mode || (mode->mode.width == xwl_output->width &&
+ mode->mode.height == xwl_output->height)) {
+ RRCrtcChanged(crtc, TRUE);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static Bool
+xwl_randr_crtc_set_gamma(ScreenPtr pScreen, RRCrtcPtr crtc)
+{
+ return TRUE;
+}
+
+static Bool
+xwl_randr_crtc_get_gamma(ScreenPtr pScreen, RRCrtcPtr crtc)
+{
+ return TRUE;
+}
+
+static Bool
+xwl_randr_output_set_property(ScreenPtr pScreen,
+ RROutputPtr output,
+ Atom property,
+ RRPropertyValuePtr value)
+{
+ return TRUE;
+}
+
+static Bool
+xwl_output_validate_mode(ScreenPtr pScreen,
+ RROutputPtr output,
+ RRModePtr mode)
+{
+ return TRUE;
+}
+
+static void
+xwl_randr_mode_destroy(ScreenPtr pScreen, RRModePtr mode)
+{
+ return;
+}
+#endif
Bool
xwl_screen_init_output(struct xwl_screen *xwl_screen)
@@ -543,7 +611,20 @@ xwl_screen_init_output(struct xwl_screen *xwl_screen)
rp = rrGetScrPriv(xwl_screen->screen);
rp->rrGetInfo = xwl_randr_get_info;
+
+#if RANDR_10_INTERFACE
rp->rrSetConfig = xwl_randr_set_config;
+#endif
+
+#if RANDR_12_INTERFACE
+ rp->rrScreenSetSize = xwl_randr_screen_set_size;
+ rp->rrCrtcSet = xwl_randr_crtc_set;
+ rp->rrCrtcSetGamma = xwl_randr_crtc_set_gamma;
+ rp->rrCrtcGetGamma = xwl_randr_crtc_get_gamma;
+ rp->rrOutputSetProperty = xwl_randr_output_set_property;
+ rp->rrOutputValidateMode = xwl_output_validate_mode;
+ rp->rrModeDestroy = xwl_randr_mode_destroy;
+#endif
return TRUE;
}
--
2.26.2

View File

@ -0,0 +1,34 @@
From 1e84fda2020b12a83c6b9c6d31ab84f993c6176c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
Date: Tue, 1 Sep 2020 11:24:57 +0200
Subject: [PATCH xserver 06/16] xfree86: Take second reference for SavedCursor
in xf86CursorSetCursor
The same pointer is kept in CurrentCursor as well, therefore two
RefCursor calls are needed.
Fixes use-after-free after switching VTs.
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1067
(cherry picked from commit 919f1f46fc67dae93b2b3f278fcbfc77af34ec58)
---
hw/xfree86/ramdac/xf86CursorRD.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/xfree86/ramdac/xf86CursorRD.c b/hw/xfree86/ramdac/xf86CursorRD.c
index ee1d98916..02dab36fe 100644
--- a/hw/xfree86/ramdac/xf86CursorRD.c
+++ b/hw/xfree86/ramdac/xf86CursorRD.c
@@ -334,6 +334,9 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
ScreenPriv->HotY = cursor->bits->yhot;
if (!infoPtr->pScrn->vtSema) {
+ cursor = RefCursor(cursor);
+ if (ScreenPriv->SavedCursor)
+ FreeCursor(ScreenPriv->SavedCursor, None);
ScreenPriv->SavedCursor = cursor;
return;
}
--
2.28.0

View File

@ -0,0 +1,80 @@
From e6ba28eb96b227e47c371a7063f778fb2ab82a0b Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 29 Aug 2019 22:45:12 +0200
Subject: [PATCH xserver 06/24] xwayland: Add per client private data
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add per client private data, which for now is empty.
This is a preparation patch for adding randr/vidmode resolution
change emulation.
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 905cb8b9e27add5f49a45fe167a0005bf05218bc)
---
hw/xwayland/xwayland.c | 14 ++++++++++++++
hw/xwayland/xwayland.h | 5 +++++
2 files changed, 19 insertions(+)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index ffd4809df..e00dba334 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -137,11 +137,18 @@ ddxProcessArgument(int argc, char *argv[], int i)
return 0;
}
+static DevPrivateKeyRec xwl_client_private_key;
static DevPrivateKeyRec xwl_window_private_key;
static DevPrivateKeyRec xwl_screen_private_key;
static DevPrivateKeyRec xwl_pixmap_private_key;
static DevPrivateKeyRec xwl_damage_private_key;
+struct xwl_client *
+xwl_client_get(ClientPtr client)
+{
+ return dixLookupPrivate(&client->devPrivates, &xwl_client_private_key);
+}
+
static struct xwl_window *
xwl_window_get(WindowPtr window)
{
@@ -1158,6 +1165,13 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
return FALSE;
if (!dixRegisterPrivateKey(&xwl_damage_private_key, PRIVATE_WINDOW, 0))
return FALSE;
+ /* There are no easy to use new / delete client hooks, we could use a
+ * ClientStateCallback, but it is easier to let the dix code manage the
+ * memory for us. This will zero fill the initial xwl_client data.
+ */
+ if (!dixRegisterPrivateKey(&xwl_client_private_key, PRIVATE_CLIENT,
+ sizeof(struct xwl_client)))
+ return FALSE;
dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen);
xwl_screen->screen = pScreen;
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 200e18a8d..19626d394 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -379,8 +379,13 @@ struct xwl_output {
Bool xdg_output_done;
};
+struct xwl_client {
+};
+
void xwl_window_create_frame_callback(struct xwl_window *xwl_window);
+struct xwl_client *xwl_client_get(ClientPtr client);
+
void xwl_sync_events (struct xwl_screen *xwl_screen);
void xwl_surface_damage(struct xwl_screen *xwl_screen,
struct wl_surface *surface,
--
2.26.2

View File

@ -0,0 +1,37 @@
From f4006d795cb199bf7deeb00f542c592db6a5becb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
Date: Mon, 7 Sep 2020 18:35:10 +0200
Subject: [PATCH xserver 07/16] present/wnmd: Can't use page flipping for
windows clipped by children
Noticed this was missing while working on the following fix.
v2:
* Dropped present_wnmd_can_window_flip hunk (that function is never
called, will be cleaned up in a follow-up MR).
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com> # v1
Reviewed-by: Roman Gilg <subdiff@gmail.com>
(cherry picked from commit 7ac303c7b1e3b1be79ba3648e217798683e65a99)
---
present/present_wnmd.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index 32c4d55f1..6a3d1035b 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -291,6 +291,10 @@ present_wnmd_check_flip(RRCrtcPtr crtc,
if ( !RegionEqual(&window->winSize, &toplvl_window->winSize) )
return FALSE;
+ /* Can't flip if window clipped by children */
+ if (!RegionEqual(&window->clipList, &window->winSize))
+ return FALSE;
+
/* Ask the driver for permission */
if (screen_priv->wnmd_info->check_flip2) {
if (!(*screen_priv->wnmd_info->check_flip2) (crtc, window, pixmap, sync_flip, reason)) {
--
2.28.0

View File

@ -0,0 +1,149 @@
From 575c8b49a715d45115625643b8495ad786961e38 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 29 Aug 2019 23:04:36 +0200
Subject: [PATCH xserver 07/24] xwayland: Add support for storing per client
per output emulated resolution
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add support for storing per output randr/vidmode emulated resolution
into the per client data.
Since we do not have a free/delete callback for the client this uses
a simple static array. The entries are tied to a specific output by the
server_output_id, with a server_output_id of 0 indicating a free slot
(0 is the "None" Wayland object id).
Note that even if we were to store this in a linked list, we would still
need the server_output_id as this is *per client* *per output*.
This is a preparation patch for adding randr/vidmode resolution
change emulation.
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit aca0a588eb40a5e6669094a2ab7f71ca0ba06b16)
---
hw/xwayland/xwayland-output.c | 67 +++++++++++++++++++++++++++++++++++
hw/xwayland/xwayland.h | 17 +++++++++
2 files changed, 84 insertions(+)
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 633ebb89e..64794dee7 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -208,6 +208,73 @@ update_screen_size(struct xwl_output *xwl_output, int width, int height)
update_desktop_dimensions();
}
+struct xwl_emulated_mode *
+xwl_output_get_emulated_mode_for_client(struct xwl_output *xwl_output,
+ ClientPtr client)
+{
+ struct xwl_client *xwl_client = xwl_client_get(client);
+ int i;
+
+ if (!xwl_output)
+ return NULL;
+
+ for (i = 0; i < XWL_CLIENT_MAX_EMULATED_MODES; i++) {
+ if (xwl_client->emulated_modes[i].server_output_id ==
+ xwl_output->server_output_id)
+ return &xwl_client->emulated_modes[i];
+ }
+
+ return NULL;
+}
+
+static void
+xwl_output_add_emulated_mode_for_client(struct xwl_output *xwl_output,
+ ClientPtr client,
+ RRModePtr mode,
+ Bool from_vidmode)
+{
+ struct xwl_client *xwl_client = xwl_client_get(client);
+ struct xwl_emulated_mode *emulated_mode;
+ int i;
+
+ emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, client);
+ if (!emulated_mode) {
+ /* Find a free spot in the emulated modes array */
+ for (i = 0; i < XWL_CLIENT_MAX_EMULATED_MODES; i++) {
+ if (xwl_client->emulated_modes[i].server_output_id == 0) {
+ emulated_mode = &xwl_client->emulated_modes[i];
+ break;
+ }
+ }
+ }
+ if (!emulated_mode) {
+ static Bool warned;
+
+ if (!warned) {
+ ErrorF("Ran out of space for emulated-modes, not adding mode");
+ warned = TRUE;
+ }
+
+ return;
+ }
+
+ emulated_mode->server_output_id = xwl_output->server_output_id;
+ emulated_mode->width = mode->mode.width;
+ emulated_mode->height = mode->mode.height;
+ emulated_mode->from_vidmode = from_vidmode;
+}
+
+static void
+xwl_output_remove_emulated_mode_for_client(struct xwl_output *xwl_output,
+ ClientPtr client)
+{
+ struct xwl_emulated_mode *emulated_mode;
+
+ emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, client);
+ if (emulated_mode)
+ memset(emulated_mode, 0, sizeof(*emulated_mode));
+}
+
/* From hw/xfree86/common/xf86DefModeSet.c with some obscure modes dropped */
const int32_t xwl_output_fake_modes[][2] = {
/* 4:3 (1.33) */
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 19626d394..c886d77e9 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -379,7 +379,21 @@ struct xwl_output {
Bool xdg_output_done;
};
+/* Per client per output emulated randr/vidmode resolution info. */
+struct xwl_emulated_mode {
+ uint32_t server_output_id;
+ int32_t width;
+ int32_t height;
+ Bool from_vidmode;
+};
+
+/* Apps which use randr/vidmode to change the mode when going fullscreen,
+ * usually change the mode of only a single monitor, so this should be plenty.
+ */
+#define XWL_CLIENT_MAX_EMULATED_MODES 16
+
struct xwl_client {
+ struct xwl_emulated_mode emulated_modes[XWL_CLIENT_MAX_EMULATED_MODES];
};
void xwl_window_create_frame_callback(struct xwl_window *xwl_window);
@@ -427,6 +441,9 @@ void xwl_output_destroy(struct xwl_output *xwl_output);
void xwl_output_remove(struct xwl_output *xwl_output);
+struct xwl_emulated_mode *xwl_output_get_emulated_mode_for_client(
+ struct xwl_output *xwl_output, ClientPtr client);
+
RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
float VRefresh, Bool Reduced, Bool Interlaced);
--
2.26.2

View File

@ -0,0 +1,462 @@
From 1317f1f02fd0037e2bf7a678f2c3a9a4170161e9 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 2 Jul 2019 11:55:26 +0200
Subject: [PATCH xserver 08/24] xwayland: Add support for randr-resolution
change emulation using viewport
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add support for per client randr-resolution change emulation using viewport,
for apps which want to change the resolution when going fullscreen.
Partly based on earlier work on this by Robert Mader <robert.mader@posteo.de>
Note SDL2 and SFML do not restore randr resolution when going from
fullscreen -> windowed, I believe this is caused by us still reporting the
desktop resolution when they query the resolution. This is not a problem
because when windowed the toplevel window size includes the window-decorations
so it never matches the emulated resolution.
One exception would be the window being resizable in Windowed mode and the
user resizing the window so that including decorations it matches the
emulated resolution *and* the window being at pos 0x0. But this is an
extreme corner case. Still I will submit patches upstream to SDL2
and SFML to always restore the desktop resolution under Xwayland,
disabling resolution emulation all together when going windowed.
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit d99b9ff0f237d15e7eb507484493c73b393d5dba)
---
hw/xwayland/xwayland-input.c | 5 +
hw/xwayland/xwayland-output.c | 63 ++++++++++-
hw/xwayland/xwayland.c | 199 ++++++++++++++++++++++++++++++++++
hw/xwayland/xwayland.h | 15 +++
4 files changed, 276 insertions(+), 6 deletions(-)
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index a05d178ff..7d75a8f54 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -488,6 +488,11 @@ dispatch_pointer_motion_event(struct xwl_seat *xwl_seat)
int dx = xwl_seat->focus_window->window->drawable.x;
int dy = xwl_seat->focus_window->window->drawable.y;
+ if (xwl_window_has_viewport_enabled(xwl_seat->focus_window)) {
+ sx *= xwl_seat->focus_window->scale_x;
+ sy *= xwl_seat->focus_window->scale_y;
+ }
+
x = dx + sx;
y = dy + sy;
} else {
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 64794dee7..e09d00108 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -371,6 +371,42 @@ err:
FatalError("Failed to allocate memory for list of RR modes");
}
+RRModePtr
+xwl_output_find_mode(struct xwl_output *xwl_output,
+ int32_t width, int32_t height)
+{
+ RROutputPtr output = xwl_output->randr_output;
+ int i;
+
+ /* width & height -1 means we want the actual output mode, which is idx 0 */
+ if (width == -1 && height == -1 && output->modes)
+ return output->modes[0];
+
+ for (i = 0; i < output->numModes; i++) {
+ if (output->modes[i]->mode.width == width && output->modes[i]->mode.height == height)
+ return output->modes[i];
+ }
+
+ ErrorF("XWAYLAND: mode %dx%d is not available\n", width, height);
+ return NULL;
+}
+
+void
+xwl_output_set_emulated_mode(struct xwl_output *xwl_output, ClientPtr client,
+ RRModePtr mode, Bool from_vidmode)
+{
+ DebugF("XWAYLAND: xwl_output_set_emulated_mode from %s: %dx%d\n",
+ from_vidmode ? "vidmode" : "randr",
+ mode->mode.width, mode->mode.height);
+
+ if (mode->mode.width == xwl_output->width && mode->mode.height == xwl_output->height)
+ xwl_output_remove_emulated_mode_for_client(xwl_output, client);
+ else
+ xwl_output_add_emulated_mode_for_client(xwl_output, client, mode, from_vidmode);
+
+ xwl_screen_check_resolution_change_emulation(xwl_output->xwl_screen);
+}
+
static void
apply_output_change(struct xwl_output *xwl_output)
{
@@ -613,21 +649,36 @@ xwl_randr_screen_set_size(ScreenPtr pScreen,
static Bool
xwl_randr_crtc_set(ScreenPtr pScreen,
RRCrtcPtr crtc,
- RRModePtr mode,
+ RRModePtr new_mode,
int x,
int y,
Rotation rotation,
int numOutputs, RROutputPtr * outputs)
{
struct xwl_output *xwl_output = crtc->devPrivate;
+ RRModePtr mode;
- if (!mode || (mode->mode.width == xwl_output->width &&
- mode->mode.height == xwl_output->height)) {
- RRCrtcChanged(crtc, TRUE);
- return TRUE;
+ if (new_mode) {
+ mode = xwl_output_find_mode(xwl_output,
+ new_mode->mode.width,
+ new_mode->mode.height);
+ } else {
+ mode = xwl_output_find_mode(xwl_output, -1, -1);
}
+ if (!mode)
+ return FALSE;
- return FALSE;
+ xwl_output_set_emulated_mode(xwl_output, GetCurrentClient(), mode, FALSE);
+
+ /* A real randr implementation would call:
+ * RRCrtcNotify(xwl_output->randr_crtc, mode, xwl_output->x, xwl_output->y,
+ * xwl_output->rotation, NULL, 1, &xwl_output->randr_output);
+ * here to update the mode reported to clients querying the randr settings
+ * but that influences *all* clients and we do randr mode change emulation
+ * on a per client basis. So we just return success here.
+ */
+
+ return TRUE;
}
static Bool
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index e00dba334..9c6cf7cf5 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -178,6 +178,23 @@ xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen)
return xwl_screen->rootless && xwl_screen_has_viewport_support(xwl_screen);
}
+/* Return the output @ 0x0, falling back to the first output in the list */
+struct xwl_output *
+xwl_screen_get_first_output(struct xwl_screen *xwl_screen)
+{
+ struct xwl_output *xwl_output;
+
+ xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
+ if (xwl_output->x == 0 && xwl_output->y == 0)
+ return xwl_output;
+ }
+
+ if (xorg_list_is_empty(&xwl_screen->output_list))
+ return NULL;
+
+ return xorg_list_first_entry(&xwl_screen->output_list, struct xwl_output, link);
+}
+
static void
xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow,
const char *debug_msg)
@@ -514,6 +531,150 @@ xwl_pixmap_get(PixmapPtr pixmap)
return dixLookupPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key);
}
+Bool
+xwl_window_has_viewport_enabled(struct xwl_window *xwl_window)
+{
+ return (xwl_window->viewport != NULL);
+}
+
+static void
+xwl_window_disable_viewport(struct xwl_window *xwl_window)
+{
+ assert (xwl_window->viewport);
+
+ DebugF("XWAYLAND: disabling viewport\n");
+ wp_viewport_destroy(xwl_window->viewport);
+ xwl_window->viewport = NULL;
+}
+
+static void
+xwl_window_enable_viewport(struct xwl_window *xwl_window,
+ struct xwl_output *xwl_output,
+ struct xwl_emulated_mode *emulated_mode)
+{
+ /* If necessary disable old viewport to apply new settings */
+ if (xwl_window_has_viewport_enabled(xwl_window))
+ xwl_window_disable_viewport(xwl_window);
+
+ DebugF("XWAYLAND: enabling viewport %dx%d -> %dx%d\n",
+ emulated_mode->width, emulated_mode->height,
+ xwl_output->width, xwl_output->height);
+
+ xwl_window->viewport =
+ wp_viewporter_get_viewport(xwl_window->xwl_screen->viewporter,
+ xwl_window->surface);
+
+ wp_viewport_set_source(xwl_window->viewport,
+ wl_fixed_from_int(0),
+ wl_fixed_from_int(0),
+ wl_fixed_from_int(emulated_mode->width),
+ wl_fixed_from_int(emulated_mode->height));
+ wp_viewport_set_destination(xwl_window->viewport,
+ xwl_output->width,
+ xwl_output->height);
+
+ xwl_window->scale_x = (float)emulated_mode->width / xwl_output->width;
+ xwl_window->scale_y = (float)emulated_mode->height / xwl_output->height;
+}
+
+static Bool
+xwl_screen_client_is_window_manager(struct xwl_screen *xwl_screen,
+ ClientPtr client)
+{
+ WindowPtr root = xwl_screen->screen->root;
+ OtherClients *others;
+
+ for (others = wOtherClients(root); others; others = others->next) {
+ if (SameClient(others, client)) {
+ if (others->mask & (SubstructureRedirectMask | ResizeRedirectMask))
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static ClientPtr
+xwl_window_get_owner(struct xwl_window *xwl_window)
+{
+ WindowPtr window = xwl_window->window;
+ ClientPtr client = wClient(window);
+
+ /* If the toplevel window is owned by the window-manager, then the
+ * actual client toplevel window has been reparented to a window-manager
+ * decoration window. In that case return the client of the
+ * first *and only* child of the toplevel (decoration) window.
+ */
+ if (xwl_screen_client_is_window_manager(xwl_window->xwl_screen, client)) {
+ if (window->firstChild && window->firstChild == window->lastChild)
+ return wClient(window->firstChild);
+ else
+ return NULL; /* Should never happen, skip resolution emulation */
+ }
+
+ return client;
+}
+
+static Bool
+xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
+ struct xwl_output **xwl_output_ret,
+ struct xwl_emulated_mode **emulated_mode_ret)
+{
+ struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
+ struct xwl_emulated_mode *emulated_mode;
+ struct xwl_output *xwl_output;
+ ClientPtr owner;
+
+ if (!xwl_screen_has_resolution_change_emulation(xwl_screen))
+ return FALSE;
+
+ owner = xwl_window_get_owner(xwl_window);
+ if (!owner)
+ return FALSE;
+
+ /* 1. Test if the window matches the emulated mode on one of the outputs
+ * This path gets hit by most games / libs (e.g. SDL, SFML, OGRE)
+ */
+ xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
+ emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, owner);
+ if (!emulated_mode)
+ continue;
+
+ if (xwl_window->x == xwl_output->x &&
+ xwl_window->y == xwl_output->y &&
+ xwl_window->width == emulated_mode->width &&
+ xwl_window->height == emulated_mode->height) {
+
+ *emulated_mode_ret = emulated_mode;
+ *xwl_output_ret = xwl_output;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static void
+xwl_window_check_resolution_change_emulation(struct xwl_window *xwl_window)
+{
+ struct xwl_emulated_mode *emulated_mode;
+ struct xwl_output *xwl_output;
+
+ if (xwl_window_should_enable_viewport(xwl_window, &xwl_output, &emulated_mode))
+ xwl_window_enable_viewport(xwl_window, xwl_output, emulated_mode);
+ else if (xwl_window_has_viewport_enabled(xwl_window))
+ xwl_window_disable_viewport(xwl_window);
+}
+
+void
+xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen)
+{
+ struct xwl_window *xwl_window;
+
+ xorg_list_for_each_entry(xwl_window, &xwl_screen->window_list, link_window)
+ xwl_window_check_resolution_change_emulation(xwl_window);
+}
+
static void
xwl_window_init_allow_commits(struct xwl_window *xwl_window)
{
@@ -584,6 +745,8 @@ ensure_surface_for_window(WindowPtr window)
xwl_window->xwl_screen = xwl_screen;
xwl_window->window = window;
+ xwl_window->width = window->drawable.width;
+ xwl_window->height = window->drawable.height;
xwl_window->surface = wl_compositor_create_surface(xwl_screen->compositor);
if (xwl_window->surface == NULL) {
ErrorF("wl_display_create_surface failed\n");
@@ -625,6 +788,7 @@ ensure_surface_for_window(WindowPtr window)
dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window);
xorg_list_init(&xwl_window->link_damage);
+ xorg_list_add(&xwl_window->link_window, &xwl_screen->window_list);
#ifdef GLAMOR_HAS_GBM
xorg_list_init(&xwl_window->frame_callback_list);
@@ -718,8 +882,12 @@ xwl_unrealize_window(WindowPtr window)
if (!xwl_window)
return ret;
+ if (xwl_window_has_viewport_enabled(xwl_window))
+ xwl_window_disable_viewport(xwl_window);
+
wl_surface_destroy(xwl_window->surface);
xorg_list_del(&xwl_window->link_damage);
+ xorg_list_del(&xwl_window->link_window);
unregister_damage(window);
if (xwl_window->frame_callback)
@@ -769,6 +937,33 @@ xwl_set_window_pixmap(WindowPtr window,
ensure_surface_for_window(window);
}
+static void
+xwl_resize_window(WindowPtr window,
+ int x, int y,
+ unsigned int width, unsigned int height,
+ WindowPtr sib)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen;
+ struct xwl_window *xwl_window;
+
+ xwl_screen = xwl_screen_get(screen);
+ xwl_window = xwl_window_get(window);
+
+ screen->ResizeWindow = xwl_screen->ResizeWindow;
+ (*screen->ResizeWindow) (window, x, y, width, height, sib);
+ xwl_screen->ResizeWindow = screen->ResizeWindow;
+ screen->ResizeWindow = xwl_resize_window;
+
+ if (xwl_window) {
+ xwl_window->x = x;
+ xwl_window->y = y;
+ xwl_window->width = width;
+ xwl_window->height = height;
+ xwl_window_check_resolution_change_emulation(xwl_window);
+ }
+}
+
static void
frame_callback(void *data,
struct wl_callback *callback,
@@ -1246,6 +1441,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
xorg_list_init(&xwl_screen->output_list);
xorg_list_init(&xwl_screen->seat_list);
xorg_list_init(&xwl_screen->damage_window_list);
+ xorg_list_init(&xwl_screen->window_list);
xwl_screen->depth = 24;
if (!monitorResolution)
@@ -1340,6 +1536,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
xwl_screen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xwl_close_screen;
+ xwl_screen->ResizeWindow = pScreen->ResizeWindow;
+ pScreen->ResizeWindow = xwl_resize_window;
+
if (xwl_screen->rootless) {
xwl_screen->SetWindowPixmap = pScreen->SetWindowPixmap;
pScreen->SetWindowPixmap = xwl_set_window_pixmap;
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index c886d77e9..36c4c4c8b 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -135,10 +135,12 @@ struct xwl_screen {
DestroyWindowProcPtr DestroyWindow;
XYToWindowProcPtr XYToWindow;
SetWindowPixmapProcPtr SetWindowPixmap;
+ ResizeWindowProcPtr ResizeWindow;
struct xorg_list output_list;
struct xorg_list seat_list;
struct xorg_list damage_window_list;
+ struct xorg_list window_list;
int wayland_fd;
struct wl_display *display;
@@ -179,9 +181,13 @@ struct xwl_screen {
struct xwl_window {
struct xwl_screen *xwl_screen;
struct wl_surface *surface;
+ struct wp_viewport *viewport;
+ int32_t x, y, width, height;
+ float scale_x, scale_y;
struct wl_shell_surface *shell_surface;
WindowPtr window;
struct xorg_list link_damage;
+ struct xorg_list link_window;
struct wl_callback *frame_callback;
Bool allow_commits;
#ifdef GLAMOR_HAS_GBM
@@ -411,6 +417,9 @@ Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen);
struct xwl_screen *xwl_screen_get(ScreenPtr screen);
Bool xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen);
+struct xwl_output *xwl_screen_get_first_output(struct xwl_screen *xwl_screen);
+void xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen);
+Bool xwl_window_has_viewport_enabled(struct xwl_window *xwl_window);
void xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *tool);
void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
@@ -444,6 +453,12 @@ void xwl_output_remove(struct xwl_output *xwl_output);
struct xwl_emulated_mode *xwl_output_get_emulated_mode_for_client(
struct xwl_output *xwl_output, ClientPtr client);
+RRModePtr xwl_output_find_mode(struct xwl_output *xwl_output,
+ int32_t width, int32_t height);
+void xwl_output_set_emulated_mode(struct xwl_output *xwl_output,
+ ClientPtr client, RRModePtr mode,
+ Bool from_vidmode);
+
RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
float VRefresh, Bool Reduced, Bool Interlaced);
--
2.26.2

View File

@ -0,0 +1,45 @@
From 51ee6e5ceb0cacc8e2fa225ad5391ffb159e36a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
Date: Mon, 7 Sep 2020 18:39:17 +0200
Subject: [PATCH xserver 08/16] xwayland: Check window pixmap in
xwl_present_check_flip2
We can only flip if the window pixmap matches that of the toplevel
window. Doing so regardless could cause the toplevel window pixmap to
get destroyed while it was still referenced by the window, resulting in
use-after-free and likely a crash.
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1033
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Roman Gilg <subdiff@gmail.com>
(cherry picked from commit 4c25356d6cd908c5030c70e712076dff318ac00d)
---
hw/xwayland/xwayland-present.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 6076f6498..d177abdd8 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -421,10 +421,18 @@ xwl_present_check_flip2(RRCrtcPtr crtc,
PresentFlipReason *reason)
{
struct xwl_window *xwl_window = xwl_window_from_window(present_window);
+ ScreenPtr screen = pixmap->drawable.pScreen;
if (!xwl_window)
return FALSE;
+ /* Can't flip if the window pixmap doesn't match the xwl_window parent
+ * window's, e.g. because a client redirected this window or one of its
+ * parents.
+ */
+ if (screen->GetWindowPixmap(xwl_window->window) != screen->GetWindowPixmap(present_window))
+ return FALSE;
+
/*
* We currently only allow flips of windows, that have the same
* dimensions as their xwl_window parent window. For the case of
--
2.28.0

View File

@ -0,0 +1,33 @@
From 174cb91d82d643f78d8ba2b9999312b9d7dea98c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
Date: Mon, 7 Sep 2020 18:40:34 +0200
Subject: [PATCH xserver 09/16] present/wnmd: Remove dead check from
present_wnmd_check_flip
present_wnmd_toplvl_pixmap_window returns a window with the same window
pixmap, so the check could never fail.
Reviewed-by: Roman Gilg <subdiff@gmail.com>
(cherry picked from commit b6b1161fd7ac409156fb69439897bcabdeacf393)
---
present/present_wnmd.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index 6a3d1035b..35ea12968 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -270,10 +270,6 @@ present_wnmd_check_flip(RRCrtcPtr crtc,
if (!screen_priv->wnmd_info->flip)
return FALSE;
- /* Can't flip redirected child windows */
- if (screen->GetWindowPixmap(window) != screen->GetWindowPixmap(toplvl_window))
- return FALSE;
-
/* Source pixmap must align with window exactly */
if (x_off || y_off)
return FALSE;
--
2.28.0

View File

@ -0,0 +1,101 @@
From 0efb1df3a2ef4bc2dd329af63e1bd3dbda3445e4 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 8 Jul 2019 14:00:27 +0200
Subject: [PATCH xserver 09/24] xwayland: Add xwlRRModeToDisplayMode() helper
function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is a preparation patch for adding emulated mode/resolution change
support to Xwayland's XF86 vidmode extension emulation, using the
Wayland viewport extension.
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 43c80078126f6f33c6ab7d3cf4668733bde03366)
---
hw/xwayland/xwayland-vidmode.c | 51 +++++++++++++++++++---------------
1 file changed, 28 insertions(+), 23 deletions(-)
diff --git a/hw/xwayland/xwayland-vidmode.c b/hw/xwayland/xwayland-vidmode.c
index d25d1aca1..428af716d 100644
--- a/hw/xwayland/xwayland-vidmode.c
+++ b/hw/xwayland/xwayland-vidmode.c
@@ -78,13 +78,37 @@ mode_refresh(const xRRModeInfo *mode_info)
return rate;
}
+static void
+xwlRRModeToDisplayMode(RRModePtr rrmode, DisplayModePtr mode)
+{
+ const xRRModeInfo *mode_info = &rrmode->mode;
+
+ mode->next = mode;
+ mode->prev = mode;
+ mode->name = "";
+ mode->VScan = 1;
+ mode->Private = NULL;
+ mode->HDisplay = mode_info->width;
+ mode->HSyncStart = mode_info->hSyncStart;
+ mode->HSyncEnd = mode_info->hSyncEnd;
+ mode->HTotal = mode_info->hTotal;
+ mode->HSkew = mode_info->hSkew;
+ mode->VDisplay = mode_info->height;
+ mode->VSyncStart = mode_info->vSyncStart;
+ mode->VSyncEnd = mode_info->vSyncEnd;
+ mode->VTotal = mode_info->vTotal;
+ mode->Flags = mode_info->modeFlags;
+ mode->Clock = mode_info->dotClock / 1000.0;
+ mode->VRefresh = mode_refresh(mode_info); /* Or RRVerticalRefresh() */
+ mode->HSync = mode_hsync(mode_info);
+}
+
static Bool
xwlVidModeGetCurrentModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock)
{
DisplayModePtr pMod;
RROutputPtr output;
RRCrtcPtr crtc;
- xRRModeInfo rrmode;
pMod = dixLookupPrivate(&pScreen->devPrivates, xwlVidModePrivateKey);
if (pMod == NULL)
@@ -98,30 +122,11 @@ xwlVidModeGetCurrentModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotCl
if (crtc == NULL)
return FALSE;
- rrmode = crtc->mode->mode;
-
- pMod->next = pMod;
- pMod->prev = pMod;
- pMod->name = "";
- pMod->VScan = 1;
- pMod->Private = NULL;
- pMod->HDisplay = rrmode.width;
- pMod->HSyncStart = rrmode.hSyncStart;
- pMod->HSyncEnd = rrmode.hSyncEnd;
- pMod->HTotal = rrmode.hTotal;
- pMod->HSkew = rrmode.hSkew;
- pMod->VDisplay = rrmode.height;
- pMod->VSyncStart = rrmode.vSyncStart;
- pMod->VSyncEnd = rrmode.vSyncEnd;
- pMod->VTotal = rrmode.vTotal;
- pMod->Flags = rrmode.modeFlags;
- pMod->Clock = rrmode.dotClock / 1000.0;
- pMod->VRefresh = mode_refresh(&rrmode); /* Or RRVerticalRefresh() */
- pMod->HSync = mode_hsync(&rrmode);
- *mode = pMod;
+ xwlRRModeToDisplayMode(crtc->mode, pMod);
+ *mode = pMod;
if (dotClock != NULL)
- *dotClock = rrmode.dotClock / 1000.0;
+ *dotClock = pMod->Clock;
return TRUE;
}
--
2.26.2

View File

@ -0,0 +1,193 @@
From fdbc9904d5af48db56877369f8b4671985ffc363 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 8 Jul 2019 18:35:27 +0200
Subject: [PATCH xserver 10/24] xwayland: Add xwlVidModeGetCurrentRRMode helper
to the vidmode code
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
crtc->mode reflects the mode set through the xrandr extension, once we
add support for also changing the mode through the vidmode extension this
will no longer correctly reflect the emulated resolution.
Add a new xwlVidModeGetCurrentRRMode helper which determines the mode by
looking at the emulated_mode instead.
Likewise add a xwlVidModeGetRRMode helper and use that in
xwlVidModeCheckModeForMonitor/xwlVidModeCheckModeForDriver to allow any
mode listed in the randr_output's mode list.
This is a preparation patch for adding emulated mode/resolution change
support to Xwayland's XF86 vidmode extension emulation.
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit bcad1b813a04b9f3ff225f57a4baad09bd6315b9)
---
hw/xwayland/xwayland-vidmode.c | 90 +++++++++++++++++++++-------------
1 file changed, 56 insertions(+), 34 deletions(-)
diff --git a/hw/xwayland/xwayland-vidmode.c b/hw/xwayland/xwayland-vidmode.c
index 428af716d..7cf982fcc 100644
--- a/hw/xwayland/xwayland-vidmode.c
+++ b/hw/xwayland/xwayland-vidmode.c
@@ -103,26 +103,56 @@ xwlRRModeToDisplayMode(RRModePtr rrmode, DisplayModePtr mode)
mode->HSync = mode_hsync(mode_info);
}
+static RRModePtr
+xwlVidModeGetRRMode(ScreenPtr pScreen, int32_t width, int32_t height)
+{
+ RROutputPtr output = RRFirstOutput(pScreen);
+
+ if (output == NULL)
+ return NULL;
+
+ return xwl_output_find_mode(output->devPrivate, width, height);
+}
+
+static RRModePtr
+xwlVidModeGetCurrentRRMode(ScreenPtr pScreen)
+{
+ struct xwl_emulated_mode *emulated_mode;
+ struct xwl_output *xwl_output;
+ RROutputPtr output;
+
+ output = RRFirstOutput(pScreen);
+ if (output == NULL)
+ return NULL;
+
+ xwl_output = output->devPrivate;
+ emulated_mode =
+ xwl_output_get_emulated_mode_for_client(xwl_output, GetCurrentClient());
+
+ if (emulated_mode) {
+ return xwl_output_find_mode(xwl_output,
+ emulated_mode->width,
+ emulated_mode->height);
+ } else {
+ return xwl_output_find_mode(xwl_output, -1, -1);
+ }
+}
+
static Bool
xwlVidModeGetCurrentModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock)
{
DisplayModePtr pMod;
- RROutputPtr output;
- RRCrtcPtr crtc;
+ RRModePtr rrmode;
pMod = dixLookupPrivate(&pScreen->devPrivates, xwlVidModePrivateKey);
if (pMod == NULL)
return FALSE;
- output = RRFirstOutput(pScreen);
- if (output == NULL)
- return FALSE;
-
- crtc = output->crtc;
- if (crtc == NULL)
+ rrmode = xwlVidModeGetCurrentRRMode(pScreen);
+ if (rrmode == NULL)
return FALSE;
- xwlRRModeToDisplayMode(crtc->mode, pMod);
+ xwlRRModeToDisplayMode(rrmode, pMod);
*mode = pMod;
if (dotClock != NULL)
@@ -135,9 +165,10 @@ static vidMonitorValue
xwlVidModeGetMonitorValue(ScreenPtr pScreen, int valtyp, int indx)
{
vidMonitorValue ret = { NULL, };
- DisplayModePtr pMod;
+ RRModePtr rrmode;
- if (!xwlVidModeGetCurrentModeline(pScreen, &pMod, NULL))
+ rrmode = xwlVidModeGetCurrentRRMode(pScreen);
+ if (rrmode == NULL)
return ret;
switch (valtyp) {
@@ -155,11 +186,11 @@ xwlVidModeGetMonitorValue(ScreenPtr pScreen, int valtyp, int indx)
break;
case VIDMODE_MON_HSYNC_LO:
case VIDMODE_MON_HSYNC_HI:
- ret.f = 100.0 * pMod->HSync;
+ ret.f = mode_hsync(&rrmode->mode) * 100.0;
break;
case VIDMODE_MON_VREFRESH_LO:
case VIDMODE_MON_VREFRESH_HI:
- ret.f = 100.0 * pMod->VRefresh;
+ ret.f = mode_refresh(&rrmode->mode) * 100.0;
break;
}
return ret;
@@ -168,13 +199,13 @@ xwlVidModeGetMonitorValue(ScreenPtr pScreen, int valtyp, int indx)
static int
xwlVidModeGetDotClock(ScreenPtr pScreen, int Clock)
{
- DisplayModePtr pMod;
+ RRModePtr rrmode;
- if (!xwlVidModeGetCurrentModeline(pScreen, &pMod, NULL))
+ rrmode = xwlVidModeGetCurrentRRMode(pScreen);
+ if (rrmode == NULL)
return 0;
- return pMod->Clock;
-
+ return rrmode->mode.dotClock / 1000.0;
}
static int
@@ -272,14 +303,15 @@ xwlVidModeLockZoom(ScreenPtr pScreen, Bool lock)
static ModeStatus
xwlVidModeCheckModeForMonitor(ScreenPtr pScreen, DisplayModePtr mode)
{
- DisplayModePtr pMod;
+ RRModePtr rrmode;
- /* This should not happen */
- if (!xwlVidModeGetCurrentModeline(pScreen, &pMod, NULL))
+ rrmode = xwlVidModeGetRRMode(pScreen, mode->HDisplay, mode->VDisplay);
+ if (rrmode == NULL)
return MODE_ERROR;
/* Only support mode with the same HSync/VRefresh as we advertise */
- if (mode->HSync == pMod->HSync && mode->VRefresh == pMod->VRefresh)
+ if (mode->HSync == mode_hsync(&rrmode->mode) &&
+ mode->VRefresh == mode_refresh(&rrmode->mode))
return MODE_OK;
/* All the rest is unsupported - If we want to succeed, return MODE_OK instead */
@@ -289,20 +321,10 @@ xwlVidModeCheckModeForMonitor(ScreenPtr pScreen, DisplayModePtr mode)
static ModeStatus
xwlVidModeCheckModeForDriver(ScreenPtr pScreen, DisplayModePtr mode)
{
- DisplayModePtr pMod;
-
- /* This should not happen */
- if (!xwlVidModeGetCurrentModeline(pScreen, &pMod, NULL))
- return MODE_ERROR;
-
- if (mode->HTotal != pMod->HTotal)
- return MODE_BAD_HVALUE;
+ RRModePtr rrmode;
- if (mode->VTotal != pMod->VTotal)
- return MODE_BAD_VVALUE;
-
- /* Unsupported for now, but pretend it works */
- return MODE_OK;
+ rrmode = xwlVidModeGetRRMode(pScreen, mode->HDisplay, mode->VDisplay);
+ return rrmode ? MODE_OK : MODE_ERROR;
}
static void
--
2.26.2

View File

@ -0,0 +1,73 @@
From d108c2c82cba242ea5998d7c91254d90d3a5db71 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Fri, 11 Sep 2020 11:30:18 +0200
Subject: [PATCH xserver 10/16] xwayland: Do not discard frame callbacks on
allow commits
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Currently, when a X11 client (usually the X11 window manager from a
Wayland compositor) changes the value of the X11 property
`_XWAYLAND_ALLOW_COMMITS` from `false` to `true`, all pending frame
callbacks on the window are discarded so that the commit occurs
immediately.
Weston uses that mechanism to prevent the content of the window from
showing before it's ready when mapping the window initially, but
discarding the pending frame callbacks has no effect on the initial
mapping of the X11 window since at that point there cannot be any frame
callback on a surface which hasn't been committed yet anyway.
However, discarding pending frame callbacks can be problematic if we
were to use the same `_XWAYLAND_ALLOW_COMMITS` mechanism to prevent
damages to be posted before the X11 toplevel is updated completely
(including the window decorations from the X11 window manager).
Remove the portion of code discarding the pending frame callback,
Xwayland should always wait for a pending frame callback if there's one
before posting new damages.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
https://gitlab.freedesktop.org/xorg/xserver/merge_requests/333
(cherry picked from commit 66da95a172c4941b75ffedcdaa0138c0a48f11fb)
---
hw/xwayland/xwayland.c | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index d02934cd5..a69188c0f 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -193,8 +193,6 @@ static void
xwl_window_property_allow_commits(struct xwl_window *xwl_window,
PropertyStateRec *propstate)
{
- Bool old_allow_commits = xwl_window->allow_commits;
-
switch (propstate->state) {
case PropertyNewValue:
xwl_window_set_allow_commits_from_property(xwl_window, propstate->prop);
@@ -207,17 +205,6 @@ xwl_window_property_allow_commits(struct xwl_window *xwl_window,
default:
break;
}
-
- /* If allow_commits turned from off to on, discard any frame
- * callback we might be waiting for so that a new buffer is posted
- * immediately through block_handler() if there is damage to post.
- */
- if (!old_allow_commits && xwl_window->allow_commits) {
- if (xwl_window->frame_callback) {
- wl_callback_destroy(xwl_window->frame_callback);
- xwl_window->frame_callback = NULL;
- }
- }
}
static void
--
2.28.0

View File

@ -0,0 +1,236 @@
From aa5920519dff3dc3dfb33af342e454627fa5402c Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 9 Jul 2019 09:31:13 +0200
Subject: [PATCH xserver 11/24] xwayland: Add vidmode mode changing emulation
support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add support for fake mode changes using viewport, for apps which want to
change the resolution when going fullscreen.
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 38de6260816674b5430144cc38a8a27d93d1bf19)
---
hw/xwayland/xwayland-vidmode.c | 130 ++++++++++++++++++++++-----------
1 file changed, 86 insertions(+), 44 deletions(-)
diff --git a/hw/xwayland/xwayland-vidmode.c b/hw/xwayland/xwayland-vidmode.c
index 7cf982fcc..99a4d2c92 100644
--- a/hw/xwayland/xwayland-vidmode.c
+++ b/hw/xwayland/xwayland-vidmode.c
@@ -106,26 +106,25 @@ xwlRRModeToDisplayMode(RRModePtr rrmode, DisplayModePtr mode)
static RRModePtr
xwlVidModeGetRRMode(ScreenPtr pScreen, int32_t width, int32_t height)
{
- RROutputPtr output = RRFirstOutput(pScreen);
+ struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
+ struct xwl_output *xwl_output = xwl_screen_get_first_output(xwl_screen);
- if (output == NULL)
+ if (!xwl_output)
return NULL;
- return xwl_output_find_mode(output->devPrivate, width, height);
+ return xwl_output_find_mode(xwl_output, width, height);
}
static RRModePtr
xwlVidModeGetCurrentRRMode(ScreenPtr pScreen)
{
+ struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
+ struct xwl_output *xwl_output = xwl_screen_get_first_output(xwl_screen);
struct xwl_emulated_mode *emulated_mode;
- struct xwl_output *xwl_output;
- RROutputPtr output;
- output = RRFirstOutput(pScreen);
- if (output == NULL)
+ if (!xwl_output)
return NULL;
- xwl_output = output->devPrivate;
emulated_mode =
xwl_output_get_emulated_mode_for_client(xwl_output, GetCurrentClient());
@@ -199,39 +198,79 @@ xwlVidModeGetMonitorValue(ScreenPtr pScreen, int valtyp, int indx)
static int
xwlVidModeGetDotClock(ScreenPtr pScreen, int Clock)
{
- RRModePtr rrmode;
-
- rrmode = xwlVidModeGetCurrentRRMode(pScreen);
- if (rrmode == NULL)
- return 0;
-
- return rrmode->mode.dotClock / 1000.0;
+ return Clock;
}
static int
xwlVidModeGetNumOfClocks(ScreenPtr pScreen, Bool *progClock)
{
- return 1;
+ /* We emulate a programmable clock, rather then a fixed set of clocks */
+ *progClock = TRUE;
+ return 0;
}
static Bool
xwlVidModeGetClocks(ScreenPtr pScreen, int *Clocks)
{
- *Clocks = xwlVidModeGetDotClock(pScreen, 0);
-
- return TRUE;
+ return FALSE; /* Programmable clock, no clock list */
}
+/* GetFirstModeline and GetNextModeline are used from Xext/vidmode.c like this:
+ * if (pVidMode->GetFirstModeline(pScreen, &mode, &dotClock)) {
+ * do {
+ * ...
+ * if (...)
+ * break;
+ * } while (pVidMode->GetNextModeline(pScreen, &mode, &dotClock));
+ * }
+ * IOW our caller basically always loops over all the modes. There never is a
+ * return to the mainloop between GetFirstModeline and NextModeline calls where
+ * other parts of the server may change our state so we do not need to worry
+ * about xwl_output->randr_output->modes changing underneath us.
+ * Thus we can simply implement these two callbacks by storing the enumeration
+ * index in pVidMode->Next.
+ */
+
static Bool
xwlVidModeGetNextModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock)
{
- return FALSE;
+ struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
+ struct xwl_output *xwl_output = xwl_screen_get_first_output(xwl_screen);
+ VidModePtr pVidMode;
+ DisplayModePtr pMod;
+ intptr_t index;
+
+ pMod = dixLookupPrivate(&pScreen->devPrivates, xwlVidModePrivateKey);
+ pVidMode = VidModeGetPtr(pScreen);
+ if (xwl_output == NULL || pMod == NULL || pVidMode == NULL)
+ return FALSE;
+
+ index = (intptr_t)pVidMode->Next;
+ if (index >= xwl_output->randr_output->numModes)
+ return FALSE;
+ xwlRRModeToDisplayMode(xwl_output->randr_output->modes[index], pMod);
+ index++;
+ pVidMode->Next = (void *)index;
+
+ *mode = pMod;
+ if (dotClock != NULL)
+ *dotClock = pMod->Clock;
+
+ return TRUE;
}
static Bool
xwlVidModeGetFirstModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock)
{
- return xwlVidModeGetCurrentModeline(pScreen, mode, dotClock);
+ VidModePtr pVidMode;
+ intptr_t index = 0;
+
+ pVidMode = VidModeGetPtr(pScreen);
+ if (pVidMode == NULL)
+ return FALSE;
+
+ pVidMode->Next = (void *)index; /* 0 */
+ return xwlVidModeGetNextModeline(pScreen, mode, dotClock);
}
static Bool
@@ -251,37 +290,27 @@ xwlVidModeZoomViewport(ScreenPtr pScreen, int zoom)
static Bool
xwlVidModeSetViewPort(ScreenPtr pScreen, int x, int y)
{
- RROutputPtr output;
- RRCrtcPtr crtc;
+ struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
+ struct xwl_output *xwl_output = xwl_screen_get_first_output(xwl_screen);
- output = RRFirstOutput(pScreen);
- if (output == NULL)
- return FALSE;
-
- crtc = output->crtc;
- if (crtc == NULL)
+ if (!xwl_output)
return FALSE;
/* Support only default viewport */
- return (x == crtc->x && y == crtc->y);
+ return (x == xwl_output->x && y == xwl_output->y);
}
static Bool
xwlVidModeGetViewPort(ScreenPtr pScreen, int *x, int *y)
{
- RROutputPtr output;
- RRCrtcPtr crtc;
+ struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
+ struct xwl_output *xwl_output = xwl_screen_get_first_output(xwl_screen);
- output = RRFirstOutput(pScreen);
- if (output == NULL)
+ if (!xwl_output)
return FALSE;
- crtc = output->crtc;
- if (crtc == NULL)
- return FALSE;
-
- *x = crtc->x;
- *y = crtc->y;
+ *x = xwl_output->x;
+ *y = xwl_output->y;
return TRUE;
}
@@ -289,8 +318,19 @@ xwlVidModeGetViewPort(ScreenPtr pScreen, int *x, int *y)
static Bool
xwlVidModeSwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
{
- /* Unsupported for now */
- return FALSE;
+ struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
+ struct xwl_output *xwl_output = xwl_screen_get_first_output(xwl_screen);
+ RRModePtr rrmode;
+
+ if (!xwl_output)
+ return FALSE;
+
+ rrmode = xwl_output_find_mode(xwl_output, mode->HDisplay, mode->VDisplay);
+ if (rrmode == NULL)
+ return FALSE;
+
+ xwl_output_set_emulated_mode(xwl_output, GetCurrentClient(), rrmode, TRUE);
+ return TRUE;
}
static Bool
@@ -344,8 +384,10 @@ xwlVidModeAddModeline(ScreenPtr pScreen, DisplayModePtr mode)
static int
xwlVidModeGetNumOfModes(ScreenPtr pScreen)
{
- /* We have only one mode */
- return 1;
+ struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
+ struct xwl_output *xwl_output = xwl_screen_get_first_output(xwl_screen);
+
+ return xwl_output ? xwl_output->randr_output->numModes : 0;
}
static Bool
--
2.26.2

View File

@ -0,0 +1,68 @@
From 1ac389dda89b2882c80767c91bbe88e01818491c Mon Sep 17 00:00:00 2001
From: Greg V <greg@unrelenting.technology>
Date: Tue, 15 Sep 2020 17:41:04 +0300
Subject: [PATCH xserver 11/16] xwayland: use drmGetNodeTypeFromFd for checking
if a node is a render one
Major/minor numbers are a.. major (ha) source of pain in FreeBSD porting.
In this case, Xwayland was thinking that /dev/dri/card0 is already a render node,
because the st_rdev on FreeBSD was passing the Linux-style check,
and because of the assumption, acceleration would fail because
various ioctls like AMDGPU_INFO would be denied on the non-render node.
Switch to libdrm's function that already works correctly on all platforms.
Signed-off-by: Greg V <greg@unrelenting.technology>
Reviewed-by: Emmanuel Vadot <manu@FreeBSD.org>
(cherry picked from commit 239ebdc9e447d4f836d0c2aa6068c6064fffb46c)
---
hw/xwayland/xwayland-glamor-gbm.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index ebff70a00..b519492cc 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -110,21 +110,6 @@ wl_drm_format_for_depth(int depth)
}
}
-static char
-is_fd_render_node(int fd)
-{
- struct stat render;
-
- if (fstat(fd, &render))
- return 0;
- if (!S_ISCHR(render.st_mode))
- return 0;
- if (render.st_rdev & 0x80)
- return 1;
-
- return 0;
-}
-
static char
is_device_path_render_node (const char *device_path)
{
@@ -135,7 +120,7 @@ is_device_path_render_node (const char *device_path)
if (fd < 0)
return 0;
- is_render_node = is_fd_render_node(fd);
+ is_render_node = (drmGetNodeTypeFromFd(fd) == DRM_NODE_RENDER);
close(fd);
return is_render_node;
@@ -767,7 +752,7 @@ xwl_drm_handle_device(void *data, struct wl_drm *drm, const char *device)
return;
}
- if (is_fd_render_node(xwl_gbm->drm_fd)) {
+ if (drmGetNodeTypeFromFd(xwl_gbm->drm_fd) == DRM_NODE_RENDER) {
xwl_gbm->fd_render_node = 1;
xwl_screen->expecting_event--;
} else {
--
2.28.0

View File

@ -0,0 +1,43 @@
From 1930ed233fdec5d22e4fc192769a0126faabb3ea Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 14 Sep 2020 15:39:10 +0200
Subject: [PATCH xserver 12/16] xwayland: Remove pending stream reference when
freeing
The EGLStream backend keeps a queue of pending streams for each Xwayland
window.
However, when this pending queue is freed, the corresponding private
data may not be cleared (typically if the pixmap for this window has
changed before the compositor finished attaching the consumer for the
window's pixmap's original eglstream), leading to a use-after-free and a
crash when trying to use that data as the window pixmap.
Make sure to clear the private data when the pending stream is freed.
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1055
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Karol Szuster <karolsz9898@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit a5f439dcd21b4fda093cb382bb1a758b434a1444)
---
hw/xwayland/xwayland-glamor-eglstream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
index 36b749aaf..0c32fff4d 100644
--- a/hw/xwayland/xwayland-glamor-eglstream.c
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
@@ -431,8 +431,8 @@ xwl_eglstream_consumer_ready_callback(void *data,
DebugF("eglstream: win %d completes eglstream for pixmap %p, congrats!\n",
pending->window->drawable.id, pending->pixmap);
- xwl_eglstream_window_set_pending(pending->window, NULL);
out:
+ xwl_eglstream_window_set_pending(pending->window, NULL);
xorg_list_del(&pending->link);
free(pending);
}
--
2.28.0

View File

@ -0,0 +1,57 @@
From a090b038c45732676d9b7e367848d5bee7ab0ea5 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 26 Aug 2019 12:26:34 +0200
Subject: [PATCH xserver 12/24] xwayland: xwl_window_should_enable_viewport:
Add extra test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Games based on the allegro gaming library or on ClanLib-1.0 do not size
their window to match the fullscreen resolution, instead they use a
window covering the entire screen, drawing only the fullscreen resolution
part of it.
This commit adds a check for these games, so that we correctly apply a
viewport to them making fullscreen work properly for these games under
Xwayland.
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 0c305dbff8a44f3fa3d6aefd372a967029a7a527)
---
hw/xwayland/xwayland.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 9c6cf7cf5..2e01822fd 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -651,6 +651,23 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
}
}
+ /* 2. Test if the window uses override-redirect + vidmode
+ * and matches (fully covers) the entire screen.
+ * This path gets hit by: allegro4, ClanLib-1.0.
+ */
+ xwl_output = xwl_screen_get_first_output(xwl_screen);
+ emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, owner);
+ if (xwl_output && xwl_window->window->overrideRedirect &&
+ emulated_mode && emulated_mode->from_vidmode &&
+ xwl_window->x == 0 && xwl_window->y == 0 &&
+ xwl_window->width == xwl_screen->width &&
+ xwl_window->height == xwl_screen->height) {
+
+ *emulated_mode_ret = emulated_mode;
+ *xwl_output_ret = xwl_output;
+ return TRUE;
+ }
+
return FALSE;
}
--
2.26.2

View File

@ -0,0 +1,121 @@
From dae234efdb7bba75744aa1697386df3c0db5348a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
Date: Fri, 11 Sep 2020 17:00:18 +0200
Subject: [PATCH xserver 13/16] present: Move flip target_msc adjustment out of
present_vblank_create
Preparation for different handling between SCMD & WNMD. No functional
change intended.
Reviewed-by: Roman Gilg <subdiff@gmail.com>
Tested-by: Roman Gilg <subdiff@gmail.com>
(cherry picked from commit 4c92dea952f7fed19857904f0f552900257ef4b9)
---
present/present_priv.h | 2 +-
present/present_scmd.c | 5 ++++-
present/present_vblank.c | 9 ++++-----
present/present_wnmd.c | 5 ++++-
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/present/present_priv.h b/present/present_priv.h
index 5849b9e0b..90c3f4e79 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -469,7 +469,7 @@ present_vblank_create(WindowPtr window,
const uint32_t *capabilities,
present_notify_ptr notifies,
int num_notifies,
- uint64_t *target_msc,
+ uint64_t target_msc,
uint64_t crtc_msc);
void
diff --git a/present/present_scmd.c b/present/present_scmd.c
index 6a580cb7a..a4d046ca8 100644
--- a/present/present_scmd.c
+++ b/present/present_scmd.c
@@ -745,12 +745,15 @@ present_scmd_pixmap(WindowPtr window,
screen_priv->info ? &screen_priv->info->capabilities : NULL,
notifies,
num_notifies,
- &target_msc,
+ target_msc,
crtc_msc);
if (!vblank)
return BadAlloc;
+ if (vblank->flip && vblank->sync_flip)
+ target_msc--;
+
xorg_list_append(&vblank->event_queue, &present_exec_queue);
vblank->queued = TRUE;
if (msc_is_after(target_msc, crtc_msc)) {
diff --git a/present/present_vblank.c b/present/present_vblank.c
index 2c124f4bb..a4b70c0d9 100644
--- a/present/present_vblank.c
+++ b/present/present_vblank.c
@@ -57,7 +57,7 @@ present_vblank_create(WindowPtr window,
const uint32_t *capabilities,
present_notify_ptr notifies,
int num_notifies,
- uint64_t *target_msc,
+ uint64_t target_msc,
uint64_t crtc_msc)
{
ScreenPtr screen = window->drawable.pScreen;
@@ -100,7 +100,7 @@ present_vblank_create(WindowPtr window,
vblank->x_off = x_off;
vblank->y_off = y_off;
- vblank->target_msc = *target_msc;
+ vblank->target_msc = target_msc;
vblank->crtc = target_crtc;
vblank->msc_offset = window_priv->msc_offset;
vblank->notifies = notifies;
@@ -111,12 +111,11 @@ present_vblank_create(WindowPtr window,
if (pixmap != NULL &&
!(options & PresentOptionCopy) &&
capabilities) {
- if (msc_is_after(*target_msc, crtc_msc) &&
+ if (msc_is_after(target_msc, crtc_msc) &&
screen_priv->check_flip (target_crtc, window, pixmap, TRUE, valid, x_off, y_off, &reason))
{
vblank->flip = TRUE;
vblank->sync_flip = TRUE;
- *target_msc = *target_msc - 1;
} else if ((*capabilities & PresentCapabilityAsync) &&
screen_priv->check_flip (target_crtc, window, pixmap, FALSE, valid, x_off, y_off, &reason))
{
@@ -139,7 +138,7 @@ present_vblank_create(WindowPtr window,
if (pixmap)
DebugPresent(("q %" PRIu64 " %p %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 " (crtc %p) flip %d vsync %d serial %d\n",
- vblank->event_id, vblank, *target_msc,
+ vblank->event_id, vblank, target_msc,
vblank->pixmap->drawable.id, vblank->window->drawable.id,
target_crtc, vblank->flip, vblank->sync_flip, vblank->serial));
return vblank;
diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index 35ea12968..31e83d6ee 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -626,11 +626,14 @@ present_wnmd_pixmap(WindowPtr window,
&screen_priv->wnmd_info->capabilities,
notifies,
num_notifies,
- &target_msc,
+ target_msc,
crtc_msc);
if (!vblank)
return BadAlloc;
+ if (vblank->flip && vblank->sync_flip)
+ target_msc--;
+
xorg_list_append(&vblank->event_queue, &window_priv->exec_queue);
vblank->queued = TRUE;
if (crtc_msc < target_msc) {
--
2.28.0

View File

@ -0,0 +1,205 @@
From e40d94637207543481769fb570515b782225ff09 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 2 Sep 2019 17:32:45 +0200
Subject: [PATCH xserver 13/24] xwayland: Set _XWAYLAND_RANDR_EMU_MONITOR_RECTS
property for resolution emulation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Apps using randr to change the resolution when going fullscreen, in
combination with _NET_WM_STATE_FULLSCREEN to tell the window-manager (WM)
to make their window fullscreen, expect the WM to give the fullscreen window
the size of the emulated resolution as would happen when run under Xorg (*).
We need the WM to emulate this behavior for these apps to work correctly,
with Xwaylands resolution change emulation. For the WM to emulate this,
it needs to know about the emulated resolution for the Windows owning
client for each monitor.
This commit adds a _XWAYLAND_RANDR_EMU_MONITOR_RECTS property, which
contains 4 Cardinals (32 bit integers) per monitor with resolution
emulation info. Window-managers can use this to get the emulated
resolution for the client and size the window correctly.
*) Since under Xorg the resolution will actually be changed and after that
going fullscreen through NET_WM_STATE_FULLSCREEN will size the window to
be equal to the new resolution.
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 5315f988d9f175e4850f4259f691a68d95ce7ac2)
---
hw/xwayland/xwayland-output.c | 77 +++++++++++++++++++++++++++++++++++
hw/xwayland/xwayland.c | 23 +++++++++++
hw/xwayland/xwayland.h | 3 ++
3 files changed, 103 insertions(+)
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index e09d00108..0d6b9ac9f 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -29,6 +29,7 @@
#include "xwayland.h"
#include <randrstr.h>
+#include <X11/Xatom.h>
#define ALL_ROTATIONS (RR_Rotate_0 | \
RR_Rotate_90 | \
@@ -391,6 +392,80 @@ xwl_output_find_mode(struct xwl_output *xwl_output,
return NULL;
}
+struct xwl_output_randr_emu_prop {
+ Atom atom;
+ uint32_t rects[XWL_CLIENT_MAX_EMULATED_MODES][4];
+ int rect_count;
+};
+
+static void
+xwl_output_randr_emu_prop(struct xwl_screen *xwl_screen, ClientPtr client,
+ struct xwl_output_randr_emu_prop *prop)
+{
+ static const char atom_name[] = "_XWAYLAND_RANDR_EMU_MONITOR_RECTS";
+ struct xwl_emulated_mode *emulated_mode;
+ struct xwl_output *xwl_output;
+ int index = 0;
+
+ prop->atom = MakeAtom(atom_name, strlen(atom_name), TRUE);
+
+ xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
+ emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, client);
+ if (!emulated_mode)
+ continue;
+
+ prop->rects[index][0] = xwl_output->x;
+ prop->rects[index][1] = xwl_output->y;
+ prop->rects[index][2] = emulated_mode->width;
+ prop->rects[index][3] = emulated_mode->height;
+ index++;
+ }
+
+ prop->rect_count = index;
+}
+
+static void
+xwl_output_set_randr_emu_prop(WindowPtr window,
+ struct xwl_output_randr_emu_prop *prop)
+{
+ if (!xwl_window_is_toplevel(window))
+ return;
+
+ if (prop->rect_count) {
+ dixChangeWindowProperty(serverClient, window, prop->atom,
+ XA_CARDINAL, 32, PropModeReplace,
+ prop->rect_count * 4, prop->rects, TRUE);
+ } else {
+ DeleteProperty(serverClient, window, prop->atom);
+ }
+}
+
+static void
+xwl_output_set_randr_emu_prop_callback(void *resource, XID id, void *user_data)
+{
+ xwl_output_set_randr_emu_prop(resource, user_data);
+}
+
+static void
+xwl_output_set_randr_emu_props(struct xwl_screen *xwl_screen, ClientPtr client)
+{
+ struct xwl_output_randr_emu_prop prop = {};
+
+ xwl_output_randr_emu_prop(xwl_screen, client, &prop);
+ FindClientResourcesByType(client, RT_WINDOW,
+ xwl_output_set_randr_emu_prop_callback, &prop);
+}
+
+void
+xwl_output_set_window_randr_emu_props(struct xwl_screen *xwl_screen,
+ WindowPtr window)
+{
+ struct xwl_output_randr_emu_prop prop = {};
+
+ xwl_output_randr_emu_prop(xwl_screen, wClient(window), &prop);
+ xwl_output_set_randr_emu_prop(window, &prop);
+}
+
void
xwl_output_set_emulated_mode(struct xwl_output *xwl_output, ClientPtr client,
RRModePtr mode, Bool from_vidmode)
@@ -405,6 +480,8 @@ xwl_output_set_emulated_mode(struct xwl_output *xwl_output, ClientPtr client,
xwl_output_add_emulated_mode_for_client(xwl_output, client, mode, from_vidmode);
xwl_screen_check_resolution_change_emulation(xwl_output->xwl_screen);
+
+ xwl_output_set_randr_emu_props(xwl_output->xwl_screen, client);
}
static void
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 2e01822fd..ac4d98e6a 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -692,6 +692,27 @@ xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen)
xwl_window_check_resolution_change_emulation(xwl_window);
}
+/* This checks if the passed in Window is a toplevel client window, note this
+ * returns false for window-manager decoration windows and returns true for
+ * the actual client top-level window even if it has been reparented to
+ * a window-manager decoration window.
+ */
+Bool
+xwl_window_is_toplevel(WindowPtr window)
+{
+ struct xwl_screen *xwl_screen = xwl_screen_get(window->drawable.pScreen);
+
+ if (xwl_screen_client_is_window_manager(xwl_screen, wClient(window)))
+ return FALSE;
+
+ /* CSD and override-redirect toplevel windows */
+ if (window_get_damage(window))
+ return TRUE;
+
+ /* Normal toplevel client windows, reparented to decoration window */
+ return (window->parent && window_get_damage(window->parent));
+}
+
static void
xwl_window_init_allow_commits(struct xwl_window *xwl_window)
{
@@ -857,6 +878,8 @@ xwl_realize_window(WindowPtr window)
return FALSE;
}
+ xwl_output_set_window_randr_emu_props(xwl_screen, window);
+
return ensure_surface_for_window(window);
}
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 36c4c4c8b..1317ae5bb 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -420,6 +420,7 @@ Bool xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen);
struct xwl_output *xwl_screen_get_first_output(struct xwl_screen *xwl_screen);
void xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen);
Bool xwl_window_has_viewport_enabled(struct xwl_window *xwl_window);
+Bool xwl_window_is_toplevel(WindowPtr window);
void xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *tool);
void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
@@ -458,6 +459,8 @@ RRModePtr xwl_output_find_mode(struct xwl_output *xwl_output,
void xwl_output_set_emulated_mode(struct xwl_output *xwl_output,
ClientPtr client, RRModePtr mode,
Bool from_vidmode);
+void xwl_output_set_window_randr_emu_props(struct xwl_screen *xwl_screen,
+ WindowPtr window);
RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
float VRefresh, Bool Reduced, Bool Interlaced);
--
2.26.2

View File

@ -0,0 +1,236 @@
From 669e40390c3679b649db33f0aa4ae4cfdd17e2a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
Date: Fri, 11 Sep 2020 17:00:35 +0200
Subject: [PATCH xserver 14/16] present: Add present_vblank::exec_msc field
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
For tracking the MSC when the present can be executed separately from
the target MSC.
Allows removing the requeue field instead, plus more later.
v2:
* Rename wait_msc → exec_msc (Roman Gilg)
* Use exec_msc = target_msc instead of exec_msc++, for clarity.
* Bug fix: Set exec_msc = target_msc also if present_flip returned
false in present_execute.
v3:
* Set exec_msc = target_msc also if present_wnmd_flip returned
false in present_wnmd_execute, for consistency.
v4:
* Specifically check for exec_msc == crtc_msc + 1 in
present_execute_wait/copy, to avoid re-introducing
https://bugs.freedesktop.org/show_bug.cgi?id=94596 .
Reviewed-by: Roman Gilg <subdiff@gmail.com>
Tested-by: Roman Gilg <subdiff@gmail.com>
(cherry picked from commit b0b3159abd8001fa3f6dfc44a288a95a62aa5cf6)
---
present/present_execute.c | 23 ++++++++++-------------
present/present_priv.h | 4 ++--
present/present_scmd.c | 13 +++++++------
present/present_vblank.c | 9 +++++----
present/present_wnmd.c | 13 +++++++------
5 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/present/present_execute.c b/present/present_execute.c
index 8d1ef4a8c..58066db86 100644
--- a/present/present_execute.c
+++ b/present/present_execute.c
@@ -48,16 +48,13 @@ present_execute_wait(present_vblank_ptr vblank, uint64_t crtc_msc)
ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
- if (vblank->requeue) {
- vblank->requeue = FALSE;
- if (msc_is_after(vblank->target_msc, crtc_msc) &&
- Success == screen_priv->queue_vblank(screen,
- window,
- vblank->crtc,
- vblank->event_id,
- vblank->target_msc))
- return TRUE;
- }
+ /* We may have to requeue for the next MSC if check_flip_window prevented
+ * using a flip.
+ */
+ if (vblank->exec_msc == crtc_msc + 1 &&
+ screen_priv->queue_vblank(screen, window, vblank->crtc, vblank->event_id,
+ vblank->exec_msc) == Success)
+ return TRUE;
if (vblank->wait_fence) {
if (!present_fence_check_triggered(vblank->wait_fence)) {
@@ -75,13 +72,13 @@ present_execute_copy(present_vblank_ptr vblank, uint64_t crtc_msc)
ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
- /* If present_flip failed, we may have to requeue for the target MSC */
- if (vblank->target_msc == crtc_msc + 1 &&
+ /* If present_flip failed, we may have to requeue for the next MSC */
+ if (vblank->exec_msc == crtc_msc + 1 &&
Success == screen_priv->queue_vblank(screen,
window,
vblank->crtc,
vblank->event_id,
- vblank->target_msc)) {
+ vblank->exec_msc)) {
vblank->queued = TRUE;
return;
}
diff --git a/present/present_priv.h b/present/present_priv.h
index 90c3f4e79..f34edd5cf 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -70,14 +70,14 @@ struct present_vblank {
int16_t y_off;
CARD16 kind;
uint64_t event_id;
- uint64_t target_msc;
+ uint64_t target_msc; /* target MSC when present should complete */
+ uint64_t exec_msc; /* MSC at which present can be executed */
uint64_t msc_offset;
present_fence_ptr idle_fence;
present_fence_ptr wait_fence;
present_notify_ptr notifies;
int num_notifies;
Bool queued; /* on present_exec_queue */
- Bool requeue; /* on queue, but target_msc has changed */
Bool flip; /* planning on using flip */
Bool flip_ready; /* wants to flip, but waiting for previous flip or unflip */
Bool flip_idler; /* driver explicitly permitted idling */
diff --git a/present/present_scmd.c b/present/present_scmd.c
index a4d046ca8..3e3ae3477 100644
--- a/present/present_scmd.c
+++ b/present/present_scmd.c
@@ -361,8 +361,8 @@ present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
ScreenPtr screen = vblank->screen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
- DebugPresent(("\tn %" PRIu64 " %p %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 "\n",
- vblank->event_id, vblank, vblank->target_msc,
+ DebugPresent(("\tn %" PRIu64 " %p %" PRIu64 " %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 "\n",
+ vblank->event_id, vblank, vblank->exec_msc, vblank->target_msc,
vblank->pixmap ? vblank->pixmap->drawable.id : 0,
vblank->window ? vblank->window->drawable.id : 0));
@@ -482,7 +482,7 @@ present_check_flip_window (WindowPtr window)
vblank->flip = FALSE;
vblank->reason = reason;
if (vblank->sync_flip)
- vblank->requeue = TRUE;
+ vblank->exec_msc = vblank->target_msc;
}
}
}
@@ -608,6 +608,7 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
*/
screen_priv->flip_pending = NULL;
vblank->flip = FALSE;
+ vblank->exec_msc = vblank->target_msc;
}
DebugPresent(("\tc %p %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 "\n",
vblank, crtc_msc, vblank->pixmap->drawable.id, vblank->window->drawable.id));
@@ -752,12 +753,12 @@ present_scmd_pixmap(WindowPtr window,
return BadAlloc;
if (vblank->flip && vblank->sync_flip)
- target_msc--;
+ vblank->exec_msc--;
xorg_list_append(&vblank->event_queue, &present_exec_queue);
vblank->queued = TRUE;
- if (msc_is_after(target_msc, crtc_msc)) {
- ret = present_queue_vblank(screen, window, target_crtc, vblank->event_id, target_msc);
+ if (msc_is_after(vblank->exec_msc, crtc_msc)) {
+ ret = present_queue_vblank(screen, window, target_crtc, vblank->event_id, vblank->exec_msc);
if (ret == Success)
return Success;
diff --git a/present/present_vblank.c b/present/present_vblank.c
index a4b70c0d9..af14fe134 100644
--- a/present/present_vblank.c
+++ b/present/present_vblank.c
@@ -101,6 +101,7 @@ present_vblank_create(WindowPtr window,
vblank->x_off = x_off;
vblank->y_off = y_off;
vblank->target_msc = target_msc;
+ vblank->exec_msc = target_msc;
vblank->crtc = target_crtc;
vblank->msc_offset = window_priv->msc_offset;
vblank->notifies = notifies;
@@ -152,8 +153,8 @@ no_mem:
void
present_vblank_scrap(present_vblank_ptr vblank)
{
- DebugPresent(("\tx %" PRIu64 " %p %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 " (crtc %p)\n",
- vblank->event_id, vblank, vblank->target_msc,
+ DebugPresent(("\tx %" PRIu64 " %p %" PRIu64 " %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 " (crtc %p)\n",
+ vblank->event_id, vblank, vblank->exec_msc, vblank->target_msc,
vblank->pixmap->drawable.id, vblank->window->drawable.id,
vblank->crtc));
@@ -174,8 +175,8 @@ present_vblank_destroy(present_vblank_ptr vblank)
/* Also make sure vblank is removed from event queue (wnmd) */
xorg_list_del(&vblank->event_queue);
- DebugPresent(("\td %" PRIu64 " %p %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 "\n",
- vblank->event_id, vblank, vblank->target_msc,
+ DebugPresent(("\td %" PRIu64 " %p %" PRIu64 " %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 "\n",
+ vblank->event_id, vblank, vblank->exec_msc, vblank->target_msc,
vblank->pixmap ? vblank->pixmap->drawable.id : 0,
vblank->window ? vblank->window->drawable.id : 0));
diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index 31e83d6ee..339e93edb 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -168,8 +168,8 @@ present_wnmd_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_
WindowPtr window = vblank->window;
present_window_priv_ptr window_priv = present_window_priv(window);
- DebugPresent(("\tn %" PRIu64 " %p %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 "\n",
- vblank->event_id, vblank, vblank->target_msc,
+ DebugPresent(("\tn %" PRIu64 " %p %" PRIu64 " %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 "\n",
+ vblank->event_id, vblank, vblank->exec_msc, vblank->target_msc,
vblank->pixmap ? vblank->pixmap->drawable.id : 0,
vblank->window ? vblank->window->drawable.id : 0));
@@ -343,7 +343,7 @@ present_wnmd_check_flip_window (WindowPtr window)
vblank->flip = FALSE;
vblank->reason = reason;
if (vblank->sync_flip)
- vblank->requeue = TRUE;
+ vblank->exec_msc = vblank->target_msc;
}
}
}
@@ -491,6 +491,7 @@ present_wnmd_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
*/
window_priv->flip_pending = NULL;
vblank->flip = FALSE;
+ vblank->exec_msc = vblank->target_msc;
}
DebugPresent(("\tc %p %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 "\n",
vblank, crtc_msc, vblank->pixmap->drawable.id, vblank->window->drawable.id));
@@ -632,12 +633,12 @@ present_wnmd_pixmap(WindowPtr window,
return BadAlloc;
if (vblank->flip && vblank->sync_flip)
- target_msc--;
+ vblank->exec_msc--;
xorg_list_append(&vblank->event_queue, &window_priv->exec_queue);
vblank->queued = TRUE;
- if (crtc_msc < target_msc) {
- if (present_wnmd_queue_vblank(screen, window, target_crtc, vblank->event_id, target_msc) == Success) {
+ if (crtc_msc < vblank->exec_msc) {
+ if (present_wnmd_queue_vblank(screen, window, target_crtc, vblank->event_id, vblank->exec_msc) == Success) {
return Success;
}
DebugPresent(("present_queue_vblank failed\n"));
--
2.28.0

View File

@ -0,0 +1,137 @@
From a35e6f9a2b15a446138f6f3e201a19833a5a2454 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 27 Jan 2020 11:08:00 +0100
Subject: [PATCH xserver 14/24] xwayland: Cache client-id for the
window-manager client
Instead of iterating over all clients which are listening for events on the
root window and checking if the client we are dealing with is the one
listening for SubstructureRedirectMask | ResizeRedirectMask events and thus
is the window-manager, cache the client-id of the window-manager in
xwl_screen and use that when checking if a client is the window-manager.
Note that we cache and compare the client-id rather then the ClienPtr,
this saves reading the ClientPtr from the global clients array when doing
the comparison.
Suggested-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit ded89300c1dd541f59fe6e93c5c69d7fe7088244)
---
hw/xwayland/xwayland.c | 48 ++++++++++++++++++++++++++++--------------
hw/xwayland/xwayland.h | 2 ++
2 files changed, 34 insertions(+), 16 deletions(-)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index ac4d98e6a..c16da330c 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -578,20 +578,11 @@ xwl_window_enable_viewport(struct xwl_window *xwl_window,
}
static Bool
-xwl_screen_client_is_window_manager(struct xwl_screen *xwl_screen,
- ClientPtr client)
+window_is_wm_window(WindowPtr window)
{
- WindowPtr root = xwl_screen->screen->root;
- OtherClients *others;
-
- for (others = wOtherClients(root); others; others = others->next) {
- if (SameClient(others, client)) {
- if (others->mask & (SubstructureRedirectMask | ResizeRedirectMask))
- return TRUE;
- }
- }
+ struct xwl_screen *xwl_screen = xwl_screen_get(window->drawable.pScreen);
- return FALSE;
+ return CLIENT_ID(window->drawable.id) == xwl_screen->wm_client_id;
}
static ClientPtr
@@ -605,7 +596,7 @@ xwl_window_get_owner(struct xwl_window *xwl_window)
* decoration window. In that case return the client of the
* first *and only* child of the toplevel (decoration) window.
*/
- if (xwl_screen_client_is_window_manager(xwl_window->xwl_screen, client)) {
+ if (window_is_wm_window(window)) {
if (window->firstChild && window->firstChild == window->lastChild)
return wClient(window->firstChild);
else
@@ -700,9 +691,7 @@ xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen)
Bool
xwl_window_is_toplevel(WindowPtr window)
{
- struct xwl_screen *xwl_screen = xwl_screen_get(window->drawable.pScreen);
-
- if (xwl_screen_client_is_window_manager(xwl_screen, wClient(window)))
+ if (window_is_wm_window(window))
return FALSE;
/* CSD and override-redirect toplevel windows */
@@ -977,6 +966,30 @@ xwl_set_window_pixmap(WindowPtr window,
ensure_surface_for_window(window);
}
+static Bool
+xwl_change_window_attributes(WindowPtr window, unsigned long mask)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+ OtherClients *others;
+ Bool ret;
+
+ screen->ChangeWindowAttributes = xwl_screen->ChangeWindowAttributes;
+ ret = (*screen->ChangeWindowAttributes) (window, mask);
+ xwl_screen->ChangeWindowAttributes = screen->ChangeWindowAttributes;
+ screen->ChangeWindowAttributes = xwl_change_window_attributes;
+
+ if (window != screen->root || !(mask & CWEventMask))
+ return ret;
+
+ for (others = wOtherClients(window); others; others = others->next) {
+ if (others->mask & (SubstructureRedirectMask | ResizeRedirectMask))
+ xwl_screen->wm_client_id = CLIENT_ID(others->resource);
+ }
+
+ return ret;
+}
+
static void
xwl_resize_window(WindowPtr window,
int x, int y,
@@ -1576,6 +1589,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
xwl_screen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xwl_close_screen;
+ xwl_screen->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
+ pScreen->ChangeWindowAttributes = xwl_change_window_attributes;
+
xwl_screen->ResizeWindow = pScreen->ResizeWindow;
pScreen->ResizeWindow = xwl_resize_window;
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 1317ae5bb..f5ffadfcc 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -118,6 +118,7 @@ struct xwl_screen {
int height;
int depth;
ScreenPtr screen;
+ int wm_client_id;
int expecting_event;
enum RootClipMode root_clip_mode;
@@ -135,6 +136,7 @@ struct xwl_screen {
DestroyWindowProcPtr DestroyWindow;
XYToWindowProcPtr XYToWindow;
SetWindowPixmapProcPtr SetWindowPixmap;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
ResizeWindowProcPtr ResizeWindow;
struct xorg_list output_list;
--
2.26.2

View File

@ -0,0 +1,58 @@
From 96ef31e0f20fcffb2edfe4cb9510f994c188785f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
Date: Tue, 28 Jul 2020 18:53:45 +0200
Subject: [PATCH xserver 15/16] present/wnmd: Move up present_wnmd_queue_vblank
Allowing it to be called from more functions than before. No functional
change.
Reviewed-by: Roman Gilg <subdiff@gmail.com>
Tested-by: Roman Gilg <subdiff@gmail.com>
(cherry picked from commit d14ea667feccf085c7d66a7c63f380975e07af66)
---
present/present_wnmd.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index 339e93edb..2c11e53f5 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -42,6 +42,17 @@
static void
present_wnmd_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc);
+static int
+present_wnmd_queue_vblank(ScreenPtr screen,
+ WindowPtr window,
+ RRCrtcPtr crtc,
+ uint64_t event_id,
+ uint64_t msc)
+{
+ present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+ return (*screen_priv->wnmd_info->queue_vblank) (window, crtc, event_id, msc);
+}
+
static void
present_wnmd_create_event_id(present_window_priv_ptr window_priv, present_vblank_ptr vblank)
{
@@ -511,17 +522,6 @@ present_wnmd_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
present_execute_post(vblank, ust, crtc_msc);
}
-static int
-present_wnmd_queue_vblank(ScreenPtr screen,
- WindowPtr window,
- RRCrtcPtr crtc,
- uint64_t event_id,
- uint64_t msc)
-{
- present_screen_priv_ptr screen_priv = present_screen_priv(screen);
- return (*screen_priv->wnmd_info->queue_vblank) (window, crtc, event_id, msc);
-}
-
static uint64_t
present_wnmd_window_to_crtc_msc(WindowPtr window, RRCrtcPtr crtc, uint64_t window_msc, uint64_t new_msc)
{
--
2.28.0

View File

@ -0,0 +1,50 @@
From e4d8f7770e27ed56e23e0ef2a87bed8cb4fa28e0 Mon Sep 17 00:00:00 2001
From: Roman Gilg <subdiff@gmail.com>
Date: Fri, 3 Jan 2020 17:12:14 +0100
Subject: [PATCH xserver 15/24] xwayland: Reuse viewport instead of recreating
When a viewport is already created we can reuse this object instead of
destroying it and getting a new one for updating the source rectangle and
destination size.
Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 948e02872feb641a176b3af82b6ef1201c97bb16)
---
hw/xwayland/xwayland.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index c16da330c..ac301ae4a 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -552,17 +552,13 @@ xwl_window_enable_viewport(struct xwl_window *xwl_window,
struct xwl_output *xwl_output,
struct xwl_emulated_mode *emulated_mode)
{
- /* If necessary disable old viewport to apply new settings */
- if (xwl_window_has_viewport_enabled(xwl_window))
- xwl_window_disable_viewport(xwl_window);
-
- DebugF("XWAYLAND: enabling viewport %dx%d -> %dx%d\n",
- emulated_mode->width, emulated_mode->height,
- xwl_output->width, xwl_output->height);
-
- xwl_window->viewport =
- wp_viewporter_get_viewport(xwl_window->xwl_screen->viewporter,
- xwl_window->surface);
+ if (!xwl_window_has_viewport_enabled(xwl_window)) {
+ DebugF("XWAYLAND: enabling viewport %dx%d -> %dx%d\n",
+ emulated_mode->width, emulated_mode->height,
+ xwl_output->width, xwl_output->height);
+ xwl_window->viewport = wp_viewporter_get_viewport(xwl_window->xwl_screen->viewporter,
+ xwl_window->surface);
+ }
wp_viewport_set_source(xwl_window->viewport,
wl_fixed_from_int(0),
--
2.26.2

View File

@ -0,0 +1,139 @@
From c3e4c1a0fd5d4d6015e9e6317b758018317e56d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
Date: Tue, 28 Jul 2020 18:40:47 +0200
Subject: [PATCH xserver 16/16] present/wnmd: Execute copies at target_msc-1
already
It always takes one update cycle for the copy to become visible on the
host windowing system, so waiting for the target MSC resulted in 1 cycle
delay.
We re-use the idle list for copies which were executed but need their
completion event sent.
Fixes black seams when resizing the "Builder" sub-window of
GDK_BACKEND=x11 gtk4-demo
on Xwayland (see
https://gitlab.gnome.org/GNOME/mutter/-/issues/1290#note_873557).
Unfortunately, this cannot completely fix the seams with apps which
queue up multiple frames in advance, since there's always at least one
queued frame corresponding to the old window size. But it should at
least help a little in that case as well.
v2:
* Bug fix: Don't update exec_msc in present_wnmd_check_flip_window.
(Roman Gilg)
* Use exec_msc = target_msc - 1 instead of exec_msc--, and add a
comment, for clarity.
v3:
* Drop exec_msc = target_msc again in present_wnmd_execute.
* present_execute_copy should never set vblank->queued in
present_wnmd_execute now, so replace that branch with an assertion.
(Roman Gilg)
Reviewed-by: Roman Gilg <subdiff@gmail.com>
Tested-by: Roman Gilg <subdiff@gmail.com>
(cherry picked from commit 1cccb486d48a5d2e7649836b993805bb65dc09e3)
[Since present_wnmd_event_notify hasn't been split up on the 1.20
branch, it needs to check vblank->flip. Doing the same in
present_wnmd_free_idle_vblanks to be safe, though I'm not sure it's
actually possible to hit non-flips there.]
---
present/present_wnmd.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index 2c11e53f5..8c31619a2 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -122,7 +122,8 @@ present_wnmd_free_idle_vblanks(WindowPtr window)
present_vblank_ptr vblank, tmp;
xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->idle_queue, event_queue) {
- present_wnmd_free_idle_vblank(vblank);
+ if (vblank->flip)
+ present_wnmd_free_idle_vblank(vblank);
}
if (window_priv->flip_active) {
@@ -245,7 +246,12 @@ present_wnmd_event_notify(WindowPtr window, uint64_t event_id, uint64_t ust, uin
xorg_list_for_each_entry(vblank, &window_priv->idle_queue, event_queue) {
if (vblank->event_id == event_id) {
- present_wnmd_free_idle_vblank(vblank);
+ if (vblank->flip)
+ present_wnmd_free_idle_vblank(vblank);
+ else
+ /* Copies which were executed but need their completion event sent */
+ present_execute_post(vblank, ust, msc);
+
return;
}
}
@@ -353,8 +359,6 @@ present_wnmd_check_flip_window (WindowPtr window)
vblank->sync_flip, vblank->valid, 0, 0, &reason)) {
vblank->flip = FALSE;
vblank->reason = reason;
- if (vblank->sync_flip)
- vblank->exec_msc = vblank->target_msc;
}
}
}
@@ -454,6 +458,7 @@ present_wnmd_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
vblank->queued = FALSE;
if (vblank->pixmap && vblank->window) {
+ ScreenPtr screen = window->drawable.pScreen;
if (vblank->flip) {
RegionPtr damage;
@@ -479,7 +484,6 @@ present_wnmd_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
// ask the driver
if (present_wnmd_flip(vblank->window, vblank->crtc, vblank->event_id,
vblank->target_msc, vblank->pixmap, vblank->sync_flip, damage)) {
- ScreenPtr screen = window->drawable.pScreen;
WindowPtr toplvl_window = present_wnmd_toplvl_pixmap_window(vblank->window);
PixmapPtr old_pixmap = screen->GetWindowPixmap(window);
@@ -502,7 +506,6 @@ present_wnmd_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
*/
window_priv->flip_pending = NULL;
vblank->flip = FALSE;
- vblank->exec_msc = vblank->target_msc;
}
DebugPresent(("\tc %p %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 "\n",
vblank, crtc_msc, vblank->pixmap->drawable.id, vblank->window->drawable.id));
@@ -510,9 +513,12 @@ present_wnmd_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
present_wnmd_cancel_flip(window);
present_execute_copy(vblank, crtc_msc);
+ assert(!vblank->queued);
- if (vblank->queued) {
- xorg_list_add(&vblank->event_queue, &window_priv->exec_queue);
+ if (present_wnmd_queue_vblank(screen, window, vblank->crtc,
+ vblank->event_id, crtc_msc + 1)
+ == Success) {
+ xorg_list_add(&vblank->event_queue, &window_priv->idle_queue);
xorg_list_append(&vblank->window_list, &window_priv->vblank);
return;
@@ -632,8 +638,10 @@ present_wnmd_pixmap(WindowPtr window,
if (!vblank)
return BadAlloc;
- if (vblank->flip && vblank->sync_flip)
- vblank->exec_msc--;
+ /* WNMD presentations always complete (at least) one frame after they
+ * are executed
+ */
+ vblank->exec_msc = vblank->target_msc - 1;
xorg_list_append(&vblank->event_queue, &window_priv->exec_queue);
vblank->queued = TRUE;
--
2.28.0

View File

@ -0,0 +1,81 @@
From 66a026eeaa49e1042d4d2ec655e78771e1acd9df Mon Sep 17 00:00:00 2001
From: Roman Gilg <subdiff@gmail.com>
Date: Fri, 3 Jan 2020 17:27:28 +0100
Subject: [PATCH xserver 16/24] xwayland: Recurse on finding the none-wm owner
An X11 window manager might add a chain of parent windows when reparenting to a
decoration window.
That is for example the case for KWin, which reparents client windows to one
decoration and another wrapper parent window.
Account for that by a recursion into the tree. For now assume as before that
all X11 window managers reparent with one child only for these parent windows.
Changes by Hans de Goede:
- Move the xwl_window_is_toplevel() from a later patch in this series here
as it really belongs together with these changes
- Drop no longer necessary xwl_window argument from window_get_none_wm_owner
parameters
Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit a69f7fbb54efc8ffad320c8afd23cb41fc9edc27)
---
hw/xwayland/xwayland.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index ac301ae4a..94e3a18fa 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -582,19 +582,18 @@ window_is_wm_window(WindowPtr window)
}
static ClientPtr
-xwl_window_get_owner(struct xwl_window *xwl_window)
+window_get_none_wm_owner(WindowPtr window)
{
- WindowPtr window = xwl_window->window;
ClientPtr client = wClient(window);
/* If the toplevel window is owned by the window-manager, then the
- * actual client toplevel window has been reparented to a window-manager
- * decoration window. In that case return the client of the
- * first *and only* child of the toplevel (decoration) window.
+ * actual client toplevel window has been reparented to some window-manager
+ * decoration/wrapper windows. In that case recurse by checking the client
+ * of the first *and only* child of the decoration/wrapper window.
*/
if (window_is_wm_window(window)) {
if (window->firstChild && window->firstChild == window->lastChild)
- return wClient(window->firstChild);
+ return window_get_none_wm_owner(window->firstChild);
else
return NULL; /* Should never happen, skip resolution emulation */
}
@@ -615,7 +614,7 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
if (!xwl_screen_has_resolution_change_emulation(xwl_screen))
return FALSE;
- owner = xwl_window_get_owner(xwl_window);
+ owner = window_get_none_wm_owner(xwl_window->window);
if (!owner)
return FALSE;
@@ -694,8 +693,8 @@ xwl_window_is_toplevel(WindowPtr window)
if (window_get_damage(window))
return TRUE;
- /* Normal toplevel client windows, reparented to decoration window */
- return (window->parent && window_get_damage(window->parent));
+ /* Normal toplevel client windows, reparented to a window-manager window */
+ return window->parent && window_is_wm_window(window->parent);
}
static void
--
2.26.2

View File

@ -0,0 +1,82 @@
From 8b9a66212bacd780f1a8ac37cbb490b650843c28 Mon Sep 17 00:00:00 2001
From: Roman Gilg <subdiff@gmail.com>
Date: Wed, 15 Jan 2020 10:07:58 +0100
Subject: [PATCH xserver 17/24] xwayland: Make window_get_none_wm_owner return
a Window instead of a Client
Make window_get_none_wm_owner return the first non-wm-window instead of the
owner (client) of the first non-wm-window and rename it to
window_get_client_toplevel to match its new behavior.
This is a preparation patch for switching to using the drawable coordinates
in xwl_window_should_enable_viewport()
Changes by Hans de Goede:
- Split this change out into a separate patch for easier reviewing
- Rename window_get_none_wm_owner to window_get_client_toplevel to match
its new behavior
Signed-off-by: Roman Gilg <subdiff@gmail.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 060f10062eb1761515b762b46cba56c7a53db72c)
---
hw/xwayland/xwayland.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 94e3a18fa..c60a2ce67 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -581,10 +581,10 @@ window_is_wm_window(WindowPtr window)
return CLIENT_ID(window->drawable.id) == xwl_screen->wm_client_id;
}
-static ClientPtr
-window_get_none_wm_owner(WindowPtr window)
+static WindowPtr
+window_get_client_toplevel(WindowPtr window)
{
- ClientPtr client = wClient(window);
+ assert(window);
/* If the toplevel window is owned by the window-manager, then the
* actual client toplevel window has been reparented to some window-manager
@@ -593,12 +593,12 @@ window_get_none_wm_owner(WindowPtr window)
*/
if (window_is_wm_window(window)) {
if (window->firstChild && window->firstChild == window->lastChild)
- return window_get_none_wm_owner(window->firstChild);
+ return window_get_client_toplevel(window->firstChild);
else
return NULL; /* Should never happen, skip resolution emulation */
}
- return client;
+ return window;
}
static Bool
@@ -610,14 +610,17 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
struct xwl_emulated_mode *emulated_mode;
struct xwl_output *xwl_output;
ClientPtr owner;
+ WindowPtr window;
if (!xwl_screen_has_resolution_change_emulation(xwl_screen))
return FALSE;
- owner = window_get_none_wm_owner(xwl_window->window);
- if (!owner)
+ window = window_get_client_toplevel(xwl_window->window);
+ if (!window)
return FALSE;
+ owner = wClient(window);
+
/* 1. Test if the window matches the emulated mode on one of the outputs
* This path gets hit by most games / libs (e.g. SDL, SFML, OGRE)
*/
--
2.26.2

View File

@ -0,0 +1,121 @@
From da3e06f4bed7fa60838ce89a0b45ea73c7d9615c Mon Sep 17 00:00:00 2001
From: Roman Gilg <subdiff@gmail.com>
Date: Fri, 3 Jan 2020 17:55:28 +0100
Subject: [PATCH xserver 18/24] xwayland: Check emulation on client toplevel
resize
When a reparented window is resized directly check the emulation instead of
doing this only when the window manager parent window is resized, what might
never happen.
For that to work we need to make sure that we compare the current size of the
client toplevel when looking for an emulated mode.
Changes by Hans de Goede:
- Remove xwl_window x, y, width and height members as those are no longer used.
- Add check for xwl_window_from_window() returning NULL.
Signed-off-by: Roman Gilg <subdiff@gmail.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 6d98f840da6dfcf2a69e03a1b3fa0bf602ba1f27)
---
hw/xwayland/xwayland.c | 27 +++++++++++----------------
hw/xwayland/xwayland.h | 1 -
2 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index c60a2ce67..898a291fd 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -611,6 +611,7 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
struct xwl_output *xwl_output;
ClientPtr owner;
WindowPtr window;
+ DrawablePtr drawable;
if (!xwl_screen_has_resolution_change_emulation(xwl_screen))
return FALSE;
@@ -620,6 +621,7 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
return FALSE;
owner = wClient(window);
+ drawable = &window->drawable;
/* 1. Test if the window matches the emulated mode on one of the outputs
* This path gets hit by most games / libs (e.g. SDL, SFML, OGRE)
@@ -629,10 +631,10 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
if (!emulated_mode)
continue;
- if (xwl_window->x == xwl_output->x &&
- xwl_window->y == xwl_output->y &&
- xwl_window->width == emulated_mode->width &&
- xwl_window->height == emulated_mode->height) {
+ if (drawable->x == xwl_output->x &&
+ drawable->y == xwl_output->y &&
+ drawable->width == emulated_mode->width &&
+ drawable->height == emulated_mode->height) {
*emulated_mode_ret = emulated_mode;
*xwl_output_ret = xwl_output;
@@ -648,9 +650,9 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, owner);
if (xwl_output && xwl_window->window->overrideRedirect &&
emulated_mode && emulated_mode->from_vidmode &&
- xwl_window->x == 0 && xwl_window->y == 0 &&
- xwl_window->width == xwl_screen->width &&
- xwl_window->height == xwl_screen->height) {
+ drawable->x == 0 && drawable->y == 0 &&
+ drawable->width == xwl_screen->width &&
+ drawable->height == xwl_screen->height) {
*emulated_mode_ret = emulated_mode;
*xwl_output_ret = xwl_output;
@@ -770,8 +772,6 @@ ensure_surface_for_window(WindowPtr window)
xwl_window->xwl_screen = xwl_screen;
xwl_window->window = window;
- xwl_window->width = window->drawable.width;
- xwl_window->height = window->drawable.height;
xwl_window->surface = wl_compositor_create_surface(xwl_screen->compositor);
if (xwl_window->surface == NULL) {
ErrorF("wl_display_create_surface failed\n");
@@ -999,20 +999,15 @@ xwl_resize_window(WindowPtr window,
struct xwl_window *xwl_window;
xwl_screen = xwl_screen_get(screen);
- xwl_window = xwl_window_get(window);
+ xwl_window = xwl_window_from_window(window);
screen->ResizeWindow = xwl_screen->ResizeWindow;
(*screen->ResizeWindow) (window, x, y, width, height, sib);
xwl_screen->ResizeWindow = screen->ResizeWindow;
screen->ResizeWindow = xwl_resize_window;
- if (xwl_window) {
- xwl_window->x = x;
- xwl_window->y = y;
- xwl_window->width = width;
- xwl_window->height = height;
+ if (xwl_window && xwl_window_is_toplevel(window))
xwl_window_check_resolution_change_emulation(xwl_window);
- }
}
static void
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index f5ffadfcc..0d0baac9b 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -184,7 +184,6 @@ struct xwl_window {
struct xwl_screen *xwl_screen;
struct wl_surface *surface;
struct wp_viewport *viewport;
- int32_t x, y, width, height;
float scale_x, scale_y;
struct wl_shell_surface *shell_surface;
WindowPtr window;
--
2.26.2

View File

@ -0,0 +1,45 @@
From 09eb525863ab6c08fd743a637f7da9d10c0c01eb Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 15 Jan 2020 14:36:45 +0100
Subject: [PATCH xserver 19/24] xwayland: Also check
resolution-change-emulation when the xwl_window itself moves
The recent change to use the top-level non-window-manager Window drawable
coordinates from xwl_window_check_resolution_change_emulation() in
combination with only calling it on a resize when the top-level window
is moved breaks things with mutter/gnome-shell.
When fullscreening a X11 window, mutter moves its window-decoration Window
wrapping the top-level Window to the monitor's origin coordinates (e.g. 0x0)
last. This updates the top-level's drawable coordinates, but as the
actual MoveWindow is called on the wrapper Window and not on the toplevel
we do not call xwl_window_check_resolution_change_emulation() and we never
enable the viewport.
This commit fixes this by also calling
xwl_window_check_resolution_change_emulation() if the Window being moved
is an xwl_window itself.
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 4fc107460a349a1a46f0e5251e6fd2a31f4c0428)
---
hw/xwayland/xwayland.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 898a291fd..b40502dad 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -1006,7 +1006,7 @@ xwl_resize_window(WindowPtr window,
xwl_screen->ResizeWindow = screen->ResizeWindow;
screen->ResizeWindow = xwl_resize_window;
- if (xwl_window && xwl_window_is_toplevel(window))
+ if (xwl_window && (xwl_window_get(window) || xwl_window_is_toplevel(window)))
xwl_window_check_resolution_change_emulation(xwl_window);
}
--
2.26.2

View File

@ -0,0 +1,83 @@
From 9f2ebb5f07dc3fff8e061b21fa175d3d958d0ee4 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 9 Jan 2020 11:00:36 +0100
Subject: [PATCH xserver 20/24] xwayland: Also hook screen's MoveWindow method
Not only hook the ResizeWindow method of the screen (which really is
MoveAndResize) but also hook the MoveWindow method for checking if we
need to setup a viewport for resolution change emulation.
Our resolution change emulation check if the windows origin matches
the monitors origin and the windows origin can also be changed by just
a move without being resized.
Also checking on a move becomes esp. important when we move to checking
on changes to the top-level non-window-manager client (X11)Window instead
of on changes to the xwl_window later on in this patch series.
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 10df0437a2b142e61c4d84ffffa9592ac6846ef1)
---
hw/xwayland/xwayland.c | 25 +++++++++++++++++++++++++
hw/xwayland/xwayland.h | 1 +
2 files changed, 26 insertions(+)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index b40502dad..7111e20ae 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -1010,6 +1010,28 @@ xwl_resize_window(WindowPtr window,
xwl_window_check_resolution_change_emulation(xwl_window);
}
+static void
+xwl_move_window(WindowPtr window,
+ int x, int y,
+ WindowPtr next_sib,
+ VTKind kind)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen;
+ struct xwl_window *xwl_window;
+
+ xwl_screen = xwl_screen_get(screen);
+ xwl_window = xwl_window_from_window(window);
+
+ screen->MoveWindow = xwl_screen->MoveWindow;
+ (*screen->MoveWindow) (window, x, y, next_sib, kind);
+ xwl_screen->MoveWindow = screen->MoveWindow;
+ screen->MoveWindow = xwl_move_window;
+
+ if (xwl_window && (xwl_window_get(window) || xwl_window_is_toplevel(window)))
+ xwl_window_check_resolution_change_emulation(xwl_window);
+}
+
static void
frame_callback(void *data,
struct wl_callback *callback,
@@ -1588,6 +1610,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
xwl_screen->ResizeWindow = pScreen->ResizeWindow;
pScreen->ResizeWindow = xwl_resize_window;
+ xwl_screen->MoveWindow = pScreen->MoveWindow;
+ pScreen->MoveWindow = xwl_move_window;
+
if (xwl_screen->rootless) {
xwl_screen->SetWindowPixmap = pScreen->SetWindowPixmap;
pScreen->SetWindowPixmap = xwl_set_window_pixmap;
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 0d0baac9b..451c08e23 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -138,6 +138,7 @@ struct xwl_screen {
SetWindowPixmapProcPtr SetWindowPixmap;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
ResizeWindowProcPtr ResizeWindow;
+ MoveWindowProcPtr MoveWindow;
struct xorg_list output_list;
struct xorg_list seat_list;
--
2.26.2

View File

@ -0,0 +1,63 @@
From 958b34ce3cab02219457d5dcc25217e7c9a0beba Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 7 Oct 2019 14:27:49 +0200
Subject: [PATCH xserver 21/24] xwayland: Fix emulated modes not being removed
when screen rotation is used
The code building the mode-list does the following to deal with screen
rotation:
if (need_rotate || xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) {
mode_width = xwl_output->width;
mode_height = xwl_output->height;
} else {
mode_width = xwl_output->height;
mode_height = xwl_output->width;
}
This means we need to do something similar in xwl_output_set_emulated_mode()
to determine if the mode being set is the actual (not-emulated) output mode
and we this should remove any emulated modes set by the client.
All callers of xwl_output_set_emulated_mode always pass a mode pointer
to a member of xwl_output->randr_output->modes, so we do not need to
duplicate this code, instead we can simply check that the passed in mode
is modes[0] which always is the actual output mode.
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 88342353de45e64f408c38bb10cd1506ba0f159a)
---
hw/xwayland/xwayland-output.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 0d6b9ac9f..4bc9cd6b8 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -272,8 +272,11 @@ xwl_output_remove_emulated_mode_for_client(struct xwl_output *xwl_output,
struct xwl_emulated_mode *emulated_mode;
emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, client);
- if (emulated_mode)
+ if (emulated_mode) {
+ DebugF("XWAYLAND: xwl_output_remove_emulated_mode: %dx%d\n",
+ emulated_mode->width, emulated_mode->height);
memset(emulated_mode, 0, sizeof(*emulated_mode));
+ }
}
/* From hw/xfree86/common/xf86DefModeSet.c with some obscure modes dropped */
@@ -474,7 +477,8 @@ xwl_output_set_emulated_mode(struct xwl_output *xwl_output, ClientPtr client,
from_vidmode ? "vidmode" : "randr",
mode->mode.width, mode->mode.height);
- if (mode->mode.width == xwl_output->width && mode->mode.height == xwl_output->height)
+ /* modes[0] is the actual (not-emulated) output mode */
+ if (mode == xwl_output->randr_output->modes[0])
xwl_output_remove_emulated_mode_for_client(xwl_output, client);
else
xwl_output_add_emulated_mode_for_client(xwl_output, client, mode, from_vidmode);
--
2.26.2

View File

@ -0,0 +1,48 @@
From 12a9c05a3088480bc7ab80902e384053f10e51a6 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 4 Nov 2019 11:46:49 +0100
Subject: [PATCH xserver 22/24] xwayland: Call
xwl_window_check_resolution_change_emulation() on newly created O-R windows
Some clients, which use vidmode to change the resolution when going fullscreen,
create an override-redirect window and never trigger the screen->ResizeWindow
callback we rely on to do the xwl_window_check_resolution_change_emulation().
This causes us to not apply a viewport to them, causing the fullscreen window
to not fill the entire monitor.
This commit adds a call to xwl_window_check_resolution_change_emulation()
at the end of ensure_surface_for_window() to fix this. Note that
ensure_surface_for_window() exits early without creating an xwl_window
for new windows which will not be backed by a wayland surface and which
thus will not have an xwl_window.
This fixes ClanLib-0.6.x and alleggl-4.4.x using apps not properly
fullscreening.
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 4cfc2677f5c82ca5db0919de549b9b077f1ba113)
---
hw/xwayland/xwayland.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 7111e20ae..734e76b2e 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -821,6 +821,11 @@ ensure_surface_for_window(WindowPtr window)
xwl_window_init_allow_commits(xwl_window);
+ if (!window_is_wm_window(window)) {
+ /* CSD or O-R toplevel window, check viewport on creation */
+ xwl_window_check_resolution_change_emulation(xwl_window);
+ }
+
return TRUE;
err_surf:
--
2.26.2

View File

@ -0,0 +1,76 @@
From 94fc11313b34e3b35aa275dad1c3bc2455a24ec3 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 4 Nov 2019 14:32:29 +0100
Subject: [PATCH xserver 23/24] xwayland: Fix setting of
_XWAYLAND_RANDR_EMU_MONITOR_RECTS prop on new windows
For window-manager managed windows, xwl_realize_window is only called for
the window-manager's decoration window and not for the actual client window
on which we should set the _XWAYLAND_RANDR_EMU_MONITOR_RECTS prop.
Usualy this is not a problem since we walk all client windows to update
the property when the resolution is changed through a randr call.
But for apps which first do the randr change and only then create their
window this does not work, and our xwl_output_set_window_randr_emu_props
call in xwl_realize_window is a no-op as that is only called for the wm
decoration window and not for the actual client's window.
This commit fixes this by making ensure_surface_for_window() call
xwl_output_set_window_randr_emu_props on the first and only child of
window-manager managed windows.
Note this also removes the non-functional xwl_output_set_window_randr_emu_props
call from xwl_realize_window, which was intended to do this, but does not
work.
This fixes apps using the ogre3d library always running at the
monitors native resolution.
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 148f428dfccf606b932a00d5a00af06e8dca8a7e)
---
hw/xwayland/xwayland.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 734e76b2e..a7c4f82df 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -751,6 +751,7 @@ ensure_surface_for_window(WindowPtr window)
struct xwl_screen *xwl_screen;
struct xwl_window *xwl_window;
struct wl_region *region;
+ WindowPtr toplevel;
if (xwl_window_get(window))
return TRUE;
@@ -821,7 +822,14 @@ ensure_surface_for_window(WindowPtr window)
xwl_window_init_allow_commits(xwl_window);
- if (!window_is_wm_window(window)) {
+ /* When a new window-manager window is realized, then the randr emulation
+ * props may have not been set on the managed client window yet.
+ */
+ if (window_is_wm_window(window)) {
+ toplevel = window_get_client_toplevel(window);
+ if (toplevel)
+ xwl_output_set_window_randr_emu_props(xwl_screen, toplevel);
+ } else {
/* CSD or O-R toplevel window, check viewport on creation */
xwl_window_check_resolution_change_emulation(xwl_window);
}
@@ -870,8 +878,6 @@ xwl_realize_window(WindowPtr window)
return FALSE;
}
- xwl_output_set_window_randr_emu_props(xwl_screen, window);
-
return ensure_surface_for_window(window);
}
--
2.26.2

View File

@ -0,0 +1,49 @@
From 2d078b3372e26278e687399a39699c495bfe16d4 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 4 Nov 2019 15:01:18 +0100
Subject: [PATCH xserver 24/24] xwayland: Remove unnecessary
xwl_window_is_toplevel() check from xwl_output_set_window_randr_emu_props()
Since the recent fix to call xwl_output_set_window_randr_emu_props() from
ensure_surface_for_window(), it is now only called on a toplevel window,
so the is-toplevel check is not necessary for the
xwl_output_set_window_randr_emu_props() case.
This commit moves the check to xwl_output_set_randr_emu_prop_callback()
so that we only do it when we are walking over all Windows of a client
to update the property on a change of the emulated resolution.
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit d4faab8708779df265239b203ed5f020bff681bf)
---
hw/xwayland/xwayland-output.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 4bc9cd6b8..9d3372c8e 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -431,9 +431,6 @@ static void
xwl_output_set_randr_emu_prop(WindowPtr window,
struct xwl_output_randr_emu_prop *prop)
{
- if (!xwl_window_is_toplevel(window))
- return;
-
if (prop->rect_count) {
dixChangeWindowProperty(serverClient, window, prop->atom,
XA_CARDINAL, 32, PropModeReplace,
@@ -446,7 +443,8 @@ xwl_output_set_randr_emu_prop(WindowPtr window,
static void
xwl_output_set_randr_emu_prop_callback(void *resource, XID id, void *user_data)
{
- xwl_output_set_randr_emu_prop(resource, user_data);
+ if (xwl_window_is_toplevel(resource))
+ xwl_output_set_randr_emu_prop(resource, user_data);
}
static void
--
2.26.2

View File

@ -0,0 +1,30 @@
Description: Use intel ddx only on pre-gen4 hw, newer ones will fall back to modesetting
Author: Timo Aaltonen <tjaalton@debian.org>
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1173,7 +1173,23 @@ xf86VideoPtrToDriverList(struct pci_devi
case 0x0bef:
/* Use fbdev/vesa driver on Oaktrail, Medfield, CDV */
break;
- default:
+ /* Default to intel only on pre-gen4 chips */
+ case 0x3577:
+ case 0x2562:
+ case 0x3582:
+ case 0x358e:
+ case 0x2572:
+ case 0x2582:
+ case 0x258a:
+ case 0x2592:
+ case 0x2772:
+ case 0x27a2:
+ case 0x27ae:
+ case 0x29b2:
+ case 0x29c2:
+ case 0x29d2:
+ case 0xa001:
+ case 0xa011:
driverList[0] = "intel";
break;
}

38
10-quirks.conf Normal file
View File

@ -0,0 +1,38 @@
# Collection of quirks and blacklist/whitelists for specific devices.
# Accelerometer device, posts data through ABS_X/ABS_Y, making X unusable
# http://bugs.freedesktop.org/show_bug.cgi?id=22442
Section "InputClass"
Identifier "ThinkPad HDAPS accelerometer blacklist"
MatchProduct "ThinkPad HDAPS accelerometer data"
Option "Ignore" "on"
EndSection
# https://bugzilla.redhat.com/show_bug.cgi?id=523914
# Mouse does not move in PV Xen guest
# Explicitly tell evdev to not ignore the absolute axes.
Section "InputClass"
Identifier "Xen Virtual Pointer axis blacklist"
MatchProduct "Xen Virtual Pointer"
Option "IgnoreAbsoluteAxes" "off"
Option "IgnoreRelativeAxes" "off"
EndSection
# https://bugs.freedesktop.org/show_bug.cgi?id=55867
# Bug 55867 - Doesn't know how to tag XI_TRACKBALL
Section "InputClass"
Identifier "Tag trackballs as XI_TRACKBALL"
MatchProduct "trackball"
MatchDriver "evdev"
Option "TypeName" "TRACKBALL"
EndSection
# https://bugs.freedesktop.org/show_bug.cgi?id=62831
# Bug 62831 - Mionix Naos 5000 mouse detected incorrectly
Section "InputClass"
Identifier "Tag Mionix Naos 5000 mouse XI_MOUSE"
MatchProduct "La-VIEW Technology Naos 5000 Mouse"
MatchDriver "evdev"
Option "TypeName" "MOUSE"
EndSection

30
Makefile Normal file
View File

@ -0,0 +1,30 @@
# Makefile for source rpm: xorg-x11-server
# $Id$
NAME := xorg-x11-server
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attempt a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)
ifeq ($(MAKECMDGOALS),me a sandwich)
.PHONY :: me a sandwich
me a:
@:
sandwich:
@[ `id -u` -ne 0 ] && echo "What? Make it yourself." || echo Okay.
endif

1
commitid Normal file
View File

@ -0,0 +1 @@
d13cb974426f7f1110b0bdb08c4ebb46ff8975f7

54
driver-abi-rebuild.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/sh
#
# Trivial script to rebuild drivers for ABI changes in the server
# Run me after a new xserver has hit the buildroot
builddir="abi-rebuild"
if [ -e "$builddir" ]; then
echo "Path '$builddir' exists. Move out of the way first"
exit 1
fi
mkdir -p $builddir
pushd $builddir
if git config --get remote.origin.url | grep -q redhat.com ; then
pkg=rhpkg
else
pkg=fedpkg
fi
# figure out the branch we're on
branch=$(git branch | awk '/^\*/ { print $2 }' | grep -v '^master$')
if [ $branch ]; then
branch="-b $branch"
fi
$pkg co $branch xorg-x11-drivers
pushd xorg-x11-drivers
driverlist=$(grep ^Requires *.spec | awk '{ print $2 }')
popd
# Things not in -drivers for whatever reason...
extradrivers="xorg-x11-drv-ivtv"
rm -rf xorg-x11-drivers
echo $driverlist $extradrivers | xargs -n1 $pkg co $branch
for i in xorg-x11-drv-*/ ; do
[ -e $i/dead.package ] && continue
pushd $i
rpmdev-bumpspec -c "- 1.15 ABI rebuild" *.spec
$pkg commit -c -p && $pkg build --nowait
#$pkg mockbuild
#$pkg srpm
#mockchain -r fedora-20-x86_64 -l $OLDPWD
#mockchain -r rhel-7.0-candidate-x86_64 -l $OLDPWD
popd
done
popd

306
gitignore Normal file
View File

@ -0,0 +1,306 @@
Makefile
Makefile.in
.deps
.libs
.msg
*.lo
*.la
*.a
*.o
*~
.*sw?
*.pbxuser
*.mode1v3
obj*
build*
local
aclocal.m4
autom4te.cache
compile
config.guess
config.log
config.status
config.sub
configure
configure.lineno
depcomp
install-sh
libtool
ltmain.sh
missing
TAGS
tags
ylwrap
xorg-server.pc
stamp-h?
do-not-use-config.h
do-not-use-config.h.in
afb/afbbltC.c
afb/afbbltCI.c
afb/afbbltG.c
afb/afbbltO.c
afb/afbbltX.c
afb/afbseg.c
afb/afbtileC.c
afb/afbtileG.c
cfb/cfb8lineCO.c
cfb/cfb8lineCP.c
cfb/cfb8lineG.c
cfb/cfb8lineX.c
cfb/cfb8segC.c
cfb/cfb8segCS.c
cfb/cfb8segX.c
cfb/cfb8setG.c
cfb/cfbbltC.c
cfb/cfbbltG.c
cfb/cfbbltO.c
cfb/cfbbltX.c
cfb/cfbfillarcC.c
cfb/cfbfillarcG.c
cfb/cfbglrop8.c
cfb/cfbply1rctC.c
cfb/cfbply1rctG.c
cfb/cfbseg.c
cfb/cfbsolidC.c
cfb/cfbsolidG.c
cfb/cfbsolidX.c
cfb/cfbtile32C.c
cfb/cfbtile32G.c
cfb/cfbtileoddC.c
cfb/cfbtileoddG.c
cfb/cfbzerarcC.c
cfb/cfbzerarcG.c
cfb/cfbzerarcX.c
cfb32/cfb8lineCO.c
cfb32/cfb8lineCP.c
cfb32/cfb8lineG.c
cfb32/cfb8lineX.c
cfb32/cfb8segC.c
cfb32/cfb8segCS.c
cfb32/cfb8segX.c
cfb32/cfb8setG.c
cfb32/cfbbltC.c
cfb32/cfbbltG.c
cfb32/cfbbltO.c
cfb32/cfbbltX.c
cfb32/cfbfillarcC.c
cfb32/cfbfillarcG.c
cfb32/cfbply1rctC.c
cfb32/cfbply1rctG.c
cfb32/cfbseg.c
cfb32/cfbsolidC.c
cfb32/cfbsolidG.c
cfb32/cfbsolidX.c
cfb32/cfbtile32C.c
cfb32/cfbtile32G.c
cfb32/cfbtileoddC.c
cfb32/cfbtileoddG.c
cfb32/cfbzerarcC.c
cfb32/cfbzerarcG.c
cfb32/cfbzerarcX.c
doc/Xserver.1x
doc/Xserver.man
hw/dmx/Xdmx
hw/dmx/Xdmx.1x
hw/dmx/config/dmxtodmx
hw/dmx/config/dmxtodmx.1x
hw/dmx/config/parser.c
hw/dmx/config/parser.h
hw/dmx/config/scanner.c
hw/dmx/config/vdltodmx
hw/dmx/config/vdltodmx.1x
hw/dmx/config/xdmxconfig
hw/dmx/config/xdmxconfig.1x
hw/dmx/examples/dmxaddinput
hw/dmx/examples/dmxaddscreen
hw/dmx/examples/dmxreconfig
hw/dmx/examples/dmxresize
hw/dmx/examples/dmxrminput
hw/dmx/examples/dmxrmscreen
hw/dmx/examples/dmxwininfo
hw/dmx/examples/ev
hw/dmx/examples/evi
hw/dmx/examples/res
hw/dmx/examples/xbell
hw/dmx/examples/xdmx
hw/dmx/examples/xinput
hw/dmx/examples/xled
hw/dmx/examples/xtest
hw/kdrive/ati/Xati
hw/kdrive/chips/Xchips
hw/kdrive/ephyr/Xephyr
hw/kdrive/epson/Xepson
hw/kdrive/fake/Xfake
hw/kdrive/fbdev/Xfbdev
hw/kdrive/i810/Xi810
hw/kdrive/mach64/Xmach64
hw/kdrive/mga/Xmga
hw/kdrive/neomagic/Xneomagic
hw/kdrive/nvidia/Xnvidia
hw/kdrive/pm2/Xpm2
hw/kdrive/r128/Xr128
hw/kdrive/sdl/Xsdl
hw/kdrive/sis300/Xsis
hw/kdrive/smi/Xsmi
hw/kdrive/vesa/Xvesa
hw/kdrive/via/Xvia
hw/vfb/Xvfb
hw/vfb/Xvfb.1x
hw/vfb/Xvfb.man
hw/xfree86/Xorg
hw/xfree86/common/xf86Build.h
hw/xfree86/common/xf86DefModeSet.c
hw/xfree86/doc/man/Xorg.1x
hw/xfree86/doc/man/Xorg.man
hw/xfree86/doc/man/xorg.conf.5x
hw/xfree86/doc/man/xorg.conf.man
hw/xfree86/exa/exa.4
hw/xfree86/exa/exa.4x
hw/xfree86/exa/exa.man
hw/xfree86/fbdevhw/fbdevhw.4x
hw/xfree86/fbdevhw/fbdevhw.man
hw/xfree86/getconfig/cfg.man
hw/xfree86/getconfig/getconfig.1x
hw/xfree86/getconfig/getconfig.5x
hw/xfree86/getconfig/getconfig.man
hw/xfree86/os-support/xorgos.c
hw/xfree86/osandcommon.c
hw/xfree86/ramdac/xf86BitOrder.c
hw/xfree86/scanpci/xf86PciData.c
hw/xfree86/scanpci/xf86PciIds.h
hw/xfree86/utils/cvt/cvt
hw/xfree86/utils/cvt/cvt.man
hw/xfree86/utils/gtf/gtf
hw/xfree86/utils/gtf/gtf.1x
hw/xfree86/utils/gtf/gtf.man
hw/xfree86/utils/ioport/inb
hw/xfree86/utils/ioport/inl
hw/xfree86/utils/ioport/inw
hw/xfree86/utils/ioport/ioport
hw/xfree86/utils/ioport/outb
hw/xfree86/utils/ioport/outl
hw/xfree86/utils/ioport/outw
hw/xfree86/utils/pcitweak/pcitweak
hw/xfree86/utils/pcitweak/pcitweak.1x
hw/xfree86/utils/pcitweak/pcitweak.man
hw/xfree86/utils/scanpci/scanpci
hw/xfree86/utils/scanpci/scanpci.1x
hw/xfree86/utils/scanpci/scanpci.man
hw/xfree86/utils/xorgcfg/XOrgCfg
hw/xfree86/utils/xorgcfg/xorgcfg
hw/xfree86/utils/xorgcfg/xorgcfg.1x
hw/xfree86/utils/xorgcfg/xorgcfg.man
hw/xfree86/utils/xorgconfig/xorgconfig
hw/xfree86/utils/xorgconfig/xorgconfig.1x
hw/xfree86/utils/xorgconfig/xorgconfig.man
hw/xfree86/xaa/l-xaaBitmap.c
hw/xfree86/xaa/l-xaaStipple.c
hw/xfree86/xaa/l-xaaTEGlyph.c
hw/xfree86/xaa/l3-xaaBitmap.c
hw/xfree86/xaa/l3-xaaStipple.c
hw/xfree86/xaa/lf-xaaBitmap.c
hw/xfree86/xaa/lf-xaaStipple.c
hw/xfree86/xaa/lf-xaaTEGlyph.c
hw/xfree86/xaa/lf3-xaaBitmap.c
hw/xfree86/xaa/lf3-xaaStipple.c
hw/xfree86/xaa/m-xaaBitmap.c
hw/xfree86/xaa/m-xaaStipple.c
hw/xfree86/xaa/m-xaaTEGlyph.c
hw/xfree86/xaa/m3-xaaBitmap.c
hw/xfree86/xaa/m3-xaaStipple.c
hw/xfree86/xaa/mf-xaaBitmap.c
hw/xfree86/xaa/mf-xaaStipple.c
hw/xfree86/xaa/mf-xaaTEGlyph.c
hw/xfree86/xaa/mf3-xaaBitmap.c
hw/xfree86/xaa/mf3-xaaStipple.c
hw/xfree86/xaa/s-xaaDashLine.c
hw/xfree86/xaa/s-xaaLine.c
hw/xfree86/xf1bpp/maskbits.c
hw/xfree86/xf1bpp/mfbbitblt.c
hw/xfree86/xf1bpp/mfbbltC.c
hw/xfree86/xf1bpp/mfbbltCI.c
hw/xfree86/xf1bpp/mfbbltG.c
hw/xfree86/xf1bpp/mfbbltO.c
hw/xfree86/xf1bpp/mfbbltX.c
hw/xfree86/xf1bpp/mfbbres.c
hw/xfree86/xf1bpp/mfbbresd.c
hw/xfree86/xf1bpp/mfbclip.c
hw/xfree86/xf1bpp/mfbcmap.c
hw/xfree86/xf1bpp/mfbfillarc.c
hw/xfree86/xf1bpp/mfbfillrct.c
hw/xfree86/xf1bpp/mfbfillsp.c
hw/xfree86/xf1bpp/mfbfont.c
hw/xfree86/xf1bpp/mfbgc.c
hw/xfree86/xf1bpp/mfbgetsp.c
hw/xfree86/xf1bpp/mfbigbblak.c
hw/xfree86/xf1bpp/mfbigbwht.c
hw/xfree86/xf1bpp/mfbhrzvert.c
hw/xfree86/xf1bpp/mfbimage.c
hw/xfree86/xf1bpp/mfbline.c
hw/xfree86/xf1bpp/mfbmisc.c
hw/xfree86/xf1bpp/mfbpablack.c
hw/xfree86/xf1bpp/mfbpainv.c
hw/xfree86/xf1bpp/mfbpawhite.c
hw/xfree86/xf1bpp/mfbpgbblak.c
hw/xfree86/xf1bpp/mfbpgbinv.c
hw/xfree86/xf1bpp/mfbpgbwht.c
hw/xfree86/xf1bpp/mfbpixmap.c
hw/xfree86/xf1bpp/mfbplyblack.c
hw/xfree86/xf1bpp/mfbplyinv.c
hw/xfree86/xf1bpp/mfbplywhite.c
hw/xfree86/xf1bpp/mfbpntwin.c
hw/xfree86/xf1bpp/mfbpolypnt.c
hw/xfree86/xf1bpp/mfbpushpxl.c
hw/xfree86/xf1bpp/mfbscrclse.c
hw/xfree86/xf1bpp/mfbscrinit.c
hw/xfree86/xf1bpp/mfbseg.c
hw/xfree86/xf1bpp/mfbsetsp.c
hw/xfree86/xf1bpp/mfbteblack.c
hw/xfree86/xf1bpp/mfbtewhite.c
hw/xfree86/xf1bpp/mfbtileC.c
hw/xfree86/xf1bpp/mfbtileG.c
hw/xfree86/xf1bpp/mfbwindow.c
hw/xfree86/xf1bpp/mfbzerarc.c
hw/xfree86/xf4bpp/mfbseg.c
hw/xfree86/xf8_32bpp/cfbgc32.c
hw/xfree86/xf8_32bpp/cfbgc8.c
hw/xfree86/xorg.c
hw/xfree86/xorg.conf.example
hw/xfree86/xorg.conf.example.pre
hw/xnest/Xnest
hw/xnest/Xnest.1x
hw/xnest/Xnest.man
hw/xprint/Xprt
hw/xprint/config/C/print/Xprinters.ghostscript
hw/xprint/doc/Xprt.1x
hw/xprint/doc/Xprt.man
hw/xprint/dpmsstubs-wrapper.c
hw/xprint/miinitext-wrapper.c
include/dix-config.h
include/kdrive-config.h
include/xgl-config.h
include/xkb-config.h
include/xorg-config.h
include/xorg-server.h
include/xwin-config.h
mfb/mfbbltC.c
mfb/mfbbltCI.c
mfb/mfbbltG.c
mfb/mfbbltO.c
mfb/mfbbltX.c
mfb/mfbigbblak.c
mfb/mfbigbwht.c
mfb/mfbpablack.c
mfb/mfbpainv.c
mfb/mfbpawhite.c
mfb/mfbpgbblak.c
mfb/mfbpgbinv.c
mfb/mfbpgbwht.c
mfb/mfbplyblack.c
mfb/mfbplyinv.c
mfb/mfbplywhite.c
mfb/mfbseg.c
mfb/mfbteblack.c
mfb/mfbtewhite.c
mfb/mfbtileC.c
mfb/mfbtileG.c

6
import.log Normal file
View File

@ -0,0 +1,6 @@
xorg-x11-server-1_5_0-1_fc10:HEAD:xorg-x11-server-1.5.0-1.fc10.src.rpm:1220485219
xorg-x11-server-1_5_1-1_fc10:HEAD:xorg-x11-server-1.5.1-1.fc10.src.rpm:1222198557
xorg-x11-server-1_5_2-1_fc10:HEAD:xorg-x11-server-1.5.2-1.fc10.src.rpm:1223667007
xorg-x11-server-1_5_3-1_fc10:HEAD:xorg-x11-server-1.5.3-1.fc10.src.rpm:1225918317
xorg-x11-server-1_6_0-1_fc11:HEAD:xorg-x11-server-1.6.0-1.fc11.src.rpm:1235594175
xorg-x11-server-1_6_1-1_fc11:HEAD:xorg-x11-server-1.6.1-1.fc11.src.rpm:1239742477

17
make-git-snapshot.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
DIRNAME=xorg-server-$( date +%Y%m%d )
rm -rf $DIRNAME
git clone git://git.freedesktop.org/git/xorg/xserver $DIRNAME
cd $DIRNAME
if [ -z "$1" ]; then
git log | head -1
else
git checkout $1
fi
git log | head -1 | awk '{ print $2 }' > ../commitid
git repack -a -d
cd ..
tar cf - $DIRNAME | xz -c9 > $DIRNAME.tar.xz
rm -rf $DIRNAME

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (xorg-server-1.20.9.tar.bz2) = d9b5f93e1b9763a89187d8b272aa7d4ce9709641b8539f4536708af153310e5a4931bffd4229c51a3b0e3b12da7838750aa71b635751fb4c0bb27438cce4e5e6

808
xorg-x11-server.spec Normal file
View File

@ -0,0 +1,808 @@
# This package is an experiment in active integration of upstream SCM with
# Fedora packaging. It works something like this:
#
# The "pristine" source is actually a git repo (with no working checkout).
# The first step of %%prep is to check it out and switch to a "fedora" branch.
# If you need to add a patch to the server, just do it like a normal git
# operation, dump it with git-format-patch to a file in the standard naming
# format, and add a PatchN: line. If you want to push something upstream,
# check out the master branch, pull, cherry-pick, and push.
# X.org requires lazy relocations to work.
%undefine _hardened_build
%undefine _strict_symbol_defs_build
#global gitdate 20161026
%global stable_abi 1
%if !0%{?gitdate} || %{stable_abi}
# Released ABI versions. Have to keep these manually in sync with the
# source because rpm is a terrible language.
%global ansic_major 0
%global ansic_minor 4
%global videodrv_major 24
%global videodrv_minor 1
%global xinput_major 24
%global xinput_minor 1
%global extension_major 10
%global extension_minor 0
%endif
%if 0%{?gitdate}
# For git snapshots, use date for major and a serial number for minor
%global minor_serial 0
%global git_ansic_major %{gitdate}
%global git_ansic_minor %{minor_serial}
%global git_videodrv_major %{gitdate}
%global git_videodrv_minor %{minor_serial}
%global git_xinput_major %{gitdate}
%global git_xinput_minor %{minor_serial}
%global git_extension_major %{gitdate}
%global git_extension_minor %{minor_serial}
%endif
%global pkgname xorg-server
Summary: X.Org X11 X server
Name: xorg-x11-server
Version: 1.20.9
Release: 1%{?gitdate:.%{gitdate}}%{?dist}
URL: http://www.x.org
License: MIT
#VCS: git:git://git.freedesktop.org/git/xorg/xserver
%if 0%{?gitdate}
# git snapshot. to recreate, run:
# ./make-git-snapshot.sh `cat commitid`
Source0: xorg-server-%{gitdate}.tar.xz
#Source0: http://www.x.org/pub/individual/xserver/%{pkgname}-%{version}.tar.bz2
Source1: make-git-snapshot.sh
Source2: commitid
%else
Source0: https://www.x.org/pub/individual/xserver/%{pkgname}-%{version}.tar.bz2
Source1: gitignore
%endif
Source4: 10-quirks.conf
Source10: xserver.pamd
# "useful" xvfb-run script
Source20: http://svn.exactcode.de/t2/trunk/package/xorg/xorg-server/xvfb-run.sh
# for requires generation in drivers
Source30: xserver-sdk-abi-requires.release
Source31: xserver-sdk-abi-requires.git
# maintainer convenience script
Source40: driver-abi-rebuild.sh
# From Debian use intel ddx driver only for gen4 and older chipsets
Patch1: 06_use-intel-only-on-pre-gen4.diff
# Default to xf86-video-modesetting on GeForce 8 and newer
Patch2: 0001-xfree86-use-modesetting-driver-by-default-on-GeForce.patch
# Default to va_gl on intel i965 as we use the modesetting drv there
# va_gl should probably just be the default everywhere ?
Patch3: 0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch
# Submitted upstream, but not going anywhere
Patch5: 0001-autobind-GPUs-to-the-screen.patch
# because the display-managers are not ready yet, do not upstream
Patch6: 0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch
# Backports from current stable "server-1.20-branch":
Patch101: 0001-Revert-linux-Fix-platform-device-probe-for-DT-based-.patch
Patch102: 0002-Revert-linux-Fix-platform-device-PCI-detection-for-c.patch
Patch103: 0003-Revert-linux-Make-platform-device-probe-less-fragile.patch
Patch104: 0004-include-Increase-the-number-of-max.-input-devices-to.patch
Patch105: 0005-glamor-Fix-glamor_poly_fill_rect_gl-xRectangle-width.patch
Patch106: 0006-xfree86-Take-second-reference-for-SavedCursor-in-xf8.patch
Patch107: 0007-present-wnmd-Can-t-use-page-flipping-for-windows-cli.patch
Patch108: 0008-xwayland-Check-window-pixmap-in-xwl_present_check_fl.patch
Patch109: 0009-present-wnmd-Remove-dead-check-from-present_wnmd_che.patch
Patch110: 0010-xwayland-Do-not-discard-frame-callbacks-on-allow-com.patch
Patch111: 0011-xwayland-use-drmGetNodeTypeFromFd-for-checking-if-a-.patch
Patch112: 0012-xwayland-Remove-pending-stream-reference-when-freein.patch
Patch113: 0013-present-Move-flip-target_msc-adjustment-out-of-prese.patch
Patch114: 0014-present-Add-present_vblank-exec_msc-field.patch
Patch115: 0015-present-wnmd-Move-up-present_wnmd_queue_vblank.patch
Patch116: 0016-present-wnmd-Execute-copies-at-target_msc-1-already.patch
# Backports from "master" upstream:
# Backported Xwayland randr resolution change emulation support
Patch501: 0001-dix-Add-GetCurrentClient-helper.patch
Patch502: 0002-xwayland-Add-wp_viewport-wayland-extension-support.patch
Patch503: 0003-xwayland-Use-buffer_damage-instead-of-surface-damage.patch
Patch504: 0004-xwayland-Add-fake-output-modes-to-xrandr-output-mode.patch
Patch505: 0005-xwayland-Use-RandR-1.2-interface-rev-2.patch
Patch506: 0006-xwayland-Add-per-client-private-data.patch
Patch507: 0007-xwayland-Add-support-for-storing-per-client-per-outp.patch
Patch508: 0008-xwayland-Add-support-for-randr-resolution-change-emu.patch
Patch509: 0009-xwayland-Add-xwlRRModeToDisplayMode-helper-function.patch
Patch510: 0010-xwayland-Add-xwlVidModeGetCurrentRRMode-helper-to-th.patch
Patch511: 0011-xwayland-Add-vidmode-mode-changing-emulation-support.patch
Patch512: 0012-xwayland-xwl_window_should_enable_viewport-Add-extra.patch
Patch513: 0013-xwayland-Set-_XWAYLAND_RANDR_EMU_MONITOR_RECTS-prope.patch
Patch514: 0014-xwayland-Cache-client-id-for-the-window-manager-clie.patch
Patch515: 0015-xwayland-Reuse-viewport-instead-of-recreating.patch
Patch516: 0016-xwayland-Recurse-on-finding-the-none-wm-owner.patch
Patch517: 0017-xwayland-Make-window_get_none_wm_owner-return-a-Wind.patch
Patch518: 0018-xwayland-Check-emulation-on-client-toplevel-resize.patch
Patch519: 0019-xwayland-Also-check-resolution-change-emulation-when.patch
Patch520: 0020-xwayland-Also-hook-screen-s-MoveWindow-method.patch
Patch521: 0021-xwayland-Fix-emulated-modes-not-being-removed-when-s.patch
Patch522: 0022-xwayland-Call-xwl_window_check_resolution_change_emu.patch
Patch523: 0023-xwayland-Fix-setting-of-_XWAYLAND_RANDR_EMU_MONITOR_.patch
Patch524: 0024-xwayland-Remove-unnecessary-xwl_window_is_toplevel-c.patch
BuildRequires: systemtap-sdt-devel
BuildRequires: git
BuildRequires: automake autoconf libtool pkgconfig
BuildRequires: xorg-x11-util-macros >= 1.17
BuildRequires: xorg-x11-proto-devel >= 7.7-10
BuildRequires: xorg-x11-font-utils >= 7.2-11
BuildRequires: dbus-devel libepoxy-devel systemd-devel
BuildRequires: xorg-x11-xtrans-devel >= 1.3.2
BuildRequires: libXfont2-devel libXau-devel libxkbfile-devel libXres-devel
BuildRequires: libfontenc-devel libXtst-devel libXdmcp-devel
BuildRequires: libX11-devel libXext-devel
BuildRequires: libXinerama-devel libXi-devel
# DMX config utils buildreqs.
BuildRequires: libXt-devel libdmx-devel libXmu-devel libXrender-devel
BuildRequires: libXi-devel libXpm-devel libXaw-devel libXfixes-devel
BuildRequires: wayland-devel
BuildRequires: wayland-protocols-devel
BuildRequires: pkgconfig(wayland-eglstream-protocols)
BuildRequires: pkgconfig(wayland-client) >= 1.3.0
BuildRequires: pkgconfig(epoxy)
BuildRequires: pkgconfig(xshmfence) >= 1.1
BuildRequires: libXv-devel
BuildRequires: pixman-devel >= 0.30.0
BuildRequires: libpciaccess-devel >= 0.13.1 openssl-devel bison flex flex-devel
BuildRequires: mesa-libGL-devel >= 9.2
BuildRequires: mesa-libEGL-devel
BuildRequires: mesa-libgbm-devel
# XXX silly...
BuildRequires: libdrm-devel >= 2.4.0 kernel-headers
BuildRequires: audit-libs-devel libselinux-devel >= 2.0.86-1
BuildRequires: libudev-devel
# libunwind is Exclusive for the following arches
%ifarch aarch64 %{arm} hppa ia64 mips ppc ppc64 %{ix86} x86_64
%if !0%{?rhel}
BuildRequires: libunwind-devel
%endif
%endif
BuildRequires: pkgconfig(xcb-aux) pkgconfig(xcb-image) pkgconfig(xcb-icccm)
BuildRequires: pkgconfig(xcb-keysyms) pkgconfig(xcb-renderutil)
%description
X.Org X11 X server
%package common
Summary: Xorg server common files
Requires: pixman >= 0.30.0
Requires: xkeyboard-config xkbcomp
%description common
Common files shared among all X servers.
%package Xorg
Summary: Xorg X server
Provides: Xorg = %{version}-%{release}
Provides: Xserver
# HdG: This should be moved to the wrapper package once the wrapper gets
# its own sub-package:
Provides: xorg-x11-server-wrapper = %{version}-%{release}
%if !0%{?gitdate} || %{stable_abi}
Provides: xserver-abi(ansic-%{ansic_major}) = %{ansic_minor}
Provides: xserver-abi(videodrv-%{videodrv_major}) = %{videodrv_minor}
Provides: xserver-abi(xinput-%{xinput_major}) = %{xinput_minor}
Provides: xserver-abi(extension-%{extension_major}) = %{extension_minor}
%endif
%if 0%{?gitdate}
Provides: xserver-abi(ansic-%{git_ansic_major}) = %{git_ansic_minor}
Provides: xserver-abi(videodrv-%{git_videodrv_major}) = %{git_videodrv_minor}
Provides: xserver-abi(xinput-%{git_xinput_major}) = %{git_xinput_minor}
Provides: xserver-abi(extension-%{git_extension_major}) = %{git_extension_minor}
%endif
Obsoletes: xorg-x11-glamor < %{version}-%{release}
Provides: xorg-x11-glamor = %{version}-%{release}
Obsoletes: xorg-x11-drv-modesetting < %{version}-%{release}
Provides: xorg-x11-drv-modesetting = %{version}-%{release}
# Dropped from F25
Obsoletes: xorg-x11-drv-vmmouse < 13.1.0-4
Requires: xorg-x11-server-common >= %{version}-%{release}
Requires: system-setup-keyboard
Requires: xorg-x11-drv-libinput
Requires: libEGL
%description Xorg
X.org X11 is an open source implementation of the X Window System. It
provides the basic low level functionality which full fledged
graphical user interfaces (GUIs) such as GNOME and KDE are designed
upon.
%package Xnest
Summary: A nested server
Requires: xorg-x11-server-common >= %{version}-%{release}
Provides: Xnest
%description Xnest
Xnest is an X server which has been implemented as an ordinary
X application. It runs in a window just like other X applications,
but it is an X server itself in which you can run other software. It
is a very useful tool for developers who wish to test their
applications without running them on their real X server.
%package Xdmx
Summary: Distributed Multihead X Server and utilities
Requires: xorg-x11-server-common >= %{version}-%{release}
Provides: Xdmx
%description Xdmx
Xdmx is proxy X server that provides multi-head support for multiple displays
attached to different machines (each of which is running a typical X server).
When Xinerama is used with Xdmx, the multiple displays on multiple machines
are presented to the user as a single unified screen. A simple application
for Xdmx would be to provide multi-head support using two desktop machines,
each of which has a single display device attached to it. A complex
application for Xdmx would be to unify a 4 by 4 grid of 1280x1024 displays
(each attached to one of 16 computers) into a unified 5120x4096 display.
%package Xvfb
Summary: A X Windows System virtual framebuffer X server
# xvfb-run is GPLv2, rest is MIT
License: MIT and GPLv2
Requires: xorg-x11-server-common >= %{version}-%{release}
# required for xvfb-run
Requires: xorg-x11-xauth
Provides: Xvfb
%description Xvfb
Xvfb (X Virtual Frame Buffer) is an X server that is able to run on
machines with no display hardware and no physical input devices.
Xvfb simulates a dumb framebuffer using virtual memory. Xvfb does
not open any devices, but behaves otherwise as an X display. Xvfb
is normally used for testing servers.
%package Xephyr
Summary: A nested server
Requires: xorg-x11-server-common >= %{version}-%{release}
Provides: Xephyr
%description Xephyr
Xephyr is an X server which has been implemented as an ordinary
X application. It runs in a window just like other X applications,
but it is an X server itself in which you can run other software. It
is a very useful tool for developers who wish to test their
applications without running them on their real X server. Unlike
Xnest, Xephyr renders to an X image rather than relaying the
X protocol, and therefore supports the newer X extensions like
Render and Composite.
%package Xwayland
Summary: Wayland X Server
Requires: xorg-x11-server-common >= %{version}-%{release}
Requires: libEGL
%description Xwayland
Xwayland is an X server for running X clients under Wayland.
%package devel
Summary: SDK for X server driver module development
Requires: xorg-x11-util-macros
Requires: xorg-x11-proto-devel
Requires: libXfont2-devel
Requires: pkgconfig pixman-devel libpciaccess-devel
Provides: xorg-x11-server-static
Obsoletes: xorg-x11-glamor-devel < %{version}-%{release}
Provides: xorg-x11-glamor-devel = %{version}-%{release}
%description devel
The SDK package provides the developmental files which are necessary for
developing X server driver modules, and for compiling driver modules
outside of the standard X11 source code tree. Developers writing video
drivers, input drivers, or other X modules should install this package.
%package source
Summary: Xserver source code required to build VNC server (Xvnc)
BuildArch: noarch
%description source
Xserver source code needed to build VNC server (Xvnc)
%prep
%autosetup -N -n %{pkgname}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}
rm -rf .git
cp %{SOURCE1} .gitignore
# ick
%global __scm git
%{expand:%__scm_setup_git -q}
%autopatch
%if 0%{?stable_abi}
# check the ABI in the source against what we expect.
getmajor() {
grep -i ^#define.ABI.$1_VERSION hw/xfree86/common/xf86Module.h |
tr '(),' ' ' | awk '{ print $4 }'
}
getminor() {
grep -i ^#define.ABI.$1_VERSION hw/xfree86/common/xf86Module.h |
tr '(),' ' ' | awk '{ print $5 }'
}
test `getmajor ansic` == %{ansic_major}
test `getminor ansic` == %{ansic_minor}
test `getmajor videodrv` == %{videodrv_major}
test `getminor videodrv` == %{videodrv_minor}
test `getmajor xinput` == %{xinput_major}
test `getminor xinput` == %{xinput_minor}
test `getmajor extension` == %{extension_major}
test `getminor extension` == %{extension_minor}
%endif
%build
export CFLAGS="$RPM_OPT_FLAGS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
export CXXFLAGS="$RPM_OPT_FLAGS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
export LDFLAGS="$RPM_LD_FLAGS -specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
%ifnarch %{ix86} x86_64
%global no_int10 --disable-vbe --disable-int10-module
%endif
%global kdrive --enable-kdrive --enable-xephyr --disable-xfake --disable-xfbdev
%global xservers --enable-xvfb --enable-xnest %{kdrive} --enable-xorg
%global default_font_path "catalogue:/etc/X11/fontpath.d,built-ins"
%global dri_flags --enable-dri --enable-dri2 %{?!rhel:--enable-dri3} --enable-suid-wrapper --enable-glamor
%global bodhi_flags --with-vendor-name="Fedora Project"
autoreconf -f -v --install || exit 1
%configure %{xservers} \
--enable-dependency-tracking \
--enable-xwayland-eglstream \
--disable-static \
--with-pic \
%{?no_int10} --with-int10=x86emu \
--with-default-font-path=%{default_font_path} \
--with-module-dir=%{_libdir}/xorg/modules \
--with-builderstring="Build ID: %{name} %{version}-%{release}" \
--with-os-name="$(hostname -s) $(uname -r)" \
--with-xkb-output=%{_localstatedir}/lib/xkb \
--without-dtrace \
--disable-linux-acpi --disable-linux-apm \
--enable-xselinux --enable-record --enable-present \
--enable-xcsecurity \
--enable-config-udev \
--disable-unit-tests \
--enable-dmx \
--enable-xwayland \
%{dri_flags} %{?bodhi_flags} \
${CONFIGURE}
make V=1 %{?_smp_mflags}
%install
%make_install
mkdir -p $RPM_BUILD_ROOT%{_libdir}/xorg/modules/{drivers,input}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pam.d
install -m 644 %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/xserver
mkdir -p $RPM_BUILD_ROOT%{_datadir}/X11/xorg.conf.d
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}/X11/xorg.conf.d
# make sure the (empty) /etc/X11/xorg.conf.d is there, system-setup-keyboard
# relies on it more or less.
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/X11/xorg.conf.d
%if %{stable_abi}
install -m 755 %{SOURCE30} $RPM_BUILD_ROOT%{_bindir}/xserver-sdk-abi-requires
%else
sed -e s/@MAJOR@/%{gitdate}/g -e s/@MINOR@/%{minor_serial}/g %{SOURCE31} > \
$RPM_BUILD_ROOT%{_bindir}/xserver-sdk-abi-requires
chmod 755 $RPM_BUILD_ROOT%{_bindir}/xserver-sdk-abi-requires
%endif
install -m 0755 %{SOURCE20} $RPM_BUILD_ROOT%{_bindir}/xvfb-run
# Make the source package
%global xserver_source_dir %{_datadir}/xorg-x11-server-source
%global inst_srcdir %{buildroot}/%{xserver_source_dir}
mkdir -p %{inst_srcdir}/{Xext,xkb,GL,hw/{xquartz/bundle,xfree86/common}}
mkdir -p %{inst_srcdir}/{hw/dmx/doc,man,doc,hw/dmx/doxygen}
cp {,%{inst_srcdir}/}hw/xquartz/bundle/cpprules.in
cp {,%{inst_srcdir}/}man/Xserver.man
cp {,%{inst_srcdir}/}doc/smartsched
cp {,%{inst_srcdir}/}hw/dmx/doxygen/doxygen.conf.in
cp {,%{inst_srcdir}/}xserver.ent.in
cp {,%{inst_srcdir}/}hw/xfree86/Xorg.sh.in
cp xkb/README.compiled %{inst_srcdir}/xkb
cp hw/xfree86/xorgconf.cpp %{inst_srcdir}/hw/xfree86
find . -type f | egrep '.*\.(c|h|am|ac|inc|m4|h.in|pc.in|man.pre|pl|txt)$' |
xargs tar cf - | (cd %{inst_srcdir} && tar xf -)
find %{inst_srcdir}/hw/xfree86 -name \*.c -delete
# Remove unwanted files/dirs
{
find $RPM_BUILD_ROOT -type f -name '*.la' | xargs rm -f -- || :
# wtf
%ifnarch %{ix86} x86_64
rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/lib{int10,vbe}.so
%endif
}
%files common
%doc COPYING
%{_mandir}/man1/Xserver.1*
%{_libdir}/xorg/protocol.txt
%dir %{_localstatedir}/lib/xkb
%{_localstatedir}/lib/xkb/README.compiled
%if 1
%global Xorgperms %attr(4755, root, root)
%else
# disable until module loading is audited
%global Xorgperms %attr(0711,root,root) %caps(cap_sys_admin,cap_sys_rawio,cap_dac_override=pe)
%endif
%files Xorg
%config %attr(0644,root,root) %{_sysconfdir}/pam.d/xserver
%{_bindir}/X
%{_bindir}/Xorg
%{_libexecdir}/Xorg
%{Xorgperms} %{_libexecdir}/Xorg.wrap
%{_bindir}/cvt
%{_bindir}/gtf
%dir %{_libdir}/xorg
%dir %{_libdir}/xorg/modules
%dir %{_libdir}/xorg/modules/drivers
%{_libdir}/xorg/modules/drivers/modesetting_drv.so
%dir %{_libdir}/xorg/modules/extensions
%{_libdir}/xorg/modules/extensions/libglx.so
%dir %{_libdir}/xorg/modules/input
%{_libdir}/xorg/modules/libfbdevhw.so
%{_libdir}/xorg/modules/libexa.so
%{_libdir}/xorg/modules/libfb.so
%{_libdir}/xorg/modules/libglamoregl.so
%{_libdir}/xorg/modules/libshadow.so
%{_libdir}/xorg/modules/libshadowfb.so
%{_libdir}/xorg/modules/libvgahw.so
%{_libdir}/xorg/modules/libwfb.so
%ifarch %{ix86} x86_64
%{_libdir}/xorg/modules/libint10.so
%{_libdir}/xorg/modules/libvbe.so
%endif
%{_mandir}/man1/gtf.1*
%{_mandir}/man1/Xorg.1*
%{_mandir}/man1/Xorg.wrap.1*
%{_mandir}/man1/cvt.1*
%{_mandir}/man4/fbdevhw.4*
%{_mandir}/man4/exa.4*
%{_mandir}/man4/modesetting.4*
%{_mandir}/man5/Xwrapper.config.5*
%{_mandir}/man5/xorg.conf.5*
%{_mandir}/man5/xorg.conf.d.5*
%dir %{_sysconfdir}/X11/xorg.conf.d
%dir %{_datadir}/X11/xorg.conf.d
%{_datadir}/X11/xorg.conf.d/10-quirks.conf
%files Xnest
%{_bindir}/Xnest
%{_mandir}/man1/Xnest.1*
%files Xdmx
%{_bindir}/Xdmx
%{_bindir}/dmxaddinput
%{_bindir}/dmxaddscreen
%{_bindir}/dmxreconfig
%{_bindir}/dmxresize
%{_bindir}/dmxrminput
%{_bindir}/dmxrmscreen
%{_bindir}/dmxtodmx
%{_bindir}/dmxwininfo
%{_bindir}/vdltodmx
%{_bindir}/dmxinfo
%{_bindir}/xdmxconfig
%{_mandir}/man1/Xdmx.1*
%{_mandir}/man1/dmxtodmx.1*
%{_mandir}/man1/vdltodmx.1*
%{_mandir}/man1/xdmxconfig.1*
%files Xvfb
%{_bindir}/Xvfb
%{_bindir}/xvfb-run
%{_mandir}/man1/Xvfb.1*
%files Xephyr
%{_bindir}/Xephyr
%{_mandir}/man1/Xephyr.1*
%files Xwayland
%{_bindir}/Xwayland
%files devel
%doc COPYING
#{_docdir}/xorg-server
%{_bindir}/xserver-sdk-abi-requires
%{_libdir}/pkgconfig/xorg-server.pc
%dir %{_includedir}/xorg
%{_includedir}/xorg/*.h
%{_datadir}/aclocal/xorg-server.m4
%files source
%{xserver_source_dir}
%changelog
* Thu Oct 8 2020 Olivier Fourdan <ofourdan@redhat.com> - 1.20.9-1
- xserver 1.20.9 + all current fixes from upstream
* Wed Aug 12 2020 Adam Jackson <ajax@redhat.com> - 1.20.8-4
- Enable XC-SECURITY
* Fri Jul 31 2020 Adam Jackson <ajax@redhat.com> - 1.20.8-3
- Fix information disclosure bug in pixmap allocation (CVE-2020-14347)
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.20.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Mar 30 2020 Olivier Fourdan <ofourdan@redhat.com> - 1.20.8-1
- xserver 1.20.8
- Backport latest Xwayland randr resolution change emulation support
patches.
* Wed Mar 18 2020 Olivier Fourdan <ofourdan@redhat.com> - 1.20.7-2
- Fix a crash on closing a window using Present found upstream:
https://gitlab.freedesktop.org/xorg/xserver/issues/1000
* Fri Mar 13 2020 Olivier Fourdan <ofourdan@redhat.com> - 1.20.7-1
- xserver 1.20.7
- backport from stable "xserver-1.20-branch" up to commit ad7364d8d
(for mutter fullscreen unredirect on Wayland)
- Update videodrv minor ABI as 1.20.7 changed the minor ABI version
(backward compatible, API addition in glamor)
- Rebase Xwayland randr resolution change emulation support patches
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.20.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Nov 25 2019 Olivier Fourdan <ofourdan@redhat.com> - 1.20.6-1
- xserver 1.20.6
* Mon Nov 4 2019 Hans de Goede <hdegoede@redhat.com> - 1.20.5-9
- Fix building with new libglvnd-1.2.0 (E)GL headers and pkgconfig files
* Mon Nov 4 2019 Hans de Goede <hdegoede@redhat.com> - 1.20.5-8
- Backport Xwayland randr resolution change emulation support
* Thu Aug 29 2019 Olivier Fourdan <ofourdan@redhat.com> 1.20.5-7
- Pick latest fixes from xserver stable branch upstream (rhbz#1729925)
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.20.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Jul 8 2019 Olivier Fourdan <ofourdan@redhat.com> 1.20.5-5
- Do not include <sys/io.h> on ARM with glibc to avoid compilation failure.
- Do not force vbe and int10 sdk headers as this enables int10 which does
not build on ARM without <sys/io.h>
* Mon Jul 8 2019 Olivier Fourdan <ofourdan@redhat.com> 1.20.5-4
- Fix regression causing screen tearing with upstream xserver 1.20.5
(rhbz#1726419)
* Fri Jun 28 2019 Olivier Fourdan <ofourdan@redhat.com> 1.20.5-3
- Remove atomic downstream patches causing regressions (#1714981, #1723715)
- Xwayland crashes (#1708119, #1691745)
- Cursor issue with tablet on Xwayland
- Xorg/modesetting issue with flipping pixmaps with Present (#1645553)
* Thu Jun 06 2019 Peter Hutterer <peter.hutterer@redhat.com> 1.20.5-2
- Return AlreadyGrabbed for keycodes > 255 (#1697804)
* Thu May 30 2019 Adam Jackson <ajax@redhat.com> - 1.20.5-1
- xserver 1.20.5
* Tue Apr 23 2019 Adam Jackson <ajax@redhat.com> - 1.20.4-4
- Fix some non-atomic modesetting calls to be atomic
* Wed Mar 27 2019 Peter Hutterer <peter.hutterer@redhat.com> 1.20.4-3
- Fix a Qt scrolling bug, don't reset the valuator on slave switch
* Thu Mar 21 2019 Adam Jackson <ajax@redhat.com> - 1.20.4-2
- Backport an Xwayland crash fix in the Present code
* Tue Feb 26 2019 Adam Jackson <ajax@redhat.com> - 1.20.4-1
- xserver 1.20.4
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.20.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jan 11 2019 Olivier Fourdan <ofourdan@redhat.com> - 1.20.3-3
- More Xwayland/Present fixes from upstream (rhbz#1609181, rhbz#1661748)
* Thu Dec 06 2018 Olivier Fourdan <ofourdan@redhat.com> - 1.20.3-2
- Xwayland/Present fixes from master upstream
* Thu Nov 01 2018 Adam Jackson <ajax@redhat.com> - 1.20.3-1
- xserver 1.20.3
* Mon Oct 15 2018 Adam Jackson <ajax@redhat.com> - 1.20.2-1
- xserver 1.20.2
* Thu Oct 4 2018 Hans de Goede <hdegoede@redhat.com> - 1.20.1-4
- Rebase patch to use va_gl as vdpau driver on i965 GPUs, re-fix rhbz#1413733
* Thu Sep 13 2018 Dave Airlie <airlied@redhat.com> - 1.20.1-3
- Build with PIE enabled (this doesn't enable bind now)
* Mon Sep 10 2018 Olivier Fourdan <ofourdan@redhat.com> - 1.20.1-2
- Include patches from upstream to fix Xwayland crashes
* Thu Aug 09 2018 Adam Jackson <ajax@redhat.com> - 1.20.1-1
- xserver 1.20.1
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.20.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 12 2018 Adam Jackson <ajax@redhat.com> - 1.20.0-4
- Xorg and Xwayland Requires: libEGL
* Fri Jun 01 2018 Adam Williamson <awilliam@redhat.com> - 1.20.0-3
- Backport fixes for RHBZ#1579067
* Wed May 16 2018 Adam Jackson <ajax@redhat.com> - 1.20.0-2
- Xorg Requires: xorg-x11-drv-libinput
* Thu May 10 2018 Adam Jackson <ajax@redhat.com> - 1.20.0-1
- xserver 1.20
* Wed Apr 25 2018 Adam Jackson <ajax@redhat.com> - 1.19.99.905-2
- Fix xvfb-run's default depth to be 24
* Tue Apr 24 2018 Adam Jackson <ajax@redhat.com> - 1.19.99.905-1
- xserver 1.20 RC5
* Thu Apr 12 2018 Olivier Fourdan <ofourdan@redhat.com> - 1.19.99.904-2
- Re-fix "use type instead of which in xvfb-run (rhbz#1443357)" which
was overridden inadvertently
* Tue Apr 10 2018 Adam Jackson <ajax@redhat.com> - 1.19.99.904-1
- xserver 1.20 RC4
* Mon Apr 02 2018 Adam Jackson <ajax@redhat.com> - 1.19.99.903-1
- xserver 1.20 RC3
* Tue Feb 13 2018 Olivier Fourdan <ofourdan@redhat.com> 1.19.6-5
- xwayland: avoid race condition on new keymap
- xwayland: Keep separate variables for pointer and tablet foci (rhbz#1519961)
- xvfb-run now support command line option “--auto-display”
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.19.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Tue Jan 30 2018 Olivier Fourdan <ofourdan@redhat.com> 1.19.6-3
- Avoid generating a core file when the Wayland compositor is gone.
* Thu Jan 11 2018 Peter Hutterer <peter.hutterer@redhat.com> 1.19.6-2
- Fix handling of devices with ID_INPUT=null
* Wed Dec 20 2017 Adam Jackson <ajax@redhat.com> - 1.19.6-1
- xserver 1.19.6
* Thu Oct 12 2017 Adam Jackson <ajax@redhat.com> - 1.19.5-1
- xserver 1.19.5
* Thu Oct 05 2017 Olivier Fourdan <ofourdan@redhat.com> - 1.19.4-1
- xserver-1.19.4
- Backport tablet support for Xwayland
* Fri Sep 08 2017 Troy Dawson <tdawson@redhat.com> - 1.19.3-9
- Cleanup spec file conditionals
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.19.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.19.3-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sun Jul 2 2017 Ville Skyttä <ville.skytta@iki.fi> - 1.19.3-6
- Use type instead of which in xvfb-run (rhbz#1443357)
* Thu May 04 2017 Orion Poplawski <orion@cora.nwra.com> - 1.19.3-5
- Enable full build for s390/x
* Mon Apr 24 2017 Ben Skeggs <bskeggs@redhat.com> - 1.19.3-4
- Default to xf86-video-modesetting on GeForce 8 and newer
* Fri Apr 07 2017 Adam Jackson <ajax@redhat.com> - 1.19.3-3
- Inoculate against a versioning bug with libdrm 2.4.78
* Thu Mar 23 2017 Hans de Goede <hdegoede@redhat.com> - 1.19.3-2
- Use va_gl as vdpau driver on i965 GPUs (rhbz#1413733)
* Wed Mar 15 2017 Adam Jackson <ajax@redhat.com> - 1.19.3-1
- xserver 1.19.3
* Thu Mar 02 2017 Adam Jackson <ajax@redhat.com> - 1.19.2-1
- xserver 1.19.2
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.19.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Feb 01 2017 Peter Hutterer <peter.hutterer@redhat.com> 1.19.1-3
- Fix a few input thread lock issues causing intel crashes (#1384486)
* Mon Jan 16 2017 Adam Jackson <ajax@redhat.com> - 1.19.1-2
- Limit the intel driver only on F26 and up
* Wed Jan 11 2017 Adam Jackson <ajax@redhat.com> - 1.19.1-1
- xserver 1.19.1
* Tue Jan 10 2017 Hans de Goede <hdegoede@redhat.com> - 1.19.0-4
- Follow Debian and only default to the intel ddx on gen4 or older intel GPUs
* Tue Dec 20 2016 Hans de Goede <hdegoede@redhat.com> - 1.19.0-3
- Add one more patch for better integration with the nvidia binary driver
* Thu Dec 15 2016 Hans de Goede <hdegoede@redhat.com> - 1.19.0-2
- Add some patches for better integration with the nvidia binary driver
- Add a patch from upstream fixing a crash (rhbz#1389886)
* Wed Nov 23 2016 Olivier Fourdan <ofourdan@redhat.com> 1.19.0-1
- xserver 1.19.0
- Fix use after free of cursors in Xwayland (rhbz#1385258)
- Fix an issue where some monitors would show only black, or
partially black when secondary GPU outputs are used
* Tue Nov 15 2016 Peter Hutterer <peter.hutterer@redhat.com> 1.19.0-0.8.rc2
- Update device barriers for new master devices (#1384432)
* Thu Nov 3 2016 Hans de Goede <hdegoede@redhat.com> - 1.19.0-0.7.rc2
- Update to 1.19.0-rc2
- Fix (hopefully) various crashes in FlushAllOutput() (rhbz#1382444)
- Fix Xwayland crashing in glamor on non glamor capable hw (rhbz#1390018)
* Tue Nov 1 2016 Ben Crocker <bcrocker@redhat.com> - 1.19.0-0.6.20161028
- Fix Config record allocation during startup: if xorg.conf.d directory
- was absent, a segfault resulted.
* Mon Oct 31 2016 Adam Jackson <ajax@redhat.com> - 1.19.0-0.5.20161026
- Use %%autopatch instead of doing our own custom git-am trick
* Fri Oct 28 2016 Hans de Goede <hdegoede@redhat.com> - 1.19.0-0.4.20161026
- Add missing Requires: libXfont2-devel to -devel sub-package (rhbz#1389711)
* Wed Oct 26 2016 Hans de Goede <hdegoede@redhat.com> - 1.19.0-0.3.20161026
- Sync with upstream git, bringing in a bunch if bug-fixes
- Add some extra fixes which are pending upstream
- This also adds PointerWarping emulation to Xwayland, which should improve
compatiblity with many games

19
xserver-sdk-abi-requires Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
#
# The X server provides capabilities of the form:
#
# Provides: xserver-abi(ansic-0) = 4
#
# for an ABI version of 0.4. The major number is encoded into the name so
# that major number changes force upgrades. If we didn't, then
#
# Requires: xserver-abi(ansic) >= 0.4
#
# would also match 1.0, which is wrong since major numbers mean an ABI break.
ver=$(pkg-config --variable abi_$1 xorg-server)
major=$(echo $ver | cut -f 1 -d .)
minor=$(echo $ver | cut -f 2 -d .)
echo "xserver-abi($1-$major) >= $minor"

14
xserver-sdk-abi-requires.git Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
#
# The X server provides capabilities of the form:
#
# Provides: xserver-abi(ansic-0) = 4
#
# for an ABI version of 0.4. The major number is encoded into the name so
# that major number changes force upgrades. If we didn't, then
#
# Requires: xserver-abi(ansic) >= 0.4
#
# would also match 1.0, which is wrong since major numbers mean an ABI break.
echo "xserver-abi($1-@MAJOR@) >= @MINOR@"

View File

@ -0,0 +1,19 @@
#!/bin/sh
#
# The X server provides capabilities of the form:
#
# Provides: xserver-abi(ansic-0) = 4
#
# for an ABI version of 0.4. The major number is encoded into the name so
# that major number changes force upgrades. If we didn't, then
#
# Requires: xserver-abi(ansic) >= 0.4
#
# would also match 1.0, which is wrong since major numbers mean an ABI break.
ver=$(pkg-config --variable abi_$1 xorg-server)
major=$(echo $ver | cut -f 1 -d .)
minor=$(echo $ver | cut -f 2 -d .)
echo "xserver-abi($1-$major) >= $minor"

5
xserver.pamd Normal file
View File

@ -0,0 +1,5 @@
#%PAM-1.0
auth sufficient pam_rootok.so
auth required pam_console.so
account required pam_permit.so
session optional pam_keyinit.so force revoke

200
xvfb-run.sh Normal file
View File

@ -0,0 +1,200 @@
#!/bin/sh
# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# T2 SDE: package/.../xorg-server/xvfb-run.sh
# Copyright (C) 2005 The T2 SDE Project
# Copyright (C) XXXX - 2005 Debian
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- T2-COPYRIGHT-NOTE-END ---
# $Id$
# from: http://necrotic.deadbeast.net/xsf/XFree86/trunk/debian/local/xvfb-run
# This script starts an instance of Xvfb, the "fake" X server, runs a command
# with that server available, and kills the X server when done. The return
# value of the command becomes the return value of this script.
#
# If anyone is using this to build a Debian package, make sure the package
# Build-Depends on xvfb, xbase-clients, and xfonts-base.
set -e
PROGNAME=xvfb-run
SERVERNUM=99
AUTHFILE=
ERRORFILE=/dev/null
STARTWAIT=3
XVFBARGS="-screen 0 640x480x24"
LISTENTCP="-nolisten tcp"
XAUTHPROTO=.
# Query the terminal to establish a default number of columns to use for
# displaying messages to the user. This is used only as a fallback in the event
# the COLUMNS variable is not set. ($COLUMNS can react to SIGWINCH while the
# script is running, and this cannot, only being calculated once.)
DEFCOLUMNS=$(stty size 2>/dev/null | awk '{print $2}') || true
if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" >/dev/null 2>&1; then
DEFCOLUMNS=80
fi
# Display a message, wrapping lines at the terminal width.
message () {
echo "$PROGNAME: $*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS}
}
# Display an error message.
error () {
message "error: $*" >&2
}
# Display a usage message.
usage () {
if [ -n "$*" ]; then
message "usage error: $*"
fi
cat <<EOF
Usage: $PROGNAME [OPTION ...] COMMAND
Run COMMAND (usually an X client) in a virtual X server environment.
Options:
-a --auto-servernum try to get a free server number, starting at
--server-num (deprecated, use --auto-display
instead)
-d --auto-display use the X server to find a display number
automatically
-e FILE --error-file=FILE file used to store xauth errors and Xvfb
output (default: $ERRORFILE)
-f FILE --auth-file=FILE file used to store auth cookie
(default: ./.Xauthority)
-h --help display this usage message and exit
-n NUM --server-num=NUM server number to use (default: $SERVERNUM)
-l --listen-tcp enable TCP port listening in the X server
-p PROTO --xauth-protocol=PROTO X authority protocol name to use
(default: xauth command's default)
-s ARGS --server-args=ARGS arguments (other than server number and
"-nolisten tcp") to pass to the Xvfb server
(default: "$XVFBARGS")
-w DELAY --wait=DELAY delay in seconds to wait for Xvfb to start
before running COMMAND (default: $STARTWAIT)
EOF
}
# Find a free server number by looking at .X*-lock files in /tmp.
find_free_servernum() {
# Sadly, the "local" keyword is not POSIX. Leave the next line commented in
# the hope Debian Policy eventually changes to allow it in /bin/sh scripts
# anyway.
#local i
i=$SERVERNUM
while [ -f /tmp/.X$i-lock ]; do
i=$(($i + 1))
done
echo $i
}
# Parse the command line.
ARGS=$(getopt --options +ade:f:hn:lp:s:w: \
--long auto-servernum,error-file:auth-file:,help,server-num:,listen-tcp,xauth-protocol:,server-args:,wait: \
--name "$PROGNAME" -- "$@")
GETOPT_STATUS=$?
if [ $GETOPT_STATUS -ne 0 ]; then
error "internal error; getopt exited with status $GETOPT_STATUS"
exit 6
fi
eval set -- "$ARGS"
while :; do
case "$1" in
-a|--auto-servernum) SERVERNUM=$(find_free_servernum) ;;
-d|--auto-display) AUTO_DISPLAY=1 ;;
-e|--error-file) ERRORFILE="$2"; shift ;;
-f|--auth-file) AUTHFILE="$2"; shift ;;
-h|--help) SHOWHELP="yes" ;;
-n|--server-num) SERVERNUM="$2"; shift ;;
-l|--listen-tcp) LISTENTCP="" ;;
-p|--xauth-protocol) XAUTHPROTO="$2"; shift ;;
-s|--server-args) XVFBARGS="$2"; shift ;;
-w|--wait) STARTWAIT="$2"; shift ;;
--) shift; break ;;
*) error "internal error; getopt permitted \"$1\" unexpectedly"
exit 6
;;
esac
shift
done
if [ "$SHOWHELP" ]; then
usage
exit 0
fi
if [ -z "$*" ]; then
usage "need a command to run" >&2
exit 2
fi
if ! type xauth >/dev/null; then
error "xauth command not found"
exit 3
fi
# Set up the temp dir for the pid and X authorization file
XVFB_RUN_TMPDIR="$(mktemp --directory --tmpdir $PROGNAME.XXXXXX)"
# If the user did not specify an X authorization file to use, set up a temporary
# directory to house one.
if [ -z "$AUTHFILE" ]; then
AUTHFILE=$(mktemp -p "$XVFB_RUN_TMPDIR" Xauthority.XXXXXX)
fi
# Start Xvfb.
MCOOKIE=$(mcookie)
if [ -z "$AUTO_DISPLAY" ]; then
# Old style using a pre-computed SERVERNUM
XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >>"$ERRORFILE" \
2>&1 &
XVFBPID=$!
else
# New style using Xvfb to provide a free display
PIDFILE=$(mktemp -p "$XVFB_RUN_TMPDIR" pid.XXXXXX)
SERVERNUM=$(XAUTHORITY=$AUTHFILE Xvfb -displayfd 1 $XVFBARGS $LISTENTCP \
2>"$ERRORFILE" & echo $! > $PIDFILE)
XVFBPID=$(cat $PIDFILE)
fi
sleep "$STARTWAIT"
XAUTHORITY=$AUTHFILE xauth source - << EOF >>"$ERRORFILE" 2>&1
add :$SERVERNUM $XAUTHPROTO $MCOOKIE
EOF
# Start the command and save its exit status.
set +e
DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1
RETVAL=$?
set -e
# Kill Xvfb now that the command has exited.
kill $XVFBPID
# Clean up.
XAUTHORITY=$AUTHFILE xauth remove ":$SERVERNUM" >"$ERRORFILE" 2>&1
if [ -n "$XVFB_RUN_TMPDIR" ]; then
if ! rm -r "$XVFB_RUN_TMPDIR"; then
error "problem while cleaning up temporary directory"
exit 5
fi
fi
# Return the executed command's exit status.
exit $RETVAL
# vim:set ai et sts=4 sw=4 tw=80: