Commit Graph

598 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
3c11149ae0 randr: don't ifdef on RANDR_10_INTERFACE anymore
It's always present (and wont go away), so no need to ifdef on it.
Still keeping the symbols, until we're sure no drivers still depending
on it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-13 14:00:41 +01:00
Enrico Weigelt, metux IT consult
fbb0983e2b randr: move over public SDK headers to include/
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-12 15:35:58 +01:00
Enrico Weigelt, metux IT consult
ebd217aafb randr: randrstr.h: minor spelling fix
Fix up to our convention of naming those "pScreen".

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-09 14:20:22 +01:00
Enrico Weigelt, metux IT consult
f26b31d8f7 randr: consistenly name reply structs "reply" instead of "rep"
Preparation for future use of generic reply assembly macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 17:12:35 +01:00
Enrico Weigelt, metux IT consult
80f49ee703 randr: drop internal server reset support
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 17:44:39 +01:00
Enrico Weigelt, metux IT consult
f27e12c918 dix: drop DE_RESET and associated cmdline args
Drop the -reset flag, so Xserver now either simply continues (w/o going
through internal reset) when last client disconnected or terminates
when -terminate is given.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-18 18:22:25 +01:00
Enrico Weigelt, metux IT consult
0fbb681fce treewide: use helper dixGetScreenPtr() for retrieving ScreenPtr's
Instead of directly accessing the global screenInfo.screens[] array,
let everybody go through a little inline helper. This one also checks
for array bounds - if the screen doesn't exist, return NULL.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-30 09:44:24 +01:00
Enrico Weigelt, metux IT consult
19921fd401 dix: unexport ConnectionInfo field
Not used by any drivers, so no need to keep it in public SDK.
Since it's not used by any drivers, effectively no ABI change, so
can be safely done within ABI-25.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-01 11:42:50 +02:00
Enrico Weigelt, metux IT consult
962580a15a treewide: macros lambda-esque screen iteration
iterating over screen list via lambda-esque macros calls like this

    DIX_FOR_EACH_SCREEN({
        do_something
    });

withing the body, the iterator variables `walkScreenIdx` and `walkScreen`
are defined and can be directly used (read-only). the code inside the body
is running in a separate scope.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-01 11:40:34 +02:00
Enrico Weigelt, metux IT consult
5e38615365 randr: inline byte-swapping into actual request handlers
No need to have whole extra functions for just a few LoC, and in the
future the whole thing will become more simplified by generic macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 12:35:03 +02:00
Enrico Weigelt, metux IT consult
1b719f8710 randr: xinerama: inline byte-swapping into actual request handlers
No need to have whole extra functions for just a few LoC, and in the
future the whole thing will become more simplified by generic macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-26 11:45:38 +02:00
Enrico Weigelt, metux IT consult
8cf54c5f6c randr: fix missing includes of extinit.h
Don't rely on this file just being included indirectly by somebody else
just by accident.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-25 13:48:21 +02:00
Enrico Weigelt, metux IT consult
36facd71b5 dix: move request/response related functions to new request_priv.h header
Move functions/macros dealing with request parsing or reply assembly/write
out of the big dix_priv.h into their own headers. This new header will also
get more of those function/macros soon (yet still in the pipeline).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:32:50 +02:00
Enrico Weigelt, metux IT consult
5720e3d375 randr: Xi: use return value of X_SEND_REPLY_SIMPLE()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-22 12:13:58 +02:00
Enrico Weigelt, metux IT consult
f288745d49 treewide: write xXineramaScreenInfo via x_rpcbuf_write_rect()
The xXineramaScreenInfo payload type has the same definition as xRectangle,
so we can just use x_rpcbuf_write_rect() for those.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 09:34:00 +02:00
Enrico Weigelt, metux IT consult
31e7112138 randr: 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-03 09:33:18 +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
Enrico Weigelt, metux IT consult
26a1e5f709 randr: rrGetScreenResources(): use x_rpcbuf_t
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 11:07:43 +02:00
Enrico Weigelt, metux IT consult
cbc4e91f02 randr: rrGetMultiScreenResources(): use x_rpcbuf_t
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 11:07:28 +02:00
Enrico Weigelt, metux IT consult
e9f9391b1d randr: ProcRRXineramaIsActive(): use x_rpcbuf_t
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 11:07:17 +02:00
Enrico Weigelt, metux IT consult
25e71fcb2a randr: ProcRRQueryProviderProperty(): use x_rpcbuf_t
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 11:07:06 +02:00
Enrico Weigelt, metux IT consult
41506c8fae randr: ProcRRListProviderProperties(): use x_rpcbuf_t
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 11:06:54 +02:00
Enrico Weigelt, metux IT consult
86755b09be randr: ProcRRGetScreenInfo(): use x_rpcbuf_t
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 11:06:41 +02:00
Enrico Weigelt, metux IT consult
d0e24582a0 randr: ProcRRGetProviders(): use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 11:06:27 +02:00
Enrico Weigelt, metux IT consult
36ef6a448b randr: ProcRRGetProviderInfo(): use x_rpcbuf_t
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 11:06:05 +02:00
Enrico Weigelt, metux IT consult
331510cc8f randr: use X_SEND_REPLY_SIMPLE() for sending simple replies
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 14:19:23 +02:00
Enrico Weigelt, metux IT consult
e6c7bd7c86 randr: ProcRRGetOutputProperty(): use x_rpcbuf_t for payload assembly
Use x_rpcbuf_t for request assembly and X_SEND_REPLY_WITH_RPCBUF()
for finally sending out everything together.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-26 10:15:09 +02:00
Enrico Weigelt, metux IT consult
1d93fbc68e randr: use 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-18 11:16:23 +02:00
Enrico Weigelt, metux IT consult
6c25d52276 randr: 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
9b6ff22f1d randr: fix size parameter to WriteToClient()
Size computation needs to be done on the struct actually written.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-14 16:53:10 +02:00
Enrico Weigelt, metux IT consult
4454a26545 randr: use x_rpcbuf_t in ProcRRGetProviderProperty()
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-14 14:19:49 +02:00
Enrico Weigelt, metux IT consult
34c3a9c7e2 treewide: fix serverGeneration int type mismatch
The global (exported) serverGeneration field is `unsigned long`, while
many other places copy it and compare it two other integer types, eg.
plain `int` (which is signed). Even if it's unlikely ever reaching such
high number of generations that it will ever make trouble, it's still
a good idea to clean this up and use the same type everywhere.

For clearity, introducing a typedef `x_server_generation_t` which is
used everywhere, instead of raw `unsigned long`.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:52:03 +02:00
Enrico Weigelt, metux IT consult
d19cfbfa70 randr: ProcRRGetOutputInfo (): 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-11 20:28:45 +02:00
Enrico Weigelt, metux IT consult
6b17a3bfbb randr: ProcRRQueryOutputProperty(): 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-11 20:23:24 +02:00
Enrico Weigelt, metux IT consult
16ab5a1456 randr: ProcRRListOutputProperties(): 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-11 20:20:17 +02:00
Enrico Weigelt, metux IT consult
e93b54bcea randr: ProcRRGetMonitors(): 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-11 20:14:35 +02:00
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
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
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
04c2c107d7 randr: rrcrtc: clean up declaration of xRRSetPanningReply
Declare struct where needed and drop zero-initialized fields.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 17:26:41 +02:00
Enrico Weigelt, metux IT consult
e1bbe46cbf randr: 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>
2025-07-29 11:45:53 +02:00
dec05eba
7ab50432ba randr: fix prime sync atom not created correctly
The commit 30cec78 incorrectly changed RRInitPrimeSyncProps to not
create the atom if it doesn't exist.

Signed-off-by: dec05eba <dec05eba@protonmail.com>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-23 19:15:07 +02:00
Enrico Weigelt, metux IT consult
86b392979e dix: don't include dix-config.h from randrstr.h
This header needs to be included in all sources at the very top anyways,
so no need to do it in other headers, too.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-23 15:46:51 +02:00
Enrico Weigelt, metux IT consult
39ef9586be randr: use dixAddAtom()
Use the new helper for creating atoms on demand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-23 12:24:27 +02:00
Enrico Weigelt, metux IT consult
30cec786e5 randr: use dixGetAtomID()
Use the new shortcut helper for cases where we need to check
whether an atom exists and retrieve it's ID.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-23 12:24:27 +02:00
Dudemanguy
eaf77db9a4 randr: set initial DPI property to a default value for all outputs
X has various ways to deal with DPI but all of the current methods have
some drawback (single global value, manually calculating from physical
dimensions, etc.) What is lacking is a simple value per output that
users and applications can use to communicate desired scaling values.
Fortunately, a generic output property mechanism already exists. And
they already send events whenever there is a change. So all we have to
do is make an "official" property for people to agree on and enshrine
it. In that case, all outputs can just always have the DPI property set
to something. In most cases, this will be 96 (the default), but one
could use the -dpi argument when launching or and that value will be
used instead. The intention is that 96 is the base that is equivalent to
1x scaling. i.e. 192 would be 2x, 144 would be 1.5x and so on. xrandr or
any other utility can modify this property at any time and applications
can choose to use the number in a way that makes sense.

Closes #208. Credit to @dec05eba for essentially coming up with the idea
of using output properties.

Signed-off-by: Dudemanguy <random342@airmail.cc>
2025-07-18 04:51:31 +02:00
dasha_uwu
7c64a06ba4 treewide: remove "lib" prefix in static_library names (meson)
this was producing static libraries named "liblibsomething.a"

Signed-off-by: dasha_uwu <dasha@linuxping.win>
2025-07-03 12:01:52 +02:00
Enrico Weigelt, metux IT consult
e91cfc890f randr: fix memleak in provider property update
If a device property is going to be updated, but failing due
the new value being too big, the buffer isn't freed.

Also compacting the logic for this into small inline function.

Fixes: 948630fa42
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-24 16:06:38 +02:00
Olivier Fourdan
948630fa42 randr: Check for overflow in RRChangeProviderProperty()
A client might send a request causing an integer overflow when computing
the total size to allocate in RRChangeProviderProperty().

To avoid the issue, check that total length in bytes won't exceed the
maximum integer value.

CVE-2025-49180

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 20:01:25 +02:00