mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
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: Eryk Brol <eryk.brol@amd.com> Signed-off-by: Mikita Lipski <mikita.lipski@amd.com> Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
918698d5c2
commit
28b2f656d3
4 changed files with 26 additions and 22 deletions
|
@ -4701,13 +4701,11 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
|
|||
if (aconnector->dsc_settings.dsc_force_enable == DSC_CLK_FORCE_ENABLE)
|
||||
stream->timing.flags.DSC = 1;
|
||||
|
||||
if (stream->timing.flags.DSC && aconnector->dsc_settings.dsc_slice_width)
|
||||
stream->timing.dsc_cfg.num_slices_h = DIV_ROUND_UP(stream->timing.h_addressable,
|
||||
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 = aconnector->dsc_settings.dsc_num_slices_h;
|
||||
|
||||
if (stream->timing.flags.DSC && aconnector->dsc_settings.dsc_slice_height)
|
||||
stream->timing.dsc_cfg.num_slices_v = DIV_ROUND_UP(stream->timing.v_addressable,
|
||||
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 = aconnector->dsc_settings.dsc_num_slices_v;
|
||||
|
||||
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;
|
||||
|
|
|
@ -351,8 +351,8 @@ enum dsc_clock_force_state {
|
|||
|
||||
struct dsc_preferred_settings {
|
||||
enum dsc_clock_force_state dsc_force_enable;
|
||||
uint32_t dsc_slice_width;
|
||||
uint32_t dsc_slice_height;
|
||||
uint32_t dsc_num_slices_v;
|
||||
uint32_t dsc_num_slices_h;
|
||||
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,
|
|||
if (!pipe_ctx || !pipe_ctx->stream)
|
||||
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:
|
||||
kfree(wr_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)
|
||||
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:
|
||||
kfree(wr_buf);
|
||||
|
|
|
@ -454,8 +454,8 @@ struct dsc_mst_fairness_params {
|
|||
bool compression_possible;
|
||||
struct drm_dp_mst_port *port;
|
||||
enum dsc_clock_force_state clock_force_enable;
|
||||
uint32_t slice_width_overwrite;
|
||||
uint32_t slice_height_overwrite;
|
||||
uint32_t num_slices_h;
|
||||
uint32_t num_slices_v;
|
||||
uint32_t bpp_overwrite;
|
||||
};
|
||||
|
||||
|
@ -496,15 +496,11 @@ static void set_dsc_configs_from_fairness_vars(struct dsc_mst_fairness_params *p
|
|||
else
|
||||
params[i].timing->dsc_cfg.bits_per_pixel = vars[i].bpp_x16;
|
||||
|
||||
if (params[i].slice_width_overwrite)
|
||||
params[i].timing->dsc_cfg.num_slices_h = DIV_ROUND_UP(
|
||||
params[i].timing->h_addressable,
|
||||
params[i].slice_width_overwrite);
|
||||
if (params[i].num_slices_h)
|
||||
params[i].timing->dsc_cfg.num_slices_h = params[i].num_slices_h;
|
||||
|
||||
if (params[i].slice_height_overwrite)
|
||||
params[i].timing->dsc_cfg.num_slices_v = DIV_ROUND_UP(
|
||||
params[i].timing->v_addressable,
|
||||
params[i].slice_height_overwrite);
|
||||
if (params[i].num_slices_v)
|
||||
params[i].timing->dsc_cfg.num_slices_v = params[i].num_slices_v;
|
||||
} else {
|
||||
params[i].timing->flags.DSC = 0;
|
||||
}
|
||||
|
@ -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;
|
||||
if (params[count].clock_force_enable == DSC_CLK_FORCE_ENABLE)
|
||||
debugfs_overwrite = true;
|
||||
params[count].slice_width_overwrite = aconnector->dsc_settings.dsc_slice_width;
|
||||
params[count].slice_height_overwrite = aconnector->dsc_settings.dsc_slice_height;
|
||||
params[count].num_slices_h = aconnector->dsc_settings.dsc_num_slices_h;
|
||||
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].compression_possible = stream->sink->dsc_caps.dsc_dec_caps.is_dsc_supported;
|
||||
dc_dsc_get_policy_for_timing(params[count].timing, &dsc_policy);
|
||||
|
|
Loading…
Reference in a new issue