Commit Graph

22359 Commits

Author SHA1 Message Date
squishypinkelephant
80112b61ba split KdInitInput for Xephyr 2026-01-08 10:32:42 +01:00
Enrico Weigelt, metux IT consult
afc8ec2475 xfree86: add macros for declaring XF86ModuleData fields
XF86_MODULE_DATA_INPUT() creates XF86ModuleData field for input driver,
while XF86_MODULE_DATA_VIDEO creating one for a video driver.

These are filled with given values, _X_EXPORT'ed and properly named so
the module loader can find them. Also creating the associated
XF86ModuleVersionInfo field and link them into the XF86ModuleData.

Example:

    XF86_MODULE_DATA_INPUT(
        egalax,
        eGalaxPlug,
        eGalaxUnplug,
        "egalax",
        PACKAGE_VERSION_MAJOR,
        PACKAGE_VERSION_MINOR,
        PACKAGE_VERSION_PATCHLEVEL);

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-07 20:33:28 +01:00
Enrico Weigelt, metux IT consult
e561e3212b xfree86: xf86Module.h: macro for declaring video driver module version
Reduce the effort of declaring/filling an video driver's module version
struct to short statement like this:

    XF86_MODULE_VERSION_VIDEO("ati",
                              PACKAGE_VERSION_MAJOR,
                              PACKAGE_VERSION_MINOR,
                              PACKAGE_VERSION_PATCHLEVEL);

This will create a properly filled XF86ModuleVersionInfo structure
named `modInfo`.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-07 20:09:39 +01:00
Enrico Weigelt, metux IT consult
a56a08e713 xfree86: xf86Module.h: macro for declaring input driver module version
Reduce the effort of declaring/filling an input driver's module version
struct to short statement like this:

    XF86_MODULE_VERSION_INPUT("egalax",
                              PACKAGE_VERSION_MAJOR,
                              PACKAGE_VERSION_MINOR,
                              PACKAGE_VERSION_PATCHLEVEL);

This will create a properly filled XF86ModuleVersionInfo structure
named `modInfo`.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-07 19:51:48 +01:00
Enrico Weigelt, metux IT consult
3adf207be1 dix: tiny cleanup in CrushTree()
Make it a little bit easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-07 19:18:54 +01:00
stefan11111
dc55d361d8 glamor/glamor_egl.c: Report skipping all modifiers as failure
If `glamor_get_modifiers` returns no modifiers, but succeeds, it means
that modifiers are implicit and chosen by the driver
(e.g. when allocating gbm buffers)

If we strip all modifiers however, it means that from the list
of modifiers we queried, we can use none.
This means that it would be an error to, for example,
create a gbm bo, create an image from it and try to
render into it.

We should treat this case as a failure.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 13:48:39 +01:00
stefan11111
d92a55c286 kdrive/src: Implement special key handling
This is needed for Ctrl + Alt + F* vt switching
and Ctrl + Alt + Backspace server terminate.

We could implement other special keys too, it we want to.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 13:48:15 +01:00
stefan11111
01b91b7f60 kdrive/linux: Add special key handler proc
We're only interested in vt switching here.
Ctrl + Alt + Backspace server terminate will be handled by it's caller.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 13:48:15 +01:00
stefan11111
2f3d22ef1e kdrive/linux: Fix keyboard flushing
The old method will break with vt switching

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 13:48:15 +01:00
stefan11111
489ba91f4b kdrive/linux: Use OsSignal to set SIGUSR1 handler
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 13:48:15 +01:00
stefan11111
e2c99a2e93 glamor/glamor_egl.c: Fix misplaced #endif
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 11:05:30 +01:00
stefan11111
8ed09861dc present: Call driver check_flip after we finish with our checks
We don't really gain anything by calling `check_flip` early,
but it turns out that doing so causes problems.

Thanks to @jipok for finding this issue:
```
// gcc crash_x11libre.c -o crash_x11libre -lX11 -lXext  -lXpresent
// Code written by LLM!

// WARNING: THIS PROGRAM IS INTENDED TO CRASH THE X SERVER (via XPresent + Glamor bug)

void attempt_crash_via_present(Display* dpy, Window win, int width, int height, int depth) {
    XShmSegmentInfo shminfo;

    // 1. Calculate TIGHT stride (width * 4 bytes).
    // Misalignment here + XPresent is the killer combination.
    int stride = width * 4;
    size_t size = stride * height;

    // 2. Resize the window to match the buffer (simulating JTK resize behavior)
    XResizeWindow(dpy, win, width, height);
    // XSync(dpy, False); // Optional: let window manager catch up, but hammering triggers races better

    // 3. Allocate Shared Memory
    memset(&shminfo, 0, sizeof(shminfo));
    shminfo.shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
    if (shminfo.shmid < 0) { perror("shmget"); return; }
    shminfo.shmaddr = (char*)shmat(shminfo.shmid, 0, 0);
    shminfo.readOnly = False;
    shmctl(shminfo.shmid, IPC_RMID, 0); // Auto-cleanup

    if (!XShmAttach(dpy, &shminfo)) {
        fprintf(stderr, "XShmAttach failed\n");
        shmdt(shminfo.shmaddr);
        return;
    }

    // 4. Create the Misaligned Pixmap
    Pixmap pixmap = XShmCreatePixmap(dpy, win, shminfo.shmaddr, &shminfo, width, height, depth);

    // 5. THE TRIGGER: XPresentPixmap
    // This forces Glamor to treat the SHM segment as a presentable surface.
    // If strided alignment logic inside miCopyRegion/glamor is broken, this dies.
    XPresentPixmap(dpy, win, pixmap, 0, 0, 0, 0, 0, None, None, None, 0, 0, 0, 0, 0, 0);

    // Flush to make sure the server received the command
    XSync(dpy, False);

    // Cleanup for next iteration
    XFreePixmap(dpy, pixmap);
    XShmDetach(dpy, &shminfo);
    shmdt(shminfo.shmaddr);
}

int main() {
    Display* dpy = XOpenDisplay(NULL);
    if (!dpy) { fprintf(stderr, "No display\n"); return 1; }

    // Check extensions
    int major, minor, pixmaps;
    if (!XShmQueryVersion(dpy, &major, &minor, &pixmaps) || !pixmaps) {
        fprintf(stderr, "XShm not supported!\n"); return 1;
    }

    int present_opcode, event_base, error_base;
    if (!XQueryExtension(dpy, "Present", &present_opcode, &event_base, &error_base)) {
        fprintf(stderr, "XPresent extension not supported! (Can't repro bug)\n");
        return 1;
    }

    int screen = DefaultScreen(dpy);
    XVisualInfo vinfo;
    if (!XMatchVisualInfo(dpy, screen, 32, TrueColor, &vinfo)) {
        printf("32-bit visual not found, using default.\n");
        vinfo.visual = DefaultVisual(dpy, screen);
        vinfo.depth = DefaultDepth(dpy, screen);
    }

    XSetWindowAttributes attrs;
    attrs.colormap = XCreateColormap(dpy, RootWindow(dpy, screen), vinfo.visual, AllocNone);
    attrs.background_pixel = 0; // Black
    attrs.border_pixel = 0;

    Window win = XCreateWindow(dpy, RootWindow(dpy, screen),
                               0, 0, 100, 100, 0,
                               vinfo.depth, InputOutput, vinfo.visual,
                               CWColormap | CWBackPixel | CWBorderPixel, &attrs);

    XMapWindow(dpy, win);
    XSync(dpy, False);

    printf("Starting XPresent Stress Test...\n");
    sleep(1);

    // Fixed height (enough to have data), varying width
    int height = 500;

    // Iterate widths. We expect crashes on non-standard alignments.
    // XLibre often crashes at 1266 width (stride 5064).
    for (int w = 1000; w < 2000; w++) {
        int stride = w * 4;

        printf("\rTesting Width: %4d | Stride: %5d (mod 64: %2d)", w, stride, stride % 64);
        fflush(stdout);

        attempt_crash_via_present(dpy, win, w, height, vinfo.depth);

        // Small delay to let the server actually try to process the Present request
        // before we trash the memory, though XSync should handle it.
        usleep(1000);
    }

    printf("\nTest finished successfully (No crash).\n");

    XDestroyWindow(dpy, win);
    XCloseDisplay(dpy);
    return 0;
}
```

Fixes: https://github.com/X11Libre/xserver/issues/1754
Fixes: 9108a2bf55

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 11:01:37 +01:00
stefan11111
0d93b942ad kdrive/src: Remove all SIGIO code from kdrive
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 10:59:39 +01:00
stefan11111
fb16cef942 kdrive/src: Use threaded input in KdReleaseAllKeys
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 10:59:39 +01:00
stefan11111
77f15917d4 kdrive/linux: Fix typo in keyboard.c
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 10:59:39 +01:00
stefan11111
9afc6b1345 kdrive/src: revert c85ef2a6b5
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 10:59:39 +01:00
stefan11111
7a50b1dc3d kdrive/src: revert fd2483745b
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 10:59:39 +01:00
Enrico Weigelt, metux IT consult
885ba96ff6 os: xtrans: drop some unused defines
The TRANS_LOCAL_*_INDEX defines aren't used anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-07 10:56:57 +01:00
b-aaz
d2dcac6eca Revert "xkb: unexport XkbGetCoreMap() and XkbSetRepeatKeys()"
This reverts commit 25d99353ee.
These symbols are required by the xorgxrdp driver.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
2026-01-07 10:56:33 +01:00
stefan11111
65d4e5e081 Xext/dri2: Fix message logging
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-06 19:23:34 +01:00
Enrico Weigelt, metux IT consult
1189bbdb40 xfree86: little documentation on XF86ModuleData
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-05 16:12:05 +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
stefan11111
186e269a9d glamor/glamor_egl.c: Skip modifiers that do not result in images
that can be rendered to

According to https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt ,
there is an interface that allows us to detect if a given format modifier is supported.

For example, nvidia uses this to report that pitch-linear images can't be
rendered to.

Since we are only interested in formats that we can actually render to,
we should strip these formats from the modifier list.

See:
https://github.com/elFarto/nvidia-vaapi-driver/issues/15#issuecomment-1015827050
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1444#note_2450902

v2: Faster and simpler filter thanks to @algrid

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-05 14:18:08 +01:00
Enrico Weigelt, metux IT consult
6890d547f2 dri: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-05 14:16:31 +01:00
stefan11111
dc39eda42b treewide: Move the dri2 extension to Xext and use it for all X servers
This is needed to get proton working in Xfbdev, but is probably useful in other places too.

Xephyr has some unrelated issues regaring Xinput, so steam doesn't work there.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-02 17:51:43 +01:00
Alan Coopersmith
2a41522349 os: make FormatInt64() handle LONG_MIN correctly
When compiling with gcc 15.2.0 using -O3 -m64 on Solaris SPARC & x64,
we'd get a test failure of:

Assertion failed: strcmp(logmsg, expected) == 0,
 file ../test/signal-logging.c, line 339, function logging_format

because 'num *= -1' produced a value that was out of the range of the
int64_t it was being stored in.  (Compiling with -O2 worked fine with
the same compiler/configuration/platform though.)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2117>
2026-01-01 13:23:22 +01:00
Oleh Nykyforchyn
3a367c5a47 xfree86/common: omit unnecessary search for matching devices
It is patch 3/3 of a series that makes adding GPU screens
more controllable.

If AutoAddGPU is "off", matching devices for autoconfigured
drivers are sought for anyway, and then the unused list is
freed. This patch cancels an unnecessary search.

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
2026-01-01 13:23:22 +01:00
Oleh Nykyforchyn
1dea31ce5c xfree86/man: add SingleDriver server flag to man page
It is patch 2/3 of a series that makes adding GPU screens
more controllable.

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
2026-01-01 13:23:22 +01:00
Oleh Nykyforchyn
c79f376594 xfree86/common: introduce SingleDriver server flag
It is patch 1/3 of a series that makes adding GPU screens
more controllable.

If SingleDriver option is set to "on", then only the first
successfully probed driver adds non-GPU screens, others
may add secondary GPU screens only.

Fixes github.com/X11Libre/xserver/issues/1669

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
2026-01-01 13:23:22 +01:00
stefan11111
8cb69cd810 modesetting: clear bo in drmmode_create_front_bo
Fixes: https://github.com/X11Libre/xserver/issues/1740

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
05fe0b519f Xext: selinux: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
8ff401cde1 Xext: xres: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
0616d9b325 composite: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
a0cd40d5af Xext: xvmc: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
d5e3eaeba2 xfixes: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
f3b783ec3d dri3: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Aggelos Tselios
4bf912f92b hw: xfree86: seatd: remove unnecessary semicolons
Functions don't need to be terminated by semicolons, so this only
generates warnings.

Signed-off-by: Aggelos Tselios <aggelostselios777@gmail.com>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
095ea152b4 xfree86: dri2: use rpcbuf and sender macros
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
callmetango
db9b427f3e .github: 01-bug-report: add version 25.1.X
Signed-off-by: callmetango <callmetango@users.noreply.github.com>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
f122e2bb86 Xext: shm: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
dcb9329b37 Xext: saver: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
2a6b886563 Xext: dpms: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
polaris
7b72ce3a23 Only call xf86platformVTProbe() when defined
Signed-off-by: 9olaris <251053665+9olaris@users.noreply.github.com>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
86a0ae295a .github: move signed-off check into main xserver build workflow
Reduce the number of total workflows, so the list isn't so crowded.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: artist <artist@artixlinux.org>
2025-12-22 23:16:14 +01:00
Enrico Weigelt, metux IT consult
32050edf76 .github: cygwin: skip setup signature check
Cygwin currently has some mirror problem: it's missing the signature file
for the setup program, thus our build job is failing.

https://github.com/cygwin/cygwin-install-action/issues/39

Temporary workaround: just skip the signature check.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-22 13:34:44 +01:00
Enrico Weigelt, metux IT consult
2ada6f5178 .github: downgrade vmactions/dragonflybsd-vm to 1.1.4
Latest vmactions/dragonflybsd-vm release (1.1.4) broke several things,
eg. not chdir'ing into the working tree.

For the time being, it's better to go back to 1.1.4.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-22 13:20:28 +01:00
Enrico Weigelt, metux IT consult
32210c1990 .github: downgrade vmactions/netbsd-vm to 1.2.3
Latest vmactions/netbsd-vm release (1.2.4) broke several things,
eg. not chdir'ing into the working tree and NetBSD became *extremely*
slow (5mins job now slowed down to hours).

For the time being, it's better to just go back to 1.2.3.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-22 13:17:45 +01:00
Enrico Weigelt, metux IT consult
306e4a8a3f release 25.1
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
xlibre-xserver-25.1.0
2025-12-21 15:53:30 +01:00
b-aaz
b4f0ee1b59 Added Cygwin builds to CI.
Bringing back Cygwin support!
This will add Cygwin builds on windows-latest in our CI.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
2025-12-21 12:59:03 +01:00
b-aaz
8368df64d1 Xext: xf86bigfont: Include osdep.h for OsSignal.
osdep.h holds the definition for OsSignal, and it was not included in
xf86bigfont which used it. This lead to build errors on Cygwin.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
2025-12-21 12:59:03 +01:00