Commit Graph

21208 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
f03042a2b7 dix: fix int mismatches related to MakeAtom()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 20:05:57 +02:00
Enrico Weigelt, metux IT consult
e006550e29 dbe: fix screen cleanup
The 2nd loop is supposed to free the privates and also clear the pointer
to them. But it instead of clearing the walk'ed pointer, it only clears
the one in the last screen left from the upper loop.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 15:27:14 +02:00
Enrico Weigelt, metux IT consult
566f961fd4 dix: fix int-type mismatches related to dixClientIdForXID()
The client index (in the client table) can never be negative, thus
make it an unsigned short.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 13:02:14 +02:00
Enrico Weigelt, metux IT consult
0fb490d536 Xext: saver: drop duplicate ScreenPtr retrival in SendScreenSaverNotify()
If we've already got the ScreenPtr, there's no need to retrieve it again
via the screen number, which we're getting via the ScreenPtr that we've
already got.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 13:01:54 +02:00
Enrico Weigelt, metux IT consult
0534ee4a75 dix: dixLookupBuiltinColor(): fix int type mismatch
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 11:27:06 +02:00
Enrico Weigelt, metux IT consult
5c3ce08b0e Xext: xv: ProcXvListImageFormats(): use x_rpcbuf_t for payload size
Use the payload size from the rpcbuf, but also compare that with our
computation as sanity check and log error on mismatch.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
2d66d11caf Xext: xv: ProcXvListImageFormats(): use x_rpcbuf_t for reply payload assembly
Use x_rpcbuf_t for reply payload assembly and byte-swap.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
8272cc25ea Xext: xv: ProcXvQueryImageAttributes: use x_rpcbuf_t for payload
Use x_rpcbuf_t for payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
b3adbc30d3 Xext: xv: ProcXvQueryPortAttributes(): use payload size of rpcbuf
Instead doing an exrtra loop for our own calculation of the
payload size, just the wpos from rpcbuf.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
29963d878f Xext: xv: ProcXvQueryPortAttributes(): use x_rpcbuf_t for payload assembly
Using x_rpcbuf_t for assembling any byte-swapping the reply payload.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
7368f6f605 Xext: xv: ProcXvQueryPortAttributes(): simplify reply header assembly
In preparation for subsequent refactoring, assembling the reply header
at once, instead of doing it piece by pice.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
ab6c25cbdd Xext: xv: ProcXvQueryAdaptors(): drop extra length computation
The payload length is already known after writing everything to the
buffer, so no need for extra size computation anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
9c203cad57 Xext: xv: ProcXvQueryAdaptors(): linearize control flow
Preparation for subsequent changes: instead of returning early when no
payload to send, move that into a conditional block.
(the WriteRpcbufToClient() call on potentially empty buffer is intentional)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
c54f284f42 Xext: xv: ProcXvQueryAdaptors(): use rpcbuf for reply payload assembly
Collect reply payload in rpcbuf and finally write it out in one block.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
0d99fd2d1c Xext: xv: ProcXvQueryExtension() simplify reply header assembly
As a prepration for upcoming changes, move assembly of the the reply
header further downwards where all values are already known, so we'll
have to touch it only once. Also eliminate the separate write path for
the case where Xv is disabled.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
aef132f847 Xext: xv: ProcXvQueryEncodings(): declare variables where assigned first
For easier understanding the code, declare the variables right where
they're assigned first.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
75f2b2334d Xext: xv: ProcXvQueryEncodings(): use payload length from rpcbuf
Skip the extra payload size calculation, use the rpcbuf's wpos instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
90a99141b5 Xext: xv: ProcXvQueryEncodings(): use x_rpcbuf_t for reply payload assembly
Simplify reply payload assembly via x_rpcbuf_t.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:23:18 +02:00
Enrico Weigelt, metux IT consult
578a554d0a randr: ProcRRGetCrtcGamma(): use x_rpcbuf_t for reply payload assembly
Simplify reply payload assembly and byte-swap by using x_rpcbuf_t.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:14:38 +02:00
Enrico Weigelt, metux IT consult
70c7c00fae randr: ProcRRGetCrtcTransform(): simplify by using x_rpcbuf_t
* use x_rpcbuf_t for reply payload assembly and byte-swap
* do byte-swap of header fields explicitly instead of cryptic functions
* drop extra length computation

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-08 13:14:19 +02:00
Oleh Nykyforchyn
c4077eb298 xserver: os: reexport TimerForce() but do not allow compile drivers with it
This function is called by nvidia390 legacy proprietary driver.

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
2025-08-07 19:48:35 +02:00
stefan11111
84081451bc os: fix OutputBufferMakeRoom and rename it to OutputBufferMakeRoomAndFlush
This function was badly broken, among other things doing a
use after free, a NULL-pointer dereferrence, and not doing
what it was supposed to do.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-08-07 19:26:12 +02:00
stefan11111
909a5462ac os: fix FlushClient
Flushclient implicitly cast the result from a write-like call
to size_t, which turned it's error return value, -1,
into a large positive value, breaking the surrounding error-checking code.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-08-07 19:26:12 +02:00
stefan11111
fe186eee6f os: use /= 2 instead of >>= 1
Compilers optimize the first one to the second one.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-08-07 19:26:12 +02:00
stefan11111
808fc3a604 os: further simplify FlushClient
Since FlushClient only writes the data in the client's buffer,
with no extra data or padding, we only write at most as many bytes
as there are in the client buffer.

we just have to set oco->count to notWritten, the amount we still
have to write.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-08-07 19:26:12 +02:00
Enrico Weigelt, metux IT consult
1328254980 randr: ProcRRGetCrtcInfo(): use x_rpcbuf_t
Instead of using our own Use x_rpcbuf_t for assembling and
byte-swapping the reply payload.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 17:24:24 +02:00
Enrico Weigelt, metux IT consult
0de028016d os: osdep: drop WIN32 compat for uname()
Since nothing on WIN32 (mingw) targets is calling uname() anymore,
this compat code is now obsolete.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 16:57:43 +02:00
Enrico Weigelt, metux IT consult
7b1283268c os: access: use xhostname()
Simplify DefineSelf() by using xhostname(). Neither need to
care about OS specifics here, nor take care of zero-terminating the
hostname string - xhostname() is already doing this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 16:57:43 +02:00
Enrico Weigelt, metux IT consult
d5dda483cb os: xtrans: replace _XSERVTransGetHostname() by xhostname()
Now that we have the OS layer xhostname() wrapper, we don't need the
_XSERVTransGetHostname() function anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 16:57:43 +02:00
Enrico Weigelt, metux IT consult
ab08f9e0a2 os: utils:: use xhostname()
Simplify set_font_authorizations() by using xhostname(). Neither need to
care about OS specifics here, nor take care of zero-terminating the
hostname string - xhostname() is already doing this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 16:57:43 +02:00
Enrico Weigelt, metux IT consult
1bfd27e8f6 xfree86: parser: use xhostname()
Simplify DoSubstitution() by using xhostname(). Neither need to
care about OS specifics here, nor take care of zero-terminating the
hostname string - xhostname() is already doing this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 16:57:43 +02:00
Enrico Weigelt, metux IT consult
4d532adf7d vfb: use xhostname()
Simplify vfbWriteXWDFileHeader() by using xhostname(). Neither need to
care about OS specifics here, nor take care of zero-terminating the
hostname string - xhostname() is already doing this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 16:57:43 +02:00
Enrico Weigelt, metux IT consult
df0d09dcb2 os: xhostname: helper for gethostname()
This little helper does the OS specific part for gethostname()
calls. It's putting the result into a fixed-length struct and making
sure it's properly filled and the string is always zero-terminated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 16:57:43 +02:00
Enrico Weigelt, metux IT consult
e0748cf74e panoramiX: PanoramiXGetImage(): move down reply struct
Move down reply struct declaration/assignment and byte-swapping to
right before the write-out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 16:49:20 +02:00
Enrico Weigelt, metux IT consult
475d53fb58 panoramix: clean up PanoramiXTranslateCoords() variable declarations
* declare and assign in one shot
* move down reply struct declaration to where it's needed

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 16:49:20 +02:00
Enrico Weigelt, metux IT consult
aaea461c6f panoramiX: clean up reply struct definitions
* declare and assign them right where they're needed, in one shot
* drop unnecessary assignment and byte-swap of zero values

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 16:49:20 +02:00
Joseph Crowell
1744f34f83 xfree86: modesetting: meson: fix symbol test path 2025-08-07 16:48:50 +02:00
Enrico Weigelt, metux IT consult
cd4e80da8d treewide: replace PICT_TYPE_OTHER by PIXMAN_TYPE_OTHER
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 15:35:38 +02:00
Enrico Weigelt, metux IT consult
6948c15499 treewide: replace PICT_TYPE_GRAY by PIXMAN_TYPE_GRAY
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 15:35:38 +02:00
Enrico Weigelt, metux IT consult
d8a06a2f9f treewide: replace PICT_TYPE_COLOR by PIXMAN_TYPE_COLOR
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 15:35:38 +02:00
Enrico Weigelt, metux IT consult
9f4391203f treewide: replace PICT_TYPE_A by PIXMAN_TYPE_A
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 15:35:38 +02:00
Enrico Weigelt, metux IT consult
71e2b20fe0 treewide: replace PICT_TYPE_BGRA by PIXMAN_TYPE_BGRA
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 15:35:38 +02:00
Enrico Weigelt, metux IT consult
ba06904f10 treewide: replace PICT_TYPE_ABGR by PIXMAN_TYPE_ABGR
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 15:35:38 +02:00
Enrico Weigelt, metux IT consult
900c893246 treewide: replace PICT_TYPE_ARGB by PIXMAN_TYPE_ARGB
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 15:35:38 +02:00
Enrico Weigelt, metux IT consult
435de433cd os: io: fix NULL output buffer after FlushClient()
FlushClient() does drops the output buffer, when it becomes empty.
This previously wasn't any problem and actually intented, because we've
returned from the write path directly after FlushClient() was called.

But now we've changed the call order, so it's called from within
OutputBufferMakeRoom(), so we need to make sure we always got valid
output buffer before trying to access it.

For the future, we should think about whether dropping output buffers
really makes sense at all. Instead we could leave them as they are
(over the client's lifetime) and maybe just trim when they've went
too big.

Fixes: 1c13cfa6ca
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 14:00:25 +02:00
Enrico Weigelt, metux IT consult
600b46c7c1 treewide: replace PICT_FORMAT_B by PIXMAN_FORMAT_B
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 12:45:37 +02:00
Enrico Weigelt, metux IT consult
ca118c9793 treewide: replace PICT_FORMAT_G by PICT_FORMAT_G
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 12:45:37 +02:00
Enrico Weigelt, metux IT consult
414d5c7654 treewide: replace PICT_FORMAT_R by PIXMAN_FORMAT_R
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 12:45:37 +02:00
Enrico Weigelt, metux IT consult
f104c96091 treewide: replace PICT_FORMAT_COLOR by PIXMAN_FORMAT_COLOR
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 12:45:37 +02:00
Enrico Weigelt, metux IT consult
3cd02f4245 treewide: replace PICT_FORMAT_VIS by PIXMAN_FORMAT_VIS
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 12:45:37 +02:00