Skip to content

New X server: Xmodesetting - #3695

Open
stefan11111 wants to merge 47 commits into
X11Libre:masterfrom
stefan11111:xmodesetting
Open

stefan11111 wants to merge 47 commits into
X11Libre:masterfrom
stefan11111:xmodesetting

Conversation

@stefan11111

Copy link
Copy Markdown
Contributor

Same as #3688 , but with Xmodesetting

As of writing this, Xmodesetting is mostly Xfbdev without dpms, ported from tinycorelinux/tinyx#20

The X server works, and asan seems just as happy as with Xfbdev.

@stefan11111
stefan11111 requested a review from a team September 12, 2026 23:59
@stefan11111
stefan11111 force-pushed the xmodesetting branch 29 times, most recently from bd106b0 to 6aa8bad Compare September 15, 2026 22:24
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Also some cosmetic changes

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Move the gamma-related stuff to a different file

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Mostly intended for testing.

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Progress report

Tested Xmodesetting on intel and nvidia, both with regular and swapped formats,
both with and without `-nogbm`, both with and without glamor.

Depths 30, 24, and 16 work both on intel and nvidia.

Depth 15 also works on nvidia, but the nvidia gbm backend
refuses to allocate a depth 15 bo.
Using the dumb gbm backend, an depth 15 bo can be allocated,
and it works.

Nvidia doesn't support depth 30 with RGB ordering, and depth 16 with BGR ordering.
Xmodesetting properly detects this and swaps the R-B channels.

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Fixes a bug where on the fallback bo map path,
one would have to chang VT away and back to the X server
for the image to appear on screen.

May be useful for implementing page flipping in the future

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
`glamor_setup_formats` chooses `PIXMAN_x2b10g10r10` format for depth 30
pixmaps on gles.

If the front buffer is XBGR2101010 on gles, swap the r-b channels,
like we would with a cpu-mapped buffer.

As I understand it, we should also swap XRGB2101010 r-b channels on gles,
but for some reason not swapping them works.
This needs further investigating.

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
@stefan11111

Copy link
Copy Markdown
Contributor Author

Users can also do -screen 0x0x24/24 if they explicitly want 24 bpp without probing the 32 bpp formats first

The one at the hand (Dragon Q6A ) didn't like explicit -screen 0x0x24/24, I wanted too much. I will try on other SBC's

Could you attach the logs?

@cepelinas9000 ping

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
@DanMit-Dev

DanMit-Dev commented Sep 25, 2026 •

Copy link
Copy Markdown

@stefan11111 wouldn't be better to do modular, separated PR's instead of one PR with 40 commits? just a suggestion for organizational structure; because if the worst happens such as: it passed on the tests, ai-reviewed all, humans revised, but then: it strangely brokens a very specific edge-case on a older architecture it's possible to simply revert the PR and btw it keeps the repo organized. however that's up to @metux, you (the author) and the core maintainers from this project. (specially that in this case it alterates in total 3339 lines of code).

@cepelinas9000

cepelinas9000 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Users can also do -screen 0x0x24/24 if they explicitly want 24 bpp without probing the 32 bpp formats first

The one at the hand (Dragon Q6A ) didn't like explicit -screen 0x0x24/24, I wanted too much. I will try on other SBC's

Could you attach the logs?

@cepelinas9000 ping

Took longer than expected,

There are no log:
There are no logs, Xmodesetting just exits:

root@radxa-dragon-q6a:/usr/local/xlibre# bin/Xmodesetting -retro -screen 0x0x24/24

Fatal server error:
no screens found
Can't deallocate console 2 Device or resource busy
root@radxa-dragon-q6a:/usr/local/xlibre# cat var/log/Xmodesetting.0.log
[2026-09-25 17:19:32] (II) Xmodesetting: X11 server for KMS devices
[2026-09-25 17:19:32] (II) 
[2026-09-25 17:19:32] (II) Xmodesetting: Configured screens info:
[2026-09-25 17:19:32] (II) 
[2026-09-25 17:19:32] (II) Xmodesetting(0): Screen 0:
[2026-09-25 17:19:32] (II) Xmodesetting(0): KMS device: not passed
[2026-09-25 17:19:32] (II) Xmodesetting(0): ShadowFB enabled
[2026-09-25 17:19:32] (II) Xmodesetting(0): Preferred format color ordering RGB
[2026-09-25 17:19:32] (II) KGlamor(0): glvnd library: not passed
[2026-09-25 17:19:32] (II) KGlamor(0): dri device: not passed
[2026-09-25 17:19:32] (II) KGlamor(0): glamor OpenGL contexts allowed
[2026-09-25 17:19:32] (II) KGlamor(0): glamor GLES contexts allowed
[2026-09-25 17:19:32] (II) KGlamor(0): glamor render acceleration enabled
[2026-09-25 17:19:32] (II) KGlamor(0): glamor render acceleration forbidden on software renderers
[2026-09-25 17:19:32] (II) KGlamor(0): glamor is allowed to use libgbm 
[2026-09-25 17:19:32] (II) KGlamor(0): glamor X-Video support enabled
[2026-09-25 17:19:32] (II) 
[2026-09-25 17:19:32] (II) Xmodesetting(card 0): Using kms device: /dev/dri/card1
[2026-09-25 17:19:32] 
Fatal server error:
[2026-09-25 17:19:32]  no screens found

The reason is fbSetupScreen required power of two bpp:

if (Ones(bpp) != 1)

gdb trace

(gdb) bt
#0  fbFinishScreenInit (pScreen=0xaaaaaaedb830, pbits=0x0, xsize=1920, ysize=1080, dpix=75, dpiy=75, width=1962, bpp=24)
    at ../fb/fbscreen.c:172
#1  0x0000aaaaaaad2cc8 in KdScreenInit (pScreen=0xaaaaaaedb830, argc=4, argv=0xfffffffff368, closure=0xaaaaaae26f00)
    at ../hw/kdrive/src/kdrive.c:915
#2  0x0000aaaaaab879e4 in AddScreen (pfnInit=0xaaaaaaad2a30 <KdScreenInit>, argc=4, argv=0xfffffffff368, closure=0xaaaaaae26f00)
    at ../dix/dispatch.c:4021
#3  0x0000aaaaaaad358c in KdAddScreen (screen=0xaaaaaae26f00, argc=4, argv=0xfffffffff368) at ../hw/kdrive/src/kdrive.c:1101
#4  0x0000aaaaaaad3718 in KdInitOutput (argc=4, argv=0xfffffffff368) at ../hw/kdrive/src/kdrive.c:1170
#5  0x0000aaaaaaacc270 in InitOutput (argc=4, argv=0xfffffffff368) at ../hw/kdrive/modesetting/msinit.c:229
#6  0x0000aaaaaab8eb54 in dix_main (argc=4, argv=0xfffffffff368, envp=0xfffffffff390) at ../dix/main.c:193
#7  0x0000aaaaaaad064c in main (argc=4, argv=0xfffffffff368, envp=0xfffffffff390) at ../dix/stubmain.c:34

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Not doing anything with them yet.
In preparation for further work

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Same reason as xf86 modesetting

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Some issues accumulated when tiled buffers and modifiers were implemented

Rotations don't yet work with tiled buffers

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
@stefan11111

Copy link
Copy Markdown
Contributor Author

@cepelinas9000 Pushed a commit that might help with 24 bpp, not sure how well it works.

You probably need to use the dumb gbm backend with this.
Maybe even to disable glamor with -dumb

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
…e it

Simplifies things a bit

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
This makes things way simpler

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Leave smaller depth alone, the bitsPerRGB value
gets reported correctly for them

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Use the mi/kdrive sw cursor functions for now

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants