drm/msm: dpu: Allow planes to extend past active display
PATCH v2 1/1 drm/msm: dpu: Allow planes to extend past active display
From: Sean Paul <[email protected]>
The atomic_check is a bit too aggressive with respect to planes which leave the active area. This caused a bunch of log spew when the cursor got to the edge of the screen and stopped it from going all the way.
This patch removes the conservative bounds checks from atomic and clips the dst rect such that we properly display planes which go off the screen.
Changes in v2:
- Apply the clip to src as well (taking into account scaling)
--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1 -2
@@ -1551,8 +1551,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, cnt++; dst =drm_plane_state_dest (pstate); -if (!drm_rect_intersect (&clip, &dst) || - !drm_rect_equals (&clip, &dst)) { +if (!drm_rect_intersect (&clip, &dst)) {DPU_ERROR ("invalid vertical/horizontal destination\n" ); DPU_ERROR("display: " DRM_RECT_FMT " plane: " DRM_RECT_FMT "\n", DRM_RECT_ARG(&crtc_rect),
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +13 -1
@@ -1254,7 +1254,8 @@ static int dpu_plane_sspp_atomic_update(struct drm_plane *plane,const struct dpu_format *fmt;struct drm_crtc *crtc;struct drm_framebuffer *fb; -struct drm_rect src, dst; +struct drm_rect clip = {0 }, src, dst; +int hscale, vscale;if (!plane) {DPU_ERROR ("invalid plane\n" );
@@ -1300,6 +1301,17 @@ static int dpu_plane_sspp_atomic_update(struct drm_plane *plane, dst =drm_plane_state_dest (state); + hscale =drm_rect_calc_hscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + vscale =drm_rect_calc_vscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + + clip.x2 = crtc->state->adjusted_mode.hdisplay; + clip.y2 = crtc->state->adjusted_mode.vdisplay; +drm_rect_clip_scaled (&src, &dst, &clip, hscale, vscale); + DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FMT "->crtc%u " DRM_RECT_FMT ", %4.4s ubwc %d\n", fb->base.id, DRM_RECT_ARG(&src), crtc->base.id, DRM_RECT_ARG(&dst),
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Quoted 72 lines · Sean Paul
From: Sean Paul <[email protected]>
The
atomic_checkis a bit too aggressive with respect to planes which leave the active area. This caused a bunch of log spew when the cursor got to the edge of the screen and stopped it from going all the way.This patch removes the conservative bounds checks from atomic and clips the dst rect such that we properly display planes which go off the screen.
Changes in v2:
- Apply the clip to src as well (taking into account scaling)Cc Sravanthi Kollukuduru <[email protected]>Cc Jeykumar Sankaran <[email protected]>Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1
-2@@ -1551,8 +1551,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, cnt++; dst =drm_plane_state_dest (pstate); -if (!drm_rect_intersect (&clip, &dst) || - !drm_rect_equals (&clip, &dst)) { +if (!drm_rect_intersect (&clip, &dst)) {DPU_ERROR ("invalid vertical/horizontal destination\n");drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +0
-0DPU_ERROR("display: " DRM_RECT_FMT " plane: " DRM_RECT_FMT "\n",
DRM_RECT_ARG(&crtc_rect),drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +2
-1@@ -1254,7 +1254,8 @@ static int dpu_plane_sspp_atomic_update(structdrm_plane *plane, const struct dpu_format *fmt;struct drm_crtc *crtc;struct drm_framebuffer *fb; -struct drm_rect src, dst; +struct drm_rect clip = {0 }, src, dst; +int hscale, vscale;if (!plane) {drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +11
-0DPU_ERROR ("invalid plane\n" );@@ -1300,6 +1301,17 @@ static int dpu_plane_sspp_atomic_update(structdrm_plane *plane, dst =drm_plane_state_dest (state); + hscale =drm_rect_calc_hscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + vscale =drm_rect_calc_vscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + + clip.x2 = crtc->state->adjusted_mode.hdisplay; + clip.y2 = crtc->state->adjusted_mode.vdisplay; +drm_rect_clip_scaled (&src, &dst, &clip, hscale, vscale); + DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FMT "->crtc%u "
Quoted 4 lines
DRM_RECT_FMT
", %4.4s ubwc %d\n",fb->base.id,DRM_RECT_ARG(&src),
crtc->base.id,DRM_RECT_ARG(&dst),
Don't you have to update pdpu->pipe_cfg.src_rect and pdpu->pipe_cfg.dst_rect with clip?
Signature · 5 lines
Jeykumar S _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 8e057e8759588455e8a1816dd8336c33-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Quoted 72 lines · Jeykumar Sankaran
Quoted 71 lines · Sean Paul
From: Sean Paul <[email protected]>
The
atomic_checkis a bit too aggressive with respect to planes which leave the active area. This caused a bunch of log spew when the cursor got to the edge of the screen and stopped it from going all the way.This patch removes the conservative bounds checks from atomic and clips the dst rect such that we properly display planes which go off the screen.
Changes in v2:
- Apply the clip to src as well (taking into account scaling)Cc Sravanthi Kollukuduru <[email protected]>Cc Jeykumar Sankaran <[email protected]>Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1
-2@@ -1551,8 +1551,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, cnt++; dst =drm_plane_state_dest (pstate); -if (!drm_rect_intersect (&clip, &dst) || - !drm_rect_equals (&clip, &dst)) { +if (!drm_rect_intersect (&clip, &dst)) {DPU_ERROR ("invalid vertical/horizontal destination\n");DPU_ERROR("display: "
DRM_RECT_FMT" plane: "
DRM_RECT_FMT"\n",DRM_RECT_ARG(&crtc_rect),drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +2
-1@@ -1254,7 +1254,8 @@ static int dpu_plane_sspp_atomic_update(structdrm_plane *plane, const struct dpu_format *fmt;struct drm_crtc *crtc;struct drm_framebuffer *fb; -struct drm_rect src, dst; +struct drm_rect clip = {0 }, src, dst; +int hscale, vscale;if (!plane) {DPU_ERROR("invalid plane\n");drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +11
-0@@ -1300,6 +1301,17 @@ static int dpu_plane_sspp_atomic_update(structdrm_plane *plane, dst =drm_plane_state_dest (state); + hscale =drm_rect_calc_hscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + vscale =drm_rect_calc_vscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + + clip.x2 = crtc->state->adjusted_mode.hdisplay; + clip.y2 = crtc->state->adjusted_mode.vdisplay; +drm_rect_clip_scaled (&src, &dst, &clip, hscale, vscale); +
Quoted 9 lines
Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0
-0DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FMT "->crtc%u "
DRM_RECT_FMT", %4.4s ubwc %d\n", fb->base.id, DRM_RECT_ARG(&src), crtc->base.id, DRM_RECT_ARG(&dst),Don't you have to update
pdpu->pipe_cfg.src_rectandpdpu->pipe_cfg.dst_rectwith clip?
No, clip is the active area, so it'll always be equal to the adjusted mode.
Sean
Quoted 3 lines
--
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
A message that is not in the archive (sent off-list or not yet received): CAMavQKLERkicusw3d4FPuxrZSzHs+-dfkUuCyhij6=-CMGfUMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 92 lines · Sean Paul
Quoted 80 lines · Jeykumar Sankaran
Quoted 3 lines · Sean Paul
From: Sean Paul <[email protected]>
The
atomic_checkis a bit too aggressive with respect to planeswhich
Quoted 1 line
leave the active area. This caused a bunch of log spew when the
cursor
Quoted 1 line
got to the edge of the screen and stopped it from going all the
way.
Quoted 2 lines
This patch removes the conservative bounds checks from atomic and
clips
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c static int dpu_crtc_atomic_check(struct
Quoted 20 lines
the dst rect such that we properly display planes which go off the screen.
Changes in v2:
- Apply the clip to src as well (taking into account scaling)Cc Sravanthi Kollukuduru <[email protected]>Cc Jeykumar Sankaran <[email protected]>Signed-off-by Sean Paul <[email protected]>---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c| 3 +--drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c| 14 +++++++++++++-2 files changed, 14 insertions(+), 3 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +0
-0@@ -1551,8 +1551,7 @@ static int dpu_crtc_atomic_check(struct
drm_crtcQuoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1
-2*crtc, cnt++; dst =drm_plane_state_dest (pstate); -if (!drm_rect_intersect (&clip, &dst) || - !drm_rect_equals (&clip, &dst)) { +if (!drm_rect_intersect (&clip, &dst)) {DPU_ERROR("invalid vertical/horizontal
destination\n");
DPU_ERROR("display: "DRM_RECT_FMT" plane:"
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c static int
Quoted 8 lines
DRM_RECT_FMT"\n",DRM_RECT_ARG(&crtc_rect),drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0
-0@@ -1254,7 +1254,8 @@ static intdpu_plane_sspp_atomic_update(struct
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c static int
Quoted 11 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +2
-1drm_plane *plane, const struct dpu_format *fmt;struct drm_crtc *crtc;struct drm_framebuffer *fb; -struct drm_rect src, dst; +struct drm_rect clip = {0 }, src, dst; +int hscale, vscale;if (!plane) {
DPU_ERROR("invalid plane\n");drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0
-0@@ -1300,6 +1301,17 @@ static intdpu_plane_sspp_atomic_update(struct
Quoted 15 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +11
-0drm_plane *plane, dst =drm_plane_state_dest (state); + hscale =drm_rect_calc_hscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + vscale =drm_rect_calc_vscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + + clip.x2 = crtc->state->adjusted_mode.hdisplay; + clip.y2 = crtc->state->adjusted_mode.vdisplay; +drm_rect_clip_scaled (&src, &dst, &clip, hscale, vscale); +Quoted 8 lines
Quoted 5 lines
DPU_DEBUG_PLANE(pdpu, "FB[%u] "
DRM_RECT_FMT"->crtc%u "DRM_RECT_FMT
", %4.4s ubwc %d\n",fb->base.id[1],DRM_RECT_ARG(&src),crtc->base.id[1],DRM_RECT_ARG(&dst),Don't you have to update
pdpu->pipe_cfg.src_rectandpdpu->pipe_cfg.dst_rectwith clip?
Quoted 5 lines
No, clip is the active area, so it'll always be equal to the adjusted mode.
Sean
Got it! In that case, can drm_atomic_helper_check_plane_state helper be useful here?
Quoted 7 lines
Quoted 2 lines
--
Jeykumar SLinks:
------
[1] http://base.id
Signature · 5 lines
Jeykumar S _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
A message that is not in the archive (sent off-list or not yet received): 2c924a940e02978b470e98ee4331f33a-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Quoted 93 lines · Jeykumar Sankaran
Quoted 92 lines · Sean Paul
Quoted 88 lines · Jeykumar Sankaran
Quoted 3 lines · Sean Paul
From: Sean Paul <[email protected]>
The
atomic_checkis a bit too aggressive with respect to planeswhich
Quoted 1 line
leave the active area. This caused a bunch of log spew when the
cursor
Quoted 1 line
got to the edge of the screen and stopped it from going all the
way.
Quoted 2 lines
This patch removes the conservative bounds checks from atomic and
clips
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c static int dpu_crtc_atomic_check(struct
Quoted 20 lines
the dst rect such that we properly display planes which go off the screen.
Changes in v2:
- Apply the clip to src as well (taking into account scaling)Cc Sravanthi Kollukuduru <[email protected]>Cc Jeykumar Sankaran <[email protected]>Signed-off-by Sean Paul <[email protected]>---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c| 3 +--drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c| 14 +++++++++++++-2 files changed, 14 insertions(+), 3 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +0
-0@@ -1551,8 +1551,7 @@ static int dpu_crtc_atomic_check(struct
drm_crtcQuoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1
-2*crtc, cnt++; dst =drm_plane_state_dest (pstate); -if (!drm_rect_intersect (&clip, &dst) || - !drm_rect_equals (&clip, &dst)) { +if (!drm_rect_intersect (&clip, &dst)) {DPU_ERROR("invalid vertical/horizontal
destination\n");
DPU_ERROR("display: "DRM_RECT_FMT" plane:"
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c static int
Quoted 8 lines
DRM_RECT_FMT"\n",DRM_RECT_ARG(&crtc_rect),drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0
-0@@ -1254,7 +1254,8 @@ static intdpu_plane_sspp_atomic_update(struct
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c static int
Quoted 11 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +2
-1drm_plane *plane, const struct dpu_format *fmt;struct drm_crtc *crtc;struct drm_framebuffer *fb; -struct drm_rect src, dst; +struct drm_rect clip = {0 }, src, dst; +int hscale, vscale;if (!plane) {
DPU_ERROR("invalid plane\n");drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0
-0@@ -1300,6 +1301,17 @@ static intdpu_plane_sspp_atomic_update(struct
Quoted 15 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +11
-0drm_plane *plane, dst =drm_plane_state_dest (state); + hscale =drm_rect_calc_hscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + vscale =drm_rect_calc_vscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + + clip.x2 = crtc->state->adjusted_mode.hdisplay; + clip.y2 = crtc->state->adjusted_mode.vdisplay; +drm_rect_clip_scaled (&src, &dst, &clip, hscale, vscale); +Quoted 5 lines
DPU_DEBUG_PLANE(pdpu, "FB[%u] "
DRM_RECT_FMT"->crtc%u "DRM_RECT_FMT
", %4.4s ubwc %d\n",fb->base.id[1],DRM_RECT_ARG(&src),crtc->base.id[1],DRM_RECT_ARG(&dst),Don't you have to update
pdpu->pipe_cfg.src_rectandpdpu->pipe_cfg.dst_rectwith clip?
Quoted 8 lines
Quoted 5 lines
No, clip is the active area, so it'll always be equal to the adjusted mode.
Sean
Got it! In that case, can
drm_atomic_helper_check_plane_statehelper be useful here?
Yeah, good call, I'll switch over to that.
Thanks,
Sean
Quoted 11 lines
Quoted 8 lines
Quoted 3 lines
--
Jeykumar SLinks:
------
[1] http://base.idSignature · 1 line
Jeykumar S
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
A message that is not in the archive (sent off-list or not yet received): 20180828205106.15168-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org
Quoted 53 lines · Sean Paul
From: Sean Paul <[email protected]>
The
atomic_checkis a bit too aggressive with respect to planes which leave the active area. This caused a bunch of log spew when the cursor got to the edge of the screen and stopped it from going all the way.This patch removes the conservative bounds checks from atomic and clips the dst rect such that we properly display planes which go off the screen.
Changes in v2:
- Apply the clip to src as well (taking into account scaling)Cc Sravanthi Kollukuduru <[email protected]>Cc Jeykumar Sankaran <[email protected]>Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1
-2@@ -1551,8 +1551,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, cnt++; dst =drm_plane_state_dest (pstate); -if (!drm_rect_intersect (&clip, &dst) || - !drm_rect_equals (&clip, &dst)) { +if (!drm_rect_intersect (&clip, &dst)) {DPU_ERROR ("invalid vertical/horizontal destination\n" ); DPU_ERROR("display: " DRM_RECT_FMT " plane: " DRM_RECT_FMT "\n", DRM_RECT_ARG(&crtc_rect),drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +2
-1@@ -1254,7 +1254,8 @@ static int dpu_plane_sspp_atomic_update(struct drm_plane *plane,const struct dpu_format *fmt;struct drm_crtc *crtc;struct drm_framebuffer *fb; -struct drm_rect src, dst; +struct drm_rect clip = {0 }, src, dst; +int hscale, vscale;if (!plane) {DPU_ERROR ("invalid plane\n" );@@ -1300,6 +1301,17 @@ static int dpu_plane_sspp_atomic_update(struct drm_plane *plane, dst =drm_plane_state_dest (state);
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c static int dpu_plane_sspp_atomic_update(struct drm_plane *plane, · line 1313
Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +10
-0+ hscale =drm_rect_calc_hscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + vscale =drm_rect_calc_vscale (&src, &dst, + pdpu->pipe_sblk->maxupscale, + pdpu->pipe_sblk->maxdwnscale); + + clip.x2 = crtc->state->adjusted_mode.hdisplay; + clip.y2 = crtc->state->adjusted_mode.vdisplay; +drm_rect_clip_scaled (&src, &dst, &clip, hscale, vscale);
Can't use drm_atomic_helper_check_plane_state() ?
Quoted 11 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1
-0+ DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FMT "->crtc%u " DRM_RECT_FMT ", %4.4s ubwc %d\n", fb->base.id, DRM_RECT_ARG(&src), crtc->base.id, DRM_RECT_ARG(&dst),Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno