Commit Graph

22147 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
f26b31d8f7 randr: consistenly name reply structs "reply" instead of "rep"
Preparation for future use of generic reply assembly macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 17:12:35 +01:00
Enrico Weigelt, metux IT consult
4d4fd5866e record: consistenly name reply structs "reply" instead of "rep"
Preparation for future use of generic reply assembly macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 16:14:06 +01:00
Enrico Weigelt, metux IT consult
cbf814f375 xfixes: consistenly name reply structs "reply" instead of "rep"
Preparation for future use of generic reply assembly macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 16:13:52 +01:00
Enrico Weigelt, metux IT consult
aa8064be86 render: consistenly name reply structs "reply" instead of "rep"
Preparation for future use of generic reply assembly macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 15:16:37 +01:00
Enrico Weigelt, metux IT consult
de60ac5bbe xkb: consistenly name reply structs "reply" instead of "rep"
Preparation for future use of generic reply assembly macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 15:03:11 +01:00
Enrico Weigelt, metux IT consult
1487c7c03f xkb: drop some junk comments
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 14:37:58 +01:00
Enrico Weigelt, metux IT consult
a173278c4f dix: make SwapLongs() inline
a) trade a little bit of code size for speed
   (depending on exact caller, compiler might also optimize a lot)
b) reduce the need for exported, but non-public symbol

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 14:30:02 +01:00
Enrico Weigelt, metux IT consult
090c68e13d Xext: consistenly name reply structs "reply" instead of "rep"
Preparation for future use of generic reply assembly macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 14:29:29 +01:00
Enrico Weigelt, metux IT consult
341c890564 include: tiny indention cleanup
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 14:00:02 +01:00
Enrico Weigelt, metux IT consult
409e721e98 os: merge os/xstrans.c and os/transport.c
Since xtrans is now in-tree and already have been trimmed down
for only things needed by the Xserver, the split between xstrans.c
and transport.c isn't needed anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 13:15:58 +01:00
Enrico Weigelt, metux IT consult
d877b4830c xwin: drop unused variable
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 11:05:24 +01:00
Enrico Weigelt, metux IT consult
6a320e76cb dix: add macros for request handlers and swapping
add some macros for making request handlers and byte swapping easier:

    * X_REQUEST_HEAD_STRUCT(type) and X_REQUEST_HEAD_AT_LEAST(type)
      declare header struct pointers and check size
    * X_REQUEST_FIELD_CARD16(field)
      swaps a CARD16 (word) header field (if neccessary)
    * X_REQUEST_FIELD_CARD32(field)
      swaps a CARD32 (dword) header field (if neccessary)
    * X_REQUEST_REST_CARD16()
      swaps remaining CARD16 array payload (if necessary)
    * X_REQUEST_REST_CARD32()
      swaps remaining CARD32 array payload (if necessary)
    * X_REQUEST_REST_COUNT_CARD16(count)
      check swaps `count` CARD16 payload fields and checks size
    * X_REQUEST_REST_COUNT_CARD32(count)
      check swaps `count` CARD32 payload fields and checks size

How to use them:

    1. put X_REQUEST_HEAD_STRUCT() or X_REQUEST_HEAD_AT_LEAST() ontop of each Proc*()
    2. add X_REQUEST_FIELD_*() et al below, for all fields to be swapped and
       drop the corresponding SProc*()'s
    3. let the dispatchers call Proc*() instead of SProc*()

Notes:

    * the length field is already swapped before request handlers called

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 10:58:14 +01:00
Oleh Nykyforchyn
f4115e69eb dix: initialize all screens before proceeding to gc's, root windows etc
Current code walks along all screens and initializes screen resources,
then gc's, stipples, root windows for each of them, hence after
the first screen registering new private keys is no more possible.
This crashes modesetting driver if it is not initialized before others.

This patch makes screen resources for all screen initialize first, hence
all necessary private keys (including of the type PRIVATE_WINDOW) are
initialized before root windows are created.

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
2025-12-03 09:24:33 +01:00
stefan11111
3f821b291e modesetting: get more values from the fallback cursor probe
The space needed to store these extra values is at worst a few dozen bytes.
In exchange for these, larger cursors glyphs can use a more optimal cursor size.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-12-02 10:14:12 +01:00
Enrico Weigelt, metux IT consult
d0b6510b64 composite: declare and initialize reply struct when needed
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-01 16:15:46 +01:00
Enrico Weigelt, metux IT consult
7d8f084fbf dri: use static struct init on declaration & drop useless assignments
Make the code a bit easier to read by using initialization of the reply
structs, at the point of declaration. Most of them aren't written to later,
just passed into WriteReplyToClient(). Also dropping some useless zero
assignments (struct initializers automatically zero-out unmentioned fields).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-01 14:09:02 +01:00
Branimir Ri\v{c}ko
3b99373a17 Fixed a out of bounds read.
Signed-off-by: Branimir Ri\v{c}ko <rickobranimir@gmail.com>
2025-12-01 11:02:06 +01:00
stefan11111
c01c4e7c72 modesetting: Only close the dmabuf fd if it isn't -1
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-28 18:44:22 +01:00
Icenowy Zheng
03fa63778b modesetting: fix shared pixmap dmabuf fd leakage
After the dmabuf fd exported by another screen is imported to a pixmap,
the pixmap holds a reference for the buffer, thus the FD itself finished
its job and needs to be closed to prevent a stale reference to the
buffer.

Signed-off-by: Icenowy Zheng's avatarIcenowy Zheng <uwu@icenowy.me>
2025-11-28 18:44:22 +01:00
stefan11111
6be7fe9d12 modesetting: print message when reverse prime mode is enabled
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-28 18:44:22 +01:00
Marc-Alexandre Espiaut
e1b3bbafa8 dix: remove dixLookupBuiltinColor() unused screen argument
Signed-off-by: Marc-Alexandre Espiaut <76531574+malespiaut@users.noreply.github.com>
2025-11-28 18:43:40 +01:00
Herman Semenoff
fc8f9f4331 xfree86: fix infinite boot when parsing incorrect BusID section Device
This change checks if there is a colon after the bus name. If there is none, *retID will point to the final null character of the original string.
2025-11-28 10:07:46 +01:00
Enrico Weigelt, metux IT consult
e14d352661 dix: move GCAllBits define into private header
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 20:05:59 +01:00
Enrico Weigelt, metux IT consult
e0ddc62bd0 os: add header for math related functions (possibly OS optimized)
Adding a new header for math related functions, beginning with new
MIN/MAX macros, which will be used by subsequent commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 19:58:33 +01:00
Enrico Weigelt, metux IT consult
33729b1361 include: windowstr.h: unexport w*() macros
These aren't used by any drivers, so no need to keep them public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 19:54:42 +01:00
Enrico Weigelt, metux IT consult
ff8d26df21 include: windowstr.h: unexport SameBackground() and SamBorder() macros
Not used by any drivers, so no need to keep them public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 19:49:14 +01:00
Enrico Weigelt, metux IT consult
2fe5e2519a os: move OsCommRec/Ptr and related functions into own header
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 19:36:00 +01:00
Enrico Weigelt, metux IT consult
4af16f4ede composite: dont include <dix-config.h> from headers
This file is supposed to be included from each source file at the
very top.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 19:35:46 +01:00
Enrico Weigelt, metux IT consult
9b8d7d1eb9 treewide: don't include <region.h> anymore
Nothing in there that we need, include <regionstr.h> instead.
But keeping the file in place, until all external consumer have
been migrated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 19:27:27 +01:00
JSOwens
d4e67aa773 .github: add a check for pull request commits to be signed off
Added a workflow to check the commit messages of a PR to make sure each is
signed off by the author. A repo token is required, here named SECRET_TOKEN,
which has access to read and write PR comments.

Signed-off-by: JSOwens <josephs.owens@gmail.com>
2025-11-27 19:27:15 +01:00
Chase
644d151173 .github: install-prereq.sh: move xproto to meson
Signed-off-by: Chase <chinkle3@illinois.edu>
2025-11-27 19:04:19 +01:00
Enrico Weigelt, metux IT consult
a72972274e mi: drop intToCoord() macro
Not used anywhere, no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 18:25:12 +01:00
Oleh Nykyforchyn
0230c6e074 dix: reexport ConnectionInfo for NVidia 390
This patch exports ConnectionInfo in server_priv.h and references
it in globals.c to force exporting.

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
2025-11-27 17:06:36 +01:00
Chase
341b7f19f8 dbe.c: remove DISABLE_MI_BY_DEFAULT macro 2025-11-27 17:05:31 +01:00
Enrico Weigelt, metux IT consult
bddf4ae8e8 xfree86: move over xf86vidmode extension to hw/xfree86
This extension is private to the xfree86 DDX, no other one supports it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 14:03:37 +01:00
Enrico Weigelt, metux IT consult
b7e9544318 Xext: xvmc: drop dead SHM code path
Xvmc isn't using SHM for over 20 years now. There's still a code path for it
that could be enabled explicitly by manually setting HAS_XVMCSHM, but no
indication whatsoever that this ever has been done.

Considering that Xvmc in general already is obsolete for very long time now,
we can safely assume this code path is really dead and can be removed.

Fixes: 9a26d6f39e
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 13:50:11 +01:00
Enrico Weigelt, metux IT consult
0b3fb18754 xfree86: drop xf86CursorScreenKey macro
Use the actual field directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 13:48:22 +01:00
Enrico Weigelt, metux IT consult
c503343a6b Xext: Xvmc: drop XvMCScreenKey macro
Directly use the actual field instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 13:47:59 +01:00
Enrico Weigelt, metux IT consult
d7b773c174 xfree86: vgaarbiter: drop VGAarbiterScreenKey and VGAarbiterGCKey macros
Use the actual fields directly instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 13:47:05 +01:00
Enrico Weigelt, metux IT consult
85fae9bffb dix: inline SProcAllocColor()
Now that we have untwisted Xinerama side, it's trivial to inline
the few lines for byte-swapping into the actual handlers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 13:46:37 +01:00
Alan Coopersmith
e352fdecfe dix: handle allocation failure in DeviceFocusEvent()
Reported in https://gitlab.freedesktop.org/xorg/xserver/-/issues/1817:

xwayland-24.1.6/redhat-linux-build/../dix/enterleave.c:786:5:
 warning[-Wanalyzer-possible-null-dereference]:
 dereference of possibly-NULL ‘xi2event’

Fixes: 3f37923a72 ("Xi: send XI2 focus events." in Xorg 1.10.0)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2078>
2025-11-27 13:36:49 +01:00
Enrico Weigelt, metux IT consult
a1f3edddf4 meson.build: enable -fno-common on all platforms
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 12:07:29 +01:00
Enrico Weigelt, metux IT consult
fe7e99f58c include: globals.h: drop unnecessary includes
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 12:06:53 +01:00
Enrico Weigelt, metux IT consult
92a015504e dix: make BITMAP_SCANLINE_UNIT private
Not used by any external drivers, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 12:05:55 +01:00
Enrico Weigelt, metux IT consult
c696329b93 include: misc: drop unused sign() macro
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 12:05:29 +01:00
Enrico Weigelt, metux IT consult
f2a0a94a1f include: misc.h: drop unused xReqPtr typedef
not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 12:04:01 +01:00
stefan11111
7279a68cc7 dri3: prevent out-of-bounds read in dri3_fd_from_pixmap
Inspired by f05f269f1d

Reported in https://gitlab.freedesktop.org/xorg/xserver/-/issues/1817:

xwayland-24.1.6/redhat-linux-build/../dri3/dri3_screen.c:143:13:
 warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
xwayland-24.1.6/redhat-linux-build/../dri3/dri3_screen.c:143:13:
 danger: out-of-bounds read from byte 16 till byte 19
 but ‘fds’ ends at byte 16
141|           int i;
142|           for (i = 0; i < num_fds; i++)
143|->             close(fds[i]);
144|           return -1;
145|       }

Only possible if fds_from_pixmap returns a value > 4, but the analyzer
doesn't know the interface is defined not to do that.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2085>

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-27 12:03:27 +01:00
stefan11111
d64fc9b668 glamor/glamor_egl.c: Set *formats to NULL after free()
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-27 12:03:27 +01:00
Alan Coopersmith
4b65fdd356 glamor: avoid double free in glamor_make_pixmap_exportable()
Reported by gcc 15.1:

../glamor/glamor_egl.c:320:9:
 warning: double-‘free’ of ‘modifiers’ [CWE-415] [-Wanalyzer-double-free]
[...]
           │  732 |│        free(*modifiers);
           │      |│        ~~~~~~~~~~~~~~~~
           │      |│        |
           │      |└───────>(25) ...to here
           │      |         (26) first ‘free’ here
[...]
    │  320 |         free(modifiers);
    │      |         ~~~~~~~~~~~~~~~
    │      |         |
    │      |         (28) ⚠️

  second ‘free’ here; first ‘free’ was at (26)

Fixes: cef12efc15 ("glamor: Implement GetSupportedModifiers")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-27 12:03:27 +01:00
Alan Coopersmith
4db6ede54d glamor: avoid null dereference in glamor_composite_clipped_region()
Reported in https://gitlab.freedesktop.org/xorg/xserver/-/issues/1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_render.c:1577:21:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-27 12:03:27 +01:00