Commit Graph

18871 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
b3de32d072 (submit/cleanup-xf86bigfont) Xext: xf86bigfont: drop some dead code
There's some piece ifdef'ed code that doesn't serve any practical purpose.
Instead add a little comment telling why that funny way of dispatching
(based on request size) is necessary.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
3e522533a9 (cleanup/xext-xres) Xext: xres: ProcXResQueryClientIds() collect reply in one stack buffer
In order to allow simplifying the reply send path, collect the reply
fragments into one buffer, instead of arbitrary number of WriteToClient()
calls. This also makes it much easier for potentially new purely packet-based
transports which (eg. binder) that would need their own stream parsing logic.

This xres function is an exceptionally hard case, since payload is constructed
step by step, and it's size only known when finished. The current way of the
fragment handling still has lots of room for improvement (eg. using very small
number of allocations), but leaving this for later exercise.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
d2611ed4e8 (cleanup/xext-xres) Xext: xres: ProcXResQueryClientResources() simplify payload write out
Collect the few bits in a local array, so one WriteToClient() call is
sufficient. That's also easing further simplifications in upcoming commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
e7db8e3302 (cleanup/xext-xres) Xext: xres: ProcXResQueryClientResources(): put temporary int array on stack
Simplify allocaton by putting the small temporary int array onto stack.
This also allows further simplifications by upcoming commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
e765fe1da9 (cleanup/xext-xres) Xext: xres: ProcXResQueryClients() simplify payload write out
Collect the few bits in a local array, so one WriteToClient() call is
sufficient. That's also easing further simplifications in upcoming commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
61533fdf1e (cleanup/xext-xres) Xext: xres: ProcXResQueryClients() put temporary int array on stack
Simplify allocaton by putting the small temporary int array onto stack.
This also allows further simplifications by upcoming commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
ea5e05f4cb (cleanup/xext-xres) Xext: xres: sort includes
Bring #include's into some logical order.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
2a15c596f8 (cleanup/xext-xres) Xext: xres: use static initialization
* use static initialization where applicable
* drop unneeded setting of zero values

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
ea2ebfedad (submit/drop-SWAPREQ_PROC) swapreq.h: drop SWAPREQ_PROC
This macro doesn't do anything more than just making the function declarations
a few bytes smaller, but this makes the code harder to read (eg. when just
grepping through the code base).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
9de45d73ee (submit/cleanup-xfixes) xfixes: use stack allocation and static init for reply structs
Canonicalize all reply structures onto stack allocation and static
initialization, like already done in most other extension. So make
the code easier to understand and allow further simplifications by
subsequent commits. Also gaining a little bit efficiency by skipping
some heap allocations.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
58e250b2dd (submit/cleanup-xfixes) xfixes: simplify dispatcher
The 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>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
ad3b9a24b8 (submit/cleanup-xfixes) xfixes: 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>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
9523790742 (submit/recv-fds) os: read file descriptors into client struct at once
Instead of having the request handler ask for fd's one by one, just read them
all into a little array in ClientRec struct. And also automatically clean up
after request had been handled.

Request handlers need to set the entries to -1 if they shouldn't be closed
automatically.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
5fa82cfe07 (submit/cleanup-xkb) xkb: ProcXkbGetKbdByName(): collect sub-replies in buffer and write at once
Instead of dozens of little WriteToClient() calls, collect the sub-replies in
a buffer and send the whole reply out at once. This also allows more upcoming
simplifications in the send path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
12371f4fed (submit/cleanup-xkb) xkb: split XkbSendGeometry()
This function is a funny beast: it assembles and writes out an xkbGetGeometryReply,
called in two different cases, ProcXkbGetGeometry() as well as ProcXkbGetKbdByName().
In the latter case the whole reply is contained in another one. That's the reason
why it's payload size is computed separately - the caller must know that in order
to set up the container's reply size correctly.

As preparation for upcoming simplifications of the reply send path, splitting off
this function into pieces: XkbAssembleGeometry() just assembles the reply payload,
while it's callers now responsible for preparing the request header and writing
out both pieces.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
4cf62d5eea (submit/cleanup-xkb) xkb: split XkbSendNames()
This function is a funny beast: it assembles and writes out an xkbGetNamesReply,
called in two different cases, ProcXkbGetNames() as well as ProcXkbGetKbdByName().
In the latter case the whole reply is contained in another one. That's the reason
why it's payload size is computed separately - the caller must know that in order
to set up the container's reply size correctly.

As preparation for upcoming simplifications of the reply send path, splitting off
this function into pieces: XkbAssembleNames() just assembles the reply payload,
while it's callers now responsible for preparing the request header and writing
out both pieces.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
c6f2207e4b (submit/cleanup-xkb) xkb: split XkbSendIndicatorMap()
This function is a funny beast: it assembles and writes out an xkbGetIndicatorMapReply,
called in two different cases, ProcXkbGetIndicatorMap() as well as ProcXkbGetKbdByName().
In the latter case the whole reply is contained in another one. That's the reason
why it's payload size is computed separately - the caller must know that in order
to set up the container's reply size correctly.

As preparation for upcoming simplifications of the reply send path, splitting off
this function into pieces: XkbAssembleIndicatorMap() just assembles the reply payload,
while it's callers now responsible for preparing the request header and writing
out both pieces.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
20ff8a86dd (submit/cleanup-xkb) xkb: split XkbSendCompatMap()
This function is a funny beast: it assembles and writes out an xkbGetCompatMapReply,
called in two different cases, ProcXkbGetCompatMap() as well as ProcXkbGetKbdByName().
In the latter case the whole reply is contained in another one. That's the reason
why it's payload size is computed separately - the caller must know that in order
to set up the container's reply size correctly.

As preparation for upcoming simplifications of the reply send path, splitting off
this function into pieces: XkbAssembleCompatMap() just assembles the reply payload,
while it's callers now responsible for preparing the request header and writing
out both pieces.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
5e2b283f55 (submit/cleanup-xkb) xkb: split XkbSendMap()
This function is a funny beast: it assembles and writes out an xkbGetMapReply,
called in two different cases, ProcXkbGetMap() as well as ProcXkbGetKbdByName().
In the latter case the whole reply is contained in another one. That's the reason
why it's payload size is computed separately - the caller must know that in order
to set up the container's reply size correctly.

As preparation for upcoming simplifications of the reply send path, splitting off
this function into pieces: XkbAssembleMap() just assembles the reply payload,
while it's callers now responsible for preparing the request header and writing
out both pieces.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
a5c6dca064 (submit/cleanup-xkb) xkb: ProcXkbGetKbdByName(): static initialization of sub-reply structs
For easier reading, move th sub-reply structs down to where they're used
first and use static initialization for the common fields.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
dc04659c2a (submit/cleanup-xkb) xkb: ProcXkbGetKbdByName() simplify reply struct initialization
Move down the declaration of the reply struct, right before swapping and sending
and use static initialization.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
dd27640eb5 (submit/cleanup-xkb) xkb: XkbSendGeometry(): pass in struct as value instead of pointer
The function doesn't need to pass anything back via this pointer, it's
the last consumer of this struct. Make understanding the code a bit easier
and clear the road for further simplifications by passing the struct as
value instead of pointer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
bc60dd254d (submit/cleanup-xkb) xkb: XkbSendNames(): move common code into a helper macro
A little bit of simplification by putting repeated statements into macro.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
13046e1f80 (submit/cleanup-xkb) xkb: XkbSendNames(): pass in struct as value instead of pointer
The function doesn't need to pass anything back via this pointer, it's
the last consumer of this struct. Make understanding the code a bit easier
and clear the road for further simplifications by passing the struct as
value instead of pointer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
977789c83e (submit/cleanup-xkb) xkb: XkbSendNames(): put buffer on reply stack
A bit of code simplification by putting the temporary buffer on stack.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
f015f7bab1 (submit/cleanup-xkb) xkb: let SendDeviceLedFBs() fill buffer instead of writing directly
Make the code flow a bit easier to understand and allow further simplification
by now just having to write out one additional payload as one block.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
0bcfe2f7f2 (submit/cleanup-xkb) xkb: ProcXkbGetDeviceInfo(): move button button action data into payload struct
Consolidate the button action data into the payload struct added by previous
commit. So we can write it out (along with the name string) by just one call.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
8439325a85 (submit/cleanup-xkb) xkb: ProcXkbGetDeviceInfo(): put string buffer on stack
Since the buffer is only used locally, it can easily be on stack.
Putting it into a struct, so following up buffers can be put in here,
and we'll still have only one write out call.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
af73bcf536 (submit/cleanup-xkb) xkb: CheckDeviceLedFBs(): untwist parameters
It's hard to see which fields of the xkbGetDeviceInfoReply struct it's
reading or writing, and that complicates further simplifications of the
caller. So instead let the caller pass in the relevant fields and do the
modifications on the reply structs on its own.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
f6eb2f2f6d (submit/cleanup-xkb) xkb: XkbSendIndicatorMap(): allocate buffer on stack
A bit more simplification by allocating the reply payload buffer on stack.
The extra length check (did we write as much as intended?) isn't necessary,
since the buffer size is computed by the very same data before this
function is called.

Hint: the size computation must be done before calling this one, because
the reply might be encapsulated in another one (xkbGetKbdByName).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
5800fbdbd4 (submit/cleanup-xkb) xkb: XkbSendIndicatorMap() pass in reply struct as value instead of pointer
It's not passing back any data via that pointer and actually the last
consumer of it. Changing it to value instead of pointer clears the
road for further simplifications by subsequent patches.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
b00edd7eb9 (submit/cleanup-xkb) xkb: XkbSendCompatMap(): use stack allocation
It's simpler and also a little bit faster to put small buffers on stack.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
0431a327ef (submit/cleanup-xkb) xkb: XkbSendCompatMap(): pass xkbGetCompatMapReply as value instead of pointer
It's not passing back any data via that pointer and actually the last
consumer of it. Changing it to value instead of pointer clears the
road for further simplifications by subsequent patches.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
4d01388798 (submit/cleanup-xkb) xkb: XkbSendMap(): allocate temporary buffer on stack
It's simpler and also a little bit faster to put small buffers on stack.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
40f1840b74 (submit/cleanup-xkb) xkb: XkbSendMap() pass in reply struct as value instead of pointer
It's not passing back any data via that pointer and actually the last
consumer of it. Changing it to value instead of pointer clears the
road for further simplifications by subsequent patches.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
2d88d08796 (submit/cleanup-xkb) xkb: XkbWriteVirtualModMap(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
472e486e46 (submit/cleanup-xkb) xkb: XkbWriteModifierMap(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
87d2bf865b (submit/cleanup-xkb) xkb: XkbWriteExplicit(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
752172ccdf (submit/cleanup-xkb) xkb: XkbWriteKeyBehaviors(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
bae7f3e55a (submit/cleanup-xkb) xkb: XkbWriteKeyActions(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
4bcb24627e (submit/cleanup-xkb) xkb: XkbWriteKeyTypes(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:05 +02:00
Enrico Weigelt, metux IT consult
c78c38f9e0 (submit/cleanup-xkb) xkb: XkbWriteKeySyms(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:05 +02:00
Enrico Weigelt, metux IT consult
882490359b (submit/cleanup-xkb) xkb: SProcXkbSelectEvents(): simplify swapping
The swapping logic isn't entirely trivial to understand and can be
simplified.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:05 +02:00
Enrico Weigelt, metux IT consult
840dc3bd1b (submit/cleanup-xkb) xkb: simplify reply struct initialization
Use static initializaton as much as possible and drop unnecessary
or duplicate zero assignments.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:05 +02:00
Enrico Weigelt, metux IT consult
ca6ce9ec5f (submit/cleanup-composite) composite: simplify dispatcher
The 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>
2024-08-29 11:35:05 +02:00
Enrico Weigelt, metux IT consult
e34f025367 (submit/cleanup-composite) composite: 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>
2024-08-29 11:35:05 +02:00
Enrico Weigelt, metux IT consult
b2b4b88c53 (submit/cleanup-xvmc) Xext: xvmc: simplify reply struct initialization
* use static initialization and stack allocation where possible
* put the lists into one one block, so they can be written in one pass
* simplify size computations

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:05 +02:00
Enrico Weigelt, metux IT consult
998187a87c (submit/cleanup-xvmc) Xext: xvmc: simplify dispatcher
The 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.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:05 +02:00
Enrico Weigelt, metux IT consult
9ad3e91a13 (submit/xrandr-swap-fix) randr: fix wrong call to RRGetScreenResources() in swapped case
ProcRRGetScreenResources() vs. RRGetScreenResourcesCurrent() have different
semantics - this also must be followed in byte-swapped case.

Fixes: fc70839431 - Add server support for RRGetScreenResourcesCurrent
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:05 +02:00
Enrico Weigelt, metux IT consult
c4481fc20f treewide: fix indentions got broke by recent commit
Commit f26f17c66a broke some indentions,
fixing them now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1662>
2024-08-27 20:08:32 +02:00