Whenever a full update is requested, the DC sets out_tf to true, forcing the output transfer function to be reprogrammed, but without transfer function settings (neither new nor previous). This unsolicited update of the output transfer function causes the previous setting, made when user space modified color management properties, to be lost. To avoid this, make the out_tf bit state persist through a full update and prevent reprogramming the output gamma LUT from empty/default data.
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/4444 Reported-by: Xaver Hugl <xaver.h...@gmail.com> Signed-off-by: Melissa Wen <m...@igalia.com> --- drivers/gpu/drm/amd/display/dc/core/dc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index c30d9ee51c83..92775deea650 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2195,9 +2195,11 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c /* Full update should unconditionally be triggered when dc_commit_state_no_check is called */ for (i = 0; i < context->stream_count; i++) { uint32_t prev_dsc_changed = context->streams[i]->update_flags.bits.dsc_changed; + uint32_t prev_out_tf = context->streams[i]->update_flags.bits.out_tf; context->streams[i]->update_flags.raw = 0xFFFFFFFF; context->streams[i]->update_flags.bits.dsc_changed = prev_dsc_changed; + context->streams[i]->update_flags.bits.out_tf = prev_out_tf; } determine_pipe_unlock_order(dc, context); @@ -3034,8 +3036,11 @@ enum surface_update_type dc_check_update_surfaces_for_stream( if (type == UPDATE_TYPE_FULL) { if (stream_update) { uint32_t dsc_changed = stream_update->stream->update_flags.bits.dsc_changed; + uint32_t out_tf = stream_update->stream->update_flags.bits.out_tf; + stream_update->stream->update_flags.raw = 0xFFFFFFFF; stream_update->stream->update_flags.bits.dsc_changed = dsc_changed; + stream_update->stream->update_flags.bits.out_tf = out_tf; } for (i = 0; i < surface_count; i++) updates[i].surface->update_flags.raw = 0xFFFFFFFF; -- 2.47.2