Commit graph

23,787 commits

Author SHA1 Message Date
stefan11111
de16c2dd4d kdrive: Move glamor and linux info from the Xfbdev man page to the Xkdrive man page
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-16 16:22:36 +02:00
stefan11111
e6313e11c7 kdrive: Lift glamor-related argument parsing from Xfbdev
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-16 16:22:36 +02:00
stefan11111
8d8c91cc2f kdrive/fbdev: Update the code and man page to reflect removed options
Final part of fixing https://github.com/X11Libre/xserver/issues/2711

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-16 16:22:36 +02:00
stefan11111
a735399f99 kdrive: Lift the meat of fbdev_glamor into generic kdrive code
May be used sometime in the future.

Some options, like partial DRI3, automatic DRI3, and Xfbdev drm master were removed.
They were added only as expermiments and used while e.g. getting glamor to work on old nvidia devices.

They have served their purpose, and will be removed in future commits.

These options also caused issues on some setups.
Part of fixing https://github.com/X11Libre/xserver/issues/2711
(by removing the offending options)

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-16 16:22:36 +02:00
stefan11111
08c5985cac kdrive: Add a proper header for the linux drivers
Stop declaring `extern` variables/functions throught the code.
Move ddxInit out of the linux driver code.

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-16 16:22:36 +02:00
Enrico Weigelt, metux IT consult
b6384684a1 cygwin CI: install python312-lxml instead of python39-lxml
The Cygwin meson runtime resolves to /usr/bin/python3.12.exe (python312 is
pulled in transitively as a meson dependency), while the workflow only
installed python39-lxml. hw/xwin/glx/meson.build therefore failed with
"python3 lxml module not found" on every PR.

Install the lxml module for the Python interpreter meson actually uses.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-09-11 20:41:21 +02:00
stefan11111
9112ac18bf modesetting: Don't enable X-Video with dri3_only glamor
Doesn't work, but doesn't segfault either
Don't forbid it in Xfbdev for easier testing

Saves a bit of system memory too

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-11 14:13:17 +02:00
stefan11111
2e03d4e0d4 modesetting: Don't allocate a gbm bo for the root pixmap with no accel
ShadowFB usually has far better performance

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-11 14:13:17 +02:00
stefan11111
978d35f0b2 modesetting: Don't call shadowRemove in CloseScreen
`shadowCloseScreen` already gets called before modesetting's
`CloseScreen`, so when modesetting calls `shadowRemove`, it reads freed memory.

Caught with asan

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-11 14:13:17 +02:00
stefan11111
d560477351 modesetting: Add option to enable glamor without render acceleration
Only enabled DRI3 and GLX support

Closes: https://github.com/X11Libre/xserver/issues/1989

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-11 14:13:17 +02:00
stefan11111
84e793a2df glamor: Restore GetImage proc
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-11 14:13:17 +02:00
stefan11111
e97c5f2521 glamor/glamor_font.c: Don't allocate gpu memory with GLAMOR_NO_RENDER_ACCEL
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-11 14:13:17 +02:00
stefan11111
c60ee9214c glamor: Render gradients in software with GLAMOR_NO_RENDER_ACCEL
Saves some more gpu resources

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-11 14:13:17 +02:00
stefan11111
125ca6bdf0 glamor: Make GLAMOR_NO_RENDER_ACCEL only affect CreatePixmap
If `CreatePixmap` is not modified, all created pixmaps will be fb

This is part of getting glamor's DRI3 implementation working
without accelerating regular pixmaps.

glamor's DRI3 implementation already moves pixmaps to
gpu memory, so there should be no need to modify that code.

See: https://github.com/X11Libre/xserver/issues/1989
for why this is useful

From my testing on a 1920x1080 screen, after the next patches to plug in
standalone DRI3 support, the X server's gpu memory usage
falls to 1-2 MB.

For systems with very limited gpu memory (e.g. 16 MB),
this is significant too, but far better than full accel.

Use `git diff -w` for easier review.

Not that most of the changes were added in
5adae6c3b3

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-11 14:13:17 +02:00
stefan11111
c504257e02 glamor/glamor_compositerects.c: Set need_free_region immediately after pixman region allocation
Otherwise, the region would leak when the pixmap is not in gpu memory

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-11 14:13:17 +02:00
stefan11111
3d27175b3c glamor/glamor_composite_glyphs.c: Fix wrong !glamor_pixmap_is_memory check
When pixmaps aren't memory, that is the happy path
When pixmaps are memory, we need to bail to glamor_composite, which bails to fb.

Fixes the trashed rendering described in https://github.com/X11Libre/xserver/pull/1853

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-11 14:13:17 +02:00
Herman Semenoff
eda471e6f0 xnest: Check malloc return values in GCOps to avoid NULL dereferences
Check malloc() return values for NULL in xnestBitBlitHelper(), xnestPolyText8(),
and xnestPolyText16() to prevent potential NULL pointer dereferences
2026-09-09 11:33:58 +02:00
Herman Semenoff
e5137d9fde mi: fix operator precedence in hookX when calculating arc hook offset
In hookX(), add parentheses around the ternary operator (left ? -def->l : def->l)
so that the addition applies to the selected delta rather than treating
(def->w + left) as the ternary condition
2026-09-09 11:33:48 +02:00
stefan11111
bd6f4c6eee CI: Enable DRI2 and DRI3 on Solaris
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-09 11:33:33 +02:00
stefan11111
dd39f27032 glamor/glamor_egl.c: Add some missing #ifdef WITH_LIBDRM guards
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-09 11:33:33 +02:00
stefan11111
d79cae9bb4 treewide: Add and use fallbacks for libdrm and libgbm
Similar to https://github.com/X11Libre/xserver/pull/2296

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-09-09 11:33:33 +02:00
Enrico Weigelt, metux IT consult
468b86a562 SDK: define BSD console macros unconditionally for driver builds
When building the xserver SDK on Linux (e.g. GitHub Actions Ubuntu runners),
the BSD console macros (CONFIG_BSD_CONSOLE, CSRG_BASED, PCVT_SUPPORT,
SYSCONS_SUPPORT, WSCONS_SUPPORT) were not defined because they were gated
on host_machine.system(). This caused driver builds (e.g. xf86-input-keyboard)
to fail when building against the SDK, as they reference xf86Info.consType
and the PCCONS/SYSCONS/PCVT/WSCONS constants.

Fix by defining these macros unconditionally in conf_data and xorg_data when
build_xorg_sdk is true, so the installed SDK headers contain them regardless
of the build platform. For non-SDK builds, keep the platform-appropriate
conditional values.

Also add CONFIG_BSD_CONSOLE to the xlibre-server.h template.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-09-07 10:59:54 +02:00
galternat
7dd2a11ae6 meson: match on host CPU family, not the raw CPU name
host_machine.cpu() returns the unnormalized machine name ('i686',
'armv7l', 'powerpc64'), but all four of these tests compare it against
cpu_family() names, so they mostly match nothing: 32-bit x86 builds
without -D_PC and without ACPI, and the arm and FreeBSD/powerpc int10
defaults never fire.

Use cpu_family() throughout, and spell out ppc64 to match the powerpc*
of the autotools case that rule came from. Only 32-bit x86, 32-bit ARM
and FreeBSD/powerpc* change; x86_64, aarch64 and ia64 evaluate as
before. ARM now gets the stub int10 that b241934238 ("default to stub
int10 implementation on arm") intended, which is why this needs the
preceding commit.

Fixes: 1549e30372 ("Add a Meson build system alongside autotools.")
Fixes: e02afb9478 ("meson: Make ACPI support optional")
Fixes: 8c54d590cb ("Fix build on FreeBSD/powerpc*")
Assisted-by: Claude:claude-opus-5
Signed-off-by: galternat <galternat.twins223@simplelogin.com>
2026-09-02 12:09:13 +02:00
galternat
f91c33272f xfree86: int10: keep the int10 core out of the stub backend
Autotools built stub.c and xf86int10module.c for INT10_STUB;
helper_exec.c, helper_mem.c and xf86int10.c belonged to the vm86 and
x86emu backends. The meson port left all three in the list shared by
every backend, so -Dint10=stub does not build: stub.c and helper_exec.c
both define xf86InitInt10(), and int10Defines.h, which helper_exec.c and
xf86int10.c include, needs <asm/vm86.h> under -D_VM86_LINUX.

Move the three files to the non-stub branch, and drop the -D_VM86_LINUX
from the stub branch, where no remaining source tests it - the vm86
branch keeps its own. vbe.c and vbeModes.c stay in the common list;
every int10 entry point they call is defined in stub.c.

Fixes: 1549e30372 ("Add a Meson build system alongside autotools.")
Assisted-by: Claude:claude-opus-5
Signed-off-by: galternat <galternat.twins223@simplelogin.com>
2026-09-02 12:09:13 +02:00
Herman Semenoff
b1571febfd fb: Avoid potential out-of-bounds shift amounts in fbBlt
Some checks failed
Build X servers / drivers-build-ubuntu (video-savage:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-siliconmotion:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sis:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sisusb:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg14:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg3:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg6:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sunffb:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sunleo:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suntcx:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-tdfx:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-trident:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-v4l:25.0.1) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vbox:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vesa:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vmware:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-voodoo:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-xgi:25.0.0) (push) Has been cancelled
Build X servers / xserver-build-mingw32-ubuntu (push) Has been cancelled
Build X servers / xserver-build-freebsd (push) Has been cancelled
Build X servers / xserver-build-dragonflybsd (push) Has been cancelled
Build X servers / xserver-build-netbsd (push) Has been cancelled
Build X servers / xserver-build-solaris (push) Has been cancelled
Build X servers / xserver-build-openbsd (push) Has been cancelled
Build X servers / xserver-build-hurd (push) Has been cancelled
Build X servers / xserver-build-alpine (push) Has been cancelled
Build X servers / gentoo-deps-image (push) Has been cancelled
Build X servers / xserver-build-rhel (10) (push) Has been cancelled
Build X servers / xserver-build-rhel (9) (push) Has been cancelled
Build X servers / Release pushed tag (push) Has been cancelled
In fbBlt(), explicitly check (srcX < dstX) in the alternate shift calculation
branch so that shift values (leftShift and rightShift) remain strictly within
valid bit-width bounds [0..FB_UNIT - 1], avoiding potential 32-bit shift
undefined behavior warnings
2026-08-31 15:51:17 +02:00
Herman Semenoff
c096eed016 Xi: Guard against NULL event pointer
Check that 'ev' is not NULL before attempting to deliver touch ownership
events in TouchPuntToNextOwner(), and add a defensive null check in
DeliverTouchEvents() to avoid potential NULL pointer dereferences
2026-08-31 14:47:14 +02:00
kaolinite7
7cc65bb53c Fix DPI property not reporting accurate value when autosetDPI is TRUE 2026-08-31 14:37:35 +02:00
kaolinite7
2b7cbdda1a Add Support for DPI Auto-Detection
This PR re-adds support for DPI Auto-Detection which was available in X.Org till 21.1, but was removed. This reverts commit 35af1299 and allows to get Auto DPI Detection back only when specified by user as:
$ X -dpi auto
2026-08-31 14:37:35 +02:00
Herman Semenoff
2c98c76fb7 randr: validate outputs pointer at start of RRCrtcNotify
Move the BUG_RETURN_VAL check for (numOutputs != 0 && outputs == NULL) to
top of RRCrtcNotify() before iterating over outputs, and guard the
memcpy() call with (numOutputs > 0) to avoid potential NULL pointer
dereferences
2026-08-31 14:32:55 +02:00
Herman Semenoff
11bb4b1b73 mi: guard against NULL event pointer
In miPointerSetPosition(), ensure nevents and events pointers are non-NULL
before checking for and updating barrier event coordinates to avoid potential
NULL pointer dereferences
2026-08-31 14:02:13 +02:00
Herman Semenoff
cf0d4a3456 damage, exa: Add NULL checks for DamagePtr in damage helpers and exaPutImage
Return NULL from DamageRegion() and DamagePendingRegion() (and check in
  DamageEmpty()) when passed a NULL DamagePtr
In exaDoPutImage(), explicitly set migration pReg to NULL since
  pExaPixmap->pDamage is guaranteed to be NULL there
2026-08-31 13:36:03 +02:00
Kiyoshi Spreclerg
3e2fccbb7a miext/sync/misyncfd.c: fix NULL deref on uninitialized screens
852128f18 made the screen private preallocated, so it exists on every
screen as soon as the single global key is registered. sync_fd_screen_priv()
therefore never returns NULL again, which breaks the "already initialized"
check in miSyncFdScreenInit() and the guards in miSyncInitFenceFromFD() /
miSyncFDFromFence(), which then call through a zeroed funcs pointer.

Multi-GPU setups crash on this: with glamor on one screen and a non-glamor
driver (NVIDIA blob under PRIME) on the other, XSyncCreateFenceFromFD on
the latter kills the server.

Use a filled-in funcs as the sentinel instead of the private's presence.

Assisted-by: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Kiyoshi Spreclerg <kiyoshi_pip@protonmail.com>
2026-08-31 12:39:20 +02:00
Tautvis
70fda9ffbf modesetting: force software cursor for vm gpus
This commit refactors 61aa2ede91 to always force the software cursor (and disable power
consumption optimizations) when a known VM DRM driver is running. This is done because cursor behavior varies depending
on the VM frontend, leading to inconsistencies:

* if the display backend is gtk, the cursor is shown by default when the window is out of focus and hidden when in focus
  (it must be rendered by the VM GPU in software).
* if the display backend is sdl, it always shows the cursor, regardless of drmModeSetCursor2 and related function calls.
* if the VM runs under a Spice backend using the QXL display, the rendering application (remote-viewer) behaves
  correctly.

For more details, see the QEMU manpage (search for show-cursor):
https://www.qemu.org/docs/master/system/qemu-manpage.html

Until a better solution is found, force the software cursor.

fixes: https://github.com/X11Libre/xserver/issues/3477

Signed-off-by: Tautvis <gtautvis@gmail.com>
2026-08-31 12:36:22 +02:00
Enrico Weigelt, metux IT consult
56be9f4320 os: fix undefined behavior in FormatInt64() for INT64_MIN
Some checks failed
Build X servers / drivers-build-ubuntu (video-siliconmotion:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sis:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sisusb:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg14:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg3:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg6:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sunffb:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sunleo:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suntcx:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-tdfx:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-trident:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-v4l:25.0.1) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vbox:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vesa:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vmware:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-voodoo:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-xgi:25.0.0) (push) Has been cancelled
Build X servers / xserver-build-mingw32-ubuntu (push) Has been cancelled
Build X servers / xserver-build-freebsd (push) Has been cancelled
Build X servers / xserver-build-dragonflybsd (push) Has been cancelled
Build X servers / xserver-build-netbsd (push) Has been cancelled
Build X servers / xserver-build-solaris (push) Has been cancelled
Build X servers / xserver-build-openbsd (push) Has been cancelled
Build X servers / xserver-build-hurd (push) Has been cancelled
Build X servers / xserver-build-alpine (push) Has been cancelled
Build X servers / gentoo-deps-image (push) Has been cancelled
Build X servers / xserver-build-gentoo (push) Has been cancelled
Build X servers / xserver-build-rhel (10) (push) Has been cancelled
Build X servers / xserver-build-rhel (9) (push) Has been cancelled
Build X servers / Release pushed tag (push) Has been cancelled
'num * -1' is undefined behavior when num is INT64_MIN, since the
positive value (9223372036854775808) exceeds INT64_MAX.

Fix by casting to uint64_t before negation, which is well-defined
unsigned modular arithmetic and produces the correct absolute value
for all int64_t values including INT64_MIN.

Fixes: https://github.com/X11Libre/xserver/issues/3610
Fixes: 2a41522349
Reported-by: Alex <alexzk1@users.noreply.github.com>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-08-27 15:51:43 +02:00
stefan11111
2959d69753 modesetting: Fix use-after-free when aborting queued events
`ms_drm_abort` calls the `match` function pointer for every
event in the queued event list

However, present frees the event data when aborting an event,
so when `ms_drm_abort` was getting called after an aborted event,
in was calling `match` with a dangling pointer, leading to an use-after-free

See: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2290

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-27 15:50:02 +02:00
daemonratte
760d5c2ed1 fix getrandom fallback
Some checks failed
Build X servers / drivers-build-ubuntu (video-siliconmotion:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sis:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sisusb:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg14:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg3:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg6:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sunffb:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sunleo:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suntcx:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-tdfx:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-trident:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-v4l:25.0.1) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vbox:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vesa:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vmware:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-voodoo:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-xgi:25.0.0) (push) Has been cancelled
Build X servers / xserver-build-mingw32-ubuntu (push) Has been cancelled
Build X servers / xserver-build-freebsd (push) Has been cancelled
Build X servers / xserver-build-dragonflybsd (push) Has been cancelled
Build X servers / xserver-build-netbsd (push) Has been cancelled
Build X servers / xserver-build-solaris (push) Has been cancelled
Build X servers / xserver-build-openbsd (push) Has been cancelled
Build X servers / xserver-build-hurd (push) Has been cancelled
Build X servers / xserver-build-alpine (push) Has been cancelled
Build X servers / gentoo-deps-image (push) Has been cancelled
Build X servers / xserver-build-gentoo (push) Has been cancelled
Build X servers / xserver-build-rhel (10) (push) Has been cancelled
Build X servers / xserver-build-rhel (9) (push) Has been cancelled
Build X servers / Release pushed tag (push) Has been cancelled
The fallback used an undefined variable and was missing the header
for getrandom(). Also avoid doing pointer arithmetic on void *.

Tested with musl on real MIPS32el, MIPS64eb, PowerPC32 and PowerPC64eb hardware.

Fixes: #3034
Signed-off-by: daemonratte <daemonratte@daemonratte.net>
2026-08-26 10:01:48 +02:00
galternat
24f7f64c5f xfree86: drop parentheses from non-expression macro arguments
In int10Defines.h the CPU_RD()/CPU_RW()/CPU_RB() name argument is
forwarded to CPU_R(), which uses it as a struct member name, so
parenthesizing it expands to regs.(eax) and every X86_* accessor fails
with "error: expected identifier before '(' token". This affects any
build defining _VM86_LINUX, which meson sets for both -Dint10=vm86 and
-Dint10=stub. The num argument is a genuine index expression and keeps
its parentheses.

In x86emui.h X86EMU_UNUSED() is used in declarator position, as in
x86emuOp_nop(u8 X86EMU_UNUSED(op1)), where parentheses serve to rebind
the postfix [] and () operators against the prefix *. Around a bare
identifier in a parameter declaration they instead expose C17
6.7.6.3p11: should op1 ever collide with a typedef, "u8 (op1)" silently
declares an unnamed u8 (*)(op1) parameter, where the plain form would
be a syntax error. Not a build failure today, but the plain form
carries no such dependency.

Fixes: a79d0cf1c9 ("xfree86: parentheses around macro argument symbols")
Assisted-by: Claude:claude-opus-5
Signed-off-by: galternat <galternat.twins223@simplelogin.com>
2026-08-25 16:45:14 +02:00
stefan11111
125eff73fa xfree86: glamor_egl: Add option "DirectDRI3"
Some checks failed
Build X servers / drivers-build-ubuntu (video-siliconmotion:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sis:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sisusb:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg14:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg3:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg6:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sunffb:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sunleo:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suntcx:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-tdfx:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-trident:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-v4l:25.0.1) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vbox:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vesa:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vmware:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-voodoo:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-xgi:25.0.0) (push) Has been cancelled
Build X servers / xserver-build-mingw32-ubuntu (push) Has been cancelled
Build X servers / xserver-build-freebsd (push) Has been cancelled
Build X servers / xserver-build-dragonflybsd (push) Has been cancelled
Build X servers / xserver-build-netbsd (push) Has been cancelled
Build X servers / xserver-build-solaris (push) Has been cancelled
Build X servers / xserver-build-openbsd (push) Has been cancelled
Build X servers / xserver-build-hurd (push) Has been cancelled
Build X servers / xserver-build-alpine (push) Has been cancelled
Build X servers / gentoo-deps-image (push) Has been cancelled
Build X servers / xserver-build-gentoo (push) Has been cancelled
Build X servers / xserver-build-rhel (10) (push) Has been cancelled
Build X servers / xserver-build-rhel (9) (push) Has been cancelled
Build X servers / Release pushed tag (push) Has been cancelled
Mostly intended for people working on this code

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:45:13 +02:00
stefan11111
b4c1eed29b glamor_egl: constify glamor_egl_conf_t
This is info we get from the DDX about setting up glamor,
we really shouldn't modify it

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:45:13 +02:00
stefan11111
69c3f90728 glamor_egl: Add some compatibility defines for missing libdrm
Allows us to get rid of some ifdefs and should get direct DRI3
working without libdrm

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:45:13 +02:00
stefan11111
5f44d74b4a glamor/glamor_egl: Simplify probing DRI3 capabilities
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:45:13 +02:00
stefan11111
1ac7652593 glamor/glamor_egl.c: Bring back the slower, gbm-based implementation of DRI3 import
Apparently KDE's compositor has issues if the dma bufs it sends are imported directly as-is.

Instead, we now create a gbm bo from the dma bufs we receive,
export that as dma bufs, and import those dma bufs.

In the no-gbm case, both when explicitly requested (like Xfbdev),
and when needed (like nvidia-470 which doesn't have official gbm support),
we still use only the faster, non-gbm-based implementation that imports dma bufs directly.

This is effectively a revert of 6b3703e120
on the setups where possible.

As a side effect, DRI3 import might be slightly slower,
hopefully not enough to be noticeable.

Note that it makes no sense to me why this would be needed.
Note also that Xwayland's EGLStream backend was also
importing dma bufs directly:
cac9b20af3/hw/xwayland/xwayland-glamor-eglstream.c (L792)

Fixes: https://github.com/X11Libre/xserver/issues/3262

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:45:13 +02:00
stefan11111
ab952e08a3 glamor_egl: split glamor_egl_init_internal into multiple functions
No functional changes intended, those will come in further commits

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:45:13 +02:00
stefan11111
916e677e7b glamor_egl: Don't pass an (offset) pointer to glamor_egl's screen private to DRI3
dri3 registers it's own screen private, which invalidates
the pointer glamor egl passes.

Caught with asan

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:45:13 +02:00
stefan11111
df2695a184 kdrive/linux: Add .Fini function to the linux keyboard driver
If this function is missing, `KdKeyboardProc` returns
`BadImplementation` and doesn't free the keyboard info

Asan still isn't happy about the leak for some reason,
but looking through gdb shows that `KdFreeKeyboard` gets
called now

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:43:31 +02:00
stefan11111
15f6f2a08e kdrive/fbdev: Call glamor_fini in fbdevFiniAccel
Purely cosmetic, since `glamor_fini` currently does nothing

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:43:31 +02:00
stefan11111
ae26465ccd kdrive/fbdev: Use FB_ACTIVATE_TEST to probe supported modes
Don't set the video card mode unnecessarily

Also clean up the mode setting code

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:43:31 +02:00
stefan11111
852128f184 miext/sync/misyncfd.c: Don't leak the screen private
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:43:31 +02:00
stefan11111
e9fe96ed50 kdrive/{fbdev,ephyr}: Free the screen private screen->driver
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:43:31 +02:00
stefan11111
8b4ab8b697 kdrive: glamor_xv: Don't leak X-Video memory and textures
Clears a few KB of leaks from asan

xf86 has similar issues

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
2026-08-25 10:43:31 +02:00