Commit 403a2e68 authored by Harish Krupo's avatar Harish Krupo Committed by Harish Krupo

gl-renderer: Implement the renderer colorspace / HDR interface

The uses the set colorspace/hdr metadata to take decisions about the
colorspace conversion and/or the tone mapping to be applied.
Signed-off-by: Harish Krupo's avatarHarish Krupo <harish.krupo.kps@intel.com>
parent 46310857
......@@ -100,6 +100,9 @@ struct gl_output_state {
struct wl_list timeline_render_point_list;
GLuint shadow_fbo;
GLuint shadow_tex;
enum weston_colorspace_enums target_colorspace;
struct weston_hdr_metadata *target_hdr_metadata;
bool hdr_state_changed;
};
enum buffer_type {
......@@ -3173,6 +3176,10 @@ gl_renderer_output_create(struct weston_output *output,
glBindFramebuffer(GL_FRAMEBUFFER, 0);
go->target_colorspace = WESTON_CS_BT709;
go->target_hdr_metadata = NULL;
go->hdr_state_changed = false;
return 0;
}
......@@ -3588,6 +3595,35 @@ gl_renderer_create_pbuffer_surface(struct gl_renderer *gr) {
return 0;
}
static void
gl_renderer_set_output_colorspace(struct weston_output *output,
uint32_t colorspace)
{
struct gl_output_state *go = get_output_state(output);
if (go->target_colorspace == colorspace)
return;
go->target_colorspace = colorspace;
go->hdr_state_changed = true;
}
static void
gl_renderer_set_output_hdr_metadata(struct weston_output *output,
struct weston_hdr_metadata *hdr_metadata)
{
struct gl_output_state *go = get_output_state(output);
if (go->target_hdr_metadata == hdr_metadata)
return;
if (go->target_hdr_metadata && hdr_metadata &&
!memcmp(go->target_hdr_metadata, hdr_metadata, sizeof(*hdr_metadata)))
return;
go->target_hdr_metadata = hdr_metadata;
go->hdr_state_changed = true;
}
static int
gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
void *native_window, const EGLint *platform_attribs,
......@@ -3617,6 +3653,8 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
gr->base.surface_get_content_size =
gl_renderer_surface_get_content_size;
gr->base.surface_copy_content = gl_renderer_surface_copy_content;
gr->base.set_output_colorspace = gl_renderer_set_output_colorspace;
gr->base.set_output_hdr_metadata = gl_renderer_set_output_hdr_metadata;
gr->egl_display = NULL;
wl_list_init(&gr->shader_list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment