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>
Stop declaring `extern` variables/functions throught the code.
Move ddxInit out of the linux driver code.
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
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>
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>
`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>
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>
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>
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
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>
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>
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>
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
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
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
In miPointerSetPosition(), ensure nevents and events pointers are non-NULL
before checking for and updating barrier event coordinates to avoid potential
NULL pointer dereferences
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
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>
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>
'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>
`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>
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>
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>
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>
dri3 registers it's own screen private, which invalidates
the pointer glamor egl passes.
Caught with asan
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
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>