Commit 28b2f656 authored by Eryk Brol's avatar Eryk Brol Committed by Alex Deucher

drm/amd/display: Calculate DSC number of slices in debugfs when forced

[why]
When comparing current DSC timing settings with enforced through
debugfs we have to calculate number of both vertical and horisontal
slices. So instead of doing that every time we should just
use number of slices rather than setting its dimensions.

[how]
In connector's dsc preferred settings structure change slice height
and slice width parameters to number of slices vertical and horisontal.
Also calculate number of slices in debugfs rather in create_stream_for_sink.
Signed-off-by: default avatarEryk Brol <eryk.brol@amd.com>
Signed-off-by: default avatarMikita Lipski <mikita.lipski@amd.com>
Acked-by: default avatarAurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 918698d5
...@@ -4701,13 +4701,11 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, ...@@ -4701,13 +4701,11 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
if (aconnector->dsc_settings.dsc_force_enable == DSC_CLK_FORCE_ENABLE) if (aconnector->dsc_settings.dsc_force_enable == DSC_CLK_FORCE_ENABLE)
stream->timing.flags.DSC = 1; stream->timing.flags.DSC = 1;
if (stream->timing.flags.DSC && aconnector->dsc_settings.dsc_slice_width) if (stream->timing.flags.DSC && aconnector->dsc_settings.dsc_num_slices_h)
stream->timing.dsc_cfg.num_slices_h = DIV_ROUND_UP(stream->timing.h_addressable, stream->timing.dsc_cfg.num_slices_h = aconnector->dsc_settings.dsc_num_slices_h;
aconnector->dsc_settings.dsc_slice_width);
if (stream->timing.flags.DSC && aconnector->dsc_settings.dsc_slice_height) if (stream->timing.flags.DSC && aconnector->dsc_settings.dsc_num_slices_v)
stream->timing.dsc_cfg.num_slices_v = DIV_ROUND_UP(stream->timing.v_addressable, stream->timing.dsc_cfg.num_slices_v = aconnector->dsc_settings.dsc_num_slices_v;
aconnector->dsc_settings.dsc_slice_height);
if (stream->timing.flags.DSC && aconnector->dsc_settings.dsc_bits_per_pixel) if (stream->timing.flags.DSC && aconnector->dsc_settings.dsc_bits_per_pixel)
stream->timing.dsc_cfg.bits_per_pixel = aconnector->dsc_settings.dsc_bits_per_pixel; stream->timing.dsc_cfg.bits_per_pixel = aconnector->dsc_settings.dsc_bits_per_pixel;
......
...@@ -351,8 +351,8 @@ enum dsc_clock_force_state { ...@@ -351,8 +351,8 @@ enum dsc_clock_force_state {
struct dsc_preferred_settings { struct dsc_preferred_settings {
enum dsc_clock_force_state dsc_force_enable; enum dsc_clock_force_state dsc_force_enable;
uint32_t dsc_slice_width; uint32_t dsc_num_slices_v;
uint32_t dsc_slice_height; uint32_t dsc_num_slices_h;
uint32_t dsc_bits_per_pixel; uint32_t dsc_bits_per_pixel;
}; };
......
...@@ -1447,7 +1447,12 @@ static ssize_t dp_dsc_slice_width_write(struct file *f, const char __user *buf, ...@@ -1447,7 +1447,12 @@ static ssize_t dp_dsc_slice_width_write(struct file *f, const char __user *buf,
if (!pipe_ctx || !pipe_ctx->stream) if (!pipe_ctx || !pipe_ctx->stream)
goto done; goto done;
aconnector->dsc_settings.dsc_slice_width = param[0]; if (param[0] > 0)
aconnector->dsc_settings.dsc_num_slices_h = DIV_ROUND_UP(
pipe_ctx->stream->timing.h_addressable,
param[0]);
else
aconnector->dsc_settings.dsc_num_slices_h = 0;
done: done:
kfree(wr_buf); kfree(wr_buf);
...@@ -1596,7 +1601,12 @@ static ssize_t dp_dsc_slice_height_write(struct file *f, const char __user *buf, ...@@ -1596,7 +1601,12 @@ static ssize_t dp_dsc_slice_height_write(struct file *f, const char __user *buf,
if (!pipe_ctx || !pipe_ctx->stream) if (!pipe_ctx || !pipe_ctx->stream)
goto done; goto done;
aconnector->dsc_settings.dsc_slice_height = param[0]; if (param[0] > 0)
aconnector->dsc_settings.dsc_num_slices_v = DIV_ROUND_UP(
pipe_ctx->stream->timing.v_addressable,
param[0]);
else
aconnector->dsc_settings.dsc_num_slices_v = 0;
done: done:
kfree(wr_buf); kfree(wr_buf);
......
...@@ -454,8 +454,8 @@ struct dsc_mst_fairness_params { ...@@ -454,8 +454,8 @@ struct dsc_mst_fairness_params {
bool compression_possible; bool compression_possible;
struct drm_dp_mst_port *port; struct drm_dp_mst_port *port;
enum dsc_clock_force_state clock_force_enable; enum dsc_clock_force_state clock_force_enable;
uint32_t slice_width_overwrite; uint32_t num_slices_h;
uint32_t slice_height_overwrite; uint32_t num_slices_v;
uint32_t bpp_overwrite; uint32_t bpp_overwrite;
}; };
...@@ -496,15 +496,11 @@ static void set_dsc_configs_from_fairness_vars(struct dsc_mst_fairness_params *p ...@@ -496,15 +496,11 @@ static void set_dsc_configs_from_fairness_vars(struct dsc_mst_fairness_params *p
else else
params[i].timing->dsc_cfg.bits_per_pixel = vars[i].bpp_x16; params[i].timing->dsc_cfg.bits_per_pixel = vars[i].bpp_x16;
if (params[i].slice_width_overwrite) if (params[i].num_slices_h)
params[i].timing->dsc_cfg.num_slices_h = DIV_ROUND_UP( params[i].timing->dsc_cfg.num_slices_h = params[i].num_slices_h;
params[i].timing->h_addressable,
params[i].slice_width_overwrite);
if (params[i].slice_height_overwrite) if (params[i].num_slices_v)
params[i].timing->dsc_cfg.num_slices_v = DIV_ROUND_UP( params[i].timing->dsc_cfg.num_slices_v = params[i].num_slices_v;
params[i].timing->v_addressable,
params[i].slice_height_overwrite);
} else { } else {
params[i].timing->flags.DSC = 0; params[i].timing->flags.DSC = 0;
} }
...@@ -721,8 +717,8 @@ static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state, ...@@ -721,8 +717,8 @@ static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state,
params[count].clock_force_enable = aconnector->dsc_settings.dsc_force_enable; params[count].clock_force_enable = aconnector->dsc_settings.dsc_force_enable;
if (params[count].clock_force_enable == DSC_CLK_FORCE_ENABLE) if (params[count].clock_force_enable == DSC_CLK_FORCE_ENABLE)
debugfs_overwrite = true; debugfs_overwrite = true;
params[count].slice_width_overwrite = aconnector->dsc_settings.dsc_slice_width; params[count].num_slices_h = aconnector->dsc_settings.dsc_num_slices_h;
params[count].slice_height_overwrite = aconnector->dsc_settings.dsc_slice_height; params[count].num_slices_v = aconnector->dsc_settings.dsc_num_slices_v;
params[count].bpp_overwrite = aconnector->dsc_settings.dsc_bits_per_pixel; params[count].bpp_overwrite = aconnector->dsc_settings.dsc_bits_per_pixel;
params[count].compression_possible = stream->sink->dsc_caps.dsc_dec_caps.is_dsc_supported; params[count].compression_possible = stream->sink->dsc_caps.dsc_dec_caps.is_dsc_supported;
dc_dsc_get_policy_for_timing(params[count].timing, &dsc_policy); dc_dsc_get_policy_for_timing(params[count].timing, &dsc_policy);
......
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