drm/msm/dpu: Fixes for virtual planes and 1.x features
cover drm/msm/dpu: Fixes for virtual planes and 1.x features
This patch series fix some issues found during testing on MDSS v1.16.
---
Vladimir Lypak (6):
drm/msm/dpu: Fix allocation of RGB SSPPs without scaling drm/msm/dpu: Propagate error from dpu_assign_plane_resources drm/msm/dpu: Disable scaling for unsupported scaler types drm/msm/dpu: Fix pixel extension sub-sampling drm/msm/dpu: Require linear modifier for writeback framebuffers drm/msm/dpu: Disable broken YUV on QSEED2 hardware
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 14 ++++++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 3 +++ 4 files changed, 14 insertions(+), 9 deletions(-)
---
base-commit: 6f3b6e91f7201e248d83232538db14d30100e9c7
change-id: 20251016-b4-dpu-fixes-c847c48e0e5d
Best regards,
Signature · 1 line
Vladimir Lypak <[email protected]>
PATCH 1/6 drm/msm/dpu: Fix allocation of RGB SSPPs without scaling
Due to condition in dpu_rm_reserve_sspp, RGB SSPPs are only tried when scaling is requested, which prevents those SSPPs from being reserved if we don't need scaling at all. Instead we should check if YUV support is requested, since scaling on RGB SSPPs is optional and is not implemented in driver yet.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +1 -1
@@ -842,7 +842,7 @@ struct dpu_hw_sspp *dpu_rm_reserve_sspp(struct dpu_rm *rm,if (!reqs->scale && !reqs->yuv) hw_sspp =dpu_rm_try_sspp (rm, global_state, crtc, reqs,SSPP_TYPE_DMA ); -if (!hw_sspp && reqs->scale) +if (!hw_sspp && !reqs->yuv) hw_sspp =dpu_rm_try_sspp (rm, global_state, crtc, reqs,SSPP_TYPE_RGB );if (!hw_sspp) hw_sspp =dpu_rm_try_sspp (rm, global_state, crtc, reqs,SSPP_TYPE_VIG );
Signature · 1 line
2.51.0
Re: [PATCH 1/6] drm/msm/dpu: Fix allocation of RGB SSPPs without scaling
Quoted 6 lines · Vladimir Lypak
Due to condition in
dpu_rm_reserve_sspp, RGB SSPPs are only tried when scaling is requested, which prevents those SSPPs from being reserved if we don't need scaling at all. Instead we should check if YUV support is requested, since scaling on RGB SSPPs is optional and is not implemented in driver yet.
Quoted 6 lines
Fixes 774bcfb73176 ("drm/msm/dpu: add support for virtual planes")Signed-off-by Vladimir Lypak <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 2/6 drm/msm/dpu: Propagate error from dpu_assign_plane_resources
In reply to Vladimir LypakThe dpu_plane_virtual_assign_resources function might fail if there is no suitable SSPP(s) for the plane. This leaves sspp field in plane state uninitialized and later leads to NULL dereference during commit:
Call trace: _dpu_crtc_blend_setup+0x194/0x620 [msm] (P) dpu_crtc_atomic_begin+0xe4/0x240 [msm] drm_atomic_helper_commit_planes+0x88/0x358 msm_atomic_commit_tail+0x1b4/0x8b8 [msm] commit_tail+0xa8/0x1b0 drm_atomic_helper_commit+0x180/0x1a0 drm_atomic_commit+0x94/0xe0 drm_mode_atomic_ioctl+0xa88/0xd60 drm_ioctl_kernel+0xc4/0x138 drm_ioctl+0x364/0x4f0 __arm64_sys_ioctl+0xac/0x108 invoke_syscall.constprop.0+0x48/0x100 el0_svc_common.constprop.0+0x40/0xe8 do_el0_svc+0x24/0x38 el0_svc+0x30/0xe0 el0t_64_sync_handler+0xa0/0xe8 el0t_64_sync+0x198/0x1a0
--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1 -1
@@ -1278,7 +1278,7 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, state, plane_state, prev_adjacent_plane_state);if (ret) -break ; +return ret; prev_adjacent_plane_state = plane_state; }
Signature · 1 line
2.51.0
Re: [PATCH 2/6] drm/msm/dpu: Propagate error from dpu_assign_plane_resources
Quoted 23 lines · Vladimir Lypak
The
dpu_plane_virtual_assign_resourcesfunction might fail if there is no suitable SSPP(s) for the plane. This leaves sspp field in plane state uninitialized and later leads to NULL dereference during commit:Call trace: _dpu_crtc_blend_setup+0x194/0x620 [msm] (P) dpu_crtc_atomic_begin+0xe4/0x240 [msm] drm_atomic_helper_commit_planes+0x88/0x358 msm_atomic_commit_tail+0x1b4/0x8b8 [msm] commit_tail+0xa8/0x1b0 drm_atomic_helper_commit+0x180/0x1a0 drm_atomic_commit+0x94/0xe0 drm_mode_atomic_ioctl+0xa88/0xd60 drm_ioctl_kernel+0xc4/0x138 drm_ioctl+0x364/0x4f0 __arm64_sys_ioctl+0xac/0x108 invoke_syscall.constprop.0+0x48/0x100 el0_svc_common.constprop.0+0x40/0xe8 do_el0_svc+0x24/0x38 el0_svc+0x30/0xe0 el0t_64_sync_handler+0xa0/0xe8 el0t_64_sync+0x198/0x1a0
Quoted 6 lines
Fixes 3ed12a3664b3 ("drm/msm/dpu: allow sharing SSPP between planes")Signed-off-by Vladimir Lypak <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 3/6 drm/msm/dpu: Disable scaling for unsupported scaler types
In reply to Vladimir LypakScaling is not implemented for some type of scalers (QSEED2 and RGB) but it was unintentionally re-enabled with change below. The remaining condition in dpu_plane_atomic_check_pipe is not enough because it only checks for length of scaler block (which is present). This patch adds a additional check for setup_scaler operation.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1 -1
@@ -740,7 +740,7 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,* We already have verified scaling against platform limitations. * Now check if the SSPP supports scaling at all. */ - if (!sblk->scaler_blk.len && + if (!(sblk->scaler_blk.len && pipe->sspp->ops.setup_scaler) && ((drm_rect_width(&new_plane_state->src) >> 16 != drm_rect_width(&new_plane_state->dst)) || (drm_rect_height(&new_plane_state->src) >> 16 !=
Signature · 1 line
2.51.0
Re: [PATCH 3/6] drm/msm/dpu: Disable scaling for unsupported scaler types
Quoted 5 lines · Vladimir Lypak
Scaling is not implemented for some type of scalers (QSEED2 and RGB) but it was unintentionally re-enabled with change below. The remaining condition in
dpu_plane_atomic_check_pipeis not enough because it only checks for length of scaler block (which is present). This patch adds a additional check forsetup_scaleroperation.
Nit: in future please refrain from using constructions like 'This patch makes foo' (see Documentation/process/submitting-patches.rst).
For this patch:
Quoted 7 lines
Fixes 8f15005783b8 ("drm/msm/dpu: move scaling limitations out of the hw_catalog")Signed-off-by Vladimir Lypak <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 4/6 drm/msm/dpu: Fix pixel extension sub-sampling
In reply to Vladimir LypakIn _dpu_plane_setup_pixel_ext function instead of dividing just chroma source resolution once (component 1 and 2), second component is divided once more because src_w and src_h variable is reused between iterations. Third component receives wrong source resolution too (from component 2). To fix this introduce temporary variables for each iteration.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +6 -4
@@ -500,13 +500,15 @@ static void _dpu_plane_setup_pixel_ext(struct dpu_hw_scaler3_cfg *scale_cfg,int i;for (i =0 ; i <DPU_MAX_PLANES ; i++) { +uint32_t w = src_w, h = src_h; +if (i ==DPU_SSPP_COMP_1_2 || i ==DPU_SSPP_COMP_2 ) { - src_w /= chroma_subsmpl_h; - src_h /= chroma_subsmpl_v; + w /= chroma_subsmpl_h; + h /= chroma_subsmpl_v; } - pixel_ext->num_ext_pxls_top[i] = src_h; - pixel_ext->num_ext_pxls_left[i] = src_w; + pixel_ext->num_ext_pxls_top[i] = h; + pixel_ext->num_ext_pxls_left[i] = w; } }
Signature · 1 line
2.51.0
Re: [PATCH 4/6] drm/msm/dpu: Fix pixel extension sub-sampling
Quoted 6 lines · Vladimir Lypak
In
_dpu_plane_setup_pixel_extfunction instead of dividing just chroma source resolution once (component 1 and 2), second component is divided once more becausesrc_wandsrc_hvariable is reused between iterations. Third component receives wrong source resolution too (from component 2). To fix this introduce temporary variables for each iteration.
Quoted 6 lines
Fixes dabfdd89eaa9 ("drm/msm/disp/dpu1: add inline rotation support for sc7280")Signed-off-by Vladimir Lypak <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 5/6 drm/msm/dpu: Require linear modifier for writeback framebuffers
In reply to Vladimir LypakUBWC-related register configuration for writeback is not implemented in the driver yet but there aren't any checks for non-linear modifiers in atomic_check. Thus when compressed framebuffer is attached to writeback connector it will be filled with linear image data. This patch forbids non-linear modifiers for writeback framebuffers until UBWC support for writeback is properly implemented.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c +3 -0
@@ -72,6 +72,9 @@ static int dpu_wb_conn_atomic_check(struct drm_connector *connector,DPU_ERROR ("invalid fb w=%d, maxlinewidth=%u\n" , fb->width, dpu_wb_conn->maxlinewidth);return -EINVAL ; + }else if (fb->modifier !=DRM_FORMAT_MOD_LINEAR ) { +DPU_ERROR ("unsupported fb modifier:%#llx\n" , fb->modifier); +return -EINVAL ; }return drm_atomic_helper_check_wb_connector_state (conn_state->connector, conn_state->state);
Signature · 1 line
2.51.0
Re: [PATCH 5/6] drm/msm/dpu: Require linear modifier for writeback framebuffers
Quoted 7 lines · Vladimir Lypak
UBWC-related register configuration for writeback is not implemented in the driver yet but there aren't any checks for non-linear modifiers in
atomic_check. Thus when compressed framebuffer is attached to writeback connector it will be filled with linear image data. This patch forbids non-linear modifiers for writeback framebuffers until UBWC support for writeback is properly implemented.
Quoted 6 lines
Fixes 71174f362d67 ("drm/msm/dpu: move writeback's atomic_check to dpu_writeback.c")Signed-off-by Vladimir Lypak <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 3 +++ 1 file changed, 3 insertions(+)
Signature · 2 lines
With best wishes Dmitry
PATCH 6/6 drm/msm/dpu: Disable broken YUV on QSEED2 hardware
In reply to Vladimir LypakYUV formats on this hardware needs scaling for chroma planes. However it is not implemented for QSEED2 which breaks display pipeline if YUV format is used (causing partial and corrupted output with PPDONE timeouts). This patch temporarily disables YUV by switching affected sub-block to RGB only format list.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +2 -2
@@ -267,8 +267,8 @@ static const u32 wb2_formats_rgb_yuv[] = { .base = 0x200, .len = 0xa0,}, \ .csc_blk = {.name = "csc", \ .base = 0x320, .len = 0x100,}, \ - .format_list = plane_formats_yuv, \ - .num_formats = ARRAY_SIZE(plane_formats_yuv), \ + .format_list = plane_formats, \ + .num_formats = ARRAY_SIZE(plane_formats), \ .rotation_cfg = NULL, \ }
Signature · 1 line
2.51.0
Re: [PATCH 6/6] drm/msm/dpu: Disable broken YUV on QSEED2 hardware
Quoted 6 lines · Vladimir Lypak
YUV formats on this hardware needs scaling for chroma planes. However it is not implemented for QSEED2 which breaks display pipeline if YUV format is used (causing partial and corrupted output with PPDONE timeouts). This patch temporarily disables YUV by switching affected sub-block to RGB only format list.
Quoted 6 lines
Fixes daf9a92daeb8 ("drm/msm/dpu: Add support for MSM8996")Signed-off-by Vladimir Lypak <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Does it apply to all QSEED2 platforms or just some of them?
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 6/6] drm/msm/dpu: Disable broken YUV on QSEED2 hardware
In reply to Vladimir LypakQuoted 6 lines · Vladimir Lypak
YUV formats on this hardware needs scaling for chroma planes. However it is not implemented for QSEED2 which breaks display pipeline if YUV format is used (causing partial and corrupted output with PPDONE timeouts). This patch temporarily disables YUV by switching affected sub-block to RGB only format list.
Quoted 6 lines
Fixes daf9a92daeb8 ("drm/msm/dpu: Add support for MSM8996")Signed-off-by Vladimir Lypak <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Dmitry Baryshkov
AppliedQuoted 3 lines · Vladimir Lypak
This patch series fix some issues found during testing on MDSS v1.16.
Applied, thanks!
[1/6] drm/msm/dpu: Fix allocation of RGB SSPPs without scaling
https://gitlab.freedesktop.org/lumag/msm/-/commit/2319551e97f0 [2/6] drm/msm/dpu: Propagate error from dpu_assign_plane_resources https://gitlab.freedesktop.org/lumag/msm/-/commit/23ab0d6228bf [3/6] drm/msm/dpu: Disable scaling for unsupported scaler types https://gitlab.freedesktop.org/lumag/msm/-/commit/425da3305972 [4/6] drm/msm/dpu: Fix pixel extension sub-sampling https://gitlab.freedesktop.org/lumag/msm/-/commit/2f8bed917542 [5/6] drm/msm/dpu: Require linear modifier for writeback framebuffers https://gitlab.freedesktop.org/lumag/msm/-/commit/5e0656b12534 [6/6] drm/msm/dpu: Disable broken YUV on QSEED2 hardware https://gitlab.freedesktop.org/lumag/msm/-/commit/bbc65d1bde82
Best regards,
Signature · 2 lines
With best wishes Dmitry