#xrender

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2025-06-08

@bamboombibbitybop @lfa it tells me it's a project I wouldn't want to join. I still wouldn't mind to see anything technically good come out of it, although I don't expect that. It would be great to see some general progress. The #Xrender / #Glamor bug I reported quite a while ago was confirmed very quickly and then nothing else happened... 😞

Oh please someone keep #X11 alive. Sure, preferably not the "make X great again" way 🙈

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2025-03-31

@thomasadam @peppe Thanks for that! I totally forgot about the decorations topic, which is of course very relevant, it means even jumping through the hoop and implementing a #wayland compositor, you can only deliver part of the functionality (and almost none of the looks) of your window manager.

But even with that issue solved, I would really dislike wayland's design. Although I *do* think that most of #X11 core drawing is obsolete and useless (mostly for the missing alpha channel), I think a display server should offer drawing facilities. Replace X with something dropping lots of cruft (indexed palettes, COMPOUND_TEXT, etc), instead incorporate extensions that everyone needs these days, extend #XRender (now as part of core) to offer more drawing primitives, etc ... you could have a replacement for X11 that's worth dealing with. And window managers could still be separate clients.

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2025-03-27

@peppe To be clear about that, I don't question the fact that #X11 is full of old cruft that's mostly useless nowadays. It became more than clear to me while implementing my #xmoji tool, which uses almost exclusively #XRender requests for rendering (an *extension* to X11, not part of the core protocol), because X core drawing requests are really designed for 1990es hardware, supporting color palettes with limited entries, but no alpha channel whatsoever. Similar goes for font support in the X11 core protocol, it's useless supporting only bitmap fonts with no antialiasing etc, so I use client-side rasterizing (with freetype) and XRender only for compositing the result. There are more silly examples, like the "Compound Text" encoding monstrosity, because the core design predates Unicode, and so on....

In a nutshell, a major rework of what the X core protocol supports would be necessary.

But then, you can *still* dislike a suggested solution. I think #wayland is taking the "simplicity" much too far, so now both compositors and clients (rendering windows) have to do the same stuff over and over again. It's a pointless exercise trying to create a wayland client without huge libraries (such as e.g. cairo for client-side rendering, better yet use a full-blown toolkit like Qt or GTK that already makes use of cairo), while this is perfectly possible for X.

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2025-03-26

Ok, first reaction (confirming my suspicion that #glamor causes the bug) was super quick, I'm impressed! Let's see whether anyone jumps in soon to actually analyze the root cause. 😎

JFTR, it's the bug I already probe for in #xmoji to enable a silly workaround when necessary, applying a transformation to the source picture.

#X11 #Xorg #XRender #development

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2025-03-14

Well, I really like #X11 (#Xorg) ... and my son loves #PeppaPig. Which gives me a stupid idea. I could write something called #Xchicken. Make some chicken lay some eggs with mouse clicks on some #XRender surface.

Rough roadmap:
- Draw some chicken and eggs, probably as SVG?
- Reuse code from #Xmoji, add special widget supporting some "layered canvas"
- Implement game logic
- Add sound? (Hm, gotta look into #OSS and maybe #sndio, cause #FreeBSD ... #Linux weirdness maybe later)
- ....?

I'll probably never start though 🙈

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2025-03-07

I want to finally resume work on #Xmoji. Starting with a bit of house-keeping, I factored out a function probing for a weird #XRender (presumably only with #glamor) bug, so it doesn't distract from the normal X client startup, and took the opportunity to also document it:

github.com/Zirias/xmoji/blob/7

If anything is really wrong with #X11 or #XOrg, it's bugs like this 😔 ...

zirias (on snac)zirias@snac.bsd.cafe
2024-10-12
A major blocker could be that it relies on my "poser" project: https://github.com/Zirias/poser ... it's a small lib, so you could certainly integrate the parts needed, but I didn't do it, I just made #Xmoji build with a bundled (statically linked) #poser by default instead. Another blocker could be that it does quite some trickery to force #xcb into an #async model with #events and registered event-handlers (provided by poser), so it integrates well with a generic event loop built on #select (which poser does, anything else based on file descriptors like #poll, #epoll, #kqueue would work as well). It abuses xcb functions meant for tracing/debugging for that purpose. 🙈

And then, of course, it's very different from #Xt. It strictly requires #XRender, using its "picture" objects as the primary drawing handle, and just offering the core X11 "drawable" on demand. It strictly requires a "true color" visual. It has NO support whatsoever for core drawing primitives and core (bitmap) fonts. It doesn't create a window for every widget but instead manages widgets fully client-side ... all these are probably not "blockers" but just how you'd design a GUI toolkit for X11 nowadays 😉
zirias (on snac)zirias@snac.bsd.cafe
2024-10-12
Haha, well, I'd stick to putting "#toolkit" in quotes only. For once, it's entirely non-portable to anything other than #X11 (with #XRender) via #xcb (like e.g. #wayland or #GDI) ... xcb types/interfaces are hardwired practically everywhere. And then, although it might be possible to extend it to some "generic" toolkit specifically for that platform, I have no plans doing so. I strictly only implemented what was necessary for #Xmoji's GUI. 😉
zirias (on snac)zirias@snac.bsd.cafe
2024-10-02
You might have noticed development of #Xmoji slowed down a bit. My time is currently very limited, but another reason is slowly closing in on a version 1.0, and I want to give it some time for proper testing.

I need your help, please! 😁

Xmoji 0.8 introduced an important part for #i18n, translations. But I'm not exactly fluent in many languages. Please, if you can, help me translate! The process is documented in https://github.com/Zirias/xmoji/blob/master/TRANSLATE.md . If there are any issues with these instructions, please let me know.

Xmoji aims to be the "best" tool to input emojis with "pure" X11:

  • Written in plain #C, with minimal dependencies
  • Uses #Xrender for its UI, communicates with the X server using #xcb
  • Offers two methods for input: Faked keyboard events or the "primary selection"
  • Has a search tab and a list of recently used emojis
  • Customizable appearance using X resources
  • Several options to configure key injection and the search method

Roadmap to V1.0:

  • Optional single-instance mode
  • Optional tray icon

#X11 #emoji #keyboard
Xmoji's about dialog shown in german locale
Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-09-30

@krausedw I wonder whether I should try to create a "toolkit" (that would ONLY work with #X11 and #Xrender) out of the small collection of "widgets" I created in #C / #xcb for #Xmoji, just to publish more stuff intentionally incompatible with #Wayland... 😏

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-08-11

@0x1eef That's unrelated, it's about a glitch actually rendering the glyphs with #XRender compositing, there's a bug getting source coordinates wrong, and I *assume* it's triggered by the "glamor" acceleration, the message just says the buggy behavior was detected and a workaround enabled.

Did you shorten that log? I also added debug messages from TextRenderer showing the effective harfbuzz properties. If you don't see them at all, that would certainly indicate a problem, but in a different place 🧐

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-08-08

I just added code to #Xmoji applying #hinting settings from #fontconfig. I had an immediate reason... 🤔

Rasterizing my glyphs with #freetype (for rendering with #XRender), kerning breaks horribly for Microsoft fonts using the "native" truetype hinting. Forcing freetype's autohinter instead, it's (almost) fine (but hinting itself might be slightly lower quality).

Am I doing something wrong, or what the ... is the problem here? Example screenshots using "Segoe UI".

#X11 #programming

A Microsoft font rendered with freetype using native truetype hintingFontconfig configuration file to enable autohinting on all Microsoft fontsThe same Microsoft font rendered with freetype using the auto-hinter
Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-08-04

@samurro @governa KISS, like any principle, needs context to apply: What is "it" here? There's a set of requirements for a "desktop environment", which is very complex. One way to achieve KISS for something like that is a good break-down into "simple" modules. #Wayland set itself a very limited scope (more or less just compositing), so sure, that's a good start.

Looking at the whole system built around that, I have doubts that's really #KISS. We'll need input handling ( -> libinput, xkb), inter-client communication ( -> dbus), client rendering ( -> cairo et al), to name just a few obvious ones.

#X11 already has these aspects integrated. They're still organized into modules. Having all the aspects (almost) every "desktop app" needs available in the one server process has the potential to reduce overall complexity.

I know that's not where we are with "modern desktops" running on #X11. That's because X11 is full of "old cruft" not matching today's requirements (like its core drawing/input/fonts etc), while development of modern replacements (like #XRender) stalled ... at least partially because developers were drawn towards #Wayland instead. That still doesn't convince me Wayland is the better concept. 🤷

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-08-01

Finally removed the nasty "glitches" setting from #Xmoji!

After lots of (unsuccessful) research whether I can somehow check which modules(!) are loaded on the X server (to find out whether #GLAMOR is used, which I *think* causes a bug in compositing glyphs with #XRender) ... I finally remembered an old strategy which is both horribly ugly and pretty reliable: probing!

I now do a dummy glyph compositing to a single-pixel off-screen pixmap during startup and fetch the resulting pixmap from the server, so I can simply *see* whether the result is buggy. 🙈

github.com/Zirias/xmoji/commit

I actually wonder why I didn't have that idea much earlier. E.g. coding on the #C64, probing the hardware (e.g. to identify VIC and SID model by their behavior) is a pretty common thing to do 🥸

#X11 #emoji #keyboard #xcb #programming

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-07-31

I guess I "fixed" it now, this looks pretty obvious, right? 😎

Using triangles to render an X is really a "fun" exercise btw 🤯

#Xmoji #X11 #xcb #xrender #programming

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-07-31

Working on #Xmoji, I currently just try to add a little convenience feature: Give the text box a "clear button".

For rendering that with #XRender, I used the TriStrip request for a series of 3 triangles. So far, so good, but any other angle than 45 degrees results in very ugly aliasing artifacts unless I enable imprecise/smooth polygon rendering. Unfortunately this is unacceptable because in imprecise mode, the edges between the 3 triangles suddenly become visible as well. 🤯

So, going with 45 degree edges only now. You tell me whether this looks like a "clear button" to you? Thanks! 😅

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-07-31

Tricky question about #X11 (with #xcb) #programming:

Is there a way to determine from an X client whether the X server uses #glamor acceleration?

Background, I experienced a rendering bug compositing #glyphs with #XRender where the source coordinates don't work as expected. I found a workaround (that of course breaks when the bug is *not* present): Apply a transformation to the source picture.

I now suspect it's glamor introducing this bug, independent from the actual GPU driver. So it would be awesome if I could automatically enable the workaround when needed. I guess it's not possible though, but hey, I can ask 😎

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-07-29

@matuzalem Thanks for hunting this down! I'm already not to happy that I *did* need to implement a glitch mode for some hardware-accelerated #XRender at all, but at least it isn't a new glitch then (but the very same as on my old radeon GPU with glamor)! 👍

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-07-29

@matuzalem Well, maybe you could install xephyr (pkg install xephyr) to double-check this is indeed some glitch with "accelerated" #XRender? (in Xephyr, it will use software rendering....)

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-07-29

@matuzalem Unfortunately I don't know. The misaligned emojis look the same as on my machine without the 'glitches' setting, but then, enabling it solves it here, obviously not for you. And I have no idea what could cause the black background color.

You *could* try running with '-glitches 1 -backingStore 0' which is just a shot in the dark in case it's the compositing from off-screen pixmaps going wrong here.

I really like the concept of #XRender, but it seems it's quite a bit buggy in practice. The Qt version probably does full client-side rendering, so isn't affected....

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst