From 91d3156a3b1708cd1e049895217f7e0738123a9c Mon Sep 17 00:00:00 2001 From: Wayne Lin Date: Mon, 19 Oct 2020 15:15:34 +0800 Subject: [PATCH] drm/amd/display: Calculate CRC on specific frame region [why] Currently, we only support calculating CRC on whole frame. We want to extend the capability to calculate CRC on specific frame area. [how] Calculate CRC on specific area once it's specified from the input parameter. Signed-off-by: Wayne Lin Reviewed-by: Nicholas Kazlauskas Reviewed-by: Tony Cheng Acked-by: Qingqing Zhuo Signed-off-by: Alex Deucher --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 15 +++++++++++++-- drivers/gpu/drm/amd/display/dc/dc_stream.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c index d0699e98db92..c29dc11619f7 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c @@ -115,7 +115,7 @@ int amdgpu_dm_crtc_configure_crc_source(struct drm_crtc *crtc, /* Enable CRTC CRC generation if necessary. */ if (dm_is_crc_source_crtc(source)) { if (!dc_stream_configure_crc(stream_state->ctx->dc, - stream_state, enable, enable)) { + stream_state, NULL, enable, enable)) { ret = -EINVAL; goto unlock; } diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 18154eea09f8..34e76fdc1334 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -346,7 +346,7 @@ bool dc_stream_get_crtc_position(struct dc *dc, * calculate the crc. */ bool dc_stream_configure_crc(struct dc *dc, struct dc_stream_state *stream, - bool enable, bool continuous) + struct crc_params *crc_window, bool enable, bool continuous) { int i; struct pipe_ctx *pipe; @@ -362,7 +362,7 @@ bool dc_stream_configure_crc(struct dc *dc, struct dc_stream_state *stream, if (i == MAX_PIPES) return false; - /* Always capture the full frame */ + /* By default, capture the full frame */ param.windowa_x_start = 0; param.windowa_y_start = 0; param.windowa_x_end = pipe->stream->timing.h_addressable; @@ -372,6 +372,17 @@ bool dc_stream_configure_crc(struct dc *dc, struct dc_stream_state *stream, param.windowb_x_end = pipe->stream->timing.h_addressable; param.windowb_y_end = pipe->stream->timing.v_addressable; + if (crc_window) { + param.windowa_x_start = crc_window->windowa_x_start; + param.windowa_y_start = crc_window->windowa_y_start; + param.windowa_x_end = crc_window->windowa_x_end; + param.windowa_y_end = crc_window->windowa_y_end; + param.windowb_x_start = crc_window->windowb_x_start; + param.windowb_y_start = crc_window->windowb_y_start; + param.windowb_x_end = crc_window->windowb_x_end; + param.windowb_y_end = crc_window->windowb_y_end; + } + param.dsc_mode = pipe->stream->timing.flags.DSC ? 1:0; param.odm_mode = pipe->next_odm_pipe ? 1:0; diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h b/drivers/gpu/drm/amd/display/dc/dc_stream.h index 82a35d008094..e37720344819 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_stream.h +++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h @@ -457,6 +457,7 @@ bool dc_stream_get_crtc_position(struct dc *dc, bool dc_stream_configure_crc(struct dc *dc, struct dc_stream_state *stream, + struct crc_params *crc_window, bool enable, bool continuous); -- 2.25.1