Commit Graph

18954 Commits

Author SHA1 Message Date
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
Enrico Weigelt, metux IT consult
456e9a79c7 Xext: sync: 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
0e2a369c5b Xext: security: 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
b3da276bc0 Xext: security: 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
0548236e1d Xext: geext: 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
155bb3064a Xext: geext: 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
f0ac7e7b44 Xext: shm: 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
ef8ade4c81 Xext: shm: 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
e913998fc2 Xext: bigreq: 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
efb6c40451 Xext: bigreq: 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
83d49cf053 Xext: shape: 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
a1f10d8f63 Xext: shape: 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
109da9a188 Xext: saver: 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
16a1db38ac Xext: saver: 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
0f414d50dd Xext: dpms: 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
6f9e1286fe Xext: dpms: 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
628eef6bbc include: dix.h: add macros for request handlers and swapping
add some macros for making request handlers easier:

    * REQUEST_HEAD_STRUCT() declares a struct and checks size (assuming
      length field already had been swapped)
    * REQUEST_FIELD_CARD16() swaps a CARD16 (word) if neccessary
    * REQUEST_FIELD_CARD32() swaps a CARD32 (dword) if neccessary

How to use them:

    1. move swapping of lengths field into the SProc*Dispatch() and drop it
       from the individual SProc*()'s
    2. put REQUEST_HEAD_STRUCT() ontop of each Proc*()
    3. add REQUEST_FIELD_*() below, for all fields to be swapped and
       drop their swapping from the SProc*()'s
    4. clean up unnecessary wrappers (SProc*()'s just be just call the
       corresponding Proc*() by now)
    5. let demux SProc just swap length field and call the normal Proc*Dispatch()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
616b4bafc1 Xext: panoramiX: ProcXineramaQueryScreens(): 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:06 +02:00
Enrico Weigelt, metux IT consult
59facb244a dri3: 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
488bb4f588 dri3: consolidate reply buffers
Allocate reply buffers on stack and put multiple fragments into one buffer,
in order to make it easier doing write out by generic macros, in subsequent
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
917be698a5 dri3: use static reply struct init on declaration
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:06 +02:00
Enrico Weigelt, metux IT consult
2a650889d6 Xext: selinux: use static reply struct init on declaration
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:06 +02:00
Enrico Weigelt, metux IT consult
7053fce89f Xext: selinux: allocate reply buffer on stack
Simplify reply buffer in SELinuxSendItemsToClient() by putting it on stack.
No need to go through heap and free it later, if the compiler can do all
the work for us.

This also allows further generalizations of reply sending code 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
6981764c9e (submit/cleanup-xi) test: Xi: make sure client swapped flag is reset
Some test cases are recycling the ClientRec between swapped/unwapped runs.
Make sure the Client's swapped flag is always reset in those cases.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
d4c702392d (submit/cleanup-xi) Xi: use stack allocation for temporary buffers
Small buffers easily fit on stack, which is much faster (just moving SP),
and alloca()'ed buffers are cleaned up automatically on function leave,
no extra free() needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
90f02064fe (submit/cleanup-xi) Xi: use static reply struct init on declaration
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:06 +02:00
Enrico Weigelt, metux IT consult
d70370a4f0 (submit/cleanup-xi) Xi: 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
f2aeb1eb8e (submit/xext-saver) Xext: saver: consolidate (non-)xinerama versions
We can make it a bit simpler by doing the request header
checking only once.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
96029bd8b2 (submit/xext-saver) Xext: saver: use explicit switch/case for dispatching
It's more robust / easier understandable programming style to use explicit
switch statements, case'ing on the constants defined in the protocol header,
instead of implicitly via a some opaque call table. It's also done this
way in the other extensions, so making the code a bit more consistent.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
7d259d9762 (submit/xext-saver) Xext: saver: skip unneeded zero init and zero-swapping
When using struct initializers, all fields not set explicitly are zero.
Also no need to swap fields that are known to be zero.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
43a5706003 (submit/xext-saver) Xext: saver: fix missing swap in QueryVersion reply
The `majorVersion` and `minorVersion` fields are CARD16, thus need to be swapped.
OTOH, the lengths field is zero anyways, so no need to swap it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
730ab9790e (submit/fix-obsolete-damage-header) damage: fix missing removal of obsolte damageext.h
This file became obsolete with 33350ef8ff, but was forgotten to
be removed.

Fixes: 33350ef8ff
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
89f7729d59 (submit/cleanup-damageext) damage: hand in request struct into doDamageCreate() and PanoramiXDamageCreate()
Saves us a little bit of duplicate request checking.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
4d48d2ffa1 (submit/cleanup-damageext) damage: 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.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00
Enrico Weigelt, metux IT consult
d64ce317d9 (submit/cleanup-damageext) damage: don't block requests when version not requested yet
The original intention was negotiating versions before any further requests
can be processed, so requests that might become incompatible in future versions
still can be dispatched correctly. But practically that's never been the case:
there's just one major version, and it's unlikely that a new *major* version
(that might be incompatible with the current one, using same request codes for
different things) will come in the forseeable future.

So this extra logic isn't practically needed and just complicates dispatching.
Dropping it clears the road for further simplification of the dispatcher.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 11:35:06 +02:00