From: Julian Parkin <[email protected]>

To ensure the infoframe gets updated during an SDR/HDR switch
this change adds a new function to to check if the HDR static
metadata has changed and adds it to is_timing_changed and
pipe_need_reprogram checks

Signed-off-by: Julian Parkin <[email protected]>
Reviewed-by: Aric Cyr <[email protected]>
Acked-by: Harry Wentland <[email protected]>
---
 .../gpu/drm/amd/display/dc/core/dc_resource.c  | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index faaba0ea0ace..6e46384e5d64 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -1303,6 +1303,19 @@ bool dc_add_all_planes_for_stream(
 }
 
 
+static bool is_hdr_static_meta_changed(struct dc_stream_state *cur_stream,
+       struct dc_stream_state *new_stream)
+{
+       if (cur_stream == NULL)
+               return true;
+
+       if (memcmp(&cur_stream->hdr_static_metadata,
+                       &new_stream->hdr_static_metadata,
+                       sizeof(struct dc_info_packet)) != 0)
+               return true;
+
+       return false;
+}
 
 static bool is_timing_changed(struct dc_stream_state *cur_stream,
                struct dc_stream_state *new_stream)
@@ -1338,6 +1351,9 @@ static bool are_stream_backends_same(
        if (is_timing_changed(stream_a, stream_b))
                return false;
 
+       if (is_hdr_static_meta_changed(stream_a, stream_b))
+               return false;
+
        return true;
 }
 
@@ -2435,6 +2451,8 @@ bool pipe_need_reprogram(
        if (is_timing_changed(pipe_ctx_old->stream, pipe_ctx->stream))
                return true;
 
+       if (is_hdr_static_meta_changed(pipe_ctx_old->stream, pipe_ctx->stream))
+               return true;
 
        return false;
 }
-- 
2.17.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to