158 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
080413fe1f Xext: damage: DamageExtSetCritical() replace Bool by bool
Prefer C standard stdbool over Xlib's own type.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-22 08:58:36 +01:00
Enrico Weigelt, metux IT consult
f0347e249c Xext: panoramiX: drop server reset support
Not needed anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 19:22:55 +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
Alan Coopersmith
0616df4a76 panoramix: avoid null dereference in PanoramiXMaybeAddDepth()
Reported in https://gitlab.freedesktop.org/xorg/xserver/-/issues/1817:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:748:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘PanoramiXDepths’
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:802:1: enter_function: entry to ‘PanoramiXConsolidate’
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:813:17: branch_true: following ‘true’ branch...
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:814:9: branch_true: ...to here
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:814:9: call_function: calling ‘PanoramiXMaybeAddDepth’ from ‘PanoramiXConsolidate’
746|       PanoramiXDepths = reallocarray(PanoramiXDepths,
747|                                      PanoramiXNumDepths, sizeof(DepthRec));
748|->     PanoramiXDepths[j].depth = pDepth->depth;
749|       PanoramiXDepths[j].numVids = 0;
750|       PanoramiXDepths[j].vids = NULL;

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2065>
2025-10-02 18:46:33 +02:00
stefan11111
2ee7e9bc92 Xext/panoramix.c: #include "os/osdep.h"
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-02 18:46:33 +02: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
7afa753652 Xext: drop PanoramiXGCKey and PanoramiXScreenKey macros
We can directly use the actual fields, no need for these extra macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-26 15:38:07 +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
a6f629cbaa Xext: 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:27 +02:00
Enrico Weigelt, metux IT consult
9e209798f1 Xext: panoramix: inline SProc*()'s
No need to have a hole bunch of extra functions, if we can just easily
inline the few relevant lines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-17 09:46:27 +02:00
Enrico Weigelt, metux IT consult
358f76f2ad treewide: fix misleading firstScreen variable naming to masterScreen
Follow-up on renaming dixGetFirstScreenPtr() to dixGetMasterScreen():
also rename the target variables for correct technical terminology.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 11:44:05 +02:00
Enrico Weigelt, metux IT consult
b0ffa7b286 treewide: rename dixGetFirstScreenPtr() to dixGetMasterScreen() for correct semantics
In Xinerama/Panoramix configuration there's one screen that's having special
meaning - it's used for simulating as the frontend for all client operations:
the clients (should) only talk to that screen, while panoramix subsystem is
proxying those operations to all the other screens (with certain changed
applied, eg. coordinate transformations).

Historically, this screen happens to be the first one in the system (some of
it's proc's are hooked up in order to achieve desired behaviour). That's why it
used to be accessed via screenInfo.screens[0] - that already had been encapsulated
into a tiny helper `dixGetFirstScreen()`.

a) the correct terminus technicus for a situation where one device (or SW entity)
   entirely controlling others is a master-slave-relationship: the controlling
   device/entity is `master`, the controlled ones are `slave` (to that specific
   master).

b) the term "first screen" is inacurate and misleading here: what the caller's are
   actually interest in isn't the first entry in the screen array, but the screen
   that's controlling the others. With upcoming refactoring of the Xinerama/Panoramix
   subsystem, this might well be a different array index than 0.

c) the term `default` also wouldn't match: `default` implies there's a real practical
   choice, and such value applies when no explicit choice has been made. But in this
   case, it practically doesn't make sense (except perhaps for debugging purpose)
   for a client to use any different screen.

Therefore fixing the function name to the correct technical terminology.
(for sake of patch readability, renaming corresponding variables is left to
subsequent patches).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 11:44:05 +02:00
Enrico Weigelt, metux IT consult
e474b81a45 damage: move the extension under the Xext directory
Tidying up the source tree structure a bit.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-10 17:06:13 +02:00
Enrico Weigelt, metux IT consult
6bc438ab5a treewide: use inline helper for accessing first screen
Instead of everybody directly accessing the (internal) screenInfo struct,
let those consumers only interested in first screen use a little helper.

Also caching the value if it's needed several times.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-10 13:45:05 +02:00
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
f9ae5def14 Xext: panoramix: drop dead code path on GLXPROXY symbol
This symbol doesn't seem to be defined ever (neither in Xorg tree, nor
any headers) - it's a relic from DMX, which had been removed aeons ago.
So let's drop that dead code path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 11:49:32 +02:00
Enrico Weigelt, metux IT consult
3880670da1 Xext: panoramix: cache screen pointer
locally cache the screen pointer in local variable.
follow-up commits will use a generic helper function for retrieving it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 10:49:49 +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
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
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
7a4136d0ff xext: panoramix: 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-24 12:08:32 +02:00
Enrico Weigelt, metux IT consult
bb6a70be0f panoramix: XineramaGetImageData() split out code inside the big loop
Split out the code inside the big for-each-screen loop into separate
function.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-22 13:39:09 +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
02737a1cd4 panoramiX: XineramaGetImageData(): simplify the loop
take way the extra scope / indention on the `if (nbox)` statement and
use `continue` instead.

Hint: for easier review, one can use `git diff -w` in order to suppress
the indention-only changes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-14 12:12:33 +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
69452c23ae panoramiX: XineramaGetImageData(): replace walk variable i by walkScreenIdx
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
e4081afa65 panoramiX: XineramaGetImageData(): add walkScreen temp variable
Instead of always accessing the global screens array, do it only once
and put it into a walk variable.

Also prepration for upcoming commits which are moving the looping logic
into a generic macro.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
be425a933c panoramiX: XineramaGetImageData(): scope scratchMem
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
1193e294e7 panoramiX: XineramaGetImageData(): scope sizeNeeded variable
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
03f3388745 panoramiX: XineramaGetImageData(): declarare and init depth in one shot
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
124dee2db0 panoramiX: XineramaGetImageData(): scope ScratchPitch variable
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
79b6f60277 panoramiX: XineramaGetImageData(): scope pBox
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
b9f76047fc panoramiX: XineramaGetImageData(): scope loop variables
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
5e68ea71f6 panoramiX: XineramaGetImageData(): scope temporary dimension variables
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
27f1fcef7f panoramiX: XineramaGetImageData(): scope split pDraw variable usage
Use a separate variable pWalkDraw for inside the loop, as it's got a
different purpose in here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
2f62e660ff panoramiX: XineramaGetImageData(): scope inOut variable
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
dee9b9a5be panoramix: XineramaGetImageData(): scope nbox
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +02:00
Enrico Weigelt, metux IT consult
d9cf1a7a9d panoramiX: XineramaGetImageData(): scope ScreenRegion
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:57:23 +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
aaea461c6f panoramiX: clean up reply struct definitions
* declare and assign them right where they're needed, in one shot
* drop unnecessary assignment and byte-swap of zero values

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 16:49:20 +02:00
Enrico Weigelt, metux IT consult
4a073eb318 panoramix: add static protocol struct size asserts
Add compile-time checks on whether sizeof(foo) == SIZEOF(foo),
using new static assert macro.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 15:50:21 +02:00
Enrico Weigelt, metux IT consult
81a79e9f8b panoramiX: ProcXineramaQueryScreens(): write out payload in one block
Collect payload pieces into x_rpcbuf, so it can be written out once.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-23 19:51:24 +02:00
Enrico Weigelt, metux IT consult
3c028a8cc0 miext: move over extinit_priv.h from include
Since most of the extension init logic (and on/off switches for them)
is driven from miext, this seems the appropriate place for the header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +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
a09805f675 dix: add dixClientForXID()
Retrieves the ClientPtr for the owner of given resource.
This way reducing the sites directly accessing clients[] array.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:34 +02:00
Enrico Weigelt, metux IT consult
0a315e45dd dix: replace CLIENT_ID() macro by dixClientIdForXID() inline function
Make it type-safe and a bit more obvious what it really does,
also adding some inline documentation. Since it's just some
bit shifting magic, it's qualified for inlining.

The CLIENT_ID() macro isn't used by any external modules, so the
new function doesn't need to be in a public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:27 +02:00
Enrico Weigelt, metux IT consult
8060c995f5 panoramix: unexport XineramaVisualsEqualPtr and make it static
There's no user outside of panoramiX.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:51:33 +02:00