ms_do_pageflip function temporary creates and destroy drmmode_bo object, but
the structure is stack ( values goes uninitialized). This became problem
because in f4362fc4ec drmmode_bo struct got extra
fields which is checked during drmmode_bo_destroy and causes crash.
Signed-off-by: Tautvis <gtautvis@gmail.com>
Moved the cursor glyph cropping into a separate function that handles reflections and rotations.
Also, x/y are indexes into the buffer, so they should be clamped to width/height len - 1 for correctness.
Signed-off-by: John Studnicka <contact@zentec.dev>
This was a old hack used before Meson 0.61.0 added install_symlink, we
are at the meson release 1.10.0 so it is safe to use the new proper
function for this task.
Also used the X server's executable name as the link target name, and as
the SUID wrapper's name.
Moved the minimum Meson version up to 0.61.0.
Signed-off-by: b-aaz <b-aazbsd@proton.me>
The device node opening with seatd, like with systemd-logind can done during probe
(see get_drm_info in hw/xfree86/os-support/shared/drm_platform.c),
but in case of failure, the modesetting driver tries to open device
node directly (open_hw function in modesetting/driver.c).
This enchanes open_hw function to try use seatd arbiter for opening device node
in as last resort manner.
To make it functional seatd_libseat_open_graphics needs to have _X_EXPORT
Signed-off-by: tautvis <gtautvis gmail com>
The space needed to store these extra values is at worst a few dozen bytes.
In exchange for these, larger cursors glyphs can use a more optimal cursor size.
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
After the dmabuf fd exported by another screen is imported to a pixmap,
the pixmap holds a reference for the buffer, thus the FD itself finished
its job and needs to be closed to prevent a stale reference to the
buffer.
Signed-off-by: Icenowy Zheng's avatarIcenowy Zheng <uwu@icenowy.me>
dixRegisterPrivateKey() assumes that DevPrivateKeyRec struct passed
to it is zero-filled before the first use, otherwise assert() fails.
Therefore these structs are usually static, which assures that they
are initialized to 0. A newly introduced key in the modesetting driver
was not static, and the driver crashed. This should be corrected.
Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
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>
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>
Add matching call for xf86_cursors_init to clean memory, as during
initialization it allocates memory (depends, but is something like ~256Kb)
and it leaks when XServer resets.
Signed-off-by: Tautvis <gtautvis@gmail.com>
Since https://github.com/X11Libre/xserver/pull/1234 landed,
the user has a way to set the hw cursor size to the size they want.
The fallback probe works around driver bugs by probing very late,
so it initializes the cursor image buffer with the largest size the driver supports.
With this change, the SIZE_HINTS probe will also initialize
the cursor image buffer with the largest size it finds,
which is what @notbabaisyou 's code originally did.
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
On certain setups, it might still be useful to force a particular cursor
size via xorg.conf.
For example, if on a system the automatic probes fail, or if the user wants
a particular cursor size, that is higher that the minimum size.
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
On most cards, SIZE_HINTS isn't available.
Without this, most users would have to set the fallback cursor size themselves,
or rely on the 64x64 default.
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>