Commit Graph

22025 Commits

Author SHA1 Message Date
Marc-Alexandre Espiaut
0588be6d1e dix: FreeClientPixels(): fix -Wunused-parameter warning
Signed-off-by: Marc-Alexandre Espiaut <76531574+malespiaut@users.noreply.github.com>
2025-11-18 13:30:32 +01:00
Chase
fcbb2bafce treewide: replace __FUNCTION__ by __func__
prefer C99 standard over non-standard legacy symbols

Signed-off-by: Chase <chinkle3@illinois.edu>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-18 13:29:47 +01:00
stefan11111
434331e129 modesetting: Split chosing gbm format into drmmode_gbm_format_for_depth
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-17 18:55:20 +01:00
stefan11111
68e3e9fcb1 modesetting: rename drmmode_bo_has_bo to drmmode_bo_get_bo
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-17 18:55:20 +01:00
stefan11111
db77a579c6 modesetting: don't return a value from drmmode_bo_destroy
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-17 18:55:20 +01:00
stefan11111
49c9aaac82 modesetting: Move the compatibility GBM_BO_USE_FRONT_RENDERING define to the top of the file
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-17 18:55:20 +01:00
Chase
e0481acb79 xf86Crtc.c: fix formatting 2025-11-17 18:53:47 +01:00
Chase
594d05757d xkb.c: const correctness 2025-11-17 18:45:29 +01:00
Chase
2fff53d35d Xtransutil.c: minor formatting fix 2025-11-17 13:16:45 +01:00
Chase
ba33b36f7a xnest icons: const correctness 2025-11-17 12:53:09 +01:00
Enrico Weigelt, metux IT consult
40f0a4237c include: regionstr.h: drop unused legacy macros
Those aren't used by any drivers anymore (and shouldn't be).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-12 15:39:50 +01:00
stefan11111
0ec0f00c23 glx: revert cb85ceae2d
This commit broke glx after server reset.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-11 10:46:29 +01:00
stefan11111
631dc9d275 dix: partially revert 8399c4e263
Turns out that glx does need this one.

Assuming no external modules need this,
it should be fine to keep this in a private header.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-11 10:46:29 +01:00
Enrico Weigelt, metux IT consult
ec3232e36e dix: move ReplyNotSwappd() out of public header
Internal, non-publich function - should not be in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-11 10:43:11 +01:00
Enrico Weigelt, metux IT consult
932f4be393 include: windowstr.h: drop unused Guarantee* defines
They aren't used anymore since about two decades, so no need to
keep them around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-11 10:42:54 +01:00
Enrico Weigelt, metux IT consult
f813cb569f dix: move swaprep.h and swapreq.h into dix
These aren't public includes, so they're better placed in dix.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-11 10:42:40 +01:00
Marc-Alexandre Espiaut
bef8267f04 config: socket_handler(): fix -Wunused-parameter warning
Signed-off-by: Marc-Alexandre Espiaut <ma.dev@espiaut.fr>
2025-11-10 11:10:00 +01:00
stefan11111
8bb2fc9d76 modesetting: Create the front buffer with GBM_BO_USE_FRONT_RENDERING
Also renamed `drmmode_create_bo` to `drmmode_create_front_bo`,
better reflecting how it is used.

According to the mesa docs: https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/gbm/main/gbm.h :
```
   /**
    * The buffer will be used for front buffer rendering.  On some
    * platforms this may (for example) disable framebuffer compression
    * to avoid problems with compression flags data being out of sync
    * with pixel data.
    */
   GBM_BO_USE_FRONT_RENDERING = (1 << 6),
```

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-10 11:08:59 +01:00
Enrico Weigelt, metux IT consult
7a8f12361d os: move OS_COMM_* defines into os/connection.c
They're only used inside os/connection.c, so no need to have them
in some header and expose them to other areas.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-10 11:07:58 +01:00
Enrico Weigelt, metux IT consult
445ee2da93 include: mark XNFasprintf() as deprecated
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-10 11:07:42 +01:00
Enrico Weigelt, metux IT consult
1e62e5f417 xfree86: pci_ids: drop unused ifndef IRIS
This symbol was never defined. Just a fallout from copying over
this file from MESA.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-10 11:05:30 +01:00
stefan11111
53f1095118 modesetting: Fix leak when disabling hw cursor
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-10 10:31:55 +01:00
stefan11111
bd540a8f46 modesetting: don't probe size_hints if the cursor is already probed
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-10 10:28:00 +01:00
stefan11111
ed49ae8fe7 modesetting: clean up drmmode_crtc_create_planes
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-10 10:28:00 +01:00
stefan11111
e5df974aab modesetting: get the SIZE_HINTS cursor plane property in drmmode_crtc_create_planes
We were duplicating this code needlessly and in an error-prone way.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-10 10:28:00 +01:00
Enrico Weigelt, metux IT consult
51bafc8244 render: drop SProcRenderDispatch() and SProcRenderVector[]
Now that we don't have any SProc*'s anymore (everything now done by the
corresponding Proc*'s), there's no need for SProcRenderDispatch() entry
point and the SProcRenderVector[] call table anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-09 17:22:26 +01:00
Enrico Weigelt, metux IT consult
b0b9a624d8 os: replace ETEST macro by ossock_wouldblock()
Move this to a little function (which also has a better name now)
inside the already platform specific ossock.c

Also removing the EMSGSIZE check: we're using TCP or local unix
socket, so EMSGSIZE is never returned.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-08 10:46:03 +01:00
Enrico Weigelt, metux IT consult
037a2e5675 include: unexport CURSOR_BITS_SIZE() and CURSOR_REC_SIZE() 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-08 10:45:43 +01:00
Enrico Weigelt, metux IT consult
5f8edd4560 glamor: fix parameter indentions on asprintf() calls
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 19:19:06 +01:00
Enrico Weigelt, metux IT consult
226211f7a7 glamor: replace XNFasprintf() by asprintf()
Just use standard libc functions instead of own (incomplete)
implementations.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 19:19:06 +01:00
Enrico Weigelt, metux IT consult
cd3b208bde os: osdep: drop unused OsFlushFunc
Not used anymore for over two decades now, so no need to keep it around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 19:12:08 +01:00
Enrico Weigelt, metux IT consult
6bc92a5674 modesetting: replace tabs by whitespace
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 16:42:27 +01:00
stefan11111
516239c164 modesetting: Fix -Wunused-variable warnings
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-07 15:38:15 +01:00
Enrico Weigelt, metux IT consult
1c706efc2b include: dixfontstr.h: drop unused PADGLYPHWIDTHBYTES defines
Not used anywhere anymore, so no need to keep them around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 09:32:40 +01:00
Enrico Weigelt, metux IT consult
94f7925f01 dix: move IMAGE_BUFSIZE define out of public header
It's just a tuning parameter (that nobody touched for aeons) for
DoGetImage(), inside dix/dispatch.c

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 09:32:17 +01:00
Enrico Weigelt, metux IT consult
b3a5b5b61c os: drop unused Xscnprintf() and Xvscnprintf()
Not used anywhere (not even in drivers), so no need to keep them anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 09:31:48 +01:00
Enrico Weigelt, metux IT consult
0c7799b916 glamor: replace XNFvasprintf() by vasprintf()
No need for carrying around our own (incomplete) implementation
of a standard libc function.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 09:31:10 +01:00
notbabaisyou
6c924809e4 modesetting: Make the async-flipping key global. 2025-11-06 15:56:07 +01:00
Qiang Yu
c5fad50afe modesetting: fix PRESENT_FLIP_REASON_BUFFER_FORMAT gets overwritten
When dmabuf_capable is enabled, ms_present_check_unflip may return
with reason PRESENT_FLIP_REASON_BUFFER_FORMAT to be reported back
to client by PresentCompleteModeSuboptimalCopy. We should not
overwrite it by page flip reasons anyway when exit.

This fix also avoid changing vblank->exec_msc in present_scmd_pixmap()
which caused by page flip reasons to prevent a present to be executed
immediatly. So that we can cancel pending vblanks when new vblanks with
same msc arrive. This happens when application just starts.

This problem can be observed at least using radeonsi OGL driver, start
xserver with dmabuf_capable enabled, no window manager, glxgears will
stuck for the first several seconds. If using a composite window manager
like Mutter, we can't observe the glxgears stuck, but the prensent
complete event still shows unexpected Copy mode instead of
PresentCompleteModeSuboptimalCopy or Skip mode.

glxgears window msc is 0 at the beginning, it will send present request
with target msc = 1, 2, 3, ... N before server send back the complete
event for target msc = 1. But server side window msc is way bigger than N,
so it will think all these present requests are outdated and just show the
Nth request at the next vblank. [1 .. N-1] requests should be skipped.
But without this fix, all [1 .. N] presents will be executed with Copy
mode which causes stuck.

Fixes: a94dd953 ("modesetting: add support for TearFree page flips")
2025-11-06 15:56:07 +01:00
notbabaisyou
e26da636bf modesetting: Allow selecting more optimal modifiers. 2025-11-06 15:56:07 +01:00
notbabaisyou
0c6cb9532b modesetting: Omit DRM_FORMAT_MOD_INVALID.
Previously it was possible for the invalid modifier to be placed in the IN_FORMATS or IN_FORMATS_ASYNC arrays, this is of course not wanted as this can cause problems with devices that lack support for explicit modifiers.
2025-11-06 15:56:07 +01:00
Ville Syrjälä
d3ec45f01c modesetting: Use IN_FORMATS_ASYNC for async flips
Use the IN_FORMATS_ASYNC blob (as opposed to the normal
IN_FORMATS blob) to determine which formats/modifiers are
supported. This will allow the client to allocate buffers
which can actually be async flipped.

In order to guarantee that the most optimal modifier is
always used we also need to force a modifier renegotiation
when swicthing between sync and async flips. Otherwise eg.
sync flips might end up using a less optimal sync+async
modifier instead of a more optimal sync-only modifier.

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
Link: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1816
2025-11-06 15:56:07 +01:00
Ville Syrjälä
a345c59673 modesetting: Parse the IN_FORMATS_ASYNC blob
The kernel has gained another format/modifier blob to indicate
which formats/modifiers support async flips since Linux 6.16. Parse it.

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
2025-11-06 15:56:07 +01:00
Ville Syrjälä
a87fb7577e modesetting: Enable universal planes client cap
Enable the universal planes client cap so that we actually
get access to the primary plane's IN_FORMATS blob. We will
now start to parse the blob.

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
2025-11-06 15:56:07 +01:00
Ville Syrjälä
671a8ee04c modesetting: Don't try to use modifiers when allocating the root pixmap
We want the root pixmap to use conservative tiling modifiers in
order to make sure modeset/etc can never fail due to hardware
watermark restictions/etc.

Currenlty this is all dead code anyway because we aren't actually
parsing the IN_FORMATS blob (missing universal plane client cap).
But we want to start parsing that, so let's first make sure we
don't get any behavioural changes from doing so.

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
2025-11-06 15:56:07 +01:00
Ville Syrjälä
d26d08cd1e present: Don't ping-pong between sync and async flips
Many Intel GPUs can't switch between sync and async flips
willy nilly. Sometimes that change itself will take one
extra frame. This means that constant ping-pong between
sync and async flips is only going to cause problems.
Stay in async flip mode as long as the client is requesting
it.

The present protocol spec does say:
"If 'options' contains PresentOptionAsync, and the 'target-msc'
 is less than or equal to the current msc for 'window', then
 the operation will be performed as soon as possible, not
 necessarily waiting for the next vertical blank interval."

So there is an expectation that a future target-msc will
still be respected even when PresentOptionAsync is specified.
Staying in async flip mode won't actually change that given
that present_scmd_pixmap() takes the flip mode into account
when calculating exec_msc. So visually the flip should still
happen on the correct target_msc regardles of whether we
executed it as sync or async.

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
2025-11-06 15:56:07 +01:00
Ville Syrjälä
003d73441b present: Walk all children when setting window pixmaps
We currently skip setting the window pixmap on any window
not using its parent's pixmap. That does not work correctly
in the presence of reparenting.

Consider the following scenario:
1. window A is created as child of B
2. present starts flipping and sets the whole window
   tree to use pixmap X
3. window C is created (uses the screen pixmap by default)
4. window A is reparented to C
5. present stops flipping and attempts to set the
   whole window tree back to the screen pixmap,
   except the walk terminates at window C
   since it's using an unexpected pixmap, and
   window A is left with the stale pixmap X
6. pixmap X is destroyed
7. the X server segfaults on a rendering operation
   on window A due the stale pixmap

I managed to hit this with mpv (doing present flips)
and crack-attack (keeps alternating between a menu
window and an actual game window):
1. start both applications
2. start a game in crack-attack
3. fullscreen mpv
4. end the game in crack attack
5. unfullscreen mpv
6. the crack-attack menu window has appeared, but
   might be corrupted and doing stuff on it segfaults
   the X server

I suppose the other option might be to make new windows
automatically inherit their parent's pixmap instead
of using the screen pixmap. But I've not looked into
how that would affect eg. composite.

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
2025-11-06 15:56:07 +01:00
stefan11111
23fd2bd19f glamor: Set *num_formats to NULL in glamor_get_formats if we don't have any formats.
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-06 15:55:16 +01:00
Chase
a3eab2e968 exa.c: 0x prefix is superfluous 2025-11-06 13:08:13 +01:00
Chase
23c906cb8c exa.c: small formatting fix 2025-11-06 13:08:13 +01:00