* [PATCH v3 0/9] drm/msm/dpu: be more friendly to X.org
@ 2024-06-13 22:36 Dmitry Baryshkov
2024-06-13 22:36 ` [PATCH v3 1/9] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds() Dmitry Baryshkov
` (8 more replies)
0 siblings, 9 replies; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-13 22:36 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
Unlike other compositors X.org allocates a single framebuffer covering
the whole screen space. This is not an issue with the single screens,
but with the multi-monitor setup 5120x4096 becomes a limiting factor.
Check the hardware-bound limitations and lift the FB max size to
16383x16383.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
Changes in v3:
- Reoder the functions to pull up a fix to the start of the patchset
(Abhinav)
- Rename the _dpu_crtc_setup_lm_bounds() to
_dpu_crtc_check_and_setup_lm_bounds() (Abhinav)
- Make dpu_crtc_mode_valid() static.
- Link to v2: https://lore.kernel.org/r/20240603-dpu-mode-config-width-v2-0-16af520575a6@linaro.org
Changes in v2:
- Added dpu_crtc_valid() to verify that 2*lm_width limit is enforced
(Abhinav)
- Link to v1: https://lore.kernel.org/r/20240319-dpu-mode-config-width-v1-0-d0fe6bf81bf1@linaro.org
---
Dmitry Baryshkov (9):
drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds()
drm/msm/dpu: drop dpu_format_check_modified_format
drm/msm/dpu: drop dpu_format_populate_layout from dpu_plane_sspp_atomic_update
drm/msm/dpu: split dpu_format_populate_layout
drm/msm/dpu: move dpu_format_populate_plane_sizes to atomic_check
drm/msm/dpu: check for the plane pitch overflow
drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin
drm/msm/dpu: merge MAX_IMG_WIDTH/HEIGHT with DPU_MAX_IMG_WIDTH/HEIGHT
drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 32 ++++++--
.../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 8 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 91 ++++++----------------
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 24 ++----
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 2 +
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 10 +--
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 37 +++++----
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h | 3 +
drivers/gpu/drm/msm/msm_kms.h | 6 --
10 files changed, 91 insertions(+), 126 deletions(-)
---
base-commit: 03d44168cbd7fc57d5de56a3730427db758fc7f6
change-id: 20240318-dpu-mode-config-width-626d3c7ad52a
Best regards,
--
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v3 1/9] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds()
2024-06-13 22:36 [PATCH v3 0/9] drm/msm/dpu: be more friendly to X.org Dmitry Baryshkov
@ 2024-06-13 22:36 ` Dmitry Baryshkov
2024-06-13 23:13 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 2/9] drm/msm/dpu: drop dpu_format_check_modified_format Dmitry Baryshkov
` (7 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-13 22:36 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
Make _dpu_crtc_setup_lm_bounds() check that CRTC width is not
overflowing LM requirements. Rename the function accordingly.
Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 9f2164782844..b0d81e8ea765 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -711,12 +711,13 @@ void dpu_crtc_complete_commit(struct drm_crtc *crtc)
_dpu_crtc_complete_flip(crtc);
}
-static void _dpu_crtc_setup_lm_bounds(struct drm_crtc *crtc,
+static int _dpu_crtc_check_and_setup_lm_bounds(struct drm_crtc *crtc,
struct drm_crtc_state *state)
{
struct dpu_crtc_state *cstate = to_dpu_crtc_state(state);
struct drm_display_mode *adj_mode = &state->adjusted_mode;
u32 crtc_split_width = adj_mode->hdisplay / cstate->num_mixers;
+ struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(crtc);
int i;
for (i = 0; i < cstate->num_mixers; i++) {
@@ -727,7 +728,12 @@ static void _dpu_crtc_setup_lm_bounds(struct drm_crtc *crtc,
r->y2 = adj_mode->vdisplay;
trace_dpu_crtc_setup_lm_bounds(DRMID(crtc), i, r);
+
+ if (drm_rect_width(r) > dpu_kms->catalog->caps->max_mixer_width)
+ return -E2BIG;
}
+
+ return 0;
}
static void _dpu_crtc_get_pcc_coeff(struct drm_crtc_state *state,
@@ -803,7 +809,7 @@ static void dpu_crtc_atomic_begin(struct drm_crtc *crtc,
DRM_DEBUG_ATOMIC("crtc%d\n", crtc->base.id);
- _dpu_crtc_setup_lm_bounds(crtc, crtc->state);
+ _dpu_crtc_check_and_setup_lm_bounds(crtc, crtc->state);
/* encoder will trigger pending mask now */
drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask)
@@ -1197,8 +1203,11 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
if (crtc_state->active_changed)
crtc_state->mode_changed = true;
- if (cstate->num_mixers)
- _dpu_crtc_setup_lm_bounds(crtc, crtc_state);
+ if (cstate->num_mixers) {
+ rc = _dpu_crtc_check_and_setup_lm_bounds(crtc, crtc_state);
+ if (rc)
+ return rc;
+ }
/* FIXME: move this to dpu_plane_atomic_check? */
drm_atomic_crtc_state_for_each_plane_state(plane, pstate, crtc_state) {
--
2.39.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 2/9] drm/msm/dpu: drop dpu_format_check_modified_format
2024-06-13 22:36 [PATCH v3 0/9] drm/msm/dpu: be more friendly to X.org Dmitry Baryshkov
2024-06-13 22:36 ` [PATCH v3 1/9] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds() Dmitry Baryshkov
@ 2024-06-13 22:36 ` Dmitry Baryshkov
2024-06-13 23:14 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 3/9] drm/msm/dpu: drop dpu_format_populate_layout from dpu_plane_sspp_atomic_update Dmitry Baryshkov
` (6 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-13 22:36 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
The msm_kms_funcs::check_modified_format() callback is not used by the
driver. Drop it completely.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 43 -----------------------------
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 16 -----------
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 1 -
drivers/gpu/drm/msm/msm_kms.h | 6 ----
4 files changed, 66 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
index 6b1e9a617da3..027eb5ecff08 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
@@ -423,46 +423,3 @@ int dpu_format_populate_layout(
return ret;
}
-
-int dpu_format_check_modified_format(
- const struct msm_kms *kms,
- const struct msm_format *fmt,
- const struct drm_mode_fb_cmd2 *cmd,
- struct drm_gem_object **bos)
-{
- const struct drm_format_info *info;
- struct dpu_hw_fmt_layout layout;
- uint32_t bos_total_size = 0;
- int ret, i;
-
- if (!fmt || !cmd || !bos) {
- DRM_ERROR("invalid arguments\n");
- return -EINVAL;
- }
-
- info = drm_format_info(fmt->pixel_format);
- if (!info)
- return -EINVAL;
-
- ret = dpu_format_get_plane_sizes(fmt, cmd->width, cmd->height,
- &layout, cmd->pitches);
- if (ret)
- return ret;
-
- for (i = 0; i < info->num_planes; i++) {
- if (!bos[i]) {
- DRM_ERROR("invalid handle for plane %d\n", i);
- return -EINVAL;
- }
- if ((i == 0) || (bos[i] != bos[0]))
- bos_total_size += bos[i]->size;
- }
-
- if (bos_total_size < layout.total_size) {
- DRM_ERROR("buffers total size too small %u expected %u\n",
- bos_total_size, layout.total_size);
- return -EINVAL;
- }
-
- return 0;
-}
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h
index 210d0ed5f0af..ef1239c95058 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h
@@ -31,22 +31,6 @@ static inline bool dpu_find_format(u32 format, const u32 *supported_formats,
return false;
}
-/**
- * dpu_format_check_modified_format - validate format and buffers for
- * dpu non-standard, i.e. modified format
- * @kms: kms driver
- * @msm_fmt: pointer to the msm_fmt base pointer of an msm_format
- * @cmd: fb_cmd2 structure user request
- * @bos: gem buffer object list
- *
- * Return: error code on failure, 0 on success
- */
-int dpu_format_check_modified_format(
- const struct msm_kms *kms,
- const struct msm_format *msm_fmt,
- const struct drm_mode_fb_cmd2 *cmd,
- struct drm_gem_object **bos);
-
/**
* dpu_format_populate_layout - populate the given format layout based on
* mmu, fb, and format found in the fb
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 1955848b1b78..0d1dcc94455c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -981,7 +981,6 @@ static const struct msm_kms_funcs kms_funcs = {
.complete_commit = dpu_kms_complete_commit,
.enable_vblank = dpu_kms_enable_vblank,
.disable_vblank = dpu_kms_disable_vblank,
- .check_modified_format = dpu_format_check_modified_format,
.destroy = dpu_kms_destroy,
.snapshot = dpu_kms_mdp_snapshot,
#ifdef CONFIG_DEBUG_FS
diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h
index 1e0c54de3716..e60162744c66 100644
--- a/drivers/gpu/drm/msm/msm_kms.h
+++ b/drivers/gpu/drm/msm/msm_kms.h
@@ -92,12 +92,6 @@ struct msm_kms_funcs {
* Format handling:
*/
- /* do format checking on format modified through fb_cmd2 modifiers */
- int (*check_modified_format)(const struct msm_kms *kms,
- const struct msm_format *msm_fmt,
- const struct drm_mode_fb_cmd2 *cmd,
- struct drm_gem_object **bos);
-
/* misc: */
long (*round_pixclk)(struct msm_kms *kms, unsigned long rate,
struct drm_encoder *encoder);
--
2.39.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 3/9] drm/msm/dpu: drop dpu_format_populate_layout from dpu_plane_sspp_atomic_update
2024-06-13 22:36 [PATCH v3 0/9] drm/msm/dpu: be more friendly to X.org Dmitry Baryshkov
2024-06-13 22:36 ` [PATCH v3 1/9] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds() Dmitry Baryshkov
2024-06-13 22:36 ` [PATCH v3 2/9] drm/msm/dpu: drop dpu_format_check_modified_format Dmitry Baryshkov
@ 2024-06-13 22:36 ` Dmitry Baryshkov
2024-06-18 22:51 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 4/9] drm/msm/dpu: split dpu_format_populate_layout Dmitry Baryshkov
` (5 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-13 22:36 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
The dpu_plane_prepare_fb() already calls dpu_format_populate_layout().
Store the generated layout in the plane state and drop this call from
dpu_plane_sspp_update().
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 19 ++++---------------
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h | 3 +++
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index 1c3a2657450c..9ee178a09a3b 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -647,7 +647,6 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane,
struct drm_framebuffer *fb = new_state->fb;
struct dpu_plane *pdpu = to_dpu_plane(plane);
struct dpu_plane_state *pstate = to_dpu_plane_state(new_state);
- struct dpu_hw_fmt_layout layout;
struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
int ret;
@@ -677,7 +676,8 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane,
/* validate framebuffer layout before commit */
ret = dpu_format_populate_layout(pstate->aspace,
- new_state->fb, &layout);
+ new_state->fb,
+ &pstate->layout);
if (ret) {
DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret);
return ret;
@@ -1100,17 +1100,6 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane)
msm_framebuffer_format(fb);
struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg;
struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->r_pipe_cfg;
- struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
- struct msm_gem_address_space *aspace = kms->base.aspace;
- struct dpu_hw_fmt_layout layout;
- bool layout_valid = false;
- int ret;
-
- ret = dpu_format_populate_layout(aspace, fb, &layout);
- if (ret)
- DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret);
- else
- layout_valid = true;
pstate->pending = true;
@@ -1125,12 +1114,12 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane)
dpu_plane_sspp_update_pipe(plane, pipe, pipe_cfg, fmt,
drm_mode_vrefresh(&crtc->mode),
- layout_valid ? &layout : NULL);
+ &pstate->layout);
if (r_pipe->sspp) {
dpu_plane_sspp_update_pipe(plane, r_pipe, r_pipe_cfg, fmt,
drm_mode_vrefresh(&crtc->mode),
- layout_valid ? &layout : NULL);
+ &pstate->layout);
}
if (pstate->needs_qos_remap)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h
index abd6b21a049b..348b0075d1ce 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h
@@ -31,6 +31,7 @@
* @plane_clk: calculated clk per plane
* @needs_dirtyfb: whether attached CRTC needs pixel data explicitly flushed
* @rotation: simplified drm rotation hint
+ * @layout: framebuffer memory layout
*/
struct dpu_plane_state {
struct drm_plane_state base;
@@ -48,6 +49,8 @@ struct dpu_plane_state {
bool needs_dirtyfb;
unsigned int rotation;
+
+ struct dpu_hw_fmt_layout layout;
};
#define to_dpu_plane_state(x) \
--
2.39.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 4/9] drm/msm/dpu: split dpu_format_populate_layout
2024-06-13 22:36 [PATCH v3 0/9] drm/msm/dpu: be more friendly to X.org Dmitry Baryshkov
` (2 preceding siblings ...)
2024-06-13 22:36 ` [PATCH v3 3/9] drm/msm/dpu: drop dpu_format_populate_layout from dpu_plane_sspp_atomic_update Dmitry Baryshkov
@ 2024-06-13 22:36 ` Dmitry Baryshkov
2024-06-18 22:51 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 5/9] drm/msm/dpu: move dpu_format_populate_plane_sizes to atomic_check Dmitry Baryshkov
` (4 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-13 22:36 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
Split dpu_format_populate_layout() into addess-related and
pitch/format-related parts.
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
.../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 8 +++-
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 45 ++++++++++++----------
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 8 +++-
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 12 ++++--
4 files changed, 46 insertions(+), 27 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
index d3ea91c1d7d2..ccf2d030cf20 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
@@ -584,7 +584,13 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc
return;
}
- ret = dpu_format_populate_layout(aspace, job->fb, &wb_cfg->dest);
+ ret = dpu_format_populate_plane_sizes(job->fb, &wb_cfg->dest);
+ if (ret) {
+ DPU_DEBUG("failed to populate plane sizes%d\n", ret);
+ return;
+ }
+
+ ret = dpu_format_populate_addrs(aspace, job->fb, &wb_cfg->dest);
if (ret) {
DPU_DEBUG("failed to populate layout %d\n", ret);
return;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
index 027eb5ecff08..c6485cb6f1d2 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
@@ -93,7 +93,7 @@ static int _dpu_format_get_media_color_ubwc(const struct msm_format *fmt)
return color_fmt;
}
-static int _dpu_format_get_plane_sizes_ubwc(
+static int _dpu_format_populate_plane_sizes_ubwc(
const struct msm_format *fmt,
const uint32_t width,
const uint32_t height,
@@ -172,7 +172,7 @@ static int _dpu_format_get_plane_sizes_ubwc(
return 0;
}
-static int _dpu_format_get_plane_sizes_linear(
+static int _dpu_format_populate_plane_sizes_linear(
const struct msm_format *fmt,
const uint32_t width,
const uint32_t height,
@@ -244,27 +244,38 @@ static int _dpu_format_get_plane_sizes_linear(
return 0;
}
-static int dpu_format_get_plane_sizes(
- const struct msm_format *fmt,
- const uint32_t w,
- const uint32_t h,
- struct dpu_hw_fmt_layout *layout,
- const uint32_t *pitches)
+/*
+ * dpu_format_populate_addrs - populate non-address part of the layout based on
+ * fb, and format found in the fb
+ * @fb: framebuffer pointer
+ * @layout: format layout structure to populate
+ *
+ * Return: error code on failure or 0 if new addresses were populated
+ */
+int dpu_format_populate_plane_sizes(
+ struct drm_framebuffer *fb,
+ struct dpu_hw_fmt_layout *layout)
{
- if (!layout || !fmt) {
+ const struct msm_format *fmt;
+
+ if (!layout || !fb) {
DRM_ERROR("invalid pointer\n");
return -EINVAL;
}
- if ((w > DPU_MAX_IMG_WIDTH) || (h > DPU_MAX_IMG_HEIGHT)) {
+ if (fb->width > DPU_MAX_IMG_WIDTH ||
+ fb->height > DPU_MAX_IMG_HEIGHT) {
DRM_ERROR("image dimensions outside max range\n");
return -ERANGE;
}
+ fmt = msm_framebuffer_format(fb);
+
if (MSM_FORMAT_IS_UBWC(fmt) || MSM_FORMAT_IS_TILE(fmt))
- return _dpu_format_get_plane_sizes_ubwc(fmt, w, h, layout);
+ return _dpu_format_populate_plane_sizes_ubwc(fmt, fb->width, fb->height, layout);
- return _dpu_format_get_plane_sizes_linear(fmt, w, h, layout, pitches);
+ return _dpu_format_populate_plane_sizes_linear(fmt, fb->width, fb->height,
+ layout, fb->pitches);
}
static int _dpu_format_populate_addrs_ubwc(
@@ -388,7 +399,7 @@ static int _dpu_format_populate_addrs_linear(
return 0;
}
-int dpu_format_populate_layout(
+int dpu_format_populate_addrs(
struct msm_gem_address_space *aspace,
struct drm_framebuffer *fb,
struct dpu_hw_fmt_layout *layout)
@@ -406,14 +417,6 @@ int dpu_format_populate_layout(
return -ERANGE;
}
- layout->format = msm_framebuffer_format(fb);
-
- /* Populate the plane sizes etc via get_format */
- ret = dpu_format_get_plane_sizes(layout->format, fb->width, fb->height,
- layout, fb->pitches);
- if (ret)
- return ret;
-
/* Populate the addresses given the fb */
if (MSM_FORMAT_IS_UBWC(layout->format) ||
MSM_FORMAT_IS_TILE(layout->format))
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h
index ef1239c95058..2f2bff14c0db 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h
@@ -32,7 +32,7 @@ static inline bool dpu_find_format(u32 format, const u32 *supported_formats,
}
/**
- * dpu_format_populate_layout - populate the given format layout based on
+ * dpu_format_populate_addrs - populate buffer addresses based on
* mmu, fb, and format found in the fb
* @aspace: address space pointer
* @fb: framebuffer pointer
@@ -41,9 +41,13 @@ static inline bool dpu_find_format(u32 format, const u32 *supported_formats,
* Return: error code on failure, -EAGAIN if success but the addresses
* are the same as before or 0 if new addresses were populated
*/
-int dpu_format_populate_layout(
+int dpu_format_populate_addrs(
struct msm_gem_address_space *aspace,
struct drm_framebuffer *fb,
struct dpu_hw_fmt_layout *fmtl);
+int dpu_format_populate_plane_sizes(
+ struct drm_framebuffer *fb,
+ struct dpu_hw_fmt_layout *layout);
+
#endif /*_DPU_FORMATS_H */
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index 9ee178a09a3b..a57853ac70b1 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -674,10 +674,16 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane,
}
}
+ ret = dpu_format_populate_plane_sizes(new_state->fb, &pstate->layout);
+ if (ret) {
+ DPU_ERROR_PLANE(pdpu, "failed to get format plane sizes, %d\n", ret);
+ return ret;
+ }
+
/* validate framebuffer layout before commit */
- ret = dpu_format_populate_layout(pstate->aspace,
- new_state->fb,
- &pstate->layout);
+ ret = dpu_format_populate_addrs(pstate->aspace,
+ new_state->fb,
+ &pstate->layout);
if (ret) {
DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret);
return ret;
--
2.39.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 5/9] drm/msm/dpu: move dpu_format_populate_plane_sizes to atomic_check
2024-06-13 22:36 [PATCH v3 0/9] drm/msm/dpu: be more friendly to X.org Dmitry Baryshkov
` (3 preceding siblings ...)
2024-06-13 22:36 ` [PATCH v3 4/9] drm/msm/dpu: split dpu_format_populate_layout Dmitry Baryshkov
@ 2024-06-13 22:36 ` Dmitry Baryshkov
2024-06-13 23:19 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 6/9] drm/msm/dpu: check for the plane pitch overflow Dmitry Baryshkov
` (3 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-13 22:36 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
Move a call to dpu_format_populate_plane_sizes() to the atomic_check
step, so that any issues with the FB layout can be reported as early as
possible.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index a57853ac70b1..927fde2f1391 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -674,12 +674,6 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane,
}
}
- ret = dpu_format_populate_plane_sizes(new_state->fb, &pstate->layout);
- if (ret) {
- DPU_ERROR_PLANE(pdpu, "failed to get format plane sizes, %d\n", ret);
- return ret;
- }
-
/* validate framebuffer layout before commit */
ret = dpu_format_populate_addrs(pstate->aspace,
new_state->fb,
@@ -865,6 +859,12 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
return -E2BIG;
}
+ ret = dpu_format_populate_plane_sizes(new_plane_state->fb, &pstate->layout);
+ if (ret) {
+ DPU_ERROR_PLANE(pdpu, "failed to get format plane sizes, %d\n", ret);
+ return ret;
+ }
+
fmt = msm_framebuffer_format(new_plane_state->fb);
max_linewidth = pdpu->catalog->caps->max_linewidth;
--
2.39.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 6/9] drm/msm/dpu: check for the plane pitch overflow
2024-06-13 22:36 [PATCH v3 0/9] drm/msm/dpu: be more friendly to X.org Dmitry Baryshkov
` (4 preceding siblings ...)
2024-06-13 22:36 ` [PATCH v3 5/9] drm/msm/dpu: move dpu_format_populate_plane_sizes to atomic_check Dmitry Baryshkov
@ 2024-06-13 22:36 ` Dmitry Baryshkov
2024-06-18 22:53 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 7/9] drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin Dmitry Baryshkov
` (2 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-13 22:36 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
Check that the plane pitch doesn't overflow the maximum pitch size
allowed by the hardware.
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 2 ++
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 6 +++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
index 4a910b808687..8998d1862e16 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
@@ -12,6 +12,8 @@
struct dpu_hw_sspp;
+#define DPU_SSPP_MAX_PITCH_SIZE 0xffff
+
/**
* Flags
*/
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index 927fde2f1391..b5848fae14ce 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -791,7 +791,7 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
{
struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
plane);
- int ret = 0, min_scale;
+ int i, ret = 0, min_scale;
struct dpu_plane *pdpu = to_dpu_plane(plane);
struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
u64 max_mdp_clk_rate = kms->perf.max_core_clk_rate;
@@ -865,6 +865,10 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
return ret;
}
+ for (i = 0; i < pstate->layout.num_planes; i++)
+ if (pstate->layout.plane_pitch[i] > DPU_SSPP_MAX_PITCH_SIZE)
+ return -E2BIG;
+
fmt = msm_framebuffer_format(new_plane_state->fb);
max_linewidth = pdpu->catalog->caps->max_linewidth;
--
2.39.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 7/9] drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin
2024-06-13 22:36 [PATCH v3 0/9] drm/msm/dpu: be more friendly to X.org Dmitry Baryshkov
` (5 preceding siblings ...)
2024-06-13 22:36 ` [PATCH v3 6/9] drm/msm/dpu: check for the plane pitch overflow Dmitry Baryshkov
@ 2024-06-13 22:36 ` Dmitry Baryshkov
2024-06-13 23:20 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 8/9] drm/msm/dpu: merge MAX_IMG_WIDTH/HEIGHT with DPU_MAX_IMG_WIDTH/HEIGHT Dmitry Baryshkov
2024-06-13 22:36 ` [PATCH v3 9/9] drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c Dmitry Baryshkov
8 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-13 22:36 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
The dpu_crtc_atomic_check() already calls the function
_dpu_crtc_check_and_setup_lm_bounds(). There is no need to call it
again from dpu_crtc_atomic_begin().
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index b0d81e8ea765..5dbf5254d310 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -809,8 +809,6 @@ static void dpu_crtc_atomic_begin(struct drm_crtc *crtc,
DRM_DEBUG_ATOMIC("crtc%d\n", crtc->base.id);
- _dpu_crtc_check_and_setup_lm_bounds(crtc, crtc->state);
-
/* encoder will trigger pending mask now */
drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask)
dpu_encoder_trigger_kickoff_pending(encoder);
--
2.39.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 8/9] drm/msm/dpu: merge MAX_IMG_WIDTH/HEIGHT with DPU_MAX_IMG_WIDTH/HEIGHT
2024-06-13 22:36 [PATCH v3 0/9] drm/msm/dpu: be more friendly to X.org Dmitry Baryshkov
` (6 preceding siblings ...)
2024-06-13 22:36 ` [PATCH v3 7/9] drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin Dmitry Baryshkov
@ 2024-06-13 22:36 ` Dmitry Baryshkov
2024-06-18 22:57 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 9/9] drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c Dmitry Baryshkov
8 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-13 22:36 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
dpu_formats.c defines DPU_MAX_IMG_WIDTH and _HEIGHT, while
dpu_hw_catalog.h defines just MAX_IMG_WIDTH and _HEIGHT. Merge these
constants to remove duplication.
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 3 ---
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 ++--
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 ++--
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
index c6485cb6f1d2..6d7c4373bf84 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
@@ -13,9 +13,6 @@
#define DPU_UBWC_PLANE_SIZE_ALIGNMENT 4096
-#define DPU_MAX_IMG_WIDTH 0x3FFF
-#define DPU_MAX_IMG_HEIGHT 0x3FFF
-
/*
* struct dpu_media_color_map - maps drm format to media format
* @format: DRM base pixel format
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
index d1aef778340b..af2ead1c4886 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
@@ -21,8 +21,8 @@
#define DPU_HW_BLK_NAME_LEN 16
-#define MAX_IMG_WIDTH 0x3fff
-#define MAX_IMG_HEIGHT 0x3fff
+#define DPU_MAX_IMG_WIDTH 0x3fff
+#define DPU_MAX_IMG_HEIGHT 0x3fff
#define CRTC_DUAL_MIXERS 2
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index b5848fae14ce..6000e84598c2 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -852,8 +852,8 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
fb_rect.y2 = new_plane_state->fb->height;
/* Ensure fb size is supported */
- if (drm_rect_width(&fb_rect) > MAX_IMG_WIDTH ||
- drm_rect_height(&fb_rect) > MAX_IMG_HEIGHT) {
+ if (drm_rect_width(&fb_rect) > DPU_MAX_IMG_WIDTH ||
+ drm_rect_height(&fb_rect) > DPU_MAX_IMG_HEIGHT) {
DPU_DEBUG_PLANE(pdpu, "invalid framebuffer " DRM_RECT_FMT "\n",
DRM_RECT_ARG(&fb_rect));
return -E2BIG;
--
2.39.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 9/9] drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c
2024-06-13 22:36 [PATCH v3 0/9] drm/msm/dpu: be more friendly to X.org Dmitry Baryshkov
` (7 preceding siblings ...)
2024-06-13 22:36 ` [PATCH v3 8/9] drm/msm/dpu: merge MAX_IMG_WIDTH/HEIGHT with DPU_MAX_IMG_WIDTH/HEIGHT Dmitry Baryshkov
@ 2024-06-13 22:36 ` Dmitry Baryshkov
2024-06-13 23:16 ` Abhinav Kumar
8 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-13 22:36 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
Lift mode_config limits set by the DPU driver to the actual FB limits as
handled by the dpu_plane.c. Move 2*max_lm_width check where it belongs,
to the drm_crtc_helper_funcs::mode_valid() callback.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 15 +++++++++++++++
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 ++-------
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 5dbf5254d310..44531666edf2 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1236,6 +1236,20 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
return 0;
}
+static enum drm_mode_status dpu_crtc_mode_valid(struct drm_crtc *crtc,
+ const struct drm_display_mode *mode)
+{
+ struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(crtc);
+
+ /*
+ * max crtc width is equal to the max mixer width * 2 and max height is
+ * is 4K
+ */
+ return drm_mode_validate_size(mode,
+ 2 * dpu_kms->catalog->caps->max_mixer_width,
+ 4096);
+}
+
int dpu_crtc_vblank(struct drm_crtc *crtc, bool en)
{
struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
@@ -1451,6 +1465,7 @@ static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = {
.atomic_check = dpu_crtc_atomic_check,
.atomic_begin = dpu_crtc_atomic_begin,
.atomic_flush = dpu_crtc_atomic_flush,
+ .mode_valid = dpu_crtc_mode_valid,
.get_scanout_position = dpu_crtc_get_scanout_position,
};
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 0d1dcc94455c..d1b937e127b0 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1147,13 +1147,8 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
dev->mode_config.min_width = 0;
dev->mode_config.min_height = 0;
- /*
- * max crtc width is equal to the max mixer width * 2 and max height is
- * is 4K
- */
- dev->mode_config.max_width =
- dpu_kms->catalog->caps->max_mixer_width * 2;
- dev->mode_config.max_height = 4096;
+ dev->mode_config.max_width = DPU_MAX_IMG_WIDTH;
+ dev->mode_config.max_height = DPU_MAX_IMG_HEIGHT;
dev->max_vblank_count = 0xffffffff;
/* Disable vblank irqs aggressively for power-saving */
--
2.39.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH v3 1/9] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds()
2024-06-13 22:36 ` [PATCH v3 1/9] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds() Dmitry Baryshkov
@ 2024-06-13 23:13 ` Abhinav Kumar
2024-06-18 22:49 ` Abhinav Kumar
0 siblings, 1 reply; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-13 23:13 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> Make _dpu_crtc_setup_lm_bounds() check that CRTC width is not
> overflowing LM requirements. Rename the function accordingly.
>
> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 2/9] drm/msm/dpu: drop dpu_format_check_modified_format
2024-06-13 22:36 ` [PATCH v3 2/9] drm/msm/dpu: drop dpu_format_check_modified_format Dmitry Baryshkov
@ 2024-06-13 23:14 ` Abhinav Kumar
2024-06-18 22:50 ` Abhinav Kumar
0 siblings, 1 reply; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-13 23:14 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> The msm_kms_funcs::check_modified_format() callback is not used by the
> driver. Drop it completely.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 43 -----------------------------
> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 16 -----------
> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 1 -
> drivers/gpu/drm/msm/msm_kms.h | 6 ----
> 4 files changed, 66 deletions(-)
>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 9/9] drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c
2024-06-13 22:36 ` [PATCH v3 9/9] drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c Dmitry Baryshkov
@ 2024-06-13 23:16 ` Abhinav Kumar
2024-06-18 22:57 ` Abhinav Kumar
0 siblings, 1 reply; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-13 23:16 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> Lift mode_config limits set by the DPU driver to the actual FB limits as
> handled by the dpu_plane.c. Move 2*max_lm_width check where it belongs,
> to the drm_crtc_helper_funcs::mode_valid() callback.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 15 +++++++++++++++
> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 ++-------
> 2 files changed, 17 insertions(+), 7 deletions(-)
>
Did anything change in this patch from v2 that the R-b was dropped?
Here it is again,
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 5/9] drm/msm/dpu: move dpu_format_populate_plane_sizes to atomic_check
2024-06-13 22:36 ` [PATCH v3 5/9] drm/msm/dpu: move dpu_format_populate_plane_sizes to atomic_check Dmitry Baryshkov
@ 2024-06-13 23:19 ` Abhinav Kumar
2024-06-14 10:34 ` Dmitry Baryshkov
0 siblings, 1 reply; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-13 23:19 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> Move a call to dpu_format_populate_plane_sizes() to the atomic_check
> step, so that any issues with the FB layout can be reported as early as
> possible.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
Did anything change between v2 to v3 that R-b was dropped?
Here it is again,
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 7/9] drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin
2024-06-13 22:36 ` [PATCH v3 7/9] drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin Dmitry Baryshkov
@ 2024-06-13 23:20 ` Abhinav Kumar
2024-06-18 22:56 ` Abhinav Kumar
0 siblings, 1 reply; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-13 23:20 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> The dpu_crtc_atomic_check() already calls the function
> _dpu_crtc_check_and_setup_lm_bounds(). There is no need to call it
> again from dpu_crtc_atomic_begin().
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 --
> 1 file changed, 2 deletions(-)
>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 5/9] drm/msm/dpu: move dpu_format_populate_plane_sizes to atomic_check
2024-06-13 23:19 ` Abhinav Kumar
@ 2024-06-14 10:34 ` Dmitry Baryshkov
2024-06-18 22:52 ` Abhinav Kumar
0 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-14 10:34 UTC (permalink / raw)
To: Abhinav Kumar
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Daniel Vetter,
Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On Thu, Jun 13, 2024 at 04:19:07PM GMT, Abhinav Kumar wrote:
>
>
> On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> > Move a call to dpu_format_populate_plane_sizes() to the atomic_check
> > step, so that any issues with the FB layout can be reported as early as
> > possible.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> > drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
>
> Did anything change between v2 to v3 that R-b was dropped?
No, it was my failure to run b4 trailers, please excuse me.
>
> Here it is again,
>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 1/9] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds()
2024-06-13 23:13 ` Abhinav Kumar
@ 2024-06-18 22:49 ` Abhinav Kumar
0 siblings, 0 replies; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-18 22:49 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 4:13 PM, Abhinav Kumar wrote:
>
>
> On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
>> Make _dpu_crtc_setup_lm_bounds() check that CRTC width is not
>> overflowing LM requirements. Rename the function accordingly.
>>
>> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 17 +++++++++++++----
>> 1 file changed, 13 insertions(+), 4 deletions(-)
>>
>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
As promised,
Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 2/9] drm/msm/dpu: drop dpu_format_check_modified_format
2024-06-13 23:14 ` Abhinav Kumar
@ 2024-06-18 22:50 ` Abhinav Kumar
0 siblings, 0 replies; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-18 22:50 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 4:14 PM, Abhinav Kumar wrote:
>
>
> On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
>> The msm_kms_funcs::check_modified_format() callback is not used by the
>> driver. Drop it completely.
>>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 43
>> -----------------------------
>> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 16 -----------
>> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 1 -
>> drivers/gpu/drm/msm/msm_kms.h | 6 ----
>> 4 files changed, 66 deletions(-)
>>
>
>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 3/9] drm/msm/dpu: drop dpu_format_populate_layout from dpu_plane_sspp_atomic_update
2024-06-13 22:36 ` [PATCH v3 3/9] drm/msm/dpu: drop dpu_format_populate_layout from dpu_plane_sspp_atomic_update Dmitry Baryshkov
@ 2024-06-18 22:51 ` Abhinav Kumar
0 siblings, 0 replies; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-18 22:51 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> The dpu_plane_prepare_fb() already calls dpu_format_populate_layout().
> Store the generated layout in the plane state and drop this call from
> dpu_plane_sspp_update().
>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 19 ++++---------------
> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h | 3 +++
> 2 files changed, 7 insertions(+), 15 deletions(-)
>
Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 4/9] drm/msm/dpu: split dpu_format_populate_layout
2024-06-13 22:36 ` [PATCH v3 4/9] drm/msm/dpu: split dpu_format_populate_layout Dmitry Baryshkov
@ 2024-06-18 22:51 ` Abhinav Kumar
0 siblings, 0 replies; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-18 22:51 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> Split dpu_format_populate_layout() into addess-related and
> pitch/format-related parts.
>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 8 +++-
> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 45 ++++++++++++----------
> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 8 +++-
> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 12 ++++--
> 4 files changed, 46 insertions(+), 27 deletions(-)
>
as promised,
Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 5/9] drm/msm/dpu: move dpu_format_populate_plane_sizes to atomic_check
2024-06-14 10:34 ` Dmitry Baryshkov
@ 2024-06-18 22:52 ` Abhinav Kumar
0 siblings, 0 replies; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-18 22:52 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Daniel Vetter,
Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/14/2024 3:34 AM, Dmitry Baryshkov wrote:
> On Thu, Jun 13, 2024 at 04:19:07PM GMT, Abhinav Kumar wrote:
>>
>>
>> On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
>>> Move a call to dpu_format_populate_plane_sizes() to the atomic_check
>>> step, so that any issues with the FB layout can be reported as early as
>>> possible.
>>>
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>> ---
>>> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 12 ++++++------
>>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>>
>>
>> Did anything change between v2 to v3 that R-b was dropped?
>
> No, it was my failure to run b4 trailers, please excuse me.
>
no problem.
Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280
>>
>> Here it is again,
>>
>> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 6/9] drm/msm/dpu: check for the plane pitch overflow
2024-06-13 22:36 ` [PATCH v3 6/9] drm/msm/dpu: check for the plane pitch overflow Dmitry Baryshkov
@ 2024-06-18 22:53 ` Abhinav Kumar
0 siblings, 0 replies; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-18 22:53 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> Check that the plane pitch doesn't overflow the maximum pitch size
> allowed by the hardware.
>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 2 ++
> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 6 +++++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 7/9] drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin
2024-06-13 23:20 ` Abhinav Kumar
@ 2024-06-18 22:56 ` Abhinav Kumar
2024-06-19 3:26 ` Dmitry Baryshkov
0 siblings, 1 reply; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-18 22:56 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 4:20 PM, Abhinav Kumar wrote:
>
>
> On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
>> The dpu_crtc_atomic_check() already calls the function
>> _dpu_crtc_check_and_setup_lm_bounds(). There is no need to call it
>> again from dpu_crtc_atomic_begin().
>>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 --
>> 1 file changed, 2 deletions(-)
>>
>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
This change is causing a small regression on sc7280 chromebook.
I have tested and concluded that this is causing the chrome boot
animation to disappear.
I have tested a couple of times and without this change it works fine.
If this change was meant as an optimization, can we drop this one and
investigate later why this is causing one? I have not spent time
investigating why it happened. Rest of the series works well and I dont
see any dependency as such. Let me know if that works for you. Otherwise
I will have to spend a little more time on this patch and why chrome
compositor does not like this for the animation screen.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 8/9] drm/msm/dpu: merge MAX_IMG_WIDTH/HEIGHT with DPU_MAX_IMG_WIDTH/HEIGHT
2024-06-13 22:36 ` [PATCH v3 8/9] drm/msm/dpu: merge MAX_IMG_WIDTH/HEIGHT with DPU_MAX_IMG_WIDTH/HEIGHT Dmitry Baryshkov
@ 2024-06-18 22:57 ` Abhinav Kumar
0 siblings, 0 replies; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-18 22:57 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> dpu_formats.c defines DPU_MAX_IMG_WIDTH and _HEIGHT, while
> dpu_hw_catalog.h defines just MAX_IMG_WIDTH and _HEIGHT. Merge these
> constants to remove duplication.
>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 3 ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 ++--
> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 ++--
> 3 files changed, 4 insertions(+), 7 deletions(-)
>
Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 9/9] drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c
2024-06-13 23:16 ` Abhinav Kumar
@ 2024-06-18 22:57 ` Abhinav Kumar
0 siblings, 0 replies; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-18 22:57 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Sean Paul, Marijn Suijten,
David Airlie, Daniel Vetter
Cc: Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/13/2024 4:16 PM, Abhinav Kumar wrote:
>
>
> On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
>> Lift mode_config limits set by the DPU driver to the actual FB limits as
>> handled by the dpu_plane.c. Move 2*max_lm_width check where it belongs,
>> to the drm_crtc_helper_funcs::mode_valid() callback.
>>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 15 +++++++++++++++
>> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 ++-------
>> 2 files changed, 17 insertions(+), 7 deletions(-)
>>
>
> Did anything change in this patch from v2 that the R-b was dropped?
>
> Here it is again,
>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>
Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 7/9] drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin
2024-06-18 22:56 ` Abhinav Kumar
@ 2024-06-19 3:26 ` Dmitry Baryshkov
2024-06-19 17:10 ` Abhinav Kumar
0 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-19 3:26 UTC (permalink / raw)
To: Abhinav Kumar
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Daniel Vetter,
Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On Wed, 19 Jun 2024 at 01:56, Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
> On 6/13/2024 4:20 PM, Abhinav Kumar wrote:
> > On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> >> The dpu_crtc_atomic_check() already calls the function
> >> _dpu_crtc_check_and_setup_lm_bounds(). There is no need to call it
> >> again from dpu_crtc_atomic_begin().
> >>
> >> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> >> ---
> >> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 --
> >> 1 file changed, 2 deletions(-)
> >>
> >
> > Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>
>
> This change is causing a small regression on sc7280 chromebook.
>
> I have tested and concluded that this is causing the chrome boot
> animation to disappear.
>
> I have tested a couple of times and without this change it works fine.
>
> If this change was meant as an optimization, can we drop this one and
> investigate later why this is causing one? I have not spent time
> investigating why it happened. Rest of the series works well and I dont
> see any dependency as such. Let me know if that works for you. Otherwise
> I will have to spend a little more time on this patch and why chrome
> compositor does not like this for the animation screen.
Oh, my. Thank you for the test!
I think I know what's happening. The cstate->num_mixers gets set only
in dpu_encoder_virt_atomic_mode_set(). So during
dpu_crtc_atomic_check() we don't have cstate->num_mixers is stale (and
if it is 0, the check is skipped).
I guess I'll have to move cstate->mixers[] and cstate->num_mixers
assignment to the dpu_encoder_virt_atomic_check(). And maybe we should
start thinking about my old idea of moving resource allocation to the
CRTC code.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 7/9] drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin
2024-06-19 3:26 ` Dmitry Baryshkov
@ 2024-06-19 17:10 ` Abhinav Kumar
2024-06-20 11:59 ` Dmitry Baryshkov
0 siblings, 1 reply; 28+ messages in thread
From: Abhinav Kumar @ 2024-06-19 17:10 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Daniel Vetter,
Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On 6/18/2024 8:26 PM, Dmitry Baryshkov wrote:
> On Wed, 19 Jun 2024 at 01:56, Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>> On 6/13/2024 4:20 PM, Abhinav Kumar wrote:
>>> On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
>>>> The dpu_crtc_atomic_check() already calls the function
>>>> _dpu_crtc_check_and_setup_lm_bounds(). There is no need to call it
>>>> again from dpu_crtc_atomic_begin().
>>>>
>>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>>> ---
>>>> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 --
>>>> 1 file changed, 2 deletions(-)
>>>>
>>>
>>> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>>
>>
>> This change is causing a small regression on sc7280 chromebook.
>>
>> I have tested and concluded that this is causing the chrome boot
>> animation to disappear.
>>
>> I have tested a couple of times and without this change it works fine.
>>
>> If this change was meant as an optimization, can we drop this one and
>> investigate later why this is causing one? I have not spent time
>> investigating why it happened. Rest of the series works well and I dont
>> see any dependency as such. Let me know if that works for you. Otherwise
>> I will have to spend a little more time on this patch and why chrome
>> compositor does not like this for the animation screen.
>
> Oh, my. Thank you for the test!
> I think I know what's happening. The cstate->num_mixers gets set only
> in dpu_encoder_virt_atomic_mode_set(). So during
> dpu_crtc_atomic_check() we don't have cstate->num_mixers is stale (and
> if it is 0, the check is skipped).
>
Yes, it is a possible explanation for this.
> I guess I'll have to move cstate->mixers[] and cstate->num_mixers
> assignment to the dpu_encoder_virt_atomic_check(). And maybe we should
> start thinking about my old idea of moving resource allocation to the
> CRTC code.
>
I wonder if thats the right fix though because it seems correct to me
that num_mixers is set in mode_set after the atomic_check phase.
Perhaps the right way would be to breakup check_and_set() to check() and
set() respectively and call only the check() part in atomic_check() and
keep the set() part in atomic_begin to avoid duplication.
Either way, I think we should re-visit this as this patch by itself is
an optimization and I am totally fine if you want to merge the rest of
this series just dropping this one for now.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 7/9] drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin
2024-06-19 17:10 ` Abhinav Kumar
@ 2024-06-20 11:59 ` Dmitry Baryshkov
0 siblings, 0 replies; 28+ messages in thread
From: Dmitry Baryshkov @ 2024-06-20 11:59 UTC (permalink / raw)
To: Abhinav Kumar
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Daniel Vetter,
Abel Vesa, Johan Hovold, linux-arm-msm, dri-devel, freedreno
On Wed, 19 Jun 2024 at 20:10, Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>
>
>
> On 6/18/2024 8:26 PM, Dmitry Baryshkov wrote:
> > On Wed, 19 Jun 2024 at 01:56, Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
> >> On 6/13/2024 4:20 PM, Abhinav Kumar wrote:
> >>> On 6/13/2024 3:36 PM, Dmitry Baryshkov wrote:
> >>>> The dpu_crtc_atomic_check() already calls the function
> >>>> _dpu_crtc_check_and_setup_lm_bounds(). There is no need to call it
> >>>> again from dpu_crtc_atomic_begin().
> >>>>
> >>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> >>>> ---
> >>>> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 --
> >>>> 1 file changed, 2 deletions(-)
> >>>>
> >>>
> >>> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> >>
> >>
> >> This change is causing a small regression on sc7280 chromebook.
> >>
> >> I have tested and concluded that this is causing the chrome boot
> >> animation to disappear.
> >>
> >> I have tested a couple of times and without this change it works fine.
> >>
> >> If this change was meant as an optimization, can we drop this one and
> >> investigate later why this is causing one? I have not spent time
> >> investigating why it happened. Rest of the series works well and I dont
> >> see any dependency as such. Let me know if that works for you. Otherwise
> >> I will have to spend a little more time on this patch and why chrome
> >> compositor does not like this for the animation screen.
> >
> > Oh, my. Thank you for the test!
> > I think I know what's happening. The cstate->num_mixers gets set only
> > in dpu_encoder_virt_atomic_mode_set(). So during
> > dpu_crtc_atomic_check() we don't have cstate->num_mixers is stale (and
> > if it is 0, the check is skipped).
> >
>
> Yes, it is a possible explanation for this.
>
> > I guess I'll have to move cstate->mixers[] and cstate->num_mixers
> > assignment to the dpu_encoder_virt_atomic_check(). And maybe we should
> > start thinking about my old idea of moving resource allocation to the
> > CRTC code.
> >
>
> I wonder if thats the right fix though because it seems correct to me
> that num_mixers is set in mode_set after the atomic_check phase.
The state should be consistent after the atomic_check(). Currently it
is not. cstate->num_mixers is not correct until mode_set().
>
> Perhaps the right way would be to breakup check_and_set() to check() and
> set() respectively and call only the check() part in atomic_check() and
> keep the set() part in atomic_begin to avoid duplication.
>
> Either way, I think we should re-visit this as this patch by itself is
> an optimization and I am totally fine if you want to merge the rest of
> this series just dropping this one for now.
The patch itself might be an optimization, but it pointed out the
actual issue with cstate->num_mixers.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2024-06-20 11:59 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13 22:36 [PATCH v3 0/9] drm/msm/dpu: be more friendly to X.org Dmitry Baryshkov
2024-06-13 22:36 ` [PATCH v3 1/9] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds() Dmitry Baryshkov
2024-06-13 23:13 ` Abhinav Kumar
2024-06-18 22:49 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 2/9] drm/msm/dpu: drop dpu_format_check_modified_format Dmitry Baryshkov
2024-06-13 23:14 ` Abhinav Kumar
2024-06-18 22:50 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 3/9] drm/msm/dpu: drop dpu_format_populate_layout from dpu_plane_sspp_atomic_update Dmitry Baryshkov
2024-06-18 22:51 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 4/9] drm/msm/dpu: split dpu_format_populate_layout Dmitry Baryshkov
2024-06-18 22:51 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 5/9] drm/msm/dpu: move dpu_format_populate_plane_sizes to atomic_check Dmitry Baryshkov
2024-06-13 23:19 ` Abhinav Kumar
2024-06-14 10:34 ` Dmitry Baryshkov
2024-06-18 22:52 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 6/9] drm/msm/dpu: check for the plane pitch overflow Dmitry Baryshkov
2024-06-18 22:53 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 7/9] drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin Dmitry Baryshkov
2024-06-13 23:20 ` Abhinav Kumar
2024-06-18 22:56 ` Abhinav Kumar
2024-06-19 3:26 ` Dmitry Baryshkov
2024-06-19 17:10 ` Abhinav Kumar
2024-06-20 11:59 ` Dmitry Baryshkov
2024-06-13 22:36 ` [PATCH v3 8/9] drm/msm/dpu: merge MAX_IMG_WIDTH/HEIGHT with DPU_MAX_IMG_WIDTH/HEIGHT Dmitry Baryshkov
2024-06-18 22:57 ` Abhinav Kumar
2024-06-13 22:36 ` [PATCH v3 9/9] drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c Dmitry Baryshkov
2024-06-13 23:16 ` Abhinav Kumar
2024-06-18 22:57 ` Abhinav Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox