Skip to content

Commit

Permalink
drm/amd/display: add sharpening policy to plane state
Browse files Browse the repository at this point in the history
[Why]
Pass in sharpening policy through plane state from control side

[How]
Add sharpener support through dc_caps.
Add sharpen policy to plane state and move to spl_input.
Pass sharpen policy from plane state to SPL.

Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Signed-off-by: Samson Tam <Samson.Tam@amd.com>
Signed-off-by: Roman Li <roman.li@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Samson Tam authored and Alex Deucher committed Oct 15, 2024
1 parent c5a332f commit c6335da
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dc.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ struct dc_dmub_caps {
uint8_t fams_ver;
};

struct dc_scl_caps {
bool sharpener_support;
};

struct dc_caps {
uint32_t max_streams;
uint32_t max_links;
Expand Down Expand Up @@ -292,6 +296,7 @@ struct dc_caps {
bool sequential_ono;
/* Conservative limit for DCC cases which require ODM4:1 to support*/
uint32_t dcc_plane_width_limit;
struct dc_scl_caps scl_caps;
};

struct dc_bug_wa {
Expand Down Expand Up @@ -1355,6 +1360,7 @@ struct dc_plane_state {
enum mpcc_movable_cm_location mcm_location;
struct dc_csc_transform cursor_csc_color_matrix;
bool adaptive_sharpness_en;
int adaptive_sharpness_policy;
int sharpness_level;
enum linear_light_scaling linear_light_scaling;
unsigned int sdr_white_level_nits;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/display/dc/dc_spl_translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void translate_SPL_in_params_from_pipe_ctx(struct pipe_ctx *pipe_ctx, struct spl
spl_in->h_active = pipe_ctx->plane_res.scl_data.h_active;
spl_in->v_active = pipe_ctx->plane_res.scl_data.v_active;

spl_in->debug.sharpen_policy = (enum sharpen_policy)pipe_ctx->stream->ctx->dc->debug.sharpen_policy;
spl_in->sharpen_policy = (enum sharpen_policy)plane_state->adaptive_sharpness_policy;
spl_in->debug.scale_to_sharpness_policy =
(enum scale_to_sharpness_policy)pipe_ctx->stream->ctx->dc->debug.scale_to_sharpness_policy;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2171,6 +2171,7 @@ static bool dcn401_resource_construct(
/* SPL */
spl_init_easf_filter_coeffs();
spl_init_blur_scale_coeffs();
dc->caps.scl_caps.sharpener_support = true;

return true;

Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/amd/display/dc/spl/dc_spl.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,13 +848,13 @@ static bool spl_get_isharp_en(struct spl_in *spl_in,
* surfaces based on policy setting
*/
if (!spl_is_yuv420(spl_in->basic_in.format) &&
(spl_in->debug.sharpen_policy == SHARPEN_YUV))
(spl_in->sharpen_policy == SHARPEN_YUV))
return enable_isharp;
else if ((spl_is_yuv420(spl_in->basic_in.format) && !fullscreen) &&
(spl_in->debug.sharpen_policy == SHARPEN_RGB_FULLSCREEN_YUV))
(spl_in->sharpen_policy == SHARPEN_RGB_FULLSCREEN_YUV))
return enable_isharp;
else if (!spl_in->is_fullscreen &&
spl_in->debug.sharpen_policy == SHARPEN_FULLSCREEN_ALL)
spl_in->sharpen_policy == SHARPEN_FULLSCREEN_ALL)
return enable_isharp;

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/display/dc/spl/dc_spl_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ struct spl_funcs {
struct spl_debug {
int visual_confirm_base_offset;
int visual_confirm_dpp_offset;
enum sharpen_policy sharpen_policy;
enum scale_to_sharpness_policy scale_to_sharpness_policy;
};

Expand All @@ -530,6 +529,7 @@ struct spl_in {
int h_active;
int v_active;
int sdr_white_level_nits;
enum sharpen_policy sharpen_policy;
};
// end of SPL inputs

Expand Down

0 comments on commit c6335da

Please sign in to comment.