Commit Graph

9351 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult 73cf8d3560 xfree86: dri: unexport DRIDestroyWindow() and make it static
This function is only called inside dri.c, not used by any drivers
(and wouldn't make sense to do so), so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1713>
2024-10-10 20:42:23 +00:00
Enrico Weigelt, metux IT consult 9323ba6fed xwin: fix memleak on freeing pixmaps
Xwin's DestroyPixmap proc just free()s the PixmapRec directly, w/o catering
for devPrivate's, so leaving a memleak. The correct DIX function for this
is FreePixmap().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1710>
2024-10-10 20:27:11 +00:00
Enrico Weigelt, metux IT consult e8c4857938 xfree86: unexport xf86SetVerbosity() and xf86SetLogVerbosity()
These aren't used by any modules/drivers, so no need to keep them exported.
Also drop the return value, which isn't used by any caller.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1687>
2024-10-10 18:25:54 +00:00
Enrico Weigelt, metux IT consult e5b5b302d3 os: replace LogVWrite() by LogVMessageVerb()
It's just a wrapper around LogVMessageVerb() and no external module
using it, so can easily be optimized-away.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1683>
2024-10-10 17:34:12 +00:00
Enrico Weigelt, metux IT consult c26023a009 os: replace LogWrite() by LogMessageVerb()
It's nothing but a wrapper, doing the same as LogMessageVerb(X_NONE, ...),
and no external module / driver needs it, so can be easily optimized away.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1683>
2024-10-10 17:34:12 +00:00
Enrico Weigelt, metux IT consult 78d420870f xquartz: drop unused code
These code pieces have been commented out since their introduction back
almost two decades ago, so probably no need for them anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1603>
2024-10-10 16:42:38 +00:00
Enrico Weigelt, metux IT consult e97adda52d xfree86: modesetting: merge FreeRec() into FreeScreen()
No need to have one function doing nothing more than calling another one
with the same prototype.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1611>
2024-10-10 15:47:51 +00:00
Enrico Weigelt, metux IT consult bd40e9f836 xfree86: os-support: move including machine/sysarch.h out of public header
The only consumer seems to be one BSD specific file, the few drivers using
the *_iopl seem to include it on their own. Thus, no need to keep it in
public headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult 4d677fab46 xfree86: os-support: move CONSOLE_X_TV_ON/OFF to i386_video.c
These are only used in i386_video.c, so move them there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult 758bee502d xfree86: os-support: move CONSOLE_X_MODE_ON/OFF to bsd_init.c
These are only used in bsd_init.c, so move them there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult 8958a99c02 xfree86: os-support: move CONSOLE_X_BELL into bsd_bell.c
This define is only used inside bsd_bell.c, so move it there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult d7e0d174a5 xfree86: os-support: drop unused CONSOLE_GET_* defines
These don't seem to be used anywhere, so we can drop them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult 0560cb35ce xfree86. os-support: drop obsolete XMODE_* defines
These only had been used by xf86-video-chips, but meanwhile this
defines them on it's own, so we can drop them from here now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult 3b99837b78 xfree86: parser: scan: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/parser/scan.c:58:
../hw/xfree86/parser/scan.c: In function ‘xf86getToken’:
../hw/xfree86/parser/scan.c:343:50: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  343 |         else if ((c == ',') && !isalpha(configBuf[configPos])) {
      |                                                  ^
../hw/xfree86/parser/scan.c:346:50: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  346 |         else if ((c == '-') && !isalpha(configBuf[configPos])) {
      |                                                  ^
../hw/xfree86/parser/scan.c: In function ‘xf86nameCompare’:
../hw/xfree86/parser/scan.c:1031:19: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1031 |     c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                   ^
../hw/xfree86/parser/scan.c:1031:34: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1031 |     c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                                  ^
../hw/xfree86/parser/scan.c:1032:19: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1032 |     c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                   ^
../hw/xfree86/parser/scan.c:1032:34: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1032 |     c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                                  ^
../hw/xfree86/parser/scan.c:1042:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1042 |         c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                       ^
../hw/xfree86/parser/scan.c:1042:38: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1042 |         c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                                      ^
../hw/xfree86/parser/scan.c:1043:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1043 |         c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                       ^
../hw/xfree86/parser/scan.c:1043:38: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1043 |         c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                                      ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult 7830b007e4 xfree86: common: xf86Configure: fix char signess mismatch
On NetBSD gives warning:

../hw/xfree86/common/xf86Configure.c: In function ‘xf86AddBusDeviceToConfigure’:
../hw/xfree86/common/xf86Configure.c:125:50: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  125 |     for (j = 0; (lower_driver[j] = tolower(driver[j])); j++);
      |                                                  ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult 43a57fc6e9 xfree86: common: xf86pciBus: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/common/xf86pciBus.c:35:
../hw/xfree86/common/xf86pciBus.c: In function ‘xf86ParsePciBusString’:
../hw/xfree86/common/xf86pciBus.c:286:27: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  286 |             if (!isdigit(d[i])) {
      |                           ^
../hw/xfree86/common/xf86pciBus.c:293:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  293 |         if (!isdigit(p[i])) {
      |                       ^
../hw/xfree86/common/xf86pciBus.c:307:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  307 |         if (!isdigit(p[i])) {
      |                       ^
../hw/xfree86/common/xf86pciBus.c:320:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  320 |         if (!isdigit(p[i])) {
      |                       ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult 1f861bbb9d xfree86: common: xf86Option: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/common/xf86Option.c:39:
../hw/xfree86/common/xf86Option.c: In function ‘xf86NormalizeName’:
../hw/xfree86/common/xf86Option.c:915:25: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  915 |             if (isupper(*p))
      |                         ^
../hw/xfree86/common/xf86Option.c:916:32: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  916 |                 *q++ = tolower(*p);
      |                                ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult 99017bf948 xfree86: common: xf86Bus: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/common/xf86Bus.c:36:
../hw/xfree86/common/xf86Bus.c: In function ‘StringToBusType’:
../hw/xfree86/common/xf86Bus.c:270:22: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  270 |     if (isdigit(busID[0])) {
      |                      ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult 84be5b4e9c dix: unexport non-public functions from dixgrabs.h and document prototypes
* unexport functions from dixgrab.h, that aren't used by any driver/module.
* add paremeter names to prototypes
* add doxygen-style documentation for all the prototypes

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:50:57 +00:00
Enrico Weigelt, metux IT consult 1891a8dc14 os: unexport client id retrieval functions
These aren't used by any (known) external modules, thus no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:45:29 +00:00
Enrico Weigelt, metux IT consult a917f6a8a8 drop obsolete HAVE_DIX_CONFIG_H
The symbol controls whether to include dix-config.h, and it's always set,
thus we don't need it (and dozens of ifdef's) anymore.

This commit only removes them from our own source files, where we can
guarantee that dix-config.h is present - leaving the (potentially exported)
headers untouched.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:38:31 +00:00
Enrico Weigelt, metux IT consult 313334ec28 Xnest: drop obsolete ifdef HAVE_XNEST_CONFIG_H
These files are always compiled w/ HAVE_XNEST_CONFIG_H and always
need to include this file, so the ifdef can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:38:31 +00:00
Michel Dänzer 23dde0860c xwayland/present: Update surface window again if manual redirect fails
Even if the manual redirect didn't result in the surface window we
wanted, it might be different again without the redirect.

I don't know of any specific scenario hitting this though, it's more of
a theoretical safeguard.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1637>
2024-10-02 08:02:03 +00:00
Michel Dänzer e6c649e6e6 xwayland/glamor: Try manual redirect only if parent window has depth 32
That's the case 8e8bc0a1ef ("xwayland: Try manual redirection for
surface window in glamor_check_flip") was intended for. If the parent
window doesn't have depth 32, the automatic redirection might have been
done by a client, in which case doing the manual redirection may run
into trouble.

Fixes: 8e8bc0a1ef ("xwayland: Try manual redirection for surface window in glamor_check_flip")
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1724
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1637>
2024-10-02 08:02:03 +00:00
Mike Blumenkrantz ff8ec59c97 xwayland: connect to the wl display before calling into EGL
using EGL (e.g., eglQueryString, epoxy_has_egl_extension)
before establishing this connection
enables the GBM/EGL implementation to potentially consume the
WAYLAND_SOCKET fd, which, if closed, will cause the compositor
to kill this xserver

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1646>
2024-09-24 08:07:39 +00:00
Enrico Weigelt, metux IT consult cda799533f xfree86: os-support: bsd: fix missing include of xf86_OSproc.h
Missing include of xf86_OSproc.h leads to missing prototype warnings.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1697>
2024-09-13 17:47:01 +02:00
Enrico Weigelt, metux IT consult fb697dd644 dix: unexport dixLookupProperty()
It's not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1340>
2024-09-02 17:50:47 +00:00
Enrico Weigelt, metux IT consult 955cc5417b include: split out non-exported stuff from property.h
Reduce cluttering public interface with non-exported stuff, moving those
things into a separate internal header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1340>
2024-09-02 17:50:47 +00:00
Enrico Weigelt, metux IT consult bd3c252710 dix: unexport NewCurrentScreen()
It's not used by external modules/drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Enrico Weigelt, metux IT consult 4aadbeb8aa dix: unexport cursor refcounting functions
These aren't used externally (drivers/modules), thus no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Olivier Fourdan 7bcf2bcafc build: Add epoll to Xwayland for DragonFly and OpenBSD
DragonFly and OpenBSD rely on epoll-shim for <sys/eventfd>, add a
optional dependency to build Xwayland.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1642>
2024-09-02 11:52:26 +00:00
Matthieu Herrb fbc034e847 Fix a double-free on syntax error without a new line.
$ echo "#foo\nfoo" > custom_config $ X -config custom_config

will trigger the double free because the contents of xf86_lex_val.str
have been realloc()ed aready  when free is called in read.c:209.

This copies the lex token and adds all the necessary free() calls to
avoid leaking it

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1176>
2024-09-01 23:28:20 +00:00
Enrico Weigelt, metux IT consult 03eb593460 include: unexport XIstubs.h
The functions declared here aren't used by any driver, so no need to keep
them in the public driver API. Since the whole file isn't included by anybody
outside the xserver tree itself, it doesn't need to be installed at all,
so making it internal and move it to Xi directory.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1325>
2024-09-01 22:21:12 +00:00
Enrico Weigelt, metux IT consult 1bfa4876f6 dix: move colormap flags into colormap_priv.h and rename them
These aren't used by any drivers/modules, so no need to keep them exported.
As already touching them, give them a proper name prefix for clarity.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult 5dc5d2965b dix: unexport QueryColors()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult 989c46fc9d dix: unexport FakeAllocColor()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:49 +00:00
Enrico Weigelt, metux IT consult ece72f50fe dix: unexport TellLostMap()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:49 +00:00
Enrico Weigelt, metux IT consult 7ce67a99bc dix: unexport CreateColormap()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:49 +00:00
Enrico Weigelt, metux IT consult 6c6944be14 os: utils: drop unused VENDORSUPPORT
This doesn't seem to be used anymore for two decades now,
so there's probably no need to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult 2cec3cfbf1 include: move private definitions out of input.h
It's not good having the public server api headers clobbered with private
definitions, so cleaning them up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1354>
2024-09-01 17:59:23 +00:00
Enrico Weigelt, metux IT consult 646831cda2 include: dixfontstr.h: drop silent dependency on libxfont2
This header includes libxfont2.h, but the dependency isn't stated anywhere,
causing some drivers to FTBS (when libxont2.h is in non-standard location).

Since this header doesn't seem to need including libxfont2.h at all, just
stop including it, instead of adding yet another dependency to server SDK.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1610>
2024-09-01 17:45:13 +00:00
Alan Coopersmith 62c9f52e41 Remove remnants of support for SVR4 systems other than Solaris & illumos
Most of the support for such OS'es was removed in 2010 for
xorg-server-1.10.0, but a few bits lingered on.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1667>
2024-09-01 02:14:10 +00:00
Alan Coopersmith f35951d83e Remove remnants of support for SysV versions before SVR4
Most of the support for such OS'es was removed in 2010 for
xorg-server-1.10.0, but a few bits lingered on, and a few
comments were left out-of-date.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1667>
2024-09-01 02:14:10 +00:00
Enrico Weigelt, metux IT consult 12f71ede8a Xnest: use Xorg's TRUE/FALSE instead of Xlib's True/False
Use Xserver's defines instead of Xlib's ones. The values are the same.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1657>
2024-09-01 00:48:52 +00:00
Enrico Weigelt, metux IT consult 0d3ae98661 Xnest: split off event handler
Tidy it up a bit and split the actual request handler from the request
reading loop, making upcoming reworks easier to review (smaller diffs).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1661>
2024-09-01 00:38:30 +00:00
Enrico Weigelt, metux IT consult 3597323d48 Xnest: xnestCollectEvents(): scope local variables
Make the code easier to read/understand by scoping variables to where
exactly they're needed. Also a preparation for subsequent reworks
(keep the diff smaller and thus easier to review)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1661>
2024-09-01 00:38:30 +00:00
Enrico Weigelt, metux IT consult e1c47ad123 Xnest: fix broken exposure events
Xnest fails to properly pass through expose events: the coordinates are
miscalculated in xnestCollectExposures(), before miSendExposures() is called.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1735
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1634>
2024-08-31 23:45:26 +00:00
Enrico Weigelt, metux IT consult ea042cd6ef Xnest: Display.h: fix missing include of colormap.h
Needs some types (eg. Pixel) from colormap.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1660>
2024-08-31 23:32:54 +00:00
Enrico Weigelt, metux IT consult 4db1da86fc Xnest: XNGC.h: add missing includes
This header makes use of types and functions defined in gcstruct.h and
privates.h. It should include them, instead of demanding it's consumers
having done that before including this file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1659>
2024-08-31 23:21:21 +00:00
Enrico Weigelt, metux IT consult eafd687c47 Xnest: add guards to Xnest.h
protect it from duplicate inclusion.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1658>
2024-08-31 23:09:30 +00:00
Enrico Weigelt, metux IT consult 720651ebf3 Xnest: Keyboard: drop unnecessary include
<X11/extensions/XKBconfig.h> isn't needed, so drop it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1649>
2024-08-26 11:33:40 +02:00
Enrico Weigelt, metux IT consult 8d5584558f Xnest: cursor: fix potentially uninitialized memory
It's safer to zero-out the cursor-private memory on allocation,
instead of relying on being cleared initialized somewhere later.

Fixes: 3f3ff971ec - Replace X-allocation functions with their C89 counterparts
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1652>
2024-08-26 03:58:28 +00:00
Enrico Weigelt, metux IT consult f26f17c66a treewide: mark pGC->ops->CopyArea() calls not using result as void
We alread have several of these calls, that aren't interested in result value,
explicitly casting to void. Fixing this up for the remaining ones.

This is helpful for the human reader as well as quality analysis tools.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1648>
2024-08-26 03:44:23 +00:00
Olivier Fourdan e2e5842444 xwayland: Report correct mode size when rootful
The vidmode extension emulation in Xwayland reports the modeline based
on the current mode.

To do so, it searches for the mode using `xwl_output_find_mode(-1, -1)`
which is supposed to return the current mode, whatever that mode is.

With XRandR emulation, in rootless mode, the default value is the mode
at index 0. That assumption, however is not true when running rootful.

That means that the vidmode extension will always return the highest
mode available, which is 5120x2880, with Xwayland running rootful:

  $ xwayland-run -geometry 1024x768 -- xvidtune -show
  "5120x2880"   1276.50   5120 5560 6128 7136   2880 2883 2888 2982 -hsync +vsync

Luckily, when Xwayland is running rootful, we have the current mode size
conveniently stored in dedicated fields of the xwayland output struct,
so we can use that to search for the right mode being used and report
that through the vidmode extension:

  $ xwayland-run -geometry 1024x768 -- xvidtune -show
  "1024x768"     63.50   1024 1064 1176 1328    768  771  775  798 -hsync +vsync

That fixes legacy games using the vidmode extension and rendering at the
wrong size when running within Xwayland rootful.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1641>
2024-08-13 10:08:19 +02:00
Ian Douglas Scott 386b54fbe9 xwayland: Release keys on keyboard `enter` event if `leave` wasn't received
The code here assumed a `leave` event always occurs between two `enter`
events. On Sway (and presumably other compositors) this happens even if
the client has destroyed the `wl_surface`, but the client gets a null
`surface` here. (Which presumably on on the wire is the id of the
destroyed surface.)

This seems like a bad thing to rely on, and is easy to avoid. But if
this is correct to assume, the Wayland protocol should be explicit about
this.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1527>
2024-08-05 09:10:51 +00:00
Olivier Fourdan 23c295ea8b xwayland: Do not include sys/eventfd.h without DRI3
Now that we won't enable DRI3 if <sys/eventfd.h> is not available, there
is not point in trying to include that header without DRI3.

That allows to build Xwayland with GLAMOR enabled (without DRI3) on
platforms which do not support eventfd.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1523>
2024-08-05 10:24:58 +02:00
Olivier Fourdan a58352b985 xwayland: Fix build without DRI3 enabled
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1668
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1523>
2024-08-05 10:24:58 +02:00
Olivier Fourdan 0525b9a5b9 xwayland/ei: Dequeue events when all caps are available
Currently, we would start dequeuing events as soon as a device is
resumed, regardless of its capabilities.

If the capabilities are not available, we would just fallback to the
regular XTEST code path and not use input emulation.

As a result, it is very likely that we shall lose the first events until
the compositor resumes first a device with the requested capabilities.

To avoid that issue, start emulating only once we have the requested
capabilities, if they match the seat capabilities.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1732
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1631>
2024-07-31 06:04:12 +00:00
Olivier Fourdan 68ec297ee9 xwayland/ei: Move code to helper function
This is a small code refactoring to help with clarity, simply move the
code from the switch case for device resume to a dedicated function.

No functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1631>
2024-07-31 06:04:12 +00:00
Alan Coopersmith bbc758d47b compiler.h: drop translation of Sun compiler platform defines to gcc
Missed when the rest of Sun compiler support was removed by
commit 6dafe3dbe6.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1628>
2024-07-28 23:26:37 +00:00
Enrico Weigelt, metux IT consult 58a2fb8b6f xv: unexport XvScreenRec and XvScreenPtr
Not used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult 01de53c815 xv: unexport XvFreeAdaptor()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult dec57e5796 treewide: replace xnfstrdup() calls by XNFstrdup()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:34 +00:00
Enrico Weigelt, metux IT consult f446235b71 treewide: replace xnfcalloc() calls by XNFcallocarray()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult 9ec31d1a88 treewide: replace strdup() calls to Xstrdup()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult a1fd7e7ba5 treewide: replace xnfrealloc() calls to XNFrealloc()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult 61233adbca treewide: replace xnfreallocarray macro call by XNFreallocarray()
The xnfreallocarray was added along (and just as an alias to) XNFreallocarray
back a decade ago. It's just used in a few places and it's only saves us from
passing the first parameter (NULL), so the actual benefit isn't really huge.

No (known) driver is using it, so the macro can be dropped entirely.

Fixes: ae75d50395
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult 6b3c916030 treewide: replace xnfallocarray() calls by XNFreallocarray
The xnfallocarray was added along (and just as an alias to) XNFreallocarray
back a decade ago.

No (known) driver is using it, so the macro can be dropped entirely.

Fixes: ae75d50395
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult c55ddd072b treewide: replace xnfalloc() calls to XNFalloc()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Fixes: ded6147bfb
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Olivier Fourdan 1a42fe40d0 xwayland/ei: Log the type name of unhandled events
Currently, we would log only the event type, use the libei API to also
log the name in plain text, so we can quickly identify the events we're
missing out.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1620>
2024-07-25 23:13:16 +00:00
Olivier Fourdan bfabd3bdab xwayland/ei: Handle EI_EVENT_KEYBOARD_MODIFIERS
Although we do not do anything with that event, handle it so we don't
end up in the "Unhandled event" territory.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1722
Fixes: a133334270 - xwayland: Add XTEST support using EIS
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1620>
2024-07-25 23:13:16 +00:00
Olivier Fourdan 66f5e7e96a xwayland: Make sure output is suitable for fullscreen
Since commit d370f1e58, Xwayland can optionally be started rootful and
fullscreen.

To do so, it will setup a viewport to scale the root window to match the
size of the output.

However, if the rootful Xwayland window receives an xdg-surface configure
event before the output definition is complete, as with e.g. the labwc
Wayland compositor, we might end up trying to setup a viewport with a
destination size of 0x0 which is a protocol violation, and that kills
Xwayland.

To avoid that issue, only setup the viewport if the output size is
meaningful.

Also, please note that once the output definition is complete, i.e. when
the "done" event is eventually received, we shall recompute the size for
fullscreen again, hence achieving the desired fullscreen state.

Fixes: d370f1e58 - xwayland: add fullscreen mode for rootful
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1717
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1621>
2024-07-24 15:42:19 +02:00
Enrico Weigelt, metux IT consult b30edf326b fix missing includes of <X11/Xfuncproto.h>
Several places using _X_ATTRIBUTE_PRINTF macro from X11/Xfuncproto.h
but missing to include it, so it depends on other headers whether it's
included by mere accident, which quickly causes trouble if include order
changes. Cleaning that up by adding explicit include statements.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1580>
2024-07-20 17:18:38 +00:00
Alan Coopersmith 522f469fe9 Move sizeof to second argument in calloc calls
Clears -Wcalloc-transposed-args warnings from gcc 14.1, such as:

../dix/main.c:165:42: warning: ‘calloc’ sizes specified with ‘sizeof’ in the
 earlier argument and not in the later argument [-Wcalloc-transposed-args]
  165 |             serverClient = calloc(sizeof(ClientRec), 1);
      |                                          ^~~~~~~~~
../dix/main.c:165:42: note: earlier argument should specify number of
 elements, later size of each element

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1606>
2024-07-19 23:45:21 +00:00
Olivier Fourdan 7203626173 xwayland: Check for pointer in xwl_seat_leave_ptr()
Since commit 792758fa ("xwayland: Update lost focus on deactivation"),
in rootful mode, if we receive an "activated" state from xdg-shell
indicating that the surface is no longer active, we shall end up calling
xwl_seat_leave_ptr().

But xwl_seat_leave_ptr() does not actually check whether the seat has
pointer capabilities, and if not, get_pointer_device() will return NULL.

As a result, we would crash using a NULL pointer in GetMaster(). This
typically can happen when using Xwayland rootful on headless compositors
such as "cage" which do not advertise any capabilities for the seat.

To avoid the issue, simply check whether get_pointer_device() returns a
valid non-null device and bail out early otherwise.

Fixes: 792758fa - xwayland: Update lost focus on deactivation
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1700
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1590>
2024-07-09 09:21:12 +00:00
Enrico Weigelt, metux IT consult 9f78d548e5 fix FTBS on NetBSD
../hw/xfree86/os-support/bsd/bsd_init.c: In function ‘xf86CloseConsole’:
../hw/xfree86/os-support/xf86_os_support.h:22:6: error: ‘dispatchException’ undeclared (first use in this function)
   22 |  if (dispatchException & DE_TERMINATE) { \
      |      ^~~~~~~~~~~~~~~~~
../hw/xfree86/os-support/bsd/bsd_init.c:634:13: note: in expansion of macro ‘xf86FatalError’
  634 |             xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
      |             ^~~~~~~~~~~~~~
../hw/xfree86/os-support/xf86_os_support.h:22:6: note: each undeclared identifier is reported only once for each function it appears in
   22 |  if (dispatchException & DE_TERMINATE) { \
      |      ^~~~~~~~~~~~~~~~~
../hw/xfree86/os-support/bsd/bsd_init.c:634:13: note: in expansion of macro ‘xf86FatalError’
  634 |             xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
      |             ^~~~~~~~~~~~~~
../hw/xfree86/os-support/xf86_os_support.h:22:26: error: ‘DE_TERMINATE’ undeclared (first use in this function); did you mean ‘ACTION_TERMINATE’?
   22 |  if (dispatchException & DE_TERMINATE) { \
      |                          ^~~~~~~~~~~~
../hw/xfree86/os-support/bsd/bsd_init.c:634:13: note: in expansion of macro ‘xf86FatalError’
  634 |             xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
      |             ^~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1575>
2024-07-06 19:40:10 +00:00
Olivier Fourdan a5e863963e xwayland: Force disposal of windows buffers for root on destroy
With explicit buffer synchronization in use, the window buffers use a
file descriptor for event notification to keep the buffer alive for
synchronization purpose.

When running rootful, the root window (which is visible) is destroyed
directly from the resource manager on server reset, and the window
buffer's eventfd will trigger after the window is destroyed, leading to
a use after free and a crash of the xserver.

To avoid the issue, check whether the window being destroyed is the root
window in rootless mode, and make sure to force the disposal of the
window buffers in that case.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1699
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1589>
2024-07-04 08:26:23 +00:00
Olivier Fourdan fa04e15afc xwayland/window-buffers: optionally force disposal
For cases (to come) where we would want to force the disposal of the
window buffers, add a parameter to force the disposal by calling
dispose() directly instead of maybe_dispose().

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1589>
2024-07-04 08:26:23 +00:00
Olivier Fourdan 571cb13342 xwayland/window-buffers: Move buffer disposal to its own function
No functional change, this is just preparation work for the next commit.

v2: Reshuffle functions (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1589>
2024-07-04 08:26:23 +00:00
Olivier Fourdan 0e1a98f52f xwayland: Make sure we do not leak xwl_window on destroy
Right now, we would dispose the xwl_window and all the data associated
with it on unrealize.

But not all window destruction go through the unrealize code path, for
example when the root window (running rootful) is destroyed from the
resource manager on server reset, we do not get to the unrealize window
step, but straight to destroy window.

As a result, we are leaking the xwl_window and all the data associated
with it, for example:

| 65,536 bytes in 1 blocks are possibly lost in loss record 12,462 of 12,488
|    at 0x484A0FC: calloc (vg_replace_malloc.c:1675)
|    by 0x48B661C: UnknownInlinedFun (pixman-bits-image.c:1273)
|    by 0x48B661C: _pixman_bits_image_init (pixman-bits-image.c:1296)
|    by 0x48B6754: create_bits_image_internal (pixman-bits-image.c:1349)
|    by 0x64180DE: UnknownInlinedFun (cairo-image-surface.c:380)
|    by 0x64180DE: UnknownInlinedFun (cairo-image-surface.c:366)
|    by 0x64180DE: cairo_image_surface_create (cairo-image-surface.c:432)
|    by 0x6346B44: UnknownInlinedFun (libdecor-gtk.c:467)
|    by 0x6346B44: libdecor_plugin_gtk_frame_new (libdecor-gtk.c:546)
|    by 0x4B7F297: libdecor_decorate (libdecor.c:559)
|    by 0x42C6F3: xwl_create_root_surface (xwayland-window.c:1266)
|    by 0x42CD97: ensure_surface_for_window (xwayland-window.c:1466)
|    by 0x42D0D1: xwl_realize_window (xwayland-window.c:1560)
|    by 0x50858F: compRealizeWindow (compwindow.c:279)
|    by 0x4FF2A2: MapWindow (window.c:2706)
|    by 0x4F9E7F: InitRootWindow (window.c:697)

To avoid that issue, check whether there is still an xwl_window
associated with the X11 window on destroy, and if that's the case,
dispose the xwl_window.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1589>
2024-07-04 08:26:23 +00:00
Olivier Fourdan 74be7a7f36 xwayland: Move xwl_window disposal to its own function
No functional change intended, this is just preparation work for the
next commit.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1589>
2024-07-04 08:26:23 +00:00
Olivier Fourdan bc9bf56360 xwayland/window-buffers: Set syncpnts for all pixmaps
The wp_linux_drm_syncobj_v1 protocol states that :

| If at surface commit time there is a pending buffer attached but no
| pending release timeline point set, the no_release_point protocol
| error is raised.

So we need to set a release timeline point in any case from the swap
pixmap routine, even for the early out code paths.

Failing to do so may cause a Wayland protocol error that is fatal to the
Wayland client, in this case Xwayland:

| wp_linux_drm_syncobj_surface_v1: error 4: No Acquire point provided
| (EE) failed to dispatch Wayland events: Protocol error

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1688
Fixes: 87bf2cafcc - xwayland: add support for wp_linux_drm_syncobj_v1
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan 33330f0dc9 xwayland/window-buffers: Move code to submit pixmaps
Move the code which takes care of submitting pixmaps and the
synchronization points to its own function.

This will allow to reuse that code from different code path.

No functional change intended.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan aab01c7391 xwayland/window-buffers: Do not always set syncpnts
The function xwl_window_swap_pixmap() can be called from two places,
either from xwl_window_attach_buffer() or from damage_report().

When called from xwl_window_attach_buffer(), the new buffer is attached
and the surface committed.

However, when called from damage_report(), a new buffer might not be
attached before the surface is committed.

That's fine with implicit synchronization, but if we use explicit
synchronization, committing a surface without a new buffer attached but
with a release timeline point set is a protocol error:

| If at surface commit time there is a pending release timeline point
| set but no pending buffer attached, a no_buffer error is raised.

To avoid such an issue, add a new parameter to xwl_window_swap_pixmap()
to hint whether it should set the synchronization points, and have the
synchronization points set only from xwl_window_attach_buffer().

v2: Rename param to handle_sync (Michel)

Suggested-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan 256cef8b20 xwayland/window-buffers: Use synchronization from GLAMOR/GBM
Now that we have the buffer synchronization implemented in the
GLAMOR/GBM code, switch to use that code.

At this point, there is still not functional change intended, this is
still preparation work for a fix that is still to come.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan cc021aca99 xwayland/glamor/gbm: Copy explicit sync code to GLAMOR/GBM
Copy the code to deal with synchronization objects from the window
buffers to the GLAMOR/GBM code.

The idea is to deal with synchronizations for all pixmaps, even when
there is no window buffer involved.

This is still preparation work for the following commits, no functional
change intended at this point.

v2: Use a "xwl_window_buffer *" instead of a "void *data" (Michel)
v3: Bail early if there's no xwl_window_buffer (Michel)
v4: Rename xwl_window_submit_pixmap() to
    xwl_glamor_gbm_wait_release_fence() (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan b5082073b0 xwayland/window-buffers: Add xwl_window_buffer_release()
We want to decorrelate the explicit buffer synchronization from the
window buffers, and move that to the GLAMOR/GBM code instead.

To do that, we need to be able to invoke the xwl_window_buffer's
release_callback() routine from outside the window buffer code.

For that purpose, introduce xwl_window_buffer_release() which calls
xwl_window_buffer_release_callback() for us.

This is preparation work for the following changes, no functional change
intended at this point.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan 0e0472a005 xwayland/window-buffers: Promote xwl_window_buffer
Make the (opaque) definition of the xwl_window_buffer generally
available.

No functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
nerdopolis 05c63d2a02 modesetting: Fix hang when all probed cursor sizes fail to find a minimum one
This fixes a hang on simpledrm where min_cursor_height and min_cursor_width is
never established, and drmmode_load_cursor_argb_check would infinitely when
the minimum values where 0 or less.
2024-06-24 09:53:11 -04:00
Michel Dänzer 8e8bc0a1ef xwayland: Try manual redirection for surface window in glamor_check_flip
If the surface window already uses automatic redirection, we can upgrade
to manual redirection and save some blits with common use cases.

This fixes a minor performance regression from a65bb8480a ('Revert
"xwayland/glamor: Avoid implicit redirection with depth 32 parent
windows"') with mutter >= 44.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1570>
2024-06-24 08:26:46 +00:00
Michel Dänzer e1b8a12194 xwayland: Only ignore manual redirection by clients for surface window
If the manual redirection was done by xwl_present_maybe_redirect_window,
we are in control.

This allows xwl_present_maybe_redirect_window to work as intended again.
Previously, xwl_window_update_surface_window would ignore the window
redirected by xwl_present_maybe_redirect_window, which would result in
xwl_present_maybe_redirect_window undoing the redirection and bailing.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1570>
2024-06-24 08:26:46 +00:00
Michel Dänzer ed575eee81 xwayland: Drop pixmap parameter from xwl_present_maybe_redirect_window
Never used.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1570>
2024-06-24 08:26:46 +00:00
Enrico Weigelt, metux IT consult 34662f15af os: unexport fields from opaque.h not used by modules / drivers
There're lots of field that aren't used by any modules or drivers,
thus no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1351>
2024-06-23 21:19:27 +00:00
Enrico Weigelt, metux IT consult 06b599edb6 dix: unexport fields from opaque.h not used by modules/drivers
Lots of fields from opaque.h aren't used by any drivers/modules and thus
don't need to be exported at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1351>
2024-06-23 21:19:27 +00:00
Enrico Weigelt, metux IT consult 487eb46826 os: move xserver_poll.h into os/ directory
This header isn't public and holds defines for code in os/ directory,
so no need to keep it in the global header dir - it's probably better
off in os/ directory - just like we already have with many others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1389>
2024-06-21 00:53:39 +00:00
Enrico Weigelt, metux IT consult 229a6953ad xfree86: x86emu: rename segment register fields
Instead of keeping lots of special hacks for Solaris, just rename the
field of struct i386_segment_regs, so we don't need special care anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1548>
2024-06-18 00:41:38 +00:00
Enrico Weigelt, metux IT consult 0a0731721f xfree86: common: include math.h unconditionally
The header exists on all supported platform, maybe some might still need
to define _XOPEN_SOURCE to get pow() defined.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1548>
2024-06-18 00:41:38 +00:00
Enrico Weigelt, metux IT consult fd6fe36622 xfree86: os-support: simplify pci init
All supported platforms, except Linux, have have to call xf86InitVidMem()
from xf86scanpci(), so we can make the code much simpler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1548>
2024-06-18 00:41:38 +00:00
Enrico Weigelt, metux IT consult 1b49f6ddb8 kdrive: drop Solaris specific hack
Since kdrive is only working on Unix'es, we don't need to care whether
that file might not exist on Windows, neither any need for doing so
exlusively on Solaris.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1548>
2024-06-18 00:41:38 +00:00
Olivier Fourdan 32e16082c5 xwayland: Stop on first unmapped child
If a child window of the same size is unmapped, we should stop walking
the tree looking for the surface window to use.

Whatever lies beneath is not visible anyway.

This also fixes an issue with the Damage list becoming corrupted when
destroying a window, because the first thing that DeleteWindow() does
is to unmap the window and crush the window tree underneath it.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Fixes: 3a0fc268 - xwayland: Add xwl_window::surface_window
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1680
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1564>
2024-06-17 07:06:38 +00:00
Olivier Fourdan 0509b13fa2 xwayland: Do not use manual redirect windows as surface window
While walking the window tree looking for the surface window to use, we
should ignore windows using manual redirection.

If a client manually redirects a window, it has control over how the
contents of that window are presented. It's not safe to present them
directly to the Wayland compositor.

v2: break instead of continue, reword commit message (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Fixes: 3a0fc268 - xwayland: Add xwl_window::surface_window
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1677
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1679
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1564>
2024-06-17 07:06:38 +00:00
Chenx Dust 7605833315 xwayland: fix segment fault in `xwl_glamor_gbm_init_main_dev`
Function `xwl_glamor_gbm_init_main_dev` does not check whether
`xwl_screen->default_feedback.main_dev` a.k.a. `main_dev` is a
valid pointer. This result in some special situation where main
linux-dmabuf device is not accessible, such as KWin nested desktop,
raising segment fault.

This commit add a null pointer check to prevent crashing.

Signed-off-by: Chenx Dust <chenx_dust@outlook.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1683
Fixes: d7f1909e - xwayland/glamor/gbm: make wl_drm optional
See-also: https://bugzilla.redhat.com/2284141
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1565>
2024-06-14 09:53:12 +00:00
Rouven Czerwinski b9754729e1 xwayland: install pkgconfig to sharedir
Remove the previous change which ensured that the xwayland pkgconfig
file was installed into $libdir. This is a breaking change for build
systems searching for the xwayland pkg-config file. The sharedir
location fits xwayland better since the pkg-config file does not contain
linking information, it only contains the data on how to locate the
xwayland binary and which features are enabled.

Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1543>
2024-05-31 11:55:12 +00:00
Rouven Czerwinski 9df084c8d1 xwayland: remove includedir from pkgconfig
Before this change, the xwayland pkgconfig file will always contain an
includedir directive, even though xwayland is not a linkable shared
library:

  prefix=/nix/store/3spcjqp5zcyg8arz6dnsj59fal5yk3jy-xwayland-23.2.6
  includedir=${prefix}/include

  exec_prefix=${prefix}
  xwayland=/nix/store/3spcjqp5zcyg8arz6dnsj59fal5yk3jy-xwayland-23.2.6/bin/Xwayland
  […]
  Cflags: -I${includedir}

According to a bug reporter this trips up cmake [1], which expects that
the include directory exists, which it does not since xwayland does not
install any header files.

Add the dataonly directive to pkgsconfig.generate() which will remove
the default "." subdir and ensures that includedir is not set inside the
pkgconfig file. Additionally enforce the install directory to
$libdir/pkgconfig, since it otherwise will be installed to
$datadir/pkgconfig, which precludes programs from finding the pkgconfig
because share/pkgconfig is usually not included in the search path.

The resulting pkgconfig does not contain an includedir:

  prefix=/nix/store/p7xhdzl65hfhzf36vxykzp2i9cyy7y6c-xwayland-23.2.6

  exec_prefix=${prefix}
  xwayland=/nix/store/p7xhdzl65hfhzf36vxykzp2i9cyy7y6c-xwayland-23.2.6/bin/Xwayland
  have_glamor=true
  have_eglstream=true
  have_initfd=true
  have_listenfd=true
  have_verbose=true
  have_terminate_delay=true
  have_no_touch_pointer_emulation=true
  have_force_xrandr_emulation=true
  have_geometry=true
  have_fullscreen=true
  have_host_grab=true
  have_decorate=false
  have_enable_ei_portal=true
  have_byteswappedclients=true

  Name: Xwayland
  Description: X Server for Wayland
  Version: 23.2.6

[1]: https://github.com/NixOS/nixpkgs/pull/309075#issuecomment-2108381428

Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1543>
2024-05-31 11:55:12 +00:00
Yusuf Khan c5d152c176 modesetting/dri2: Remove always true ifdef
GLAMOR_HAS_GBM is ifdefed through the whole file, so checking for it
again is redundant.

Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1554>
2024-05-22 05:34:30 +00:00
Michael Dluhosch e61bd1e5fd xkb: Replaced hardcoded values with compile time options
The core keyboard before this change always used a layout of "us" even if you
configured the build with another default layout.

Signed-off-by: Michael Dluhosch <michael.dluhosch@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1549>
2024-05-15 19:37:19 +02:00
Alan Coopersmith 7e119c5114 solaris: convert APM interfaces to official SRN interfaces
The sun_apm.c support was written to a draft version of the interfaces that
were integrated under a different name (SRN - Suspend/Resume Notification)
in 2007 for OpenSolaris, and what eventually became Solaris 11.0. Adopt the
official names and use the system-provided header file for these now.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1540>
2024-05-14 04:12:44 +00:00
Alan Coopersmith a4d298d855 xf86_OSlib.h: Don't need to include Solaris keyboard headers here
Left over from the builtin keyboard driver removed from the Xorg
server in 2006 (commit 3eeb62e8f5).

Requires xorg/driver/xf86-input-keyboard@40ef7d9e24987eb6708d822d0ea070
to build the current keyboard driver with this change.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1541>
2024-05-13 23:14:48 +00:00
Olivier Fourdan 702a419c39 xwayland: Move XRandR emulation to the ResizeWindow hook
This restores the handling of the XRandR emulation for Xwayland rootless
where it was before commit fa7b1c20.

Some compositors may trigger a protocol error if the viewport source is
larger than the actual window size, having that handled in the window
resize hook makes sure we do not regress.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1521>
2024-05-13 08:52:32 +00:00
Olivier Fourdan 31d6f9998d xwayland: Handle rootful resize in ResizeWindow
Commit fa7b1c20 ("xwayland: Use ConfigNotify screen hook instead of
ResizeWindow") replaced the WindowResize hook with ConfigNotify.

However, that's breaking rootful Xwayland with libdecor because the root
window size is already set so the libdecor size is not updated, and the
root size will be reverted back as soon as the focus changes.

Reinstate the rootful size change in ResizeWindow to avoid that issue.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1669
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1671
Fixes: fa7b1c20 - xwayland: Use ConfigNotify screen hook instead of ResizeWindow
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1521>
2024-05-13 08:52:32 +00:00
Olivier Fourdan 539859bde0 xwayland: Restore the ResizeWindow handler
For now it just chains to ResizeWindow hook.

This is preparation work for the next commit, no functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1521>
2024-05-13 08:52:32 +00:00
Joshua Ashton 7745fde24e xwayland: Send ei_device_frame on device_scroll_discrete
This fixes the scroll action in Steam Input in SteamOS/Gamescope when using the new libeis backend.

Fixes: a133334270 ("xwayland: Add XTEST support using EIS")
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1531>
2024-05-11 07:25:48 +01:00
Trevor Davenport 69beb65653 modesetting: Fix invalid identity CTM on 32-bit.
On 32-bit, the shifts used to initialized the identity CTM overflow and
result in zero instead of the intended 1.  This results in a broken
display (on at least i915) when using the modesetting xorg driver.

Fix the invalid CTM by using ULL suffix on the shifts.

Fixes:4e670f1281ad75c5673b6ac75645036d810da8d9

Signed-off-by: Trevor Davenport <trevor_davenport@selinc.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1526>
2024-05-09 11:59:55 -06:00
Enrico Weigelt, metux IT consult e5c8b664d3 os: unexport ddx callbacks
The DDX callbacks (where core/DIX calls into DDX) aren't supposed to be
called by drivers directly, so unexport them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1332>
2024-05-08 09:37:35 +02:00
Olivier Fourdan a7ba1e9fe4 xquartz: Remove invalid Unicode sequence
This is flagged by the automatic scanning tools.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1673
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1524>
2024-05-07 22:26:34 +00:00
Vlad Zahorodnii 8c2b9f4e71 xwayland: Use correct xwl_window lookup function in xwl_set_shape
In xwl_set_shape(), xwl_window_set_input_region() should be called only
when the input shape of the toplevel window changes.

However, given that xwl_window_from_window() is going to walk the
ancestor tree until it finds an xwl_window, that lookup function cannot
be used. Instead, xwl_window_get() should be used. It's going to return
a valid xwl_window object iff the specified window has one associated
with it.

Fixes: a4ed100c0 - xwayland: Set wl_surface input region
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1672
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1516>
2024-05-06 14:47:39 +00:00
Michel Dänzer 069ad69efe xwayland/present: Drop vblank->flip_ready assignment
Xwayland hasn't used the flip_ready field's value for anything since
e1f16fb1ac ("xwayland: don't scrap pending present requests").

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1511>
2024-05-02 08:17:35 +00:00
Michel Dänzer 0d9a54aa97 xwayland/present: Skip queued flip when a new one becomes ready
If multiple flips become ready for the same MSC, we would previously
execute them all sequentially, one per MSC for sync flips. This could
result in an unbounded flip queue and corresponding memory consumption.

With implicit sync, leave the mailbox handling to the compositor for
async flips though.

v2:
* Use present_vblank_rec::sync_flip.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1664
Fixes: e1f16fb1ac ("xwayland: don't scrap pending present requests")
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1511>
2024-05-02 08:17:35 +00:00
Erik Kurzinger d5192ba8eb xwayland: use write fence in xwl_glamor_dmabuf_import_sync_file
The functions xwl_glamor_dmabuf_import_sync_file and
xwl_glamor_dmabuf_export_sync_file are used to ensure proper
synchronization between clients using PresentPixmapSynced and
compositors that do not support the wp_linux_drm_syncobj_v1 protocol
when presenting by flipping. The acquire point's fence will be imported
as the DMA-BUF's implicit fence before handing it off to the compositor,
and then, after the DMA-BUF has been released, its new implicit fence
will be exported and become the release point's fence which the client
is expected to wait for before re-using the buffer.

Both functions currently set the flags arguments of their respective
ioctls to DMA_BUF_SYNC_READ. When importing a sync file, this means that
any subsequent implicitly synchronized reads from the buffer will not
wait for the fence, and when exporting a sync file it means that the
returned fence may be signaled before preceeding reads from the buffer
have completed.

While this is correct for xwl_glamor_dmabuf_export_sync_file since the
compositor will never write to the buffer, it is incorrect for
xwl_glamor_dmabuf_import_sync_file. To avoid corruption, we need any
reads from the buffer by the compositor to wait on the acquire point's
fence.

As a fix, instead of setting the DMA_BUF_SYNC_READ flag in
xwl_glamor_dmabuf_import_sync_file, we set the DMA_BUF_SYNC_WRITE flag.
This *does* provide the necessary guarantees.

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1509>
2024-04-30 13:18:30 +00:00
Vlad Zahorodnii a4ed100c0c xwayland: Set wl_surface input region
Some applications that use client side decorations usually set custom
input shape in order to prevent drop shadows stealing pointer events
from windows below. Currently, the only way to get it is to use some
XFixes APIs.

On the other hand, plenty of wayland compositors use solely the
wl_surface input region to decide what view can receive pointer input,
which results in some pointer input issues around client side drop
shadows because Xwayland doesn't set wl_surface.input_region.

See-also: https://bugs.kde.org/show_bug.cgi?id=448119
Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1510>
2024-04-30 12:46:49 +00:00
Olivier Fourdan 4053782443 xwayland: Do not remove output on withdraw if leased
On DRM lease connector withdrawn event, Xwayland would free the
corresponding xwl_output offered for lease.

However, the pointer is still referenced from the rrLease->outputs[],
meaning that trying to clean up the RANDR DRM leases as done with commit
ef181265 (xwayland: Clean up drm lease when terminating) would cause a
use after free and random crashes.

To avoid that issue, on the connector withdraw event, set the connector
withdrawn flag but do not to remove (i.e. free) the xwayland output if
its is offered for lease.

Then, once the lease is terminated, check for the xwl_outputs with a
withdrawn connector and remove them (once we have no use for them
anymore.

Note that we cannot do that cleanup from xwl_randr_terminate_lease() as
removing the xwl_output will free the RRcrtc resources, which checks for
leases in XRANDR, and calls RRTerminateLease(), which chains back to
xwl_randr_terminate_lease().

v2: Use a "withdrawn_connector" flag to mark outputs to remove (Xaver)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Xaver Hugl <xaver.hugl@kde.org>
fixes: ef181265 - xwayland: Clean up drm lease when terminating

See-also: https://gitlab.freedesktop.org/xorg/xserver/-/issues/946
See-also: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1130
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1482>
2024-04-30 09:13:34 +02:00
Olivier Fourdan 21916ae148 xwayland: Check for outputs before lease devices
In xwl_randr_request_lease(), the code checks first for leased device,
and then checks for existing output for lease.

The former assumes there are outputs for lease whereas the latter checks
for the output, connector and lease.

So if there is any existing rrLease->outputs[]->devPrivate unset, the
code would crash on a NULL pointer dereference on the first sanity check
before having a chance to reach the second check that would have caught
the problem.

Invert the sanity checks so that we would catch this first and return a
BadValue instead of possibly segfaulting.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Xaver Hugl <xaver.hugl@kde.org>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1482>
2024-04-30 09:13:34 +02:00
Enrico Weigelt, metux IT consult eff7ccc11c include: move private definitions out of exevents.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to private header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-30 00:47:38 +00:00
Enrico Weigelt, metux IT consult 33350ef8ff include: move private definitions out of extinit.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to extinit_priv.h.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-30 00:47:38 +00:00
Enrico Weigelt, metux IT consult bae6cbc8ca include: move private defs to dixstruct_priv.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to dixstruct_priv.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-30 00:47:38 +00:00
Enrico Weigelt, metux IT consult f17bc7e24d include: split out non-exported prototypes to dix_priv.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to dix-intern.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-30 00:47:38 +00:00
Michel Dänzer 08113b8923 xwayland/glamor: Handle depth 15 in gbm_format_for_depth
Prevents Xwayland with glamor from logging

 unexpected depth: 15

to stderr many times when running

 rendercheck -t blend -o clear

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1507>
2024-04-25 17:17:55 +02:00
Olivier Fourdan 49b8f131f7 xwayland: Use the connector name for XRANDR leases
Use the connector name as basis for the Xwayland output name in XRANDR,
similar to what we do for regular outputs, instead of the generic
"XWAYLAND<n>" name which changes every time the output is leased.

Prefix the actual name with "lease-" to distinguish from duplicate names
from the regular outputs.

v2: avoid duplicate names (Simon)
v3: Move the check for duplicates to xwl_output_set_name() (Simon)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1492>
2024-04-23 11:14:31 +02:00
Olivier Fourdan d36f66f15d xwayland: Check for duplicate output names
Even though the name provided by either xdg-output or wl_output are
guaranteed to be unique, that might not be the case with output names
between different protocols, such as the one offered for DRM lease.

To avoid running into name conflicts, check that no other existing
output of the same name exists prior to changing the output name.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1492>
2024-04-23 11:14:31 +02:00
Olivier Fourdan 0cb4ec4dbd xwayland: Make xwl_output_set_name() public
No functional change, this is preparation work for the next commit.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1492>
2024-04-23 11:14:31 +02:00
Olivier Fourdan 12265aaa1c xwayland: Define MAX_OUTPUT_NAME in the header
So that other parts of the Xwayland code can use it.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1492>
2024-04-23 11:14:31 +02:00
Enrico Weigelt, metux IT consult 75cf29fe6c dbe: unexport dbestruct.h
This include isn't used by any (known) driver nor included by any other
public header, so no need to keep it in the public module API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1422>
2024-04-23 02:18:02 +00:00
Enrico Weigelt, metux IT consult 8982344e53 include: move dbus-core.h to config
This header is internal (not installed) and holds definitions for sources
in config/, thus it fells more clean moving it to config/, too.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1357>
2024-04-23 01:46:24 +00:00
Enrico Weigelt, metux IT consult 140b75298a include: colormap.h: move internal typedef to dix/colormap_priv.h
Moving the internal EntryType typedef from "colormap.h" into newly added
internal-only header "dix/colormap_priv.h"

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1283>
2024-04-23 01:05:06 +00:00
Enrico Weigelt, metux IT consult 94451181c2 xnest: fix segfault in miCreateScreenResources()
With aa3f5023e3, pScreen->devPrivate now is
initialized only once, which uncovered a silent bug in xnestOpenScreen:
It's NULL'ing the pScreen->devPrivate pointer which already had been
initialized by previous miScreenDevPrivateInit() call.

Fixes: aa3f5023e3
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1495>
2024-04-23 00:52:52 +00:00
Enrico Weigelt, metux IT consult 17db4ba3de xfree86: sdksyms: drop errornous check for mifillarc.h
This file had been dropped from public API a decade ago, but sdksyms.sh
yet had been forgotten to be fixed.

Fixes: 707965407a
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1497>
2024-04-22 20:43:38 +02:00
Enrico Weigelt, metux IT consult 43f47e8e65 xfree86: x86emu: fix warning on unneccessary abs()
fix warning:

> In file included from ../hw/xfree86/int10/x86emu.c:11:
> ../hw/xfree86/x86emu/prim_ops.c:2478:9: warning: taking the absolute value of unsigned type 'x86emuu32' (aka 'unsigned int') has no effect [-Wabsolute-value]
>     if (abs(div) > 0xff) {
>         ^
> ../hw/xfree86/x86emu/prim_ops.c:2478:9: note: remove the call to 'abs' since unsigned values cannot be negative
>     if (abs(div) > 0xff) {
>         ^~~
> ../hw/xfree86/x86emu/prim_ops.c:2502:9: warning: taking the absolute value of unsigned type 'x86emuu32' (aka 'unsigned int') has no effect [-Wabsolute-value]
>     if (abs(div) > 0xffff) {
>         ^
> ../hw/xfree86/x86emu/prim_ops.c:2502:9: note: remove the call to 'abs' since unsigned values cannot be negative
>     if (abs(div) > 0xffff) {
>         ^~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1428>
2024-04-18 01:03:11 +00:00
Enrico Weigelt, metux IT consult a0daa6f1fe xfree86: x86emu: drop unused stq_u()
fix warning on unused function:

> ../hw/xfree86/x86emu/sys.c:87:1: warning: unused function 'stq_u' [-Wunused-function]
> stq_u(u64 val, u64 * p)
> ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1428>
2024-04-18 01:03:11 +00:00
Enrico Weigelt, metux IT consult 8081fe1206 xfree86: x86emu: drop unused ldq_u()
fix warning on unused function:

> ../hw/xfree86/x86emu/sys.c:69:1: warning: unused function 'ldq_u' [-Wunused-function]
> ldq_u(u64 * p)
> ^
> ../hw/xfree86/x86emu/sys.c:95:1: warning: unused function 'stq_u' [-Wunused-function]
> stq_u(u64 val, u64 * p)
> ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1428>
2024-04-18 01:03:11 +00:00
Enrico Weigelt, metux IT consult 1e7085d143 xfree86: os-support: bsd: fix missing prototypes
Fix warnings on missing prototypes:

> ../hw/xfree86/os-support/bsd/bsd_VTsw.c:56:20: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86VTSwitchPending()
>                    ^
>                     void
> ../hw/xfree86/os-support/bsd/bsd_VTsw.c:67:17: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86VTSwitchAway()
>                 ^
>                  void
> ../hw/xfree86/os-support/bsd/bsd_VTsw.c:82:15: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86VTSwitchTo()
>               ^
>                void

> ../hw/xfree86/os-support/bsd/bsd_init.c:155:16: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86OpenConsole()
>                ^
>                 void
> ../hw/xfree86/os-support/bsd/bsd_init.c:322:15: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86OpenPccons()
>               ^
>                void
> ../hw/xfree86/os-support/bsd/bsd_init.c:347:16: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86OpenSyscons()
>                ^
>                 void
> ../hw/xfree86/os-support/bsd/bsd_init.c:453:13: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86OpenPcvt()
>             ^
>              void
> ../hw/xfree86/os-support/bsd/bsd_init.c:596:17: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86CloseConsole()
>                 ^
>                  void
> ../hw/xfree86/os-support/bsd/bsd_init.c:673:11: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86UseMsg()
>           ^
>            void

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1428>
2024-04-18 01:03:11 +00:00
Enrico Weigelt, metux IT consult 20d0545f0d xfree86: modes: drop unused xf86_driver_has_show_cursor()
Fix warning on unused function:

> ../hw/xfree86/modes/xf86Cursors.c:212:1: warning: unused function 'xf86_driver_has_show_cursor' [-Wunused-function]
> xf86_driver_has_show_cursor(xf86CrtcPtr crtc)
> ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1428>
2024-04-18 01:03:11 +00:00
Enrico Weigelt, metux IT consult 0f715b4ca4 xfree86: os-support: move hidden Solaris-specific symbols out of public header
These aren't exported at all, so no need to have it in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult 7429f8ee8f xfree86: os-support: move xf86FatalError macro out of public header
This macro is only used inside xfree86's os-support layer, not by any
(known) drivers. Thus no need to have it exported in the public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult 16a3790d60 xfree86: os-support: move unexported stuff out of xf86_OSproc.h
It's cleaner to have public headers only holding public stuff and
xf86_os_support seems to be much more appropriate place for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult 5b23578f93 xfree86: os-support: move VidMemInfo xf86_os_support.h
This type is only used inside the os-support layer of xfree86, so it fits
better into xf86_os_support.h, whose purpose is being the primary entry
point into os-support layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult 533c45e595 xfree86: os-support: move xf86OSInitVidMem() to xf86_os_support.h
This function isn't exported at all, so it better fits into xf86_os_support.h,
whose purpose is being the primary entry point into os-support layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult a5cfe020f5 xfree86: os-support: unexport xf86RemoveSIGIOHandler
It's not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult 3e4fc3e588 xfree86: os-support: unexport xf86DeallocateGARTMemory
It's not used in any drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult 38030fce53 xfree86: os-support: unexport xf86OSInputThreadInit()
This is just called by xfree86 core, not by any drivers, thus no need
to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult b9569f1eb3 xfree86: os-support: unexport xf86OSRingBell()
This function is only internal to xfree86 DDX, not used by any drivers,
thus no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult 7aa3fa54d4 xfree86: unexport os-support functions
These aren't called by drivers/modules, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult e2fa0d2ae0 fix including <sys/mman.h>
Make sure everybody who needs stuff from <sys/mman.h> actually includes it,
and dropped the include from xf86_OSlib.h.

Check for all symbols defined by Open Group spec.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1412>
2024-04-18 00:12:02 +00:00
Enrico Weigelt, metux IT consult 8ce76acddf xfree86: os-support: bsd fix warning on unused label on NetBSD
The label is only used on FreeBSD, so compiling on NetBSD gives a
warning on unused label.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1447>
2024-04-18 00:01:27 +00:00
Enrico Weigelt, metux IT consult 6eea4f0b8c xfree86: os-support: bsd: fix warning on discarded const
Fix warnings:

../hw/xfree86/os-support/bsd/bsd_init.c
../hw/xfree86/os-support/bsd/bsd_init.c:91:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   91 |     "pccons (with X support)",
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xfree86/os-support/bsd/bsd_init.c:97:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   97 |     "pcvt",
      |     ^~~~~~
../hw/xfree86/os-support/bsd/bsd_init.c💯5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  100 |     "wscons",
      |     ^~~~~~~~

../hw/xfree86/os-support/bsd/bsd_init.c:462:14: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  462 |     vtprefix = "/dev/ttyv";
      |              ^
../hw/xfree86/os-support/bsd/bsd_init.c:471:18: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  471 |         vtprefix = "/dev/ttyE";
      |                  ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1446>
2024-04-17 23:50:09 +00:00
Olivier Fourdan 41c3155fdf xwayland: Use exec name instead of hardcoding '/Xwayland'
Use the target name instead of hardcoding the 'Xwayland' executable
name, along with the / operator.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1490>
2024-04-17 15:20:05 +00:00
Olivier Fourdan 8ff88ffec9 xwayland: Use the path to Xwayland as installed
Otherwise the executable cannot be found where specified.

v2: Use 'xwayland_path' (Simon)

Fixes: fbf5e26b5 - xwayland: Use full path for Xwayland exec
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1490>
2024-04-17 15:20:05 +00:00
Simon Ser d1fe52933e xwayland: use array for protocol XML files
Saves us the repetition.

Signed-off-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1491>
2024-04-17 15:25:34 +02:00
Enrico Weigelt, metux IT consult 5057c716eb Fix missing include of sys/stat.h
Instead of relying on very indirect includes, it's more more clean when
everybody explicitly includes what he really needs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1417>
2024-04-17 10:55:10 +02:00
Enrico Weigelt, metux IT consult 97e26532d5 xfree86: os-support: drop ununsed POSIX_TTY
Found no evidence that this define is practically used anywhere, aymore.
Web research just showed up a single ancient .c file (looks like an
Wacom driver) from 1998. Xserver's git history doesn't tell when it
actually had been introduced.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1408>
2024-04-17 02:16:12 +00:00
Enrico Weigelt, metux IT consult a1c1f8b9d8 xfree86: drop unused xf86EnableAGP()
This function doesn't seem to be used anymore, neither inside the xserver,
nor by any drivers - so it can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1404>
2024-04-17 02:05:36 +00:00
Enrico Weigelt, metux IT consult ba870af892 xfree86: drop unused xf86SetReallySlowBcopy()
This had been introduced almost two decades ago, by Dave Airlie (*1) along
with some major IO speed improvement, just in case some driver still needed
the old behaviour - in that case it would call xf86SetReallySlowBcopy(),
so xf86SlowBcopy() would fall back to the old approach emitting an extra
outb() on debug port, in order to slow things down more.

Now aeons have passed and there doesn't seem to be any actual user for this,
so it's time to drop that ancient relic.

*1) commit e717eb82dc

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1402>
2024-04-17 01:54:28 +00:00
Enrico Weigelt, metux IT consult e37bcac1dc xfree86: linux: int10: drop dead code
The code pieces inside `ifdef DoSubModule` aren't used anymore since very
long time. There's no evidence of this symbol ever been set in the whole
git history, so it must be an really ancient relic, that nobody used for
decades.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1400>
2024-04-17 01:43:30 +00:00
Enrico Weigelt, metux IT consult be4c8444eb os: unexport Os*() functions
These aren't called (and suited for being called) by drivers,
thus drop them from the public module API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1381>
2024-04-16 14:20:30 +02:00
Enrico Weigelt, metux IT consult 85d4bd0dba rename remaining RT_* defines to X11_RESTYPE_*
Since we already had to rename some of them, in order to fix name clashes
on win32, it's now time to rename all the remaining ones.

The old ones are still present as define's to the new ones, just for
backwards compatibility.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
2024-04-15 19:00:47 -07:00
Enrico Weigelt, metux IT consult 232cad9ec3 prevent name clash on Windows w/ RT_* defines
Windows' native headers using some our RT_* define's names for other things.
Since the naming isn't very nice anyways, introducing some new ones
(X11_RESTYPE_NONE, X11_RESTYPE_FONT, X11_RESTYPE_CURSOR) and define the old
ones as an alias to them, in case some out-of-tree code still uses them.

With thins change, we don't need to be so extremely careful about include
ordering and have explicit #undef's in order to prevent name clashes on
Win32 targets.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
2024-04-15 18:59:23 -07:00
Enrico Weigelt, metux IT consult d444cd4237 dix: unexport some lookup functions
These aren't used by any drivers, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1380>
2024-04-15 18:11:57 -07:00
Enrico Weigelt, metux IT consult 76d01e9bf6 os: unexport OsVendorVErrorFProc pointer
This pointer allows a DDX to install it's own error print handler. It's really
only intended for DDXes, thus no need to have it exported to modules.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1369>
2024-04-15 23:59:38 +00:00
Enrico Weigelt, metux IT consult 1205f5b6f9 dix: unexport GetCurrentClient()
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1377>
2024-04-15 23:47:47 +00:00
Enrico Weigelt, metux IT consult 3b7a63e6ae os: unexport xthread_sigmask
This function isn't used by drivers and there's currently no need to do so,
thus keep it out of the public module API.

Fixes: 30ac756798
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1368>
2024-04-15 22:49:02 +00:00
Enrico Weigelt, metux IT consult 5a9b885118 os: unexport authorization management functions
Those aren't used by modules, thus no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:55:22 -07:00
Enrico Weigelt, metux IT consult bed778ee60 os: unexport LocalAccessScopeUser()
this function is only used by wayland ddx, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:55:22 -07:00
Enrico Weigelt, metux IT consult 389b528203 os: unexport command line args handling functions
These functions shouldn't be called by drivers or extensions, thus
shouldn't be exported. Also moving it to separate header, so the
already huge ones aren't cluttered with even more things.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1334>
2024-04-15 21:21:40 +00:00
Enrico Weigelt, metux IT consult 84407af615 xfree86: x86emu: fix missing Xfuncproto.h include in debug.h
The header uses macros from Xfuncproto.h - right now it just works by pure
accident since consumers of this header indirectly include Xfuncproto.h
by totally different roads. This is a fragile programming style that deserved
to be cleand up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1331>
2024-04-15 20:11:18 +00:00
Enrico Weigelt, metux IT consult 045c9185f8 xfree86: x86emu: drop unnecessary extern C from debug.h
Since we're not using C++ code, thus no trouble w/ name mangling, we don't
need explicit extern "C" { ... } sections in the code. (If we would, we
have to have it in many other places, too)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1331>
2024-04-15 20:11:18 +00:00
Enrico Weigelt, metux IT consult 8516bbe422 Xnest: print event ID on warning about unhandled upstream event
When getting an unhandled event from upstream Xserver, a warning
is printed, but it doesn't tell which one yet. Just printing it's
ID should be good enough for now - it's already a good help
for debugging.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1398>
2024-04-15 19:33:57 +00:00
Enrico Weigelt, metux IT consult 2cc5c57238 Xnest: cleanup X.h includes
It's cleaner to include explicitly instead of relying on indirect includes,
thus adding a few more on X.h.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1394>
2024-04-15 19:20:39 +00:00
Enrico Weigelt, metux IT consult 737c316a99 Xnest: canonicalize includes: <X11/Xdefs.h>
For cleaner code, make sure every source needing something from Xdefs.h
does explicitly include it (not relying on indirect including)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1394>
2024-04-15 19:20:39 +00:00
Enrico Weigelt, metux IT consult b15f0204b2 Xnest: ignore NoExpose event
Sometimes getting NoExpose event from upstream xserver, where
we've got nothing actually to do.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1399>
2024-04-15 19:06:59 +00:00
Enrico Weigelt, metux IT consult 57254ca23c xnest: Display: fix xallocarray() compiler warning
Compiler warning:

[7/29] Compiling C object hw/xnest/Xnest.p/Display.c.o
In file included from ../include/misc.h:119,
                 from ../include/screenint.h:50,
                 from ../hw/xnest/Display.c:24:
../hw/xnest/Display.c: In function ‘xnestOpenDisplay’:
../include/os.h:81:32: warning: argument 2 range [2147483648, 4294967295] exceeds maximum object size 2147483647 [-Walloc-size-larger-than=]
   81 | #define xallocarray(num, size) reallocarray(NULL, (num), (size))
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xnest/Display.c:124:29: note: in expansion of macro ‘xallocarray’
  124 |     xnestDefaultColormaps = xallocarray(xnestNumDefaultColormaps,
      |                             ^~~~~~~~~~~
In file included from ../include/os.h:54:
/usr/include/stdlib.h:582:14: note: in a call to allocation function ‘reallocarray’ declared here
  582 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
      |              ^~~~~~~~~~~~

Since we really don't need more than 2^16 colormaps, using uint16_t here
to silence this warning.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1392>
2024-04-15 18:52:13 +00:00
Tom Yan aa3f5023e3 xnest/mi: remove redundant call of miScreenDevPrivateInit()
miScreenDevPrivateInit() is also made static in this commit.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/854>
2024-04-14 17:20:09 +00:00
Enrico Weigelt, metux IT consult 786f7ceb61 xfree86: vgahw: drop obsolete _NEED_SYSI86
This doesn't seem to be needed anymore, probably a left over from migration
to libpciaccess. So it can be removed now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1415>
2024-04-13 19:43:59 +00:00
Enrico Weigelt, metux IT consult dee16edd2e xfree86: os-support: move _NEED_SYSI86 guarded block to sun_vid.c
The sun_vid.c driver seems to be the only actual consumer left, so it
can be dropped from public headers and moved to sun_vid.c instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1414>
2024-04-13 12:13:50 -07:00
Enrico Weigelt, metux IT consult 1073ca2b8a xfree86: os-support: drop Solaris pre-7 remains
Since meson transition, we can't build on Solaris older than v7
(which came out 1998), so no need for extra quirks.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1414>
2024-04-13 12:13:42 -07:00
Enrico Weigelt, metux IT consult bfcc7726a8 xfree86: os-support: clean out remains of SVR3/sysv support
SVR3/sysv support had been removed 13 years ago, but there still was
some fallout left. The symbol HAS_SVR3_MMAPDRV never had been set by
autoconf, let alone meson, so this piece of code is really dead.

Fixes: 6ce1908ba4
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1414>
2024-04-13 12:13:42 -07:00
Olivier Fourdan 385226bdaf xwayland: Walk the regions' boxes
In xwl_source_validate(), the actual box wasn't updated, so we would
possibly copy several times the same first box.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Fixes: aa05f38f3 - xwayland: Add SourceValidate hook
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1485>
2024-04-12 07:38:26 +00:00
Michel Dänzer 4dc7e99840 xwayland: Use drmDevicesEqual in xwl_dmabuf_feedback_tranche_done
xwl_dmabuf_feedback_tranche_target_device always allocates a new
drmDevice for xwl_feedback->tmp_tranche.drm_dev, so the pointers are
never equal here.

Fixes: 6f0b9deed6 ("xwayland: use drmDevice to compare DRM devices")

v2:
* Flip order of checks, so drmDevicesEqual is called only if the
  supports_scanout flags match.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1484>
2024-04-12 07:25:55 +00:00
Michel Dänzer 82d3b8ff05 xwayland: Call drmFreeDevice for dma-buf default feedback
Fixes leaks:

==13712== 144 bytes in 1 blocks are definitely lost in loss record 4,827 of 7,462
==13712==    at 0x48459F3: calloc (vg_replace_malloc.c:1340)
==13712==    by 0x49BE94D: drmDeviceAlloc (xf86drm.c:4072)
==13712==    by 0x49BFAC9: drmProcessPciDevice (xf86drm.c:4104)
==13712==    by 0x49BFAC9: process_device (xf86drm.c:4508)
==13712==    by 0x49C35FB: drmGetDeviceFromDevId (xf86drm.c:4670)
==13712==    by 0x1AD370: xwl_dmabuf_feedback_main_device (xwayland-dmabuf.c:477)
==13712==    by 0x53C03FD: ffi_call_unix64 (unix64.S:104)
==13712==    by 0x53BF70C: ffi_call_int (ffi64.c:673)
==13712==    by 0x53BFEE2: ffi_call (ffi64.c:710)
==13712==    by 0x49AC920: wl_closure_invoke (connection.c:1025)
==13712==    by 0x49A8C08: dispatch_event.isra.0 (wayland-client.c:1631)
==13712==    by 0x49AA5AB: dispatch_queue (wayland-client.c:1777)
==13712==    by 0x49AA5AB: wl_display_dispatch_queue_pending (wayland-client.c:2019)
==13712==    by 0x49AAB5E: wl_display_roundtrip_queue (wayland-client.c:1403)

==13712== 576 bytes in 4 blocks are definitely lost in loss record 6,289 of 7,462
==13712==    at 0x48459F3: calloc (vg_replace_malloc.c:1340)
==13712==    by 0x49BE94D: drmDeviceAlloc (xf86drm.c:4072)
==13712==    by 0x49BFAC9: drmProcessPciDevice (xf86drm.c:4104)
==13712==    by 0x49BFAC9: process_device (xf86drm.c:4508)
==13712==    by 0x49C35FB: drmGetDeviceFromDevId (xf86drm.c:4670)
==13712==    by 0x1AD583: xwl_dmabuf_feedback_main_device (xwayland-dmabuf.c:477)
==13712==    by 0x1AD583: xwl_window_dmabuf_feedback_main_device (xwayland-dmabuf.c:691)
==13712==    by 0x53C03FD: ffi_call_unix64 (unix64.S:104)
==13712==    by 0x53BF70C: ffi_call_int (ffi64.c:673)
==13712==    by 0x53BFEE2: ffi_call (ffi64.c:710)
==13712==    by 0x49AC920: wl_closure_invoke (connection.c:1025)
==13712==    by 0x49A8C08: dispatch_event.isra.0 (wayland-client.c:1631)
==13712==    by 0x49AA5AB: dispatch_queue (wayland-client.c:1777)
==13712==    by 0x49AA5AB: wl_display_dispatch_queue_pending (wayland-client.c:2019)
==13712==    by 0x1A1842: xwl_read_events (xwayland-screen.c:566)
==13712==    by 0x1A1842: xwl_read_events (xwayland-screen.c:553)

Fixes: 6f0b9deed6 ("xwayland: use drmDevice to compare DRM devices")
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1484>
2024-04-12 07:25:55 +00:00
Olivier Fourdan a65bb8480a Revert "xwayland/glamor: Avoid implicit redirection with depth 32 parent windows"
There are a number of regressions and hard to reproduce issues that find
their roots in this change, so revert it until those can be ironed out
some more.

This reverts commit 4bb1f976d5.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1655
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1656
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1457>
2024-04-11 07:33:19 +00:00
Jan Beich f0748b05dc xwayland: avoid Linux-only headers on non-Linux
hw/xwayland/xwayland-glamor-gbm.c:38:10: fatal error: 'linux/dma-buf.h' file not found
   38 | #include <linux/dma-buf.h>
      |          ^~~~~~~~~~~~~~~~~

Fixes: 3df236a3d5 ("xwayland: add functions to import and export dma-buf implicit fences")
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1481>
2024-04-11 06:30:11 +00:00
Michel Dänzer c7d56b0e29 xwayland/present: Redirect surface window as needed for page flips
It's needed when the surface window is a depth 24 descendant of a depth
32 toplevel window.

xwl_source_validate ensures the toplevel window pixmap has valid
contents when a client reads from it, or when the window hierarchy /
geometry changes. It's never called in the normal fullscreen application
case, so there's no GPU copy overhead with that.

v2:
* Don't try to redirect a depth 32 descendant of different-depth
  ancestors, the alpha channel wouldn't be handled correctly.
  (Olivier Fourdan)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10 08:55:08 +00:00
Michel Dänzer 4495c696b5 xwayland/present: Check window & source pixmap depth match last
Preparation for next commit, no functional change intended.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10 08:55:08 +00:00
Michel Dänzer aa05f38f3d xwayland: Add SourceValidate hook
A later commit will use it to ensure the toplevel window pixmap has
valid contents.

It's hooked up only while any xwl_window->surface_window_damage points
to a non-empty region. So far it's always NULL, so no functional change
intended.

v2:
* Fix trailing whitespace. (Olivier Fourdan)
v3:
* Use toplevel local variable more in xwl_window_update_surface_window.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10 08:55:08 +00:00
Michel Dänzer fca63f8fb8 xwayland/present: Add xwl_present_maybe_(un)redirect_window
A later commit will use these to (un)redirect the surface window on
demand.

Not used yet, so no functional change intended.

v2:
* Use "surface_window_damage" instead of "surf_win_damage".
  (Olivier Fourdan)
* Slightly simplify logic in xwl_unrealize_window.
v3:
* Add comment in xwl_present_maybe_unredirect_window explaining why we
  use a timer. (Olivier Fourdan)
v4:
* Rename unredir_timer field to unredirect_timer.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10 08:55:08 +00:00
Michel Dänzer fa7b1c20c4 xwayland: Use ConfigNotify screen hook instead of ResizeWindow
Preparation for later commits, no functional change intended.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10 08:55:08 +00:00
Michel Dänzer 3a0fc2684a xwayland: Add xwl_window::surface_window
It may track a non-toplevel window which fully covers the area of the
window pixmap / Wayland surface. It is now used instead of
xwl_window::toplevel for updating the Wayland surface contents.

The surface_window can now hit the Present page flip path while it's
automatically redirected.

v2:
* Use "surface_window" instead of "surf_win". (Olivier Fourdan)
* Add comment describing surface_window, and describe what
  surface_window/toplevel are useful for respectively. (Olivier Fourdan)
* Use surface_window in xwl_realize_window.
v3:
* Backtrack up to the closest opaque ancestor in
  xwl_window_update_surface_window. (Olivier Fourdan)
v4:
* Clean up logic for determining the surface window in
  xwl_window_update_surface_window, and document it better.
* Handle window_get_damage(xwl_window->surface_window) returning NULL
  in xwl_window_update_surface_window.
* Call xwl_window_update_surface_window after xwl_window_buffers_init
  in ensure_surface_for_window, since the former may call
  xwl_window_buffers_dispose.
* Rename surf/win_pix to surface/window_pixmap in
  xwl_window_update_surface_window.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10 08:55:08 +00:00
Michel Dänzer db248682b3 xwayland: Pass xwl_window to xwl_glamor_dri3_syncobj_passthrough
Preparation for later changes, no functional change intended.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10 08:55:08 +00:00
Michel Dänzer d3448f7aad xwayland: Use xwl_window for damage closure
Preparation for later commits, no functional change intended.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10 08:55:08 +00:00
Michel Dänzer 07f6032627 xwayland: Call register_damage depending on ensure_surface_for_window
Preparation for next commit.

This might change behaviour for non-InputOutput top-level windows.
ensure_surface_for_window getting called and returning non-NULL for
those would seem like a pre-existing bug though.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10 08:55:08 +00:00
Michel Dänzer a562d01a18 xwayland: Return struct xwl_window * from ensure_surface_for_window
Preparation for later commits, no functional change intended.

v2:
* Leave register_damage call unchanged in this commit. (Olivier Fourdan)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10 08:55:08 +00:00
Michel Dänzer 972d5af537 xwayland: Rename xwl_window::window to ::toplevel
It's always the toplevel window, i.e. either the root window or a child
of it.

Preparation for later commits, no functional change.

v2: (Olivier Fourdan)
* Fix debug build.
* Add comment describing ::toplevel.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10 08:55:08 +00:00