Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
_X_EXPORT'ing some x_rpcbuf_clear() and x_rpcbuf_write_CARD8s() just for
internal use (eg. glx) - those are *NOT* supposed to be called by any
external modules/drivers.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This function is internal to DIX (used for assembling XQueryFont replies
and not used by any drivers (not even proprietary NVidia), and really
shouldn't ever called by them at all. It's been one the many victims of a
really unthoughtful mass export back 17 years ago.
That'S a necessary step for refactoring the RPC reply mechanics.
Since it's never used by any driver at all, we can easily to this change
within the current ABI level.
Fixes: d6cbd4511e
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
As preparation for moving doListFontsWithInfo() (and it's callers) to
x_rpcbuf_t, inline the SwapFonts() call into the caller function.
SwapFonts() has several problems, eg. directly operating on a buffer that's
holding xQueryFontReply struct (which isn't the correct one, just happens to
match) as well as the whole payload.
We first need to get them out of the way, before we can split off the reply
into the (statically declared) header struct and the (x_rpcbuf_t-filled)
payload.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
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>
Use x_rpcbuf_t for reply payload assembly and send it out via
X_SEND_REPLY_WITH_RPCBUF() macro.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Use x_rpcbuf_t for reply payload assembly, so we can uniformly use the
X_SEND_REPLY_WITH_RPCBUF() macro for final write out.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Let X_SEND_REPLY_SIMPLE() macro return the X11 result code `Success`.
No change in semantics, just allowing a bit shorter typing, so one
can now directly write `return X_SEND_REPLY_SIMPLE(...)` in one line.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Needs to be bytes_to_int32() instead of pad_to_int32(), since we want
the amount of units instead of bytes here.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Check for rpcbuf error and return BadAlloc then, otherwise return Success.
This way, callers don't need to check their rpcbuf for error on their own
anymore, but can just do return X_SEND_REPLY_WITH_RPCBUF(...).
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>