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>
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>
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>
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>
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>
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>
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>
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>
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")
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.
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
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>
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>
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>
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>
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>
This warning doesn't matter in this case:
> ../test/simple-xinit.c: In function ‘handle_sigchld’:
> ../test/simple-xinit.c:69:5: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
> 69 | write(server_displayfd, server_dead, strlen(server_dead));
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In order to allow building w/ -Werror, it should be suppressed.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
No need for patching up the request buffer anymore - just pass in the correct
value directly.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This pointer just had been kept in at previous commit for keeping the
diff small and so easier to review. Now accessing the fields within
the local struct directly, dropping the extra pointer.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
No need for patching up the original request buffer anymore - just pass
in a modified copy.
Trying to keep this patch small for easier review. Some cleanups coming
with a follow-up.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>