Commit 984809d8 authored by Paloma Arellano's avatar Paloma Arellano Committed by Dmitry Baryshkov

drm/msm/dpu: reserve CDM blocks for DP if mode is YUV420

Reserve CDM blocks for DP if the mode format is YUV420. Currently this
reservation only works for writeback and DP if the format is YUV420. But
this can be easily extented to other YUV formats for DP.

Changes in v2:
	- Minor code simplification
Signed-off-by: default avatarPaloma Arellano <quic_parellan@quicinc.com>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/579630/
Link: https://lore.kernel.org/r/20240222194025.25329-19-quic_parellan@quicinc.comSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
parent 57d6ca4c
...@@ -635,6 +635,7 @@ static int dpu_encoder_virt_atomic_check( ...@@ -635,6 +635,7 @@ static int dpu_encoder_virt_atomic_check(
struct dpu_kms *dpu_kms; struct dpu_kms *dpu_kms;
struct drm_display_mode *adj_mode; struct drm_display_mode *adj_mode;
struct msm_display_topology topology; struct msm_display_topology topology;
struct msm_display_info *disp_info;
struct dpu_global_state *global_state; struct dpu_global_state *global_state;
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
struct drm_dsc_config *dsc; struct drm_dsc_config *dsc;
...@@ -650,6 +651,7 @@ static int dpu_encoder_virt_atomic_check( ...@@ -650,6 +651,7 @@ static int dpu_encoder_virt_atomic_check(
DPU_DEBUG_ENC(dpu_enc, "\n"); DPU_DEBUG_ENC(dpu_enc, "\n");
priv = drm_enc->dev->dev_private; priv = drm_enc->dev->dev_private;
disp_info = &dpu_enc->disp_info;
dpu_kms = to_dpu_kms(priv->kms); dpu_kms = to_dpu_kms(priv->kms);
adj_mode = &crtc_state->adjusted_mode; adj_mode = &crtc_state->adjusted_mode;
global_state = dpu_kms_get_global_state(crtc_state->state); global_state = dpu_kms_get_global_state(crtc_state->state);
...@@ -663,21 +665,24 @@ static int dpu_encoder_virt_atomic_check( ...@@ -663,21 +665,24 @@ static int dpu_encoder_virt_atomic_check(
topology = dpu_encoder_get_topology(dpu_enc, dpu_kms, adj_mode, crtc_state, dsc); topology = dpu_encoder_get_topology(dpu_enc, dpu_kms, adj_mode, crtc_state, dsc);
/* /*
* Use CDM only for writeback at the moment as other interfaces cannot handle it. * Use CDM only for writeback or DP at the moment as other interfaces cannot handle it.
* if writeback itself cannot handle cdm for some reason it will fail in its atomic_check() * If writeback itself cannot handle cdm for some reason it will fail in its atomic_check()
* earlier. * earlier.
*/ */
if (dpu_enc->disp_info.intf_type == INTF_WB && conn_state->writeback_job) { if (disp_info->intf_type == INTF_WB && conn_state->writeback_job) {
fb = conn_state->writeback_job->fb; fb = conn_state->writeback_job->fb;
if (fb && DPU_FORMAT_IS_YUV(to_dpu_format(msm_framebuffer_format(fb)))) if (fb && DPU_FORMAT_IS_YUV(to_dpu_format(msm_framebuffer_format(fb))))
topology.needs_cdm = true; topology.needs_cdm = true;
if (topology.needs_cdm && !dpu_enc->cur_master->hw_cdm) } else if (disp_info->intf_type == INTF_DP) {
crtc_state->mode_changed = true; if (msm_dp_is_yuv_420_enabled(priv->dp[disp_info->h_tile_instance[0]], adj_mode))
else if (!topology.needs_cdm && dpu_enc->cur_master->hw_cdm) topology.needs_cdm = true;
crtc_state->mode_changed = true;
} }
if (topology.needs_cdm && !dpu_enc->cur_master->hw_cdm)
crtc_state->mode_changed = true;
else if (!topology.needs_cdm && dpu_enc->cur_master->hw_cdm)
crtc_state->mode_changed = true;
/* /*
* Release and Allocate resources on every modeset * Release and Allocate resources on every modeset
* Dont allocate when active is false. * Dont allocate when active is false.
...@@ -1149,7 +1154,8 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, ...@@ -1149,7 +1154,8 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc,
dpu_enc->dsc_mask = dsc_mask; dpu_enc->dsc_mask = dsc_mask;
if (dpu_enc->disp_info.intf_type == INTF_WB && conn_state->writeback_job) { if ((dpu_enc->disp_info.intf_type == INTF_WB && conn_state->writeback_job) ||
dpu_enc->disp_info.intf_type == INTF_DP) {
struct dpu_hw_blk *hw_cdm = NULL; struct dpu_hw_blk *hw_cdm = NULL;
dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state,
......
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