Skip to content

vrend: convert linear color to srgb for 24bpp imported EGL resources

Ryan Neph requested to merge ryanneph/virglrenderer:convert-clear-to-srgb into master

Resources imported from dma-bufs as EGL images are given internal format GL_RGB8 (24bpp) by host mesa. When placing srgb texture views on such resources, the appropriate view format would be GL_SRGB8, but this is not color-renderable for GL or GLES and results in an incomplete framebuffer. Instead, GL_RGB8 must be used as the attachment format and linear->srgb colorspace conversions must be applied manually in the frag shader and for calls to glClearColor() involving these surfaces.

This resolves a dEQP-EGL.functional.wide_color.window_888_colorspace_srgb test failure for GBM-enabled hosts with newer host mesa, which imports B8G8R8X8_UNORM and R8G8B8X8_UNORM as 24bpp instead of the more compatible 32bpp.

Signed-off-by: Ryan Neph ryanneph@google.com

Edited by Ryan Neph

Merge request reports