[Mesa-dev] Adding support for sRGB framebuffers to EGL

John Kåre Alsaker john.kare.alsaker at gmail.com
Wed Sep 26 03:49:38 PDT 2012


EGL_GAMMA_SRGB_BIT should be changed to a boolean EGL config attribute
so it can be optionally sorted by eglChooseConfig. It should be sorted
after EGL_COLOR_BUFFER_TYPE and true values would be preferred. This
sorting should be optional and is done so compositing window managers
can sample the framebuffer as an sRGB texture. EGL_GAMMA_SRGB_BIT
could also optionally be disabled when the format is not supported as
an sRGB texture by the hardware.

On Wed, Sep 26, 2012 at 10:19 AM, John Kåre Alsaker
<john.kare.alsaker at gmail.com> wrote:
> The way this would interact with ARB_framebuffer_sRGB is that the
> EGL's surface EGL_GAMMA attribute would be ignored. If a EGL config
> has the EGL_GAMMA_SRGB_BIT, it is required to support sRGB for the
> default OpenGL framebuffer.
>
> On Tue, Sep 25, 2012 at 5:58 PM, John Kåre Alsaker
> <john.kare.alsaker at gmail.com> wrote:
>> Hello,
>>
>> I would like add support for sRGB framebuffers to EGL. Here are my
>> proposed changes to EGL:
>>
>> A new EGL_SURFACE_TYPE bit:
>> EGL_GAMMA_SRGB_BIT - This format supports sRGB framebuffers. This also
>> means that ARB_framebuffer_sRGB is supported for this format.
>>
>> New values:
>> EGL_GAMMA_LINEAR - The gamma is linear.
>> EGL_GAMMA_SRGB - The gamma is as defined by the sRGB standard.
>>
>> New EGL surface attribute:
>> EGL_GAMMA - The gamma of the surface's framebuffer. The default value
>> is EGL_GAMMA_LINEAR.
>>
>> When the surface's EGL_GAMMA attribute's value is EGL_GAMMA_SRGB and
>> this is supported by
>> the format, reads from this framebuffer will be converted from sRGB
>> gamma and writes will
>> be converted to sRGB gamma. This may not apply to all functions in the
>> client API.
>>
>> There may be something related to the ARB_framebuffer_sRGB extension
>> in EGL already, in
>> which case someone should link me to it.
>>
>> There's two assumptions behind this proposal. One is that you won't
>> support sRGB only
>> formats. The other is that linear gamma and sRGB gamma format support
>> is the same.
>> This means that window systems can't add a new linear gamma format
>> without adding an sRGB
>> format and the other way around.
>>
>> I'd like some comments on this proposal and tips on how it could be
>> implemented in the
>> mess that is DRI.
>>
>> Thanks,
>> John Kåre


More information about the mesa-dev mailing list