10-bit color crashes #651

Closed
opened 4 weeks ago by toastal · 14 comments

8-bit color is the default, but it's normal for consumer displays to support 10-bit color. DefaultDepth 30 in the screen section of Xorg config, crashes the bar.

$ xmobar
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  139 (RENDER)
  Minor opcode of failed request:  4 (RenderCreatePicture)
  Serial number of failed request:  282
  Current serial number in output stream:  288
8-bit color is the default, but it's normal for consumer displays to support 10-bit color. `DefaultDepth 30` in the screen section of Xorg config, crashes the bar. ```shell-session $ xmobar X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 139 (RENDER) Minor opcode of failed request: 4 (RenderCreatePicture) Serial number of failed request: 282 Current serial number in output stream: 288 ```
Owner

@toastal i haven't yet tried, but i confess i didn't even know 30 was a possibility there. i use xmobar with depth 32 without problems, and thought only 24 and 32 were possible. does it work for you with any of those two values? are you using any bitmaps or pixmaps in your configuration?

@toastal i haven't yet tried, but i confess i didn't even know 30 was a possibility there. i use xmobar with depth 32 without problems, and thought only 24 and 32 were possible. does it work for you with any of those two values? are you using any bitmaps or pixmaps in your configuration?
Poster

I'll admit I'm a bit out of my depth when it comes to graphics, so I'm not entirely sure.

I was following the Arch Wiki Guide and verified that my GPU supports 10-bit color. I wanted to try it out to reduce banding--especially when doing photography work.

https://wiki.archlinux.org/title/AMDGPU#10-bit_color

I'll admit I'm a bit out of my depth when it comes to graphics, so I'm not entirely sure. I was following the Arch Wiki Guide and verified that my GPU supports 10-bit color. I wanted to try it out to reduce banding--especially when doing photography work. https://wiki.archlinux.org/title/AMDGPU#10-bit_color
Poster
Gentoo's docs: https://wiki.gentoo.org/wiki/30bpp
Owner

i see... from the looks of it, the crash might be caused by one of the low-level libraries that we indirectly use (cairo/pango, x11 and its deps), but that's quite complicated to debug. unfortunately, i don't have that hardware and cannot try myself, but perhaps someone else will chime in.

i see... from the looks of it, the crash might be caused by one of the low-level libraries that we indirectly use (cairo/pango, x11 and its deps), but that's quite complicated to debug. unfortunately, i don't have that hardware and cannot try myself, but perhaps someone else will chime in.
Poster

Dang, I was hoping that wasn't the case. My graphic stack knowledge is nil, my Haskell skills novice, but since there's a Flake, there's a possibility I could try to take a peek and the errors.

Dang, I was hoping that wasn't the case. My graphic stack knowledge is nil, my Haskell skills novice, but since there's a Flake, there's a possibility I could try to take a peek and the errors.
Poster

Disclaimer: I know very little about Graphics, Haskell, or C

Given the error with RenderCreatePicture (xRenderCreatePicture in what appears to be FFI and used in withRenderPicture), I think I learned some things.

This project line

Xrender.hsc

    format <- xRenderFindStandardFormat d 1 -- PictStandardRGB24

and these parts of the Xlib stuff

Xrender.h

/** 8-bit RGB. @hideinitializer */
#define PictStandardRGB24 1

Xrender.c

/* PictStandardRGB24 */
	{
	    {
		0,			    /* id */
		PictTypeDirect,		    /* type */
		24,			    /* depth */
		{			    /* direct */
		    16,			    /* direct.red */
		    0xff,		    /* direct.redMask */
		    8,			    /* direct.green */
		    0xff,		    /* direct.greenMask */
		    0,			    /* direct.blue */
		    0xff,		    /* direct.blueMask */
		    0,			    /* direct.alpha */
		    0x00,		    /* direct.alphaMask */
		},
		0,			    /* colormap */
	    },
	    PictFormatType |
	    PictFormatDepth |
	    PictFormatRed |
	    PictFormatRedMask |
	    PictFormatGreen |
	    PictFormatGreenMask |
	    PictFormatBlue |
	    PictFormatBlueMask |
	    PictFormatAlphaMask,
	},

There's also CAIRO_FORMAT_RGB30 as FormatRGB30 in gtk2hs + Cairo.

I'm clued to believe there needs to be a 10-bit RGB option not present. The reading I've done, it seem many projects use OpenGL to render 10-bit-per-channel color. I have no idea if this is patchable or the math could be done in Haskell with a 30Depth = true flag or anything like this, but I figured it could be useful for someone with more skill to look at into this. Since it's out of my skillset, I may unfortunately be pushed to use a different status bar.

I've looked around and it seems 10-bit color is mainstreaming. I've seen it on a lot of monitors and phone screens as well.

Disclaimer: I know very little about Graphics, Haskell, *or* C Given the error with `RenderCreatePicture` (`xRenderCreatePicture` in what appears to be FFI and used in `withRenderPicture`), I think I learned some things. This project line Xrender.hsc ```haskell format <- xRenderFindStandardFormat d 1 -- PictStandardRGB24 ``` and these parts of the Xlib stuff Xrender.h ```c /** 8-bit RGB. @hideinitializer */ #define PictStandardRGB24 1 ``` Xrender.c ```c /* PictStandardRGB24 */ { { 0, /* id */ PictTypeDirect, /* type */ 24, /* depth */ { /* direct */ 16, /* direct.red */ 0xff, /* direct.redMask */ 8, /* direct.green */ 0xff, /* direct.greenMask */ 0, /* direct.blue */ 0xff, /* direct.blueMask */ 0, /* direct.alpha */ 0x00, /* direct.alphaMask */ }, 0, /* colormap */ }, PictFormatType | PictFormatDepth | PictFormatRed | PictFormatRedMask | PictFormatGreen | PictFormatGreenMask | PictFormatBlue | PictFormatBlueMask | PictFormatAlphaMask, }, ``` There's also `CAIRO_FORMAT_RGB30 as FormatRGB30` in `gtk2hs` + Cairo. I'm clued to believe there needs to be a 10-bit RGB option not present. The reading I've done, it seem many projects use OpenGL to render 10-bit-per-channel color. I have no idea if this is patchable or the math could be done in Haskell with a `30Depth = true` flag or anything like this, but I figured it could be useful for someone with more skill to look at into this. Since it's out of my skillset, I may unfortunately be pushed to use a different status bar. I've looked around and it seems 10-bit color is mainstreaming. I've seen it on a lot of monitors and phone screens as well.
Owner

@toastal do you use a transparent background? if you don't, you don' need to use the Xrender at all, just compile xmobar with something like

 cabal build -fall_extensions -f-with_xrender

and, i think, things should work fine for you...

@toastal do you use a transparent background? if you don't, you don' need to use the Xrender at all, just compile xmobar with something like cabal build -fall_extensions -f-with_xrender and, i think, things should work fine for you...
Owner

(the transparency is fake anyway :))

(the transparency is fake anyway :))
Poster

Looks like NixOS doesn't build with_xrender by default


"-fwith_alsa" "-fwith_conduit" "-fwith_datezone" "-fwith_dbus"
"-fwith_inotify" "-fwith_iwlib" "-fwith_mpd" "-fwith_mpris"
"-fwith_rtsopts" "-fwith_threaded" "-fwith_utf8" "-fwith_uvmeter"
"-fwith_weather" "-fwith_xft" "-fwith_xpm"
Looks like NixOS doesn't build `with_xrender` by default ``` "-fwith_alsa" "-fwith_conduit" "-fwith_datezone" "-fwith_dbus" "-fwith_inotify" "-fwith_iwlib" "-fwith_mpd" "-fwith_mpris" "-fwith_rtsopts" "-fwith_threaded" "-fwith_utf8" "-fwith_uvmeter" "-fwith_weather" "-fwith_xft" "-fwith_xpm" ```
Poster

Ah, the negative flag is still needed.

Ah, the negative flag is still needed.
Poster
Patched it in my NixOS config: https://git.sr.ht/~toastal/nixcfg/tree/trunk/item/service/window-manager/xmonad/default.nix
Owner

Patched it in my NixOS config: https://git.sr.ht/~toastal/nixcfg/tree/trunk/item/service/window-manager/xmonad/default.nix

and does it work now with 10bit?

> Patched it in my NixOS config: https://git.sr.ht/~toastal/nixcfg/tree/trunk/item/service/window-manager/xmonad/default.nix and does it work now with 10bit?
Poster

and does it work now with 10bit?

Yes, it works. I don't personally have interest in transparency anyhow.

> and does it work now with 10bit? Yes, it works. I don't personally have interest in transparency anyhow.
Owner

and does it work now with 10bit?

Yes, it works. I don't personally have interest in transparency anyhow.

okay, thanks for confirming, and for your help in understanding the origin of the problem. i've added a pointer in the documentation to this discussion, taking the easy route of simply declaring Xrender not compatible with 10-bit colours :)

> > and does it work now with 10bit? > > Yes, it works. I don't personally have interest in transparency anyhow. okay, thanks for confirming, and for your help in understanding the origin of the problem. i've added a pointer in the documentation to this discussion, taking the easy route of simply declaring Xrender not compatible with 10-bit colours :)
jao closed this issue 2 weeks ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: xmobar/xmobar#651
Loading…
There is no content yet.