Enrico Weigelt, metux IT consult
cbef3c8e63
randr: use struct initializer for reply structs
...
Improve readability, move the declarations to where they're needed first
and get rid of extra individual assignments. In some cases this should also
allow the compiler to produce a bit more efficient code.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
1089dc3e21
randr: RRCrtcCreate(): drop unnecessary zero assigments
...
The struct is already zero'ed out by calloc(), so no need to additionally
clear individual fields.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
cc6a76545b
randr: use explicit case statement instead of SProcRandrVector table
...
No need to go indirectly through a vector table, since everything's fixed
anyways. It's not a pretty robust programming style: any changes need great
care, in order to not mix up things.
Replacing this by direct switch/case statement, which is using the defines
from the xrandr protocol headers. Also adding a little bit more protection
against subtle programming errors and reducing cognitive load (source size)
on understanding the code by using a tiny macro for deducing define name and
function name from the request's name.
This approach actually uncovered some subtle bug that had been waiting in
the dark for over 15 years.
As collateral benefit, getting a tiny bit better performance.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
da336d0fe3
randr: use explicit case statement instead of ProcRandrVector table
...
No need to go indirectly through a vector table, since everything's fixed
anyways. It's not a pretty robust programming style: any changes need great
care, in order to not mix up things.
Replacing this by direct switch/case statement, which is using the defines
from the xrandr protocol headers. Also adding a little bit more protection
against subtle programming errors and reducing cognitive load (source size)
on understanding the code by using a tiny macro for deducing define name and
function name from the request's name.
This approach actually uncovered some subtle bug that had been waiting in
the dark for over 15 years.
As collateral benefit, getting a tiny bit better performance.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
00ef5b1f5f
randr: let SProc*'s call their Proc*'s directly
...
No need to go indirectly through an vector table. It's much clearer and
easier to understand when calling them directly. And a tiny bit performance
improvement as collateral benefit.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
7d6372ea3b
randr: RRScreenInit(): drop unnecessary zero'ing
...
The whole struct is already allocated by calloc(), so no need to explicitly
zero-out individual fields.
Fixes: 479b2be4ba - Clear allocated RandR screen private structure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
1534692c98
Xext: panoramiX: PanoramiXGetImage() reply payload in one block
...
Simplify writing reply payload into just one block.
This also makes further simplifications by subsequent patches easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
6bc31594c2
dri: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
e6de0be04c
dri: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
ac30288aab
dri: ProcXF86DRIGetDrawableInfo() allocate temporary buffer on stack
...
No need for going through heap, stack is also fine.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
c496df2f29
dri: use static struct init on declaration & drop useless assignments
...
Make the code a bit easier to read by using initialization of the reply
structs, at the point of declaration. Most of them aren't written to later,
just passed into WriteReplyToClient(). Also dropping some useless zero
assignments (struct initializers automatically zero-out unmentioned fields).
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
026b19af56
dri: report failed memory allocation
...
ProcXF86DRIGetDrawableInfo() should report failed memory allocation instead
of pretending everything's okay.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
9d40106aaa
dbe: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
c1139d2524
dbe: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
cf30667163
dbe: ProcDbeGetVisualInfo() collect payload in buffer before writing
...
The payload lengths is already known, so we can easily collect the data
in a stack buffer and only need one WriteToClient() operation.
This also clears the road for further simplification/unification of the
reply sending code, coming with follow-up commits.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
d8d430c11c
dbe: simplify temporary buffer allocation via local stack
...
Small buffers easily fit on stack, so their allocation can be simplified.
No need to go through heap and have extra free() calls on each return point.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
8bf0c3d716
dbe: fix byte swapping in SProcDbeSwapBuffers()
...
The loop forgot to move the SwapInfo pointer, so the same list entry
gets swapped over and over again, while the remaining ones get ignored.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:07 +02:00
Enrico Weigelt, metux IT consult
5ac24f0c0b
xkb: use new macros for byte swapping in network buffers
...
Use the new macros for doing byte-swapping in network buffer structs
which aren't requests or reply structs.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
018f941b2c
xkb: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
5f17708a84
xkb: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
1030ba58a2
dri3: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
3ced8a2501
dri3: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
62d48e1720
Xext: panoramiX: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
4a0a6e963d
Xext: panoramiX: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
d93666575e
Xext: xvmc: enable swapped requests
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
fe5b9f0a73
Xext: xvmc: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
f4c75bd036
Xext: xvmc: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
ccbb4315a1
xfixes: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
97186ab87c
xfixes: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
64012bd401
Xi: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
1dd0382acb
Xi: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
43ef04bc86
composite: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
4bc3a24388
composite: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
f2b1a6e555
damage: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
ba60f262e3
damage: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
a5df5f98fa
Xext: xv: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
41926b5ee7
Xext: xv: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
f53d96df93
Xext: xtest: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
3354adaded
Xext: xtest: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
6021d051ae
Xext: selinux: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
ad3bc82bd2
Xext: selinux: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
959ab004c7
Xext: xres: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
91ae0db303
Xext: xres: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
726e65229d
Xext: xf86bigfont: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
8a65a468c0
Xext: xf86bigfont: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
03080acc50
Xext: xcmisc: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
2bc853336e
Xext: xcmisc: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
d7e8d32e4d
Xext: vidmode: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
68d931a320
Xext: vidmode: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
...
Use the new macros to make request struct parsing / field swapping
much easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
04d39c0751
Xext: sync: use REPLY_*() macros for preparing / sending replies
...
Use the new macros for preparing and sending replies to clients.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net >
2024-08-29 11:35:06 +02:00