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

Color management on EGL Wayland platform #197

Open
ppaalanen opened this issue Feb 13, 2024 · 1 comment
Open

Color management on EGL Wayland platform #197

ppaalanen opened this issue Feb 13, 2024 · 1 comment

Comments

@ppaalanen
Copy link

We are developing a color-management Wayland protocol extension, and expect EGL implementations to use it on behalf of the application, because EGL already defines the extensions to do so. We need to define the rules how that works in EGL_KHR_platform_wayland.

The relevant existing extensions that should feed into color-management are:

Most of these extensions work by defining new values for EGL_GL_COLORSPACE EGLSurface attribute. These extension values are clear how they should map to color-management. The EGL extensions assume that the values are forwarded to and used by the platform, that is, the window system.

The base values (defined by EGL 1.5) are not obvious how they should work though, especially the default being EGL_GL_COLORSPACE_LINEAR1. Without color-management protocol extension, Wayland cannot handle "linear color", that is, optically encoded stimulus. Hence, no application has ever actually provided "linear color" on Wayland, and I doubt they did that on any other platform either because the usual 8 bits per color channel is not enough precision for dark shades. The color-management protocol is perfectly capable of communicating optically encoded stimulus, but mapping EGL_GL_COLORSPACE_LINEAR to that would likely break all existing EGL Wayland applications.

In order to preserve the behavior of existing applications, the use of EGL_GL_COLORSPACE_LINEAR must result in EGL not setting any "image description" on the Wayland surface with color-management protocol extension. Probably EGL_GL_COLORSPACE_SRGB needs to do the same. Wayland compositors will handle such Wayland surfaces appropriately, given that it is needed for backward compatibility of any Wayland application not using color-management protocol.

This also means that using EGL API, it is not possible to tell the Wayland window system that the surface is explicitly sRGB.

We also need to guarantee a way to use EGL on a wl_surface such that the application itself, not EGL, drives the color-management Wayland extension. The Wayland extension supports more than EGL API exposes, particularly the use of ICC profiles. Defining EGL_GL_COLORSPACE_LINEAR and EGL_GL_COLORSPACE_SRGB settings to not create a wp_color_management_surface_v1 on EGL Wayland platform achieves that.

The above needs to be documented in EGL_KHR_platform_wayland.

Footnotes

  1. It seems to me that EGL_GL_COLORSPACE attribute was somehow originally yet another switch in allowing GL to do the sRGB transfer function encoding/decoding automatically. Then, all EXT_gl_colorspace_* extensions re-purposed the attribute for communicating stimulus encoding to the window system (platform).

@stonesthrow
Copy link
Contributor

https://registry.khronos.org/EGL/extensions/KHR/EGL_KHR_gl_colorspace.txt
Is the initial colorspace extension and defines sRGB - to add to your list of relevant. As you noted about EGL_GL_COLORSPACE attribute.

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