Commit Graph

22736 Commits

Author SHA1 Message Date
Alan Coopersmith
cbe66c79bf present: prevent memory leaks in present_create_notifies()
Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../present/present_notify.c:83:17:
 warning[-Wanalyzer-malloc-leak]: leak of ‘notifies’
xwayland-24.1.6/redhat-linux-build/../present/present_notify.c:83:17:
 branch_false: following ‘false’ branch (when ‘i >= num_notifies’)...

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2164>
2026-04-13 12:40:10 +02:00
Alan Coopersmith
29f39cf072 os: handle memory allocation failure in set_font_authorizations()
Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../os/utils.c:1108:9:
 warning[-Wanalyzer-possible-null-dereference]:
  dereference of possibly-NULL ‘result’
xwayland-24.1.6/redhat-linux-build/../os/utils.c:1108:9:
 danger: ‘malloc((long unsigned int)len + 18)’ could be NULL:
  unchecked value from (3)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2163>
2026-04-13 12:40:10 +02:00
Jeremy Huddleston Sequoia
5a6dcdf668 xquartz: Bump copyrights in Info.plist to 2026
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2026-04-13 12:40:10 +02:00
Jeremy Huddleston Sequoia
1671e543b3 rootless: Protect alpha channel for Render operations
The Render extension operates on PictFormats rather than GC, so it
bypasses the rootless layer's GC-based alpha protection
(ROOTLESS_PROTECT_ALPHA).  Depth-24 windows use PICT_x8r8g8b8 where
the 'x' tells pixman the high byte is padding it may freely zero.
The macOS compositor needs this byte to be 0xFF (opaque).

Before each Render operation that targets a rootless window,
temporarily upgrade the destination Picture's format from
PICT_x8r8g8b8 to PICT_a8r8g8b8.  This tells pixman that the alpha
channel is significant and must not be optimized away.  The format
is restored after the operation completes.

This parallels how ROOTLESS_PROTECT_ALPHA handles GC operations (by
masking alpha out of the planemask) and how ROOTLESS_SAFEALPHA
handles PaintWindow (by forcing alpha in solid fills).  The
save/restore approach is analogous to rootlessGC.c's GC_SAVE /
GC_RESTORE pattern.

Fixes [2/2]: https://github.com/XQuartz/XQuartz/issues/31

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2026-04-13 12:40:10 +02:00
Jeremy Huddleston Sequoia
fa36e0111a rootless: Add Trapezoids, Triangles, and CompositeRects wrapping
The Render extension's Trapezoids and Triangles operations
(fbTrapezoids, fbTriangles) render directly via pixman through
fbShapes without going through ps->Composite, so RootlessComposite
never fires for these operations.  This means RootlessStartDrawing
is not called and the macOS compositor is not notified of changed
pixels.

Add RootlessTrapezoids and RootlessTriangles wrappers following the
same pattern as RootlessComposite: call RootlessStartDrawing before
the operation, then compute the bounding box via miTrapezoidBounds or
miTriangleBounds and call RootlessDamageBox after.  The default
miTriStrip and miTriFan implementations decompose their input into
triangles and dispatch through ps->Triangles, so the RootlessTriangles
wrapper covers TriStrip and TriFan as well.

Also add a RootlessCompositeRects wrapper as defense-in-depth.  The
current miCompositeRects implementation already has partial rootless
coverage: PictOpSrc/PictOpClear go through the GC layer, and other
ops route through CompositePicture -> RootlessComposite.  Wrapping at
the PictureScreen level ensures robustness regardless of the underlying
implementation.

Fixes [1/2]: https://github.com/XQuartz/XQuartz/issues/31

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2026-04-13 12:40:10 +02:00
Alan Coopersmith
20b3ca4b43 os: use winsock2.h definitions on mingw in xserver_poll.h
Avoids build warnings & failures, such as:

../os/xserver_poll.h:40: warning: "POLLNVAL" redefined
   40 | #define POLLNVAL        0x20
      |
/usr/share/mingw-w64/include/winsock2.h:1190: note: this is the location
 of the previous definition
 1190 | #define POLLNVAL   0x0004
      |
../os/xserver_poll.h:42:8: error: redefinition of ‘struct pollfd’
   42 | struct pollfd
      |        ^~~~~~
/usr/share/mingw-w64/include/winsock2.h:1192:16: note: originally defined here
 1192 | typedef struct pollfd {
      |                ^~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2141>
2026-04-13 12:40:10 +02:00
Alan Coopersmith
ce2e9e1f5e ephyr: add -name to Xephyr man page
Fixes: f028e245a ("Bug #10016: Implement WM_CLASS hints in Xephyr.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2137>
2026-04-13 12:40:10 +02:00
Alan Coopersmith
f9e388bd8d ephyr: add -title to Xephyr man page
Fixes: e3c65cf1d ("xephyr: Add -title option.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2137>
2026-04-13 12:40:10 +02:00
Diego Viola
d5bcf62732 Fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2134>
2026-04-13 12:40:10 +02:00
Alan Coopersmith
4892a42d40 os: add a generic -verbose option instead of making each server add its own
Replaces Xwayland's server-specific implementation, but leaves Xorg's
since it sets global variables in the xfree86 ddx layer.  Also leaves
Xephyr's differently-spelled "-verbosity" for backwards compatibility.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2131>
2026-04-13 12:40:10 +02:00
Christian Göttsche
2fe0214c84 selinux: only generate audit events for avc and error messages
Only generate audit events for messages of the type avc (permission
denied) and error (e.g. invalid context).
For example avoid USER_SELINUX_ERR for policy load events:
    audit[980]: USER_SELINUX_ERR pid=980 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xorg_t:s0 msg='avc:  op=load_policy lsm=selinux seqno=8 res=1 exe="/usr/lib/xorg/Xorg" sauid=0 hostname=? addr=? terminal=?'

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/801>
2026-04-13 12:40:10 +02:00
Christian Göttsche
21c598eaad selinux: remap security classes on policyload
Re-map the SELinux security classes on policy loads, as the mapping will
be desynchronized (see man:selinux_set_mapping(3)) and audit messages
will not show the actual class and permission names:

    USER_AVC pid=24283 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xorg_t:s0 msg='avc:  denied  { 0x10 } for request=XFIXES:SelectSelectionInput comm=/usr/bin/python3 resid=6400001 restype=WINDOW scontext=xuser_u:xuser_r:systemd_user_instance_generic_bin_t:s0 tcontext=xuser_u:object_r:xorg_t:s0 tclass=(null) permissive=1

In addition use type-safe assignments.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/801>
2026-04-13 12:40:10 +02:00
Alan Coopersmith
30c4293a12 [PR #2175] xfree86: remove leftover ev56.c source files
PR: https://github.com/X11Libre/xserver/pull/2175
2026-04-13 12:40:10 +02:00
Konstantin
a7931e241e [PR #2176] xv: change FOURCC_RGBA32 to AMD one
PR: https://github.com/X11Libre/xserver/pull/2176
2026-04-13 12:40:10 +02:00
Enrico Weigelt, metux IT consult
fc6225d568 [PR #2177] dri2: little spelling fix
PR: https://github.com/X11Libre/xserver/pull/2177
2026-04-13 12:40:10 +02:00
Alan Coopersmith
80bfd26ff4 [PR #2178] glx: avoid null dereference in validGlxFBConfigForWindow()
PR: https://github.com/X11Libre/xserver/pull/2178
2026-04-13 12:40:10 +02:00
Jeremy Huddleston Sequoia
dc000f4d60 [PR #2182] rootless: Fix Glyphs damage bounding box to correctly compute union
PR: https://github.com/X11Libre/xserver/pull/2182
2026-04-13 12:40:10 +02:00
Olivier Fourdan
aacdd732cd [PR #2187] config: Fix compiler warning
PR: https://github.com/X11Libre/xserver/pull/2187
2026-04-13 12:40:10 +02:00
Alan Coopersmith
36d24b6a20 [PR #2190] render: handle -Wanalyzer-null-dereference in AllocateGlyphHash()
PR: https://github.com/X11Libre/xserver/pull/2190
2026-04-13 12:40:10 +02:00
Alan Coopersmith
6530d1a84e [PR #2191] tests: plug leak of results in compute_expected_damage()
PR: https://github.com/X11Libre/xserver/pull/2191
2026-04-13 12:40:10 +02:00
Alan Coopersmith
04d9972173 [PR #2192] fb: quiet -Wanalyzer-out-of-bounds warnings in fbOverlayCopyWindow()
PR: https://github.com/X11Libre/xserver/pull/2192
2026-04-13 12:40:10 +02:00
Tautvis
3b81b8a9b9 modesetting: fix defined(GBM_BO_*) enum compile checks
Apparently the enum values cannot be checked during preprocessor phase.
Fix it with checking gbm version using meson and defining additional
symbols which are visible during compile time.

Signed-off-by: Tautvis <gtautvis@gmail.com>
2026-04-10 14:09:38 +02:00
Joseph Crowell
1a756353ae fix DRI3 version detection
Signed-off-by: Joseph Crowell <joseph.w.crowell@gmail.com>
2026-04-10 14:09:24 +02:00
stefan11111
569787fcb4 meson.build: Lower libdrm version requirement
The version requrement was increased twice for Xwayland:
5a742ab876
588464332d

If we eventually add explicit sync support, we can increase the requirement again,
or add `ifdef`'s so we allow build with older libdrm

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-04-09 13:00:38 +02:00
stefan11111
91e09f8865 glamor: xfree86/glamor_egl: Fix builds without libdrm
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-04-09 13:00:38 +02:00
stefan11111
eb85cf92db glamor_egl: Split closeScreen cleanup in 2 functions
Fixes: 1530c7de53 (use-after-free)

The reason I moved this to PostCloseScreen is that glamor provides the function `glamor_egl_get_gbm_device`.

This function returns the gbm device that glamor creates.
Drivers (notably modesetting) can then use this gbm device to create bo's for whatever they need.

Since glamor's gbm device remains owned by glamor, it must only get freed
after the driver finishes freeing the bo's it created.

As such, glamor_egl's `closeScreen` must be called after the driver's `closeScreen`,
because otherwise, if we free the gbm device before freeing the bo's,
then when the bo's are freed, we will have an use-after-free.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-04-08 09:42:50 +02:00
stefan11111
d4e0c357f8 modesetting: Don't leak modifier list when creating a front bo
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-04-07 20:01:30 +02:00
stefan11111
a6a8bc9464 glamor: xfree86: Fully separate xfree86 glamor egl code from generic code
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-04-02 10:13:02 +02:00
stefan11111
1530c7de53 glxmor/glamor_egl: Move glamor_egl_close_screen to the post screen close hook
We want drivers' close screen hooks to be called before glamor's close screen
hook, because they may have gbm bo's created with glamor's gbm device.
If we free the gbm device before the driver frees all gbm bo's, then the
drivers could have an use-after-free when freeing the bo's.

This fixes a memory leak, since before this change, we were just
leaking everything glamor mapped to a screen, not freeing EGLImages,
gbm devices, etc.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-04-02 10:13:02 +02:00
stefan11111
2027509a86 glamor/glamor_egl: xfree86/glamor_egl: Split generic and xf86 glamor egl code
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-04-02 10:13:02 +02:00
stefan11111
36d80785ab glamor/glamor_egl.c: Split glamor_egl_init into generic and xf86 parts
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-04-02 10:13:02 +02:00
stefan11111
b76d18bf9b glamor/glamor_egl.c: Only use ScrnInfoPtr in the xf86-only code
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-04-02 10:13:02 +02:00
stefan11111
787cbc0bb2 glamor/glamor_egl.c: Begin spliting xf86 code from generic glamor egl code
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-04-02 10:13:02 +02:00
stefan11111
0d48e99e21 glamor/glamor_egl.c: Check if at least one (format, modifier) pair is supported
If there is not even one (format, modifier) pair,
then dri/dmabuf-based glamor egl cannot function.
This allows drivers, notably modesetting, to detect early that
glamor cannot be used, and fall back to something else.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-04-02 10:13:02 +02:00
John Studnicka
cf7c358d5b os: add busfault dummy struct
This should make the busfault structs happy on both sides of the ifdef

Signed-off-by: John Studnicka <contact@zentec.dev>
2026-03-25 14:40:09 +01:00
John Studnicka
06467f469f clang: don't use gnu_printf attribute
This should stop a lot of warning spam on any clang install, not just macOS/FreeBSD

Signed-off-by: John Studnicka <contact@zentec.dev>
2026-03-25 14:40:09 +01:00
stefan11111
3ad7e030ce modesetting: find the first compatible dri device as default
This change replaces the default "/dev/dri/card0" by a loop which
searches for the first compatible device.

This change avoids the error below which happens on some ARM boards:
(EE) No devices detected.
(EE)
Fatal server error:
(EE) no screens found(EE)
(EE)

Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1496>

----------------------------------------------------------------------------

modesetting: Plug seatd suppport into the dynamic dri node detection

Extended dynamic detection to 32 /dev nodes

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-03-24 15:49:43 +01:00
Edênis Freindorfer
8970a9f82e Support XDG Base Dir Spec 0.8.
This version of the spec (latest as of 27.12.2021) adds a variable
`$XDG_STATE_HOME` that may be used for log files, as described:

```
...
$XDG_STATE_HOME defines the base directory relative to which user-specific
state files should be stored. If $XDG_STATE_HOME is either not set or
empty, a default equal to $HOME/.local/state should be used.

The $XDG_STATE_HOME contains state data that should persist between
(application) restarts, but that is not important or portable enough to
the user that it should be stored in $XDG_DATA_HOME. It may contain:

actions history (logs, history, recently used files, …)
...
```

- https://specifications.freedesktop.org/basedir/0.8/

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/836>
2026-03-24 15:48:09 +01:00
Mario Limonciello
a86be24e6e Add compatibility define for pci_device_is_boot_display()
It will take some time for a new libpciaccess to be released and
even then bumping the dependency for libpciaccess isn't attractive.
If an older libpciaccess is used just add a static inline define.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2038>
2026-03-23 12:46:15 +01:00
Dongwon Kim
99473bb976 modesetting: Empty damage once dispatch is done
This commit is to fix some regression caused by

commit 995e60a919

where DamageEmpty on damage was missing in several
places.

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1486>
2026-03-19 18:48:39 +01:00
Sultan Alsawaf
7f7753dd87 modesetting: Don't recursively force present to unflip
Present calls drmmode_set_mode_major() as part of ms_present_unflip(),
which leads to a crash due to the recursive attempt to force present to
unflip when it already is.

Fix it by simply skipping the forced present unflip when present itself is
unflipping. This also speeds up drmmmode_prepare_modeset() when present
isn't even flipping to begin with.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1791

Fixes: 899c87af1f ("modesetting: unflip before any setcrtc() calls")
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1793>
2026-03-19 18:48:28 +01:00
Povilas Kanapickas
9edc105abd Revert "glamor: explicitly draw endpoints of line segments"
This reverts commit 530e80375e.

The commit breaks xts5/Xlib9/XDrawLines/XDrawLines test as per
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1801#note_2812218

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1858>
2026-03-19 18:48:04 +01:00
stefan11111
a2976e3023 treewide: Pull DEFAULT_LOGDIR into dix-config.h
With this, X servers don't have to parse this option separately,
and can just use it after including dix-config.h

Linux kdrive servers (currently Xfbdev only) now support logging.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-03-18 14:09:52 +01:00
EXtremeExploit
16fe763707 os/log: Fix syslog identification
Signed-off-by: EXtremeExploit <pedro.montes.alcalde@gmail.com>
2026-03-18 10:13:41 +01:00
NexusSfan
13234efe7b Fix Hurd support for the vesa driver.
Also, nitpick, but `__GNU__` is the correct ifdef to use, not `__hurd__`.

Signed-off-by: NexusSfan <nexussfan@duck.com>
2026-03-16 13:30:13 +01:00
Mikhail Dmitrichenko
9036215b02 dix: avoid null ptr deref at doListFontsAndAliases
In the `doListFontsAndAliases` function in dixfonts.c, when a font alias
is encountered (`err == FontNameAlias`) as a result of
`list_next_font_or_alias` call, the code allocates memory for
`resolved` variable (`resolvedlen + 1` bytes) for storing target font
name. In this case, if the `malloc(resolvedlen + 1)` call fails,
`resolved` remains NULL.

Later, when check (`else if (err == FontNameAlias)`) is TRUE, the code
uses `memcpy` to copy nullable `resolved` into `tmp_pattern` without
checking if `resolved` is NULL, so there is a potential null ptr
dereference.

This commit replaces `malloc` with `XNFalloc` for allocating memory for
`resolved`. `XNFalloc` will internally check result of `malloc` and stop
program execution if allocation was failed, preventing potential NULL
dereferencing.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2114>
2026-03-16 13:26:38 +01:00
Mikhail Dmitrichenko
4eeb22c8be render: fix multiple mem leaks on err paths
Free nested allocations when initialization fails.
Several code paths returned early on error without releasing
memory owned by embedded structures, leading to leaks.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2125>
2026-03-16 13:26:38 +01:00
Merlion Spiller
0f5c85f51b COPYING: add author to HPND-sell-MIT-disclaimer-xserver
the license notice comes from these files:
- dix/registry.c
- Xext/xselinuxint.h
- Xext/xselinux_label.c
- Xext/xselinux_hooks.c
- Xext/xselinux_ext.c
- Xext/xselinux.h
- Xext/xacestr.h
- Xext/xace.h
- Xext/xace.c

while this is not like the standard `Copyright (C)` lines I think it
still belongs to the license, even if just to make it more clearly
separate from the MIT license above

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2098>
2026-03-16 13:25:53 +01:00
Merlion Spiller
6aa1ba4579 COPYING: add missing paragraph to SGI-B-2.0
all files that this license applies to include the last paragraph:
- glx/xfont.c
- glx/unpack.h
- glx/singlesize.h
- glx/singlesize.c
- glx/singlepixswap.c
- glx/singlepix.c
- glx/single2swap.c
- glx/single2.c
- glx/rensize.c
- glx/renderpixswap.c
- glx/renderpix.c
- glx/render2swap.c
- glx/render2.c
- glx/glxutil.h
- glx/glxdrawable.h
- glx/glxserver.h
- glx/glxcontext.h
- glx/glxscreens.h
- glx/glxscreens.c
- glx/glxcmdsswap.c
- glx/glxext.h
- glx/glxcmds.c
- glx/glxext.c

the paragraph was likely accidentally missed when the license changed
from SGI-B-1.0 to SGI-B-2.0 in ed9aecf851

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2097>
2026-03-16 13:25:53 +01:00
Qiang Yu
2c0c2ec102 glamor: enable dmabuf_capable by default for radeonsi
This is needed by radeonsi to support multi plane modifier when
using modesetting DDX.

xserver reject any multi plane buffer (in DRI3PixmapFromBuffers)
without the dmabuf_capable debug option. It's OK for single plane
buffer as xserver will fallback to DRI3BufferFromPixmap path.
amdgpu DDX does not expose DRI3PixmapFromBuffers, mesa just use
the single plane path anyway, so amdgpu DDX does not have this
problem.

Reviewed-by: Sultan Alsawaf <sultan@kerneltoast.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2091>
2026-03-16 13:23:52 +01:00