Commit Graph

580 Commits

Author SHA1 Message Date
stefan11111
e6a0fa4b0c Treewide: Fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2134>

----------------------------------------------------------------------------

This commit is the result of `git apply commit.diff --reject`
applied on e8f4522312

67c82078fe does not
apply to Xlibre

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-03-16 13:11:07 +01:00
Enrico Weigelt, metux IT consult
0272fcd55e present: move over public SDK header to include/
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-12 16:21:20 +01:00
Enrico Weigelt, metux IT consult
5862f31d18 glx: move over vndserver.h public SDK header to include/
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-12 14:25:12 +01:00
Tautvis
2cfb92330f glx: glxext fix memory leak when calling DestroyPixmap
Call dixDestroyPixmap instead pScreen->DestroyPixmap, which is correct
call to free resources as since cece84fa93
the Screen->DestroyPixmap function is no longer wrapped.

Fixes: https://github.com/X11Libre/xserver/issues/1809

Signed-off-By: Tautvis <gtautvis@gmail.com>
2026-01-13 14:44:52 +01:00
Enrico Weigelt, metux IT consult
0b1e8a759c stop defining _XF86DRI_SERVER_
This once was needed on including xf86driproto.h, but these day
have gone now for aeons.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-05 14:42:01 +01:00
b-aaz
7f7efe8195 Revert 9a82f5c, bring back Cygwin support.
Brought back the code removed in that commit so that we can bring back
Cygwin support.
Small changes are done in the process of resolving conflicts against the
current head.

Some checks have not been reverted, because they were not necessary
anymore.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
2025-12-21 12:59:03 +01:00
stefan11111
63f2422475 glx: include: meson_options.txt: Allow disabling DRI glx backends
This allows building the X server with glx and without mesa.
This also makes the X server optionally no longer be a loader for dri drivers.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1638
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1819

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-12-16 15:56:04 +01:00
Enrico Weigelt, metux IT consult
aafd986528 glx: fix (signed) char array subscript
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-14 11:26:15 +01:00
Enrico Weigelt, metux IT consult
33729b1361 include: windowstr.h: unexport w*() macros
These aren't used by any drivers, so no need to keep them public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 19:54:42 +01:00
Enrico Weigelt, metux IT consult
8039c2cbf1 dix: unexport SwapLongs()
Not used by any external drivers, so no need to keep it in public SDK.
Since it's used by internal modules, still needs to be _X_EXPORT'ed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-25 18:26:02 +01:00
Enrico Weigelt, metux IT consult
95499a9525 dix: unexport enableIndirectGLX
Still needs to be _X_EXPORT'ed for internal modules, but
not supposed to be visible to external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 19:25:41 +01:00
Enrico Weigelt, metux IT consult
44620ed67c glx: drop internal server reset support
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 19:23:19 +01:00
stefan11111
0ec0f00c23 glx: revert cb85ceae2d
This commit broke glx after server reset.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-11 10:46:29 +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
stefan11111
3109a95e56 glx: vndcmds: Update a comment
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-24 12:47:15 +02:00
stefan11111
9c53dd0a87 glx: vndcmds: revert 22a51912d1 "glx: vndcmds: save unecessary calls to clear current context for same vendor"
Looks like the answer to the commented question:
```
        // TODO: For switching contexts in a single vendor, just make one
        // makeCurrent call?
```
is no.

Fixes: https://github.com/X11Libre/xserver/issues/1246
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-24 12:47:15 +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
sesankm
794a3f3630 glx: glxcmds: use rpcbuf to build xGLXGetVisualConfigsReply payload
Signed-off-by: sesankm <26676400+sesankm@users.noreply.github.com>
2025-09-29 12:35:20 +02:00
Enrico Weigelt, metux IT consult
cb85ceae2d glx: use DeleteCallbackList() for callback list destruction
We already have a function for callback list deletion, so use this one
instead of doing it manually.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 10:53:27 +02:00
Enrico Weigelt, metux IT consult
f29fb6bb62 present: unexport symbols not used by drivers
these symbols aren't used by any external drivers (not even proprietary
Nvidia), so no need to keep them exported any longer:

 * present_check_flips
 * present_register_complete_notify
 * present_can_window_flip
 * uint32_t FakeScreenFps

Since it's not any *effective* ABI change, can go into current ABI-25 line.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-26 17:09:43 +02:00
sesankm
79d092cfb9 glx: glxcmds: use rpcbuf to build xGLXGetDrawableAttributesReply payload
Signed-off-by: sesankm <26676400+sesankm@users.noreply.github.com>
2025-09-26 11:50:39 +02:00
Enrico Weigelt, metux IT consult
8e2c1ad714 glx: 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:08 +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
809b0a7999 glx: Xi: use return value of X_SEND_REPLY_SIMPLE()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-22 12:05:39 +02:00
sesankm
22a51912d1 glx: vndcmds: save unecessary calls to clear current context for same vendor
Signed-off-by: sesankm <26676400+sesankm@users.noreply.github.com>
2025-09-22 11:26:53 +02:00
sesankm
16d6182e15 glx: glxcmds: use rpcbuf for payload in __glXDisp_QueryExtensionsString
Signed-off-by: sesankm <26676400+sesankm@users.noreply.github.com>
2025-09-12 19:36:21 +02:00
Enrico Weigelt, metux IT consult
143fafad24 glx: fix wrong swapped encoding in __glXDisp_QueryExtensionsString()
The name string is supposed to be transmitted as-is, not swapped in
4-byte chunks.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-10 10:27:34 +02:00
sesankm
4c71d77d08 glx: glxcmds.c: use x_rpcbuf_t in DoQueryContext
Signed-off-by: sesankm <26676400+sesankm@users.noreply.github.com>
2025-09-09 09:44:49 +02:00
Enrico Weigelt, metux IT consult
025227a113 glx: __glXDisp_RenderMode(): use x_rpcbuf_t
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>
2025-09-08 17:40:01 +02:00
Enrico Weigelt, metux IT consult
9449df5896 glx: __glXSendReply(): use x_rpcbuf_t
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>
2025-09-08 09:48:56 +02:00
Enrico Weigelt, metux IT consult
c339338277 glx: replace __GLX_SWAP_INT() by swapl()
We have an optimized function for this, so use it.
2025-09-04 18:33:24 +02:00
Enrico Weigelt, metux IT consult
09cecbf724 glx: consolidate retrieval of vendor for screen
Move the steps for retrieving the vendor object for given screen
into a little helper function.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 14:07:17 +02:00
Enrico Weigelt, metux IT consult
a574ab57b2 glx: replace __GLX_SWAP_INT_ARRAY() by SwapLongs()
We have an optimized function for this, so use it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 11:49:02 +02:00
Enrico Weigelt, metux IT consult
1c65d0949e glx: xorgGlxServerInit(): canonical screen iterator index
in preparation of upcoming generic screen iterator macros, already
rename the index variable to what the macro will be using.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 11:06:45 +02:00
Enrico Weigelt, metux IT consult
44228d264a glx: replace __GLX_SWAP_SHORT() by swaps()
We have an optimized function for this, so use it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 09:32:38 +02:00
Enrico Weigelt, metux IT consult
5ea2496d20 treewide: clean up static zero initialization
Do it the ISO C way.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 14:21:16 +02:00
Enrico Weigelt, metux IT consult
953261e160 glx: xtest: 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-25 10:10:16 +02:00
Enrico Weigelt, metux IT consult
d8149d9c9e glx: 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
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
c25a0a533e glx: fix duplicate typedef
../glx/indirect_table.c
  In file included from ../glx/indirect_table.c:28:
  In file included from ../glx/glxserver.h:66:
  ../include/glx_extinit.h:33:28: warning: redefinition of typedef '__GLXscreen' is a C11 feature [-Wtypedef-redefinition]
     33 | typedef struct __GLXscreen __GLXscreen;
        |                            ^
  ../glx/glxscreens.h:113:28: note: previous definition is here
    113 | typedef struct __GLXscreen __GLXscreen;
        |                            ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-05 10:18:19 +02:00
Enrico Weigelt, metux IT consult
af38d5881b glx: drop including dix-config.h from internal includes
The consumers always need to include <dix-config.h> at the very top
anyways, so no need to also include it (with extra guards) from
internal headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 04:51:30 +02:00
Nathan Kidd
7ca8b37ab1 glx: Don't blindly write 8 bytes in GLX single replies
Previously we leaked stack when invalid enum parameters were
specified and caused __glGet*_size functions to return a 0 size.

Further, we read out-of-bounds (and leaked) when the input data was less
than 8 bytes (__glXDispSwap_GetFramebufferAttachmentParameteriv and
__glXDisp_GetRenderbufferParameteriv).

Now we only write a single element in the reply padding, and only when there
is a single element. This is what the Mesa client-side libGL expects, and
restores original GLX server behaviour, matching both pre-public (1996) SGI GLX
and XFree86 4.

The main risk of this change is if we have any error in element count or size;
previously it may not have mattered but now it does.

There are no piglit result changes from this modification using either mesa
libGLX or NVIDIA libGLX.

For performance considerations, an extra conditional and variable-length
memcpy has no meaningful impact on the indirect rendering pipeline cost.

There is still the possiblity to leak if our size checks allow an enum that
the GL implemention does not. Guarding against that requires zero-initializing
all temp storage, which wants re-evaluation of the blind 200-byte buffers
used for many calls and thus is a much bigger change.

Signed-off-by: Nathan Kidd <nkidd@rocketsoftware.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1647>
2025-07-03 16:43:18 +02:00
Nathan Kidd
5b810bac5e glx: Fix out-of-bounds reads from negative return
The callers of these functions were casting -1 to unsigned and then
using 4GB indexes. By returning 0 we match all the other size functions.

GLX size functions return -1 to indicate error, but GL size functions return 0.

Signed-off-by: Nathan Kidd <nkidd@rocketsoftware.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1647>
2025-07-03 16:43:18 +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
Herman Semenov
604582d179 glx: fix correct sizeof GL unsigned int
Signed-off-by: Herman Semenov <GermanAizek@yandex.ru>
2025-06-23 16:18:47 +02:00
Enrico Weigelt, metux IT consult
e6467895f9 dix: add dixAllocServerXID()
Adding a separate function for allocating server-client's XIDs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult
14e0b1715b dix: unexport ResizeVisualArray()
Not used by any drivers, and shouldn't be used by them.
Needs to _X_EXPORT'ed, as long as glx is a separate module.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00
Enrico Weigelt, metux IT consult
9a82f5c30b drop remains of cygwin support
Cygwin support doesn't seem to be used anymore, so it can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +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
b6c72bc9f5 treewide: clean up remaining consumers of extinit.h
Several sources including it without need. For consistency, those who still
need someting from there should include exitinit_priv.h (which also pulls
in extinit.h)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00