Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff499944 authored by Chris Forbes's avatar Chris Forbes
Browse files

libEGL: When driver doesn't understand P3, map sRGB-encoded P3 to sRGB

Even though the driver doesn't need to do anything else differently for
P3, it must know to apply the sRGB transfer function to framebuffer
writes.

Fixes:
	dEQP-EGL.functional.wide_color.pbuffer_8888_colorspace_p3
	dEQP-EGL.functional.wide_color.window_8888_colorspace_p3

Bug: b/117104367
Change-Id: I5a0199ad353cd52d421ce86e3dc967a72b3cba71
Merged-In: I5a0199ad353cd52d421ce86e3dc967a72b3cba71
parent 49e57551
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -562,6 +562,15 @@ static EGLBoolean processAttributes(egl_display_ptr dp, NativeWindowType window,
                    break;
                }
            }

            // If the driver doesn't understand it, we should map sRGB-encoded P3 to
            // sRGB rather than just dropping the colorspace on the floor.
            // For this format, the driver is expected to apply the sRGB
            // transfer function during framebuffer operations.
            if (!copyAttribute && attr[1] == EGL_GL_COLORSPACE_DISPLAY_P3_EXT) {
                strippedAttribList->push_back(attr[0]);
                strippedAttribList->push_back(EGL_GL_COLORSPACE_SRGB_KHR);
            }
        }
        if (copyAttribute) {
            strippedAttribList->push_back(attr[0]);