Commit Graph

2749 Commits

Author SHA1 Message Date
stefan11111
90846d49cc xfree86: add (optional) ScreenRec padding for legacy Nvidia driver
Commit 3cb3024fea removed pScratchPixmap field
in ScreenRec, which broke legacy Nvidia (proprietary) drivers (470.x), thus
we should add an empty/dummy field here, to ensure correct padding. But this
would break ABI again - can't do that within minor release line.

As compromise, adding a *build time* option CONFIG_LEGACY_NVIDIA_PADDING for
this, so operators/packagers can opt-in to this change.

As it breaks ABI, the option is disabled by default until the next major release
and intended for EXPERTS ONLY who need nvidia390 or nvidia470 drivers.

Note that ALL DRIVERS should be rebuild if it is applied!

This compile-time option, along with the hacks needed to support it
in a non-abi-breaking way, should be droppen in the next major release.

Co-authored-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-22 17:02:12 +02:00
Enrico Weigelt, metux IT consult
bbccfab253 dix: rpcbuf: fix x_rpcbuf_write_INT32()
The typecast was wrong (copy-paste error), needs to be CARD32 instead of CARD16.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-22 15:53:25 +02:00
Enrico Weigelt, metux IT consult
7c3ddc80ef dix: drop obsolete WriteSwappedDataToClient() macro
This macro isn't and shouldn't be used anymore, so get rid of it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-22 15:45:47 +02:00
Enrico Weigelt, metux IT consult
d6089c52c3 treewide: macro for computing extra units needed for reply header
Add and use macro X_REPLY_HEADER_UNITS() for computing how many
extra protocol units are needed for a reply header (for .length field)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-22 14:14:32 +02:00
Enrico Weigelt, metux IT consult
f9fba638cf dix: add macro X_SEND_REPLY_SIMPLE() for sending simple replies
This macro fixes up a given reply header, computes it's full size
and sends it out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-21 18:32:45 +02:00
Enrico Weigelt, metux IT consult
658d2db226 dix: rpcbuf: add x_rpcbuf_write_INT32()
litle wrapper for directly writing INT32 w/o signess warnings.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-21 17:42:04 +02:00
Enrico Weigelt, metux IT consult
7f648df8af dix: rpcbuf: add x_rpcbuf_write_rect() for writing RECTANGLE PDU
The `RECTANGLE` PDU is pretty common, so it's good to have a helper for
writing this, so it doesn't need to be open-coded everywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-20 11:37:47 +02:00
Enrico Weigelt, metux IT consult
2edb06c8bc dix: rpcbuf: add x_rpcbuf_write_rpcbuf_pad()
This is writing the contents of source rpcbuf into the target one,
pads it and finally clears the source buffer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-20 11:37:02 +02:00
Enrico Weigelt, metux IT consult
66311c6d51 dix: rpcbuf: add x_rpcbuf_write_counted_string_pad()
Add a helper for writing pascal-type strings: the counter is written
as CARD16, then followed by the string characters (w/o zero), and
finally everything padded up to full protocol units.

This encoding is used in various places throughout the Xserver,
eg. in xkb.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-20 11:13:07 +02:00
Enrico Weigelt, metux IT consult
15fdd0ae20 dix: fix X_SEND_REPLY_WITH_RPCBUF()
We need to call bytes_to_int32() instead of pad_to_int32(),
otherwise our computation is totally broken.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-18 19:38:15 +02:00
Enrico Weigelt, metux IT consult
0b7194c9bc dix: add X_SEND_REPLY_WITH_RPCBUF() macro
This macro is sending a reply header struct and rpcbuf payload
all in one shot. It also automatically computes the payload lengths
as well as also filling common fields like `type` and `sequenceNumber`

A typical call site looks like this:

>    int ProcFooRequest(ClientPtr client) {
>
>        [ ... ]
>
>        X_SEND_REPLY_WITH_RPCBUF(client, rep, rpcbuf);
>        return Success;
>    }

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-18 11:16:23 +02:00
Enrico Weigelt, metux IT consult
361b576c48 dix: 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
2fddefcf8c dix: use x_rpcbuf_t in ProcListProperties()
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-15 19:52:07 +02:00
Enrico Weigelt, metux IT consult
5d8f149a57 dix: fix memory clearing in dix_main()
Clearing of screens and gpuscreens pointer list on teardown has been wrong.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-15 14:27:39 +02:00
Enrico Weigelt, metux IT consult
91bc0ff6b2 dix: use x_rpcbuf_t in ProcGetKeyboardMapping()
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-15 13:34:26 +02:00
Enrico Weigelt, metux IT consult
eb04c7a1b3 dix: use x_rpcbuf_t in ProcQueryTree()
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-15 12:58:06 +02:00
Enrico Weigelt, metux IT consult
aac7a9330a dix: use x_rpcbuf_t in ProcGetProperty()
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-15 00:04:10 +02:00
Enrico Weigelt, metux IT consult
8a2dfa1aba dix: macro for computing extra units needed for reply header
Add macro X_REPLY_HEADER_UNITS() for computing how many extra
protocol units are needed for a reply header (for .length field)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-14 19:17:39 +02:00
Enrico Weigelt, metux IT consult
a95ae61658 dix: rpcbuf: add rpcbuf_write_INT16()
Just a convenience wrapper for writing an INT16.
Technically it's really the same as CARD16, but we still need a typecast
in order to not getting a compiler warning on int signedness mismatch.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-14 19:00:45 +02:00
Enrico Weigelt, metux IT consult
e07a939765 dix: rpcbuf: add x_rpcbuf_pad() for padding the buffer
New function for padding the buffer to full protocol units granularity:
If the current write position isn't at 4-byte granularity, it reserves
the remaining number of bytes (ie. writing zeros), in order to make the
next write align to 4-byte granularity again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-14 12:44:26 +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
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
3af53d474f dix: let CreateGCperDepth() accept ScreenPtr instead of screen id
It's only caller already has the ScreenPtr, so it doesn't make any sense
passing in the screen number and let that function retrieve the pointer
on its own again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-12 11:09:43 +02:00
Enrico Weigelt, metux IT consult
d4fc1506ad dix: let CreateDefaultStipple() accept ScreenPtr instead of screen id
It's only caller already has the ScreenPtr, so it doesn't make any sense
passing in the screen number and let that function retrieve the pointer
on its own again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-12 11:09:35 +02:00
Enrico Weigelt, metux IT consult
a1c3dcb527 dix: let x_rpcbuf_wsize_units() return CARD32
Practically all callers need to assign to a CARD32 field, so let it
directly compute and return as CARD32.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-12 10:29:01 +02:00
Enrico Weigelt, metux IT consult
35c075e2c4 dix: WriteRpcbufToClient(): fix int type mismatches
Use explicit cast to match WriteToClient()'s expectation and
return ssize_t, as coming from WriteToClient()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 20:11:09 +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
566f961fd4 dix: fix int-type mismatches related to dixClientIdForXID()
The client index (in the client table) can never be negative, thus
make it an unsigned short.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 13:02:14 +02:00
Enrico Weigelt, metux IT consult
0534ee4a75 dix: dixLookupBuiltinColor(): fix int type mismatch
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 11:27:06 +02:00
Enrico Weigelt, metux IT consult
967ae609b6 dix: drop DDXBEFORERESET symbol
Reduce complexity for things that really don't matter much:

The ddxBeforeReset() function is called when the Xserver going to reset
(new server generation). Right now, the only DDX really needing that is
Xwin, on all the others it's just no-op.

We've got an extra complicated build logic, which ifdef's out this all when
Xwin isn't built at all. The saving is extremely minimal - just skipping
few stub functions, which in most sessions aren't even called.

Therefore, get rid of this extra complexity that isn't giving us any
notable gain.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 11:41:48 +02:00
Enrico Weigelt, metux IT consult
7fd5a6759e dix: inpututils: don't use %hhx printf pattern
mingw's printf() doesn't understand it yet, and it's not really
important here, so just use `%hx` instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 17:31:00 +02:00
SuperDuperDeou
45434690cc dix: small diff files more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
3feeeb9365 dix: enterleave.c more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
fff263d7c7 dix: privates.c more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
620c9ddf11 dix: grab.c more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
7764b29365 dix: dixutils.c more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
952cbeda25 dix: getevents.c more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
fa6ff96f21 dix: touch.c mode C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
3910a9e0b0 dix: dispatch.c more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
35d27fd384 dix: resource.c more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
bdd8a5315c dix: inpututils.c more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
6410fda821 dix: window.c more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
20ccf138b3 dix: dixfonts.c more C99 scoped declarations
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
329488e824 dix: events.c mode C99 coped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
15aced699a dix: devices.c, more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
SuperDuperDeou
ebeb805b70 dix: colormap.c more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
2025-07-31 16:57:44 +02:00
Enrico Weigelt, metux IT consult
19c21b24ae dix: macro for checking X protocol types
The X protocol types from xorgproto all have corresponding sz_<typename>
defines with their actual network payload size (this can be checked via
SIZEOF() macro).

In theory, this should always be the same as sizeof(), but just to be sure,
adding a macro for a static assert on that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 15:50:21 +02:00
Enrico Weigelt, metux IT consult
731ace6c13 dix: ProcGetMotionEvents(): simplify writing out xTimecoord
The swapping is so trivial, we don't need several extra functions
for that - just do it right where the header fields are swapped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-24 11:57:19 +02:00
Enrico Weigelt, metux IT consult
ed47ec4bcb dix: rpcbuf: don't clear memory unless requested explicitly
Instead of always zero'ing out the whole buffer at allocation time, only
do it where really necessary. Also adding x_rpcbuf_reserve0() for reserving
buffer space that's explicitly cleared.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-23 17:26:25 +02:00
Enrico Weigelt, metux IT consult
123652228e dix: rpcbuf: use x_rpcbuf_t instead of struct x_rpcbuf
Both are the same types, the `struct x_rpcbuf` still remains, but it
seems more clear to use the `x_rpcbuf_t` as the canonical name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-23 17:26:25 +02:00