Commit Graph

114 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
eb17b34362 Xinerama: lambda-esque macro for walking Xinerama screens
Move the walking loops on Xinerama screens into lambda-esque macros:
the callers look quite like we've been using lambda functions and
closures, but actually are just fancy macro trickery.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-09 14:12:40 +02:00
Enrico Weigelt, metux IT consult
f598186c0d Xext: canonical walkScreenIdx variable on screen list iterations
When iterating screen lists, consistently use the same variable name
`walkScreenIdx` for holding current screen index everywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-08 17:40:42 +02:00
Enrico Weigelt, metux IT consult
f8ad69698a treewide return code of X_SEND_REPLY_WITH_RPCBUF()
The macro will automatically return BadAlloc if the buffer is broken,
otherwise Success. Thus, we don't need extra prior rpcbuf check.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 12:48:50 +02:00
stefan11111
dc6c3c39c2 Xext: Fix Xv reply
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-08-27 16:36:18 +02:00
Enrico Weigelt, metux IT consult
cd86e5f69a Xext: canonical naming for reply structs
Let all reply structs be called `reply`.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-26 10:15:40 +02:00
Enrico Weigelt, metux IT consult
7aa06ee749 Xext: replace WriteRpcbufToClient() by X_SEND_REPLY_WITH_RPCBUF() macro
Use the new X_SEND_REPLY_WITH_RPCBUF() macro for final reply write out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-24 12:11:31 +02:00
Enrico Weigelt, metux IT consult
0f0d95d50a xext: xv: use X_SEND_REPLY_SIMPLE()
Use X_SEND_REPLY_SIMPLE() for sending out simple replies.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-22 14:23:52 +02:00
Enrico Weigelt, metux IT consult
8ea70e9e78 treewide: use use x_rpcbuf_wsize_units() instead of rpcbuf.wpos
In the request handlers, use x_rpcbuf_wsize_units() for payload length
computation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-19 15:50:54 +02:00
Enrico Weigelt, metux IT consult
d81cf93329 Xext: canonical walkScreen variable on screen list iterations
When iterating screen lists, consistently use the same variable name
`walkScreen` for holding current screen pointer everywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-18 10:52:49 +02:00
Enrico Weigelt, metux IT consult
03928dea4b panoramiX: don't use FOR_NSCREENS_FORWARD_SKIP() anymore
in preparation of upcoming new iterator macros, phase out
FOR_NSCREENS_FORWARD_SKIP, so we don't need an additional macro
for just the case where first screen is skipped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-14 12:10:27 +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
bbabd96e6c meson: rename symbol MITSHM to CONFIG_MITSHM
some bit better naming for config symbols.
Yet leaving the old one defined, until all drivers have kept up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-05 11:39:28 +02:00
Enrico Weigelt, metux IT consult
c8c52387c5 xv: inline SWriteListImageFormatsReply()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvListImageFormats ().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
a3de7f5c57 xv: inline SWriteQueryImageAttributesReply()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvQueryImageAttributes().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
9f5b2597e0 xv: inline SWriteQueryPortAttributesReply()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvQueryPortAttributes().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
199e049b95 xv: inline SWriteQueryBestSizeReply()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvQueryBestSize().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
c744d17e69 xv: inline SWriteGetPortAttributeReply()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvGetPortAttribute().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
71713fbf50 xv: inline SWriteGrabPortReply()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvGrabPort().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
25565daa42 xv: inline SWriteImageFormatInfo()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvListImageFormats().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
26b0ad79ed xv: inline SWriteAttributeInfo()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvQueryPortAttributes().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
08d44466a8 xv: inline SWriteFormat()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvQueryAdaptors().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
1adc19e10c xv: inline SWriteEncodingInfo()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvQueryEncodings().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
73ca100659 xv: inline SWriteAdaptorInfo()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvQueryAdaptors().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
3bd75a2fd6 xv: inline SWriteQueryEncodingsReply()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvQueryEncodings().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
ef8cf84e6d xv: inline SWriteQueryAdaptorsReply()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvQueryExtension().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
875c29c253 xv: inline SWriteQueryExtensionReply()
Instead of complex macro machinery, just move the conditional swapping
directly into ProcXvQueryExtension().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 16:57:26 +02:00
Enrico Weigelt, metux IT consult
535a110c60 Xext: clean up including panoramix headers
* use their actual path instead of relying this to be in compiler's
  include path list.
* no need to do it only conditionally, no #ifdef needed

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult
a15d8d25de Xext: xv: more obvious size computations in ProcXvQueryImageAttributes()
Formulate the buffer/field size computations a bit more verbose in
ProcXvQueryImageAttributes(), so they're easier to understand on
reading the code.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult
dfdb3d3722 Xext: xv: use int32_t in ProcXvQueryImageAttributes()
Make sure it's really a 32bit integer, since we're hard-casting since
we're relying on the buffer being made of 32bit integers (and treating
it like CARD32's). If we encounter an arch, where int isn't 32bits,
the compiler should shout out loud now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult
cf68881ab6 Xext: xv: simplify dispatcher
These dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

It's also much cleaner to use the defines from proto headers instead of
raw numbers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult
bee797a348 Xext: xv: untwist Xinerama handling
The current way of switching between Xinerama and single-screen handlers
is quite complicated and needs call vector tables that are changed on
the fly, which in turn makes dispatching more complicated.

Reworking this into a simple and straight code flow, where individual request
procs just look at a flag to decide whether to call the Xinerama or single
screen version.

This isn't just much easier to understand (and debug), but also removes the need
or the call vectors, thus allowing further simplification of the dispatcher.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult
1fb8493498 Xext: xv: use static struct initialization on declaration
A little bit of code simplification by using static initialization
of struct right at the point of declaration. Also dropping a few now
unneccessary zero assignments.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult
c96901a85a Xext: use calloc() instead of malloc()
Using calloc() instead of malloc() as preventive measure, so there
never can be any hidden bugs or leaks due uninitialized memory.

The extra cost of using this compiler intrinsic should be practically
impossible to measure - in many cases a good compiler can even deduce
if certain areas really don't need to be zero'd (because they're written
to right after allocation) and create more efficient machine code.

The code pathes in question are pretty cold anyways, so it's probably
not worth even thinking about potential extra runtime costs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:48:11 +02:00
Enrico Weigelt, metux IT consult
25f50e2cc5 panoramix: replace FOR_NSCREENS() by FOR_NSCREENS_BACKWARD(i)
FOR_NSCREENS() is just alias for FOR_NSCREENS_BACKWARD(). In many cases
it really matters that we're going backwards and the last iteration visited
the screen #0, and that one is panoramix-wrapped.

Thus directly calling FOR_NSCREENS_BACKWARD() here and dropping the alias.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:24:18 +02:00
Enrico Weigelt, metux IT consult
dc9a998b96 Xext: xv: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:52 +00:00
Enrico Weigelt, metux IT consult
54d4dd619c Xext: xv: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
fb696a7d7b rename old symbol PANORAMIX to XINERAMA
PANORAMIX was the original working title of the extension, before it became
official standard. Just nobody cared about fixing the symbols to the official
naming.

For backwards compatibility with drivers, the old PANORAMIX symbol will
still be set.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1258>
2025-02-06 15:51:27 +00:00
Enrico Weigelt, metux IT consult
a917f6a8a8 drop obsolete HAVE_DIX_CONFIG_H
The symbol controls whether to include dix-config.h, and it's always set,
thus we don't need it (and dozens of ifdef's) anymore.

This commit only removes them from our own source files, where we can
guarantee that dix-config.h is present - leaving the (potentially exported)
headers untouched.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:38:31 +00:00