Skip to content

Commit 984809d

Browse files
Paloma Arellanolumag
authored andcommitted
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: Paloma Arellano <quic_parellan@quicinc.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/579630/ Link: https://lore.kernel.org/r/20240222194025.25329-19-quic_parellan@quicinc.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
1 parent 57d6ca4 commit 984809d

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ static int dpu_encoder_virt_atomic_check(
635635
struct dpu_kms *dpu_kms;
636636
struct drm_display_mode *adj_mode;
637637
struct msm_display_topology topology;
638+
struct msm_display_info *disp_info;
638639
struct dpu_global_state *global_state;
639640
struct drm_framebuffer *fb;
640641
struct drm_dsc_config *dsc;
@@ -650,6 +651,7 @@ static int dpu_encoder_virt_atomic_check(
650651
DPU_DEBUG_ENC(dpu_enc, "\n");
651652

652653
priv = drm_enc->dev->dev_private;
654+
disp_info = &dpu_enc->disp_info;
653655
dpu_kms = to_dpu_kms(priv->kms);
654656
adj_mode = &crtc_state->adjusted_mode;
655657
global_state = dpu_kms_get_global_state(crtc_state->state);
@@ -663,21 +665,24 @@ static int dpu_encoder_virt_atomic_check(
663665
topology = dpu_encoder_get_topology(dpu_enc, dpu_kms, adj_mode, crtc_state, dsc);
664666

665667
/*
666-
* Use CDM only for writeback at the moment as other interfaces cannot handle it.
667-
* if writeback itself cannot handle cdm for some reason it will fail in its atomic_check()
668+
* Use CDM only for writeback or DP at the moment as other interfaces cannot handle it.
669+
* If writeback itself cannot handle cdm for some reason it will fail in its atomic_check()
668670
* earlier.
669671
*/
670-
if (dpu_enc->disp_info.intf_type == INTF_WB && conn_state->writeback_job) {
672+
if (disp_info->intf_type == INTF_WB && conn_state->writeback_job) {
671673
fb = conn_state->writeback_job->fb;
672674

673675
if (fb && DPU_FORMAT_IS_YUV(to_dpu_format(msm_framebuffer_format(fb))))
674676
topology.needs_cdm = true;
675-
if (topology.needs_cdm && !dpu_enc->cur_master->hw_cdm)
676-
crtc_state->mode_changed = true;
677-
else if (!topology.needs_cdm && dpu_enc->cur_master->hw_cdm)
678-
crtc_state->mode_changed = true;
677+
} else if (disp_info->intf_type == INTF_DP) {
678+
if (msm_dp_is_yuv_420_enabled(priv->dp[disp_info->h_tile_instance[0]], adj_mode))
679+
topology.needs_cdm = true;
679680
}
680681

682+
if (topology.needs_cdm && !dpu_enc->cur_master->hw_cdm)
683+
crtc_state->mode_changed = true;
684+
else if (!topology.needs_cdm && dpu_enc->cur_master->hw_cdm)
685+
crtc_state->mode_changed = true;
681686
/*
682687
* Release and Allocate resources on every modeset
683688
* Dont allocate when active is false.
@@ -1149,7 +1154,8 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc,
11491154

11501155
dpu_enc->dsc_mask = dsc_mask;
11511156

1152-
if (dpu_enc->disp_info.intf_type == INTF_WB && conn_state->writeback_job) {
1157+
if ((dpu_enc->disp_info.intf_type == INTF_WB && conn_state->writeback_job) ||
1158+
dpu_enc->disp_info.intf_type == INTF_DP) {
11531159
struct dpu_hw_blk *hw_cdm = NULL;
11541160

11551161
dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state,

0 commit comments

Comments
 (0)