Commit Graph

10109 Commits

Author SHA1 Message Date
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
6a1bdcedd3 dix: unexport DeleteProperty()
Not used by any external driver, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 19:22:35 +01:00
Enrico Weigelt, metux IT consult
416f69eb88 include: misc.h: unexport lowbit() macro
Not used by any drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 19:20:07 +01:00
Enrico Weigelt, metux IT consult
805dec1661 include: drop obsolete hotplug.h
Nobody's including it anymore, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 16:37:03 +01:00
Enrico Weigelt, metux IT consult
062a930f3c kdrive: drop obsolete support for internal server reset
Not used anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 16:35:50 +01:00
Enrico Weigelt, metux IT consult
1749a8bdfd config: unexport config_init() and config_fini()
Those 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-20 14:11:27 +01:00
Enrico Weigelt, metux IT consult
064e5f2ddf os: drop OsCleanup()
Since we're always terminating now, everbody can call UnlockServer()
directly, so we don't need that extra function anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 11:19:02 +01:00
Enrico Weigelt, metux IT consult
1ae9646936 pseudoramiX: unexport noPseudoramiXExtension
Not used by any driver (not even by xf86 at all), so no need to
keep it exported. Also disposing the now empty nonsdk_extinit.h,
which also isn't used by any drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-19 13:32:31 +01:00
Enrico Weigelt, metux IT consult
25d99353ee xkb: unexport XkbGetCoreMap() and XkbSetRepeatKeys()
Not needed by external drivers, so no need to keep them public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-19 13:32:12 +01:00
Chase
fcbb2bafce treewide: replace __FUNCTION__ by __func__
prefer C99 standard over non-standard legacy symbols

Signed-off-by: Chase <chinkle3@illinois.edu>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-18 13:29:47 +01:00
stefan11111
434331e129 modesetting: Split chosing gbm format into drmmode_gbm_format_for_depth
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-17 18:55:20 +01:00
stefan11111
68e3e9fcb1 modesetting: rename drmmode_bo_has_bo to drmmode_bo_get_bo
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-17 18:55:20 +01:00
stefan11111
db77a579c6 modesetting: don't return a value from drmmode_bo_destroy
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-17 18:55:20 +01:00
stefan11111
49c9aaac82 modesetting: Move the compatibility GBM_BO_USE_FRONT_RENDERING define to the top of the file
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-17 18:55:20 +01:00
Chase
e0481acb79 xf86Crtc.c: fix formatting 2025-11-17 18:53:47 +01:00
Chase
ba33b36f7a xnest icons: const correctness 2025-11-17 12:53:09 +01:00
stefan11111
8bb2fc9d76 modesetting: Create the front buffer with GBM_BO_USE_FRONT_RENDERING
Also renamed `drmmode_create_bo` to `drmmode_create_front_bo`,
better reflecting how it is used.

According to the mesa docs: https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/gbm/main/gbm.h :
```
   /**
    * The buffer will be used for front buffer rendering.  On some
    * platforms this may (for example) disable framebuffer compression
    * to avoid problems with compression flags data being out of sync
    * with pixel data.
    */
   GBM_BO_USE_FRONT_RENDERING = (1 << 6),
```

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-10 11:08:59 +01:00
Enrico Weigelt, metux IT consult
1e62e5f417 xfree86: pci_ids: drop unused ifndef IRIS
This symbol was never defined. Just a fallout from copying over
this file from MESA.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-10 11:05:30 +01:00
stefan11111
53f1095118 modesetting: Fix leak when disabling hw cursor
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-10 10:31:55 +01:00
stefan11111
bd540a8f46 modesetting: don't probe size_hints if the cursor is already probed
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-10 10:28:00 +01:00
stefan11111
ed49ae8fe7 modesetting: clean up drmmode_crtc_create_planes
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-10 10:28:00 +01:00
stefan11111
e5df974aab modesetting: get the SIZE_HINTS cursor plane property in drmmode_crtc_create_planes
We were duplicating this code needlessly and in an error-prone way.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-10 10:28:00 +01:00
Enrico Weigelt, metux IT consult
6bc92a5674 modesetting: replace tabs by whitespace
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 16:42:27 +01:00
stefan11111
516239c164 modesetting: Fix -Wunused-variable warnings
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-07 15:38:15 +01:00
notbabaisyou
6c924809e4 modesetting: Make the async-flipping key global. 2025-11-06 15:56:07 +01:00
Qiang Yu
c5fad50afe modesetting: fix PRESENT_FLIP_REASON_BUFFER_FORMAT gets overwritten
When dmabuf_capable is enabled, ms_present_check_unflip may return
with reason PRESENT_FLIP_REASON_BUFFER_FORMAT to be reported back
to client by PresentCompleteModeSuboptimalCopy. We should not
overwrite it by page flip reasons anyway when exit.

This fix also avoid changing vblank->exec_msc in present_scmd_pixmap()
which caused by page flip reasons to prevent a present to be executed
immediatly. So that we can cancel pending vblanks when new vblanks with
same msc arrive. This happens when application just starts.

This problem can be observed at least using radeonsi OGL driver, start
xserver with dmabuf_capable enabled, no window manager, glxgears will
stuck for the first several seconds. If using a composite window manager
like Mutter, we can't observe the glxgears stuck, but the prensent
complete event still shows unexpected Copy mode instead of
PresentCompleteModeSuboptimalCopy or Skip mode.

glxgears window msc is 0 at the beginning, it will send present request
with target msc = 1, 2, 3, ... N before server send back the complete
event for target msc = 1. But server side window msc is way bigger than N,
so it will think all these present requests are outdated and just show the
Nth request at the next vblank. [1 .. N-1] requests should be skipped.
But without this fix, all [1 .. N] presents will be executed with Copy
mode which causes stuck.

Fixes: a94dd953 ("modesetting: add support for TearFree page flips")
2025-11-06 15:56:07 +01:00
notbabaisyou
e26da636bf modesetting: Allow selecting more optimal modifiers. 2025-11-06 15:56:07 +01:00
notbabaisyou
0c6cb9532b modesetting: Omit DRM_FORMAT_MOD_INVALID.
Previously it was possible for the invalid modifier to be placed in the IN_FORMATS or IN_FORMATS_ASYNC arrays, this is of course not wanted as this can cause problems with devices that lack support for explicit modifiers.
2025-11-06 15:56:07 +01:00
Ville Syrjälä
d3ec45f01c modesetting: Use IN_FORMATS_ASYNC for async flips
Use the IN_FORMATS_ASYNC blob (as opposed to the normal
IN_FORMATS blob) to determine which formats/modifiers are
supported. This will allow the client to allocate buffers
which can actually be async flipped.

In order to guarantee that the most optimal modifier is
always used we also need to force a modifier renegotiation
when swicthing between sync and async flips. Otherwise eg.
sync flips might end up using a less optimal sync+async
modifier instead of a more optimal sync-only modifier.

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
Link: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1816
2025-11-06 15:56:07 +01:00
Ville Syrjälä
a345c59673 modesetting: Parse the IN_FORMATS_ASYNC blob
The kernel has gained another format/modifier blob to indicate
which formats/modifiers support async flips since Linux 6.16. Parse it.

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
2025-11-06 15:56:07 +01:00
Ville Syrjälä
a87fb7577e modesetting: Enable universal planes client cap
Enable the universal planes client cap so that we actually
get access to the primary plane's IN_FORMATS blob. We will
now start to parse the blob.

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
2025-11-06 15:56:07 +01:00
Ville Syrjälä
671a8ee04c modesetting: Don't try to use modifiers when allocating the root pixmap
We want the root pixmap to use conservative tiling modifiers in
order to make sure modeset/etc can never fail due to hardware
watermark restictions/etc.

Currenlty this is all dead code anyway because we aren't actually
parsing the IN_FORMATS blob (missing universal plane client cap).
But we want to start parsing that, so let's first make sure we
don't get any behavioural changes from doing so.

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
2025-11-06 15:56:07 +01:00
stefan11111
32f0c01c14 loader: Tell users to give the modesetting DDX a try
if they are using the proprietary nvidia DDX

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-05 17:47:45 +01:00
stefan11111
c7fa008f68 loader: Print instructions about using old nvidia proprietary ddx drivers
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-05 17:47:45 +01:00
Tautvis
16a1be1939 modesetting: call xf86_cursors_fini during CloseScreen
Add matching call for xf86_cursors_init to clean memory, as during
initialization it allocates memory (depends, but is something like ~256Kb)
and it leaks when XServer resets.

Signed-off-by: Tautvis <gtautvis@gmail.com>
2025-11-04 12:12:58 +01:00
stefan11111
0e851b9710 xfree86/loader: Apply unloadsubmodule gentoo patch
See: https://github.com/gentoo/gentoo/blob/master/x11-base/xorg-server/files/xorg-server-1.12-unloadsubmodule.patch
See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686152#14

Verbatim copy of https://github.com/X11Libre/xserver/issues/319#issuecomment-3033729517 ,which gives more context for this patch:

I took a closer look at that patch.
It is logically equivalent to:
```
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 2cdf91fd2..49785fdc8 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -885,6 +885,7 @@ RemoveChild(ModuleDescPtr child)
     parent = child->parent;
     if (parent->child == child) {
         parent->child = child->sib;
+        child->sib = NULL;
         return;
     }
```
RemoveChild is a static function that is only called in UnloadSubModule:
```
void
UnloadSubModule(ModuleDescPtr mod)
{
    /* Some drivers are calling us on built-in submodules, ignore them */
    if (mod == (ModuleDescPtr) 1)
        return;
    RemoveChild(mod);
    UnloadModule(mod);
}
```
Whether or not child->sib is NULL tells UnloadModule if it should recursively unload child->sib or not:
```
    if (mod->child)
        UnloadModule(mod->child);
    if (mod->sib)
        UnloadModule(mod->sib);
    free(mod);
```
Looking at the source, the module loader uses some weird kind of tree-like structure,
where every node has at most one child and one sibling (but then, if foo has child bar, and bar has sibling baz, shouldn't baz also be foo's child?).
```
typedef struct module_desc {
    struct module_desc *child;
    struct module_desc *sib;
    struct module_desc *parent;
    void *handle;
    ModuleSetupProc SetupProc;
    ModuleTearDownProc TearDownProc;
    void *TearDownData;         /* returned from SetupProc */
    const XF86ModuleVersionInfo *VersionInfo;
} ModuleDesc, *ModuleDescPtr;
```

All in all, this patch makes UnloadSubModule to never unload the sibling of the unloaded module, whereas
as it is now, UnloadSubModule would also unload the module's sibling if `child->parent == child->parent->child`
(master child?).

I don't see how this patch changed the behavior on ia64, or any other arch.

@metux Could you tell me what kind of data structure this is, and whether or not this patch is right?

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

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-04 10:53:42 +01:00
stefan11111
585810fb13 modesetting: Handle bo allocation failure
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-03 17:15:14 +01:00
stefan11111
cf4b49ac84 modesetting: Create the largest possible cursor image buffer.
Since https://github.com/X11Libre/xserver/pull/1234 landed,
the user has a way to set the hw cursor size to the size they want.

The fallback probe works around driver bugs by probing very late,
so it initializes the cursor image buffer with the largest size the driver supports.

With this change, the SIZE_HINTS probe will also initialize
the cursor image buffer with the largest size it finds,
which is what @notbabaisyou 's code originally did.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-30 12:34:52 +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
d2fcf85214 ramdac: Don't read/write oob if the cursor size is not aligned to the mask interleave
This doesn't mean the unaligned cursor sizes are recommended now,
just that they will no longer segfault.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-29 13:17:40 +01:00
Enrico Weigelt, metux IT consult
bf8c7d27fe xfree86: compat: re-add GEInitEvent() for proprietary nvidia driver
Yet another very internal function that the proprietary Nvidia driver
is using for unknown reasons. NVidia really needs a separate function
for just for some trivial struct initialization and don't manage to
add three simple lines to their code, so we have to make an extra
function for them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-28 16:26:44 +01:00
Enrico Weigelt, metux IT consult
7ef8400df5 xfree86: compat: re-add TimeCheck() for proprietary nvidia driver
Yet another very internal function that the proprietary Nvidia driver
is using for unknown reasons.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-28 16:26:44 +01:00
stefan11111
011d7bfac3 modesetting: handle some allocation failures
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-27 15:16:12 +01:00
stefan11111
8b8cde2cb2 modesetting: add "CursorSize" option
On certain setups, it might still be useful to force a particular cursor
size via xorg.conf.
For example, if on a system the automatic probes fail, or if the user wants
a particular cursor size, that is higher that the minimum size.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-21 16:12:46 +02:00
stefan11111
cf092cd469 modesetting: probe using the old method if SIZE_HINTS isn't available
On most cards, SIZE_HINTS isn't available.
Without this, most users would have to set the fallback cursor size themselves,
or rely on the 64x64 default.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-21 16:12:46 +02:00
stefan11111
6f7731c44c modesetting: Fix cursor buffer not getting cleared when the pitch changes.
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-21 16:12:46 +02:00
Alan Coopersmith
e446fdc14a xfree86: add missing headers to build sun_init.c on Solaris/SPARC
Fixes: 0f715b4ca4 ("xfree86: os-support: move hidden Solaris-specific symbols out of public header")
Fixes: e2fa0d2ae0 ("fix including <sys/mman.h>")

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2070>

Further explanation about this commit by @alanc:

This particular set of `#ifdefs` matches the ones around the code using the fbio ioctls and mmap calls in the `xf86CloseConsole()` code later in the file:
c62cd2feaa/hw/xfree86/os-support/solaris/sun_init.c (L281)
reflecting the lack of /dev/fb style drivers on x86 systems on Solaris.
2025-10-21 10:25:32 +02:00
Alan Coopersmith
855aa4ef86 xfree86: Fix -Wdiscarded-qualifiers warnings in SPARC Sbus probe code
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2070>
2025-10-21 10:25:32 +02:00
Alan Coopersmith
c179700b99 xfree86: fix meson build on 64-bit Solaris/SPARC systems
For cpu_family(), meson returns "sparc" for 32-bit sparc,
and "sparc64" for 64-bit sparc, regardless of the OS in use.

For cpu(), meson returns values like "sun4v" on Solaris/SPARC,
and doesn't promise stability of the values, or portability across
OS'es, unlike cpu_family().

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2070>
2025-10-21 10:25:32 +02:00
kohnish
166dec4701 Fix missing include and signature mismatch on gentoo linux 2025-10-20 10:25:28 +02:00