Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set correct colorspace (RGB/BGR/etc.)? #14

Closed
MLXProjects opened this issue Jan 17, 2023 · 4 comments
Closed

How to set correct colorspace (RGB/BGR/etc.)? #14

MLXProjects opened this issue Jan 17, 2023 · 4 comments

Comments

@MLXProjects
Copy link

I'm using the drmModeAddFB() call which requests to add the framebuffer using RGB as the default pixel format, which for some displays seem to be wrong (red and blue are inverted because of the display using BGR colorspace).
Can the correct display colorspace be detected in some way?
IIRC the encoder should take care of adapting the pixel data properly, but for some reason that doesn't happen here...

@dvdhrm
Copy link
Owner

dvdhrm commented Jan 18, 2023

Use drmModeAddFB2() (see modeset-atomic.c for an example). This call allows specifying the encoding (well, also the color-space in a sense, but not exactly, since sRGB and friends need further configuration).

@MLXProjects
Copy link
Author

MLXProjects commented Jan 19, 2023

This call allows specifying the encoding (well, also the color-space in a sense, but not exactly, since sRGB and friends need further configuration).

The issue is that I don't always know the correct encoding/colorspace beforehand, the idea is to find it out using any other drm api if it exists
For example, using fbdev, you could know it by checking the red/green/blue offsets

@dvdhrm
Copy link
Owner

dvdhrm commented Jan 20, 2023

I think the idea is that you specify which one to use and the hardware adapts, not the other way around. However, there is likely a way to query the crtc/encoders for the supported four-cc codes, but I am currently not sure about it. I recommend checking what the existing compositors do and how they decide what to use as argument to drmModeAddFB2.

@MLXProjects
Copy link
Author

Thanks! I'll close the issue so it doesn't keep around, and will research the reason of this not working as I think it should.
I'll post back if I ever find the correct way of doing this.

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

No branches or pull requests

2 participants