Skip to contentSkip to conversation

drm: drm_plane_helper_check_state() related stuff

PATCH In review Ville Syrjala 5 participants 31 messages Nov 1, 2017 – Nov 23, 2017

Subsystems (17)
lore
Share & tools
lore
#0 lore raw

cover drm: drm_plane_helper_check_state() related stuff

From: Ville Syrjälä <[email protected]>

While trawling the tree I spotted some issues with the way vmwgfx uses drm_plane_helper_check_state(). Here's my attempt at fixing it. Do note that I haven't actually tested the resulting code at all, but it does build at least.

And while touching that general area I took up Daniel's suggestion from long ago that drm_plane_helper_check_state() should be renamed and relocated to better reflect its status.

Here's a branch with the entire series:
git://github.com/vsyrjala/linux.git atomic_helper_plane_stuff

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Cc Daniel Vetter <[email protected]>

Ville Syrjälä (5):
drm/vmwgfx: Remove bogus crtc coords vs fb size check drm/vmwgfx: Use drm_plane_helper_check_state() drm/vmwgfx: Try to fix plane clipping
drm: Check crtc_state->enable rather than crtc->enabled in
drm_plane_helper_check_state()
drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

 drivers/gpu/drm/arm/hdlcd_crtc.c            |   8 +-
 drivers/gpu/drm/arm/malidp_planes.c         |   3 +-
 drivers/gpu/drm/drm_atomic_helper.c         |  95 ++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane_helper.c          | 111 +++-------------------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |   9 ++-
 drivers/gpu/drm/i915/intel_display.c        |  20 ++---
 drivers/gpu/drm/imx/ipuv3-plane.c           |   8 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |   8 +-
 drivers/gpu/drm/meson/meson_plane.c         |   8 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
 drivers/gpu/drm/nouveau/nv50_display.c      |  18 +++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c                  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  40 ++++------
 drivers/gpu/drm/zte/zx_plane.c              |  15 ++--
 include/drm/drm_atomic_helper.h             |   7 ++
 include/drm/drm_plane_helper.h              |   5 --
 17 files changed, 187 insertions(+), 183 deletions(-)
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 1/5 drm/vmwgfx: Remove bogus crtc coords vs fb size check

From: Ville Syrjälä <[email protected]>

Throw away the bugs crtc coords vs. fb size check. Crtc coords don't define the viewport inside the fb, that's a job for the src coords, which have been checked by the core already.

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +0 -6
index 0545740b3724..a4b56699679a 100644
@@ -476,12 +476,6 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 
 		vcs = vmw_connector_state_to_vcs(du->connector.state);
 
-		if ((dest.x2 > new_fb->width ||
-		     dest.y2 > new_fb->height)) {
-			DRM_ERROR("CRTC area outside of framebuffer\n");
-			return -EINVAL;
-		}
-
 		/* Only one active implicit framebuffer at a time. */
 		mutex_lock(&dev_priv->global_kms_state_mutex);
 		if (vcs->is_implicit && dev_priv->implicit_fb &&
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] drm/vmwgfx: Remove bogus crtc coords vs fb size check

Quoted 10 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Throw away the bugs crtc coords vs. fb size check. Crtc coords don't define the viewport inside the fb, that's a job for the src coords, which have been checked by the core already.

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Quoted 28 lines
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +0 -6
index 0545740b3724..a4b56699679a 100644
@@ -476,12 +476,6 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 
 		vcs = vmw_connector_state_to_vcs(du->connector.state);
 
-		if ((dest.x2 > new_fb->width ||
-		     dest.y2 > new_fb->height)) {
-			DRM_ERROR("CRTC area outside of framebuffer\n");
-			return -EINVAL;
-		}
-
 		/* Only one active implicit framebuffer at a time. */
 		mutex_lock(&dev_priv->global_kms_state_mutex);
 		if (vcs->is_implicit && dev_priv->implicit_fb &&
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/5
#3 lore raw

Re: [PATCH 1/5] drm/vmwgfx: Remove bogus crtc coords vs fb size check

In reply to Ville Syrjala

Hi Ville,

Thank you for the patch.

Quoted 10 lines · On Wednesday, 1 November 2017 20:29:16 EET Ville Syrjala wrote:

From: Ville Syrjälä <[email protected]>

Throw away the bugs crtc coords vs. fb size check. Crtc coords don't define the viewport inside the fb, that's a job for the src coords, which have been checked by the core already.

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Quoted 23 lines
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 ------
 1 file changed, 6 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 0545740b3724..a4b56699679a 100644

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +0 -6
@@ -476,12 +476,6 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane
 *plane,
 
 		vcs = vmw_connector_state_to_vcs(du->connector.state);
 
-		if ((dest.x2 > new_fb->width ||
-		     dest.y2 > new_fb->height)) {
-			DRM_ERROR("CRTC area outside of framebuffer\n");
-			return -EINVAL;
-		}
-
 		/* Only one active implicit framebuffer at a time. */
 		mutex_lock(&dev_priv->global_kms_state_mutex);

if (vcs->is_implicit && dev_priv->implicit_fb &&

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 2/5 drm/vmwgfx: Use drm_plane_helper_check_state()

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Atomic drivers have no reason to use drm_plane_helper_check_update() instead of drm_plane_helper_check_state(). So let's switch over.

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +3 -14
index a4b56699679a..515b67783a41 100644
@@ -442,29 +442,18 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 				      struct drm_plane_state *state)
 {
 	struct drm_framebuffer *new_fb = state->fb;
-	bool visible;
-
-	struct drm_rect src = {
-		.x1 = state->src_x,
-		.y1 = state->src_y,
-		.x2 = state->src_x + state->src_w,
-		.y2 = state->src_y + state->src_h,
-	};
-	struct drm_rect dest = {
+	struct drm_rect clip = {
 		.x1 = state->crtc_x,
 		.y1 = state->crtc_y,
 		.x2 = state->crtc_x + state->crtc_w,
 		.y2 = state->crtc_y + state->crtc_h,
 	};
-	struct drm_rect clip = dest;
 	int ret;
 
-	ret = drm_plane_helper_check_update(plane, state->crtc, new_fb,
-					    &src, &dest, &clip,
-					    DRM_MODE_ROTATE_0,
+	ret = drm_plane_helper_check_state(state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true, &visible);
+					    false, true);
 
 
 	if (!ret && new_fb) {
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/5
#5 lore raw

Re: [PATCH 2/5] drm/vmwgfx: Use drm_plane_helper_check_state()

Quoted 9 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Atomic drivers have no reason to use drm_plane_helper_check_update() instead of drm_plane_helper_check_state(). So let's switch over.

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>

I think the new atomic helper landed at about the same time vmwgfx landed, hence why it wasn't converted.

Quoted 48 lines
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +3 -14
index a4b56699679a..515b67783a41 100644
@@ -442,29 +442,18 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 				      struct drm_plane_state *state)
 {
 	struct drm_framebuffer *new_fb = state->fb;
-	bool visible;
-
-	struct drm_rect src = {
-		.x1 = state->src_x,
-		.y1 = state->src_y,
-		.x2 = state->src_x + state->src_w,
-		.y2 = state->src_y + state->src_h,
-	};
-	struct drm_rect dest = {
+	struct drm_rect clip = {
 		.x1 = state->crtc_x,
 		.y1 = state->crtc_y,
 		.x2 = state->crtc_x + state->crtc_w,
 		.y2 = state->crtc_y + state->crtc_h,
 	};
-	struct drm_rect clip = dest;
 	int ret;
 
-	ret = drm_plane_helper_check_update(plane, state->crtc, new_fb,
-					    &src, &dest, &clip,
-					    DRM_MODE_ROTATE_0,
+	ret = drm_plane_helper_check_state(state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true, &visible);
+					    false, true);
 
 
 	if (!ret && new_fb) {
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/5
#6 lore raw

Re: [PATCH 2/5] drm/vmwgfx: Use drm_plane_helper_check_state()

In reply to Ville Syrjala

Hi Ville,

Thank you for the patch.

Quoted 9 lines · On Wednesday, 1 November 2017 20:29:17 EET Ville Syrjala wrote:

From: Ville Syrjälä <[email protected]>

Atomic drivers have no reason to use drm_plane_helper_check_update() instead of drm_plane_helper_check_state(). So let's switch over.

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Quoted 42 lines
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index a4b56699679a..515b67783a41 100644

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +3 -14
@@ -442,29 +442,18 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane
 *plane, struct drm_plane_state *state)
 {
 	struct drm_framebuffer *new_fb = state->fb;
-	bool visible;
-
-	struct drm_rect src = {
-		.x1 = state->src_x,
-		.y1 = state->src_y,
-		.x2 = state->src_x + state->src_w,
-		.y2 = state->src_y + state->src_h,
-	};
-	struct drm_rect dest = {
+	struct drm_rect clip = {
 		.x1 = state->crtc_x,
 		.y1 = state->crtc_y,
 		.x2 = state->crtc_x + state->crtc_w,
 		.y2 = state->crtc_y + state->crtc_h,
 	};
-	struct drm_rect clip = dest;
 	int ret;
 
-	ret = drm_plane_helper_check_update(plane, state->crtc, new_fb,
-					    &src, &dest, &clip,
-					    DRM_MODE_ROTATE_0,
+	ret = drm_plane_helper_check_state(state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true, &visible);
+					    false, true);
 
 
 	if (!ret && new_fb) {
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

PATCH 3/5 drm/vmwgfx: Try to fix plane clipping

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Try to fix the code to actually clip the plane to the crtc bounds instead of the user provided crtc coordinates (which would be a no-op since those are exactly the coordinates before clipping).

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +13 -10
index 515b67783a41..efa41c086198 100644
@@ -441,20 +441,23 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
 int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 				      struct drm_plane_state *state)
 {
+	struct drm_crtc_state *crtc_state = NULL;
 	struct drm_framebuffer *new_fb = state->fb;
-	struct drm_rect clip = {
-		.x1 = state->crtc_x,
-		.y1 = state->crtc_y,
-		.x2 = state->crtc_x + state->crtc_w,
-		.y2 = state->crtc_y + state->crtc_h,
-	};
+	struct drm_rect clip = {};
 	int ret;
 
-	ret = drm_plane_helper_check_state(state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	if (state->crtc)
+		crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
 
+	if (crtc_state && crtc_state->enable) {
+		clip.x2 = crtc_state->adjusted_mode.hdisplay;
+		clip.y2 = crtc_state->adjusted_mode.vdisplay;
+	}
+
+	ret = drm_plane_helper_check_state(state, &clip,
+					   DRM_PLANE_HELPER_NO_SCALING,
+					   DRM_PLANE_HELPER_NO_SCALING,
+					   false, true);
 
 	if (!ret && new_fb) {
 		struct drm_crtc *crtc = state->crtc;
Signature · 6 lines
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Re: [PATCH 3/5] drm/vmwgfx: Try to fix plane clipping

Quoted 10 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Try to fix the code to actually clip the plane to the crtc bounds instead of the user provided crtc coordinates (which would be a no-op since those are exactly the coordinates before clipping).

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>

I kinda wonder whether we shouldn't push this down into the helper ...

Either way, Reviewed-by: Daniel Vetter <[email protected]>

Quoted 49 lines
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +13 -10
index 515b67783a41..efa41c086198 100644
@@ -441,20 +441,23 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
 int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 				      struct drm_plane_state *state)
 {
+	struct drm_crtc_state *crtc_state = NULL;
 	struct drm_framebuffer *new_fb = state->fb;
-	struct drm_rect clip = {
-		.x1 = state->crtc_x,
-		.y1 = state->crtc_y,
-		.x2 = state->crtc_x + state->crtc_w,
-		.y2 = state->crtc_y + state->crtc_h,
-	};
+	struct drm_rect clip = {};
 	int ret;
 
-	ret = drm_plane_helper_check_state(state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	if (state->crtc)
+		crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
 
+	if (crtc_state && crtc_state->enable) {
+		clip.x2 = crtc_state->adjusted_mode.hdisplay;
+		clip.y2 = crtc_state->adjusted_mode.vdisplay;
+	}
+
+	ret = drm_plane_helper_check_state(state, &clip,
+					   DRM_PLANE_HELPER_NO_SCALING,
+					   DRM_PLANE_HELPER_NO_SCALING,
+					   false, true);
 
 	if (!ret && new_fb) {
 		struct drm_crtc *crtc = state->crtc;
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

Re: [PATCH 3/5] drm/vmwgfx: Try to fix plane clipping

Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Try to fix the code to actually clip the plane to the crtc bounds instead of the user provided crtc coordinates (which would be a no-op since those are exactly the coordinates before clipping).

Quoted 6 lines
Quoted 4 lines
Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>

I kinda wonder whether we shouldn't push this down into the helper ...

Would require quite going through all drivers making sure they are happy with using the adjusted_mode.crtc_ timings. I think most drivers use the other adjusted_mode timings currently, and some even use the user mode timings (which could be an actual bug).

Quoted 57 lines

Either way, Reviewed-by: Daniel Vetter <[email protected]>

Quoted 49 lines
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +13 -10
index 515b67783a41..efa41c086198 100644
@@ -441,20 +441,23 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
 int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 				      struct drm_plane_state *state)
 {
+	struct drm_crtc_state *crtc_state = NULL;
 	struct drm_framebuffer *new_fb = state->fb;
-	struct drm_rect clip = {
-		.x1 = state->crtc_x,
-		.y1 = state->crtc_y,
-		.x2 = state->crtc_x + state->crtc_w,
-		.y2 = state->crtc_y + state->crtc_h,
-	};
+	struct drm_rect clip = {};
 	int ret;
 
-	ret = drm_plane_helper_check_state(state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	if (state->crtc)
+		crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
 
+	if (crtc_state && crtc_state->enable) {
+		clip.x2 = crtc_state->adjusted_mode.hdisplay;
+		clip.y2 = crtc_state->adjusted_mode.vdisplay;
+	}
+
+	ret = drm_plane_helper_check_state(state, &clip,
+					   DRM_PLANE_HELPER_NO_SCALING,
+					   DRM_PLANE_HELPER_NO_SCALING,
+					   false, true);
 
 	if (!ret && new_fb) {
 		struct drm_crtc *crtc = state->crtc;
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Re: [Intel-gfx] [PATCH 3/5] drm/vmwgfx: Try to fix plane clipping

Quoted 13 lines · Ville Syrjälä
Quoted 12 lines · Daniel Vetter
Quoted 10 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Try to fix the code to actually clip the plane to the crtc bounds instead of the user provided crtc coordinates (which would be a no-op since those are exactly the coordinates before clipping).

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Quoted 6 lines
Quoted 1 line

I kinda wonder whether we shouldn't push this down into the helper ...

Would require quite going through all drivers making sure they are happy with using the adjusted_mode.crtc_ timings. I think most drivers use the other adjusted_mode timings currently, and some even use the user mode timings (which could be an actual bug).

Let me take that back. What we want is to clip to the user mode timings. Stereo 3D needs the special treatment from drm_mode_get_hv_timing(). I'm getting confused by all these different timings we have all over the place.

I think for i915 all we would need is to change the double wide/dual link adjustent for pipe_src_w to simply reject odd widths instead. That would guarantee that the user mode timings match the pipe_src_w/h 100%.

For the other driver we'd need to figure out why they're using adjusted_mode timings for clipping. I guess that's just a mistake, which I repeated here with vmwgfx after getting confused by looking at the other drivers.

I guess I just volunteered myself to do this. Just needs plenty of acks from driver maintainers I suppose.

Quoted 66 lines
Quoted 58 lines

Either way, Reviewed-by: Daniel Vetter <[email protected]>

Quoted 49 lines
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +13 -10
index 515b67783a41..efa41c086198 100644
@@ -441,20 +441,23 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
 int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 				      struct drm_plane_state *state)
 {
+	struct drm_crtc_state *crtc_state = NULL;
 	struct drm_framebuffer *new_fb = state->fb;
-	struct drm_rect clip = {
-		.x1 = state->crtc_x,
-		.y1 = state->crtc_y,
-		.x2 = state->crtc_x + state->crtc_w,
-		.y2 = state->crtc_y + state->crtc_h,
-	};
+	struct drm_rect clip = {};
 	int ret;
 
-	ret = drm_plane_helper_check_state(state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	if (state->crtc)
+		crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
 
+	if (crtc_state && crtc_state->enable) {
+		clip.x2 = crtc_state->adjusted_mode.hdisplay;
+		clip.y2 = crtc_state->adjusted_mode.vdisplay;
+	}
+
+	ret = drm_plane_helper_check_state(state, &clip,
+					   DRM_PLANE_HELPER_NO_SCALING,
+					   DRM_PLANE_HELPER_NO_SCALING,
+					   false, true);
 
 	if (!ret && new_fb) {
 		struct drm_crtc *crtc = state->crtc;
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw

Re: [PATCH 3/5] drm/vmwgfx: Try to fix plane clipping

Quoted 31 lines · Ville Syrjälä
Quoted 13 lines · Ville Syrjälä
Quoted 12 lines · Daniel Vetter
Quoted 10 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Try to fix the code to actually clip the plane to the crtc bounds instead of the user provided crtc coordinates (which would be a no-op since those are exactly the coordinates before clipping).

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Quoted 6 lines
Quoted 1 line

I kinda wonder whether we shouldn't push this down into the helper ...

Would require quite going through all drivers making sure they are happy with using the adjusted_mode.crtc_ timings. I think most drivers use the other adjusted_mode timings currently, and some even use the user mode timings (which could be an actual bug).

Let me take that back. What we want is to clip to the user mode timings. Stereo 3D needs the special treatment from drm_mode_get_hv_timing(). I'm getting confused by all these different timings we have all over the place.

I think for i915 all we would need is to change the double wide/dual link adjustent for pipe_src_w to simply reject odd widths instead. That would guarantee that the user mode timings match the pipe_src_w/h 100%.

Quoted 7 lines

For the other driver we'd need to figure out why they're using adjusted_mode timings for clipping. I guess that's just a mistake, which I repeated here with vmwgfx after getting confused by looking at the other drivers.

I guess I just volunteered myself to do this. Just needs plenty of acks from driver maintainers I suppose.

Yeah consistently using drm_mode_get_hv_timing from crtc_state->requested_mode seems like the right thing to do. Otherwise there's a driver bug lurking somewhere ...
-Daniel

Quoted 71 lines
Quoted 67 lines
Quoted 59 lines

Either way, Reviewed-by: Daniel Vetter <[email protected]>

Quoted 49 lines
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +13 -10
index 515b67783a41..efa41c086198 100644
@@ -441,20 +441,23 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
 int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 				      struct drm_plane_state *state)
 {
+	struct drm_crtc_state *crtc_state = NULL;
 	struct drm_framebuffer *new_fb = state->fb;
-	struct drm_rect clip = {
-		.x1 = state->crtc_x,
-		.y1 = state->crtc_y,
-		.x2 = state->crtc_x + state->crtc_w,
-		.y2 = state->crtc_y + state->crtc_h,
-	};
+	struct drm_rect clip = {};
 	int ret;
 
-	ret = drm_plane_helper_check_state(state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	if (state->crtc)
+		crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
 
+	if (crtc_state && crtc_state->enable) {
+		clip.x2 = crtc_state->adjusted_mode.hdisplay;
+		clip.y2 = crtc_state->adjusted_mode.vdisplay;
+	}
+
+	ret = drm_plane_helper_check_state(state, &clip,
+					   DRM_PLANE_HELPER_NO_SCALING,
+					   DRM_PLANE_HELPER_NO_SCALING,
+					   false, true);
 
 	if (!ret && new_fb) {
 		struct drm_crtc *crtc = state->crtc;
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

Re: [Intel-gfx] [PATCH 3/5] drm/vmwgfx: Try to fix plane clipping

In reply to Ville Syrjälä

Hi Ville,

Quoted 9 lines · On Monday, 6 November 2017 20:04:38 EET Ville Syrjälä wrote:
Quoted 8 lines · Ville Syrjälä
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Try to fix the code to actually clip the plane to the crtc bounds instead of the user provided crtc coordinates (which would be a no-op since those are exactly the coordinates before clipping).

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>

I kinda wonder whether we shouldn't push this down into the helper ...

I think that would be nice.

Quoted 15 lines
Quoted 4 lines

Would require quite going through all drivers making sure they are happy with using the adjusted_mode.crtc_ timings. I think most drivers use the other adjusted_mode timings currently, and some even use the user mode timings (which could be an actual bug).

Let me take that back. What we want is to clip to the user mode timings. Stereo 3D needs the special treatment from drm_mode_get_hv_timing(). I'm getting confused by all these different timings we have all over the place.

I think for i915 all we would need is to change the double wide/dual link adjustent for pipe_src_w to simply reject odd widths instead. That would guarantee that the user mode timings match the pipe_src_w/h 100%.

Quoted 4 lines

For the other driver we'd need to figure out why they're using adjusted_mode timings for clipping. I guess that's just a mistake, which I repeated here with vmwgfx after getting confused by looking at the other drivers.

I suppose it's a mix of cargo-cult and the fact that adjusted_mode hints that it contains the timings that should be applied to the hardware. That's why I use it in rcar-du.

Are drivers allowed to adjust the hdisplay and vdisplay values though ? I thought unsupported values there had to be rejected with an error at atomic check time, not adjusted.

Quoted 2 lines

I guess I just volunteered myself to do this. Just needs plenty of acks from driver maintainers I suppose.

I'll review and test the rcar-du patch :-)

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw

PATCH 4/5 drm: Check crtc_state->enable rather than crtc->enabled in drm_plane_helper_check_state()

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

drm_plane_helper_check_state() is supposed to do things the atomic way, so it should not be inspecting crtc->enabled. Rather we should be looking at crtc_state->enable.

We have a slight complication due to drm_plane_helper_check_update() reusing drm_plane_helper_check_state() for non-atomic drivers. Thus we'll have to pass the crtc_state in manally and construct a fake crtc_state in drm_plane_helper_check_update().

---
 drivers/gpu/drm/arm/hdlcd_crtc.c            |  2 +-
 drivers/gpu/drm/arm/malidp_planes.c         |  3 +-
 drivers/gpu/drm/drm_plane_helper.c          | 52 +++++++++++++++++------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |  2 +-
 drivers/gpu/drm/i915/intel_display.c        |  2 ++
 drivers/gpu/drm/imx/ipuv3-plane.c           |  2 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |  2 +-
 drivers/gpu/drm/meson/meson_plane.c         |  2 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |  4 +--
 drivers/gpu/drm/nouveau/nv50_display.c      |  6 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  2 +-
 drivers/gpu/drm/tegra/dc.c                  |  4 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  2 +-
 drivers/gpu/drm/zte/zx_plane.c              |  4 +--
 include/drm/drm_plane_helper.h              |  3 +-
 15 files changed, 53 insertions(+), 39 deletions(-)
drivers/gpu/drm/arm/hdlcd_crtc.c +1 -1
index 72b22b805412..14721723fa8a 100644
@@ -252,7 +252,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    false, true);
drivers/gpu/drm/arm/malidp_planes.c +2 -1
index 94e7e3fa3408..492d99dd55d4 100644
@@ -150,7 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, &clip, 0, INT_MAX, true, true);
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   0, INT_MAX, true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/drm_plane_helper.c +30 -22

113 lines not on this page · raw message

drivers/gpu/drm/drm_simple_kms_helper.c +1 -1
index dc9fd109de14..d428c805025c 100644
@@ -103,7 +103,7 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(plane_state, &clip,
+	ret = drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
drivers/gpu/drm/i915/intel_display.c +2 -0
index 737de251d0f8..4a459726b36b 100644
@@ -9317,6 +9317,7 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
 	int ret;
 
 	ret = drm_plane_helper_check_state(&plane_state->base,
+					   &crtc_state->base,
 					   &plane_state->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
@@ -12808,6 +12809,7 @@ intel_check_primary_plane(struct intel_plane *plane,
 	}
 
 	ret = drm_plane_helper_check_state(&state->base,
+					   &crtc_state->base,
 					   &state->clip,
 					   min_scale, max_scale,
 					   can_position, true);
drivers/gpu/drm/imx/ipuv3-plane.c +1 -1
index 247c60e6bed2..51b23ac175e3 100644
@@ -342,7 +342,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
 	clip.y1 = 0;
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   can_position, true);
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1 -1
index 6f121891430f..7ebb33657704 100644
@@ -111,7 +111,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    true, true);
drivers/gpu/drm/meson/meson_plane.c +1 -1
index 17e96fa47868..2a00b720c371 100644
@@ -61,7 +61,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    true, true);
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +2 -2
index 4b22ac3413a1..1c194a9453d9 100644
@@ -348,8 +348,8 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
 	min_scale = FRAC_16_16(1, 8);
 	max_scale = FRAC_16_16(8, 1);
 
-	ret = drm_plane_helper_check_state(state, &clip, min_scale,
-					   max_scale, true, true);
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   min_scale, max_scale, true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/nouveau/nv50_display.c +4 -2
index e4751f92b342..7f11a88d0593 100644
@@ -1143,7 +1143,8 @@ nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 {
 	int ret;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip,
+	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
+					   &asyw->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   true, true);
@@ -1432,7 +1433,8 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 	if (!fb->format->depth)
 		return -EINVAL;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip,
+	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
+					   &asyw->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1 -1
index 19128b4dea54..36d0f101e30d 100644
@@ -659,7 +659,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   min_scale, max_scale,
 					   true, true);
 	if (ret)
drivers/gpu/drm/tegra/dc.c +2 -2
index 24a5ef4f5bb8..e95d9e2a7f6c 100644
@@ -491,8 +491,8 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
 	clip.y2 = crtc_state->mode.vdisplay;
 
 	/* Check plane state for visibility and calculate clipping bounds */
-	err = drm_plane_helper_check_state(state, &clip, 0, INT_MAX,
-					   true, true);
+	err = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   0, INT_MAX, true, true);
 	if (err < 0)
 		return err;
 
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -1
index efa41c086198..d95e7b1c3b11 100644
@@ -454,7 +454,7 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 		clip.y2 = crtc_state->adjusted_mode.vdisplay;
 	}
 
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
drivers/gpu/drm/zte/zx_plane.c +2 -2
index 18e763493264..ee0002529b8f 100644
@@ -80,7 +80,7 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, &clip,
+	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					    min_scale, max_scale,
 					    true, true);
 }
@@ -315,7 +315,7 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, &clip,
+	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    false, true);
include/drm/drm_plane_helper.h +2 -1
index 7c8a00ceadb7..41b8309b0a57 100644
@@ -38,7 +38,8 @@
  */
 #define DRM_PLANE_HELPER_NO_SCALING (1<<16)
 
-int drm_plane_helper_check_state(struct drm_plane_state *state,
+int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
+				 const struct drm_crtc_state *crtc_state,
 				 const struct drm_rect *clip,
 				 int min_scale, int max_scale,
 				 bool can_position,
Signature · 6 lines
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH v2 4/5 drm: Check crtc_state->enable rather than crtc->enabled in drm_plane_helper_check_state()

From: Ville Syrjälä <[email protected]>

drm_plane_helper_check_state() is supposed to do things the atomic way, so it should not be inspecting crtc->enabled. Rather we should be looking at crtc_state->enable.

We have a slight complication due to drm_plane_helper_check_update() reusing drm_plane_helper_check_state() for non-atomic drivers. Thus we'll have to pass the crtc_state in manally and construct a fake crtc_state in drm_plane_helper_check_update().

v2: Fix the WARNs about plane_state->crtc matching crtc_state->crtc

---
 drivers/gpu/drm/arm/hdlcd_crtc.c            |  2 +-
 drivers/gpu/drm/arm/malidp_planes.c         |  3 +-
 drivers/gpu/drm/drm_plane_helper.c          | 51 ++++++++++++++++-------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |  2 +-
 drivers/gpu/drm/i915/intel_display.c        |  2 ++
 drivers/gpu/drm/imx/ipuv3-plane.c           |  2 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |  2 +-
 drivers/gpu/drm/meson/meson_plane.c         |  2 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |  4 +--
 drivers/gpu/drm/nouveau/nv50_display.c      |  6 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  2 +-
 drivers/gpu/drm/tegra/dc.c                  |  4 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  2 +-
 drivers/gpu/drm/zte/zx_plane.c              |  4 +--
 include/drm/drm_plane_helper.h              |  3 +-
 15 files changed, 52 insertions(+), 39 deletions(-)
drivers/gpu/drm/arm/hdlcd_crtc.c +1 -1
index 72b22b805412..14721723fa8a 100644
@@ -252,7 +252,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    false, true);
drivers/gpu/drm/arm/malidp_planes.c +2 -1
index 94e7e3fa3408..492d99dd55d4 100644
@@ -150,7 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, &clip, 0, INT_MAX, true, true);
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   0, INT_MAX, true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/drm_plane_helper.c +29 -22

112 lines not on this page · raw message

drivers/gpu/drm/drm_simple_kms_helper.c +1 -1
index dc9fd109de14..d428c805025c 100644
@@ -103,7 +103,7 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(plane_state, &clip,
+	ret = drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
drivers/gpu/drm/i915/intel_display.c +2 -0
index 737de251d0f8..4a459726b36b 100644
@@ -9317,6 +9317,7 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
 	int ret;
 
 	ret = drm_plane_helper_check_state(&plane_state->base,
+					   &crtc_state->base,
 					   &plane_state->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
@@ -12808,6 +12809,7 @@ intel_check_primary_plane(struct intel_plane *plane,
 	}
 
 	ret = drm_plane_helper_check_state(&state->base,
+					   &crtc_state->base,
 					   &state->clip,
 					   min_scale, max_scale,
 					   can_position, true);
drivers/gpu/drm/imx/ipuv3-plane.c +1 -1
index 247c60e6bed2..51b23ac175e3 100644
@@ -342,7 +342,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
 	clip.y1 = 0;
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   can_position, true);
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1 -1
index 6f121891430f..7ebb33657704 100644
@@ -111,7 +111,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    true, true);
drivers/gpu/drm/meson/meson_plane.c +1 -1
index 17e96fa47868..2a00b720c371 100644
@@ -61,7 +61,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    true, true);
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +2 -2
index 4b22ac3413a1..1c194a9453d9 100644
@@ -348,8 +348,8 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
 	min_scale = FRAC_16_16(1, 8);
 	max_scale = FRAC_16_16(8, 1);
 
-	ret = drm_plane_helper_check_state(state, &clip, min_scale,
-					   max_scale, true, true);
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   min_scale, max_scale, true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/nouveau/nv50_display.c +4 -2
index e4751f92b342..7f11a88d0593 100644
@@ -1143,7 +1143,8 @@ nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 {
 	int ret;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip,
+	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
+					   &asyw->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   true, true);
@@ -1432,7 +1433,8 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 	if (!fb->format->depth)
 		return -EINVAL;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip,
+	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
+					   &asyw->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1 -1
index 19128b4dea54..36d0f101e30d 100644
@@ -659,7 +659,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   min_scale, max_scale,
 					   true, true);
 	if (ret)
drivers/gpu/drm/tegra/dc.c +2 -2
index 24a5ef4f5bb8..e95d9e2a7f6c 100644
@@ -491,8 +491,8 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
 	clip.y2 = crtc_state->mode.vdisplay;
 
 	/* Check plane state for visibility and calculate clipping bounds */
-	err = drm_plane_helper_check_state(state, &clip, 0, INT_MAX,
-					   true, true);
+	err = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   0, INT_MAX, true, true);
 	if (err < 0)
 		return err;
 
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -1
index efa41c086198..d95e7b1c3b11 100644
@@ -454,7 +454,7 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 		clip.y2 = crtc_state->adjusted_mode.vdisplay;
 	}
 
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
drivers/gpu/drm/zte/zx_plane.c +2 -2
index 18e763493264..ee0002529b8f 100644
@@ -80,7 +80,7 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, &clip,
+	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					    min_scale, max_scale,
 					    true, true);
 }
@@ -315,7 +315,7 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, &clip,
+	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    false, true);
include/drm/drm_plane_helper.h +2 -1
index 7c8a00ceadb7..41b8309b0a57 100644
@@ -38,7 +38,8 @@
  */
 #define DRM_PLANE_HELPER_NO_SCALING (1<<16)
 
-int drm_plane_helper_check_state(struct drm_plane_state *state,
+int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
+				 const struct drm_crtc_state *crtc_state,
 				 const struct drm_rect *clip,
 				 int min_scale, int max_scale,
 				 bool can_position,
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v2 4/5
#15 lore raw

Re: [PATCH v2 4/5] drm: Check crtc_state->enable rather than crtc->enabled in drm_plane_helper_check_state()

Quoted 5 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

drm_plane_helper_check_state() is supposed to do things the atomic way, so it should not be inspecting crtc->enabled. Rather we should be looking at crtc_state->enable.

Oh dear, how often are those legacy state thingies going to hurt us :-/

Quoted 8 lines

We have a slight complication due to drm_plane_helper_check_update() reusing drm_plane_helper_check_state() for non-atomic drivers. Thus we'll have to pass the crtc_state in manally and construct a fake crtc_state in drm_plane_helper_check_update().

v2: Fix the WARNs about plane_state->crtc matching crtc_state->crtc

I guess even more reasons to drop the clip rectangle and just look at crtc_state?

Anyway, this looks good to me.

Quoted 361 lines
---
 drivers/gpu/drm/arm/hdlcd_crtc.c            |  2 +-
 drivers/gpu/drm/arm/malidp_planes.c         |  3 +-
 drivers/gpu/drm/drm_plane_helper.c          | 51 ++++++++++++++++-------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |  2 +-
 drivers/gpu/drm/i915/intel_display.c        |  2 ++
 drivers/gpu/drm/imx/ipuv3-plane.c           |  2 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |  2 +-
 drivers/gpu/drm/meson/meson_plane.c         |  2 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |  4 +--
 drivers/gpu/drm/nouveau/nv50_display.c      |  6 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  2 +-
 drivers/gpu/drm/tegra/dc.c                  |  4 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  2 +-
 drivers/gpu/drm/zte/zx_plane.c              |  4 +--
 include/drm/drm_plane_helper.h              |  3 +-
 15 files changed, 52 insertions(+), 39 deletions(-)
drivers/gpu/drm/arm/hdlcd_crtc.c +1 -1
index 72b22b805412..14721723fa8a 100644
@@ -252,7 +252,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    false, true);
drivers/gpu/drm/arm/malidp_planes.c +2 -1
index 94e7e3fa3408..492d99dd55d4 100644
@@ -150,7 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, &clip, 0, INT_MAX, true, true);
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   0, INT_MAX, true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/drm_plane_helper.c +29 -22
index 759ed93f4ba8..eef0ffcd7ed5 100644
@@ -101,7 +101,8 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
 
 /**
  * drm_plane_helper_check_state() - Check plane state for validity
- * @state: plane state to check
+ * @plane_state: plane state to check
+ * @crtc_state: crtc state to check
  * @clip: integer clipping coordinates
  * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
  * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
@@ -120,35 +121,37 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
  * RETURNS:
  * Zero if update appears valid, error code on failure
  */
-int drm_plane_helper_check_state(struct drm_plane_state *state,
+int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
+				 const struct drm_crtc_state *crtc_state,
 				 const struct drm_rect *clip,
 				 int min_scale,
 				 int max_scale,
 				 bool can_position,
 				 bool can_update_disabled)
 {
-	struct drm_crtc *crtc = state->crtc;
-	struct drm_framebuffer *fb = state->fb;
-	struct drm_rect *src = &state->src;
-	struct drm_rect *dst = &state->dst;
-	unsigned int rotation = state->rotation;
+	struct drm_framebuffer *fb = plane_state->fb;
+	struct drm_rect *src = &plane_state->src;
+	struct drm_rect *dst = &plane_state->dst;
+	unsigned int rotation = plane_state->rotation;
 	int hscale, vscale;
 
-	*src = drm_plane_state_src(state);
-	*dst = drm_plane_state_dest(state);
+	WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc);
+
+	*src = drm_plane_state_src(plane_state);
+	*dst = drm_plane_state_dest(plane_state);
 
 	if (!fb) {
-		state->visible = false;
+		plane_state->visible = false;
 		return 0;
 	}
 
 	/* crtc should only be NULL when disabling (i.e., !fb) */
-	if (WARN_ON(!crtc)) {
-		state->visible = false;
+	if (WARN_ON(!plane_state->crtc)) {
+		plane_state->visible = false;
 		return 0;
 	}
 
-	if (!crtc->enabled && !can_update_disabled) {
+	if (!crtc_state->enable && !can_update_disabled) {
 		DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
 		return -EINVAL;
 	}
@@ -160,16 +163,16 @@ int drm_plane_helper_check_state(struct drm_plane_state *state,
 	vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
 	if (hscale < 0 || vscale < 0) {
 		DRM_DEBUG_KMS("Invalid scaling of plane\n");
-		drm_rect_debug_print("src: ", &state->src, true);
-		drm_rect_debug_print("dst: ", &state->dst, false);
+		drm_rect_debug_print("src: ", &plane_state->src, true);
+		drm_rect_debug_print("dst: ", &plane_state->dst, false);
 		return -ERANGE;
 	}
 
-	state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
+	plane_state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
 
 	drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
 
-	if (!state->visible)
+	if (!plane_state->visible)
 		/*
 		 * Plane isn't visible; some drivers can handle this
 		 * so we just return success here.  Drivers that can't
@@ -230,7 +233,7 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
 				  bool can_update_disabled,
 				  bool *visible)
 {
-	struct drm_plane_state state = {
+	struct drm_plane_state plane_state = {
 		.plane = plane,
 		.crtc = crtc,
 		.fb = fb,
@@ -245,18 +248,22 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
 		.rotation = rotation,
 		.visible = *visible,
 	};
+	struct drm_crtc_state crtc_state = {
+		.crtc = crtc,
+		.enable = crtc->enabled,
+	};
 	int ret;
 
-	ret = drm_plane_helper_check_state(&state, clip,
+	ret = drm_plane_helper_check_state(&plane_state, &crtc_state, clip,
 					   min_scale, max_scale,
 					   can_position,
 					   can_update_disabled);
 	if (ret)
 		return ret;
 
-	*src = state.src;
-	*dst = state.dst;
-	*visible = state.visible;
+	*src = plane_state.src;
+	*dst = plane_state.dst;
+	*visible = plane_state.visible;
 
 	return 0;
 }
drivers/gpu/drm/drm_simple_kms_helper.c +1 -1
index dc9fd109de14..d428c805025c 100644
@@ -103,7 +103,7 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(plane_state, &clip,
+	ret = drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
drivers/gpu/drm/i915/intel_display.c +2 -0
index 737de251d0f8..4a459726b36b 100644
@@ -9317,6 +9317,7 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
 	int ret;
 
 	ret = drm_plane_helper_check_state(&plane_state->base,
+					   &crtc_state->base,
 					   &plane_state->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
@@ -12808,6 +12809,7 @@ intel_check_primary_plane(struct intel_plane *plane,
 	}
 
 	ret = drm_plane_helper_check_state(&state->base,
+					   &crtc_state->base,
 					   &state->clip,
 					   min_scale, max_scale,
 					   can_position, true);
drivers/gpu/drm/imx/ipuv3-plane.c +1 -1
index 247c60e6bed2..51b23ac175e3 100644
@@ -342,7 +342,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
 	clip.y1 = 0;
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   can_position, true);
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1 -1
index 6f121891430f..7ebb33657704 100644
@@ -111,7 +111,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    true, true);
drivers/gpu/drm/meson/meson_plane.c +1 -1
index 17e96fa47868..2a00b720c371 100644
@@ -61,7 +61,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    true, true);
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +2 -2
index 4b22ac3413a1..1c194a9453d9 100644
@@ -348,8 +348,8 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
 	min_scale = FRAC_16_16(1, 8);
 	max_scale = FRAC_16_16(8, 1);
 
-	ret = drm_plane_helper_check_state(state, &clip, min_scale,
-					   max_scale, true, true);
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   min_scale, max_scale, true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/nouveau/nv50_display.c +4 -2
index e4751f92b342..7f11a88d0593 100644
@@ -1143,7 +1143,8 @@ nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 {
 	int ret;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip,
+	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
+					   &asyw->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   true, true);
@@ -1432,7 +1433,8 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 	if (!fb->format->depth)
 		return -EINVAL;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip,
+	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
+					   &asyw->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1 -1
index 19128b4dea54..36d0f101e30d 100644
@@ -659,7 +659,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   min_scale, max_scale,
 					   true, true);
 	if (ret)
drivers/gpu/drm/tegra/dc.c +2 -2
index 24a5ef4f5bb8..e95d9e2a7f6c 100644
@@ -491,8 +491,8 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
 	clip.y2 = crtc_state->mode.vdisplay;
 
 	/* Check plane state for visibility and calculate clipping bounds */
-	err = drm_plane_helper_check_state(state, &clip, 0, INT_MAX,
-					   true, true);
+	err = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   0, INT_MAX, true, true);
 	if (err < 0)
 		return err;
 
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -1
index efa41c086198..d95e7b1c3b11 100644
@@ -454,7 +454,7 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 		clip.y2 = crtc_state->adjusted_mode.vdisplay;
 	}
 
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
drivers/gpu/drm/zte/zx_plane.c +2 -2
index 18e763493264..ee0002529b8f 100644
@@ -80,7 +80,7 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, &clip,
+	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					    min_scale, max_scale,
 					    true, true);
 }
@@ -315,7 +315,7 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, &clip,
+	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    false, true);
include/drm/drm_plane_helper.h +2 -1
index 7c8a00ceadb7..41b8309b0a57 100644
@@ -38,7 +38,8 @@
  */
 #define DRM_PLANE_HELPER_NO_SCALING (1<<16)
 
-int drm_plane_helper_check_state(struct drm_plane_state *state,
+int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
+				 const struct drm_crtc_state *crtc_state,
 				 const struct drm_rect *clip,
 				 int min_scale, int max_scale,
 				 bool can_position,
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 4/5
#16 lore raw

Re: [PATCH 4/5] drm: Check crtc_state->enable rather than crtc->enabled in drm_plane_helper_check_state()

In reply to Ville Syrjala

Hi Ville,

Thank you for the patch.

Quoted 10 lines · On Wednesday, 1 November 2017 20:29:19 EET Ville Syrjala wrote:

From: Ville Syrjälä <[email protected]>

drm_plane_helper_check_state() is supposed to do things the atomic way, so it should not be inspecting crtc->enabled. Rather we should be looking at crtc_state->enable.

We have a slight complication due to drm_plane_helper_check_update() reusing drm_plane_helper_check_state() for non-atomic drivers. Thus we'll have to pass the crtc_state in manally and construct a fake crtc_state in drm_plane_helper_check_update().

The only user of drm_plane_helper_check_update() apart from vmwgfx which you converted in patch 2/5 is the armada driver. It would be nice to convert it to atomic modesetting and drop this function :-) At the very least, I'd add a comment to drm_plane_helper_check_update() that this change should be reverted when the function is dropped, otherwise we'll carry the CRTC state argument for a long time without realizing it's not needed anymore.

Apart from that,

Quoted 370 lines
---
 drivers/gpu/drm/arm/hdlcd_crtc.c            |  2 +-
 drivers/gpu/drm/arm/malidp_planes.c         |  3 +-
 drivers/gpu/drm/drm_plane_helper.c          | 52 ++++++++++++++------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |  2 +-
 drivers/gpu/drm/i915/intel_display.c        |  2 ++
 drivers/gpu/drm/imx/ipuv3-plane.c           |  2 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |  2 +-
 drivers/gpu/drm/meson/meson_plane.c         |  2 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |  4 +--
 drivers/gpu/drm/nouveau/nv50_display.c      |  6 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  2 +-
 drivers/gpu/drm/tegra/dc.c                  |  4 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  2 +-
 drivers/gpu/drm/zte/zx_plane.c              |  4 +--
 include/drm/drm_plane_helper.h              |  3 +-
 15 files changed, 53 insertions(+), 39 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/arm/hdlcd_crtc.c index 72b22b805412..14721723fa8a 100644

drivers/gpu/drm/arm/hdlcd_crtc.c +1 -1
@@ -252,7 +252,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    false, true);
(quoted diff) +0 -0

b/drivers/gpu/drm/arm/malidp_planes.c index 94e7e3fa3408..492d99dd55d4 100644

drivers/gpu/drm/arm/malidp_planes.c +2 -1
@@ -150,7 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane
 *mp,
 
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, &clip, 0, INT_MAX, true, true);
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   0, INT_MAX, true, true);
 	if (ret)
 		return ret;
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_plane_helper.c index 759ed93f4ba8..adb8d94484f2 100644

drivers/gpu/drm/drm_plane_helper.c +2 -1
@@ -101,7 +101,8 @@ static int get_connectors_for_crtc(struct drm_crtc
 *crtc,
 
 /**
  * drm_plane_helper_check_state() - Check plane state for validity
- * @state: plane state to check
+ * @plane_state: plane state to check
+ * @crtc_state: crtc state to check
  * @clip: integer clipping coordinates
  * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point

* @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point

drivers/gpu/drm/drm_plane_helper.c +19 -16
@@ -120,35 +121,38 @@ static int get_connectors_for_crtc(struct drm_crtc
 *crtc, * RETURNS:
  * Zero if update appears valid, error code on failure
  */
-int drm_plane_helper_check_state(struct drm_plane_state *state,
+int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
+				 const struct drm_crtc_state *crtc_state,
 				 const struct drm_rect *clip,
 				 int min_scale,
 				 int max_scale,
 				 bool can_position,
 				 bool can_update_disabled)
 {
-	struct drm_crtc *crtc = state->crtc;
-	struct drm_framebuffer *fb = state->fb;
-	struct drm_rect *src = &state->src;
-	struct drm_rect *dst = &state->dst;
-	unsigned int rotation = state->rotation;
+	struct drm_framebuffer *fb = plane_state->fb;
+	struct drm_rect *src = &plane_state->src;
+	struct drm_rect *dst = &plane_state->dst;
+	unsigned int rotation = plane_state->rotation;
 	int hscale, vscale;
 
-	*src = drm_plane_state_src(state);
-	*dst = drm_plane_state_dest(state);
+	WARN_ON(!crtc_state != !plane_state->crtc);
+	WARN_ON(crtc_state && crtc_state->crtc != plane_state->crtc);
+
+	*src = drm_plane_state_src(plane_state);
+	*dst = drm_plane_state_dest(plane_state);
 
 	if (!fb) {
-		state->visible = false;
+		plane_state->visible = false;
 		return 0;
 	}
 
 	/* crtc should only be NULL when disabling (i.e., !fb) */
-	if (WARN_ON(!crtc)) {
-		state->visible = false;
+	if (WARN_ON(!plane_state->crtc)) {
+		plane_state->visible = false;
 		return 0;
 	}
 
-	if (!crtc->enabled && !can_update_disabled) {
+	if (!crtc_state->enable && !can_update_disabled) {
 		DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
 		return -EINVAL;
 	}
@@ -160,16 +164,16 @@ int drm_plane_helper_check_state(struct
 drm_plane_state *state, vscale = drm_rect_calc_vscale(src, dst, min_scale,
 max_scale);
 	if (hscale < 0 || vscale < 0) {
 		DRM_DEBUG_KMS("Invalid scaling of plane\n");
-		drm_rect_debug_print("src: ", &state->src, true);
-		drm_rect_debug_print("dst: ", &state->dst, false);
+		drm_rect_debug_print("src: ", &plane_state->src, true);
+		drm_rect_debug_print("dst: ", &plane_state->dst, false);
 		return -ERANGE;
 	}
 
-	state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
+	plane_state->visible = drm_rect_clip_scaled(src, dst, clip, hscale,
 vscale);
 
 	drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
 
-	if (!state->visible)
+	if (!plane_state->visible)
 		/*
drivers/gpu/drm/drm_plane_helper.c +9 -5
 		 * Plane isn't visible; some drivers can handle this
 		 * so we just return success here.  Drivers that can't
@@ -230,7 +234,7 @@ int drm_plane_helper_check_update(struct drm_plane
 *plane, bool can_update_disabled,
 				  bool *visible)
 {
-	struct drm_plane_state state = {
+	struct drm_plane_state plane_state = {
 		.plane = plane,
 		.crtc = crtc,
 		.fb = fb,
@@ -245,18 +249,22 @@ int drm_plane_helper_check_update(struct drm_plane
 *plane, .rotation = rotation,
 		.visible = *visible,
 	};
+	struct drm_crtc_state crtc_state = {
+		.crtc = crtc,
+		.enable = crtc->enabled,
+	};
 	int ret;
 
-	ret = drm_plane_helper_check_state(&state, clip,
+	ret = drm_plane_helper_check_state(&plane_state, &crtc_state, clip,
 					   min_scale, max_scale,
 					   can_position,
 					   can_update_disabled);
 	if (ret)
 		return ret;
 
-	*src = state.src;
-	*dst = state.dst;
-	*visible = state.visible;
+	*src = plane_state.src;
+	*dst = plane_state.dst;
+	*visible = plane_state.visible;
 
 	return 0;
 }
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_simple_kms_helper.c index dc9fd109de14..d428c805025c 100644

drivers/gpu/drm/drm_simple_kms_helper.c +1 -1
@@ -103,7 +103,7 @@ static int drm_simple_kms_plane_atomic_check(struct
 drm_plane *plane, clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(plane_state, &clip,
+	ret = drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_display.c index 737de251d0f8..4a459726b36b 100644

drivers/gpu/drm/i915/intel_display.c +2 -0
@@ -9317,6 +9317,7 @@ static int intel_check_cursor(struct intel_crtc_state
 *crtc_state, int ret;
 
 	ret = drm_plane_helper_check_state(&plane_state->base,
+					   &crtc_state->base,
 					   &plane_state->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
@@ -12808,6 +12809,7 @@ intel_check_primary_plane(struct intel_plane *plane,
 }
 
 	ret = drm_plane_helper_check_state(&state->base,
+					   &crtc_state->base,
 					   &state->clip,
 					   min_scale, max_scale,
 					   can_position, true);
(quoted diff) +0 -0

b/drivers/gpu/drm/imx/ipuv3-plane.c index 247c60e6bed2..51b23ac175e3 100644

drivers/gpu/drm/imx/ipuv3-plane.c +1 -1
@@ -342,7 +342,7 @@ static int ipu_plane_atomic_check(struct drm_plane
 *plane, clip.y1 = 0;
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   can_position, true);
(quoted diff) +0 -0

b/drivers/gpu/drm/mediatek/mtk_drm_plane.c index 6f121891430f..7ebb33657704 100644

drivers/gpu/drm/mediatek/mtk_drm_plane.c +1 -1
@@ -111,7 +111,7 @@ static int mtk_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    true, true);
(quoted diff) +0 -0

b/drivers/gpu/drm/meson/meson_plane.c index 17e96fa47868..2a00b720c371 100644

drivers/gpu/drm/meson/meson_plane.c +1 -1
@@ -61,7 +61,7 @@ static int meson_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, &clip,
+	return drm_plane_helper_check_state(state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    true, true);
(quoted diff) +0 -0

b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index
4b22ac3413a1..1c194a9453d9 100644

drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +2 -2
@@ -348,8 +348,8 @@ static int mdp5_plane_atomic_check_with_state(struct
 drm_crtc_state *crtc_state, min_scale = FRAC_16_16(1, 8);
 	max_scale = FRAC_16_16(8, 1);
 
-	ret = drm_plane_helper_check_state(state, &clip, min_scale,
-					   max_scale, true, true);
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   min_scale, max_scale, true, true);
 	if (ret)
 		return ret;
 
(quoted diff) +0 -0

b/drivers/gpu/drm/nouveau/nv50_display.c index e4751f92b342..7f11a88d0593 100644

drivers/gpu/drm/nouveau/nv50_display.c +4 -2
@@ -1143,7 +1143,8 @@ nv50_curs_acquire(struct nv50_wndw *wndw, struct
 nv50_wndw_atom *asyw, {
 	int ret;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip,
+	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
+					   &asyw->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   true, true);
@@ -1432,7 +1433,8 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct
 nv50_wndw_atom *asyw, if (!fb->format->depth)
 		return -EINVAL;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip,
+	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
+					   &asyw->clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
(quoted diff) +0 -0

b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 19128b4dea54..36d0f101e30d 100644

drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1 -1
@@ -659,7 +659,7 @@ static int vop_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   min_scale, max_scale,
 					   true, true);
 	if (ret)
drivers/gpu/drm/tegra/dc.c +2 -2
index 24a5ef4f5bb8..e95d9e2a7f6c 100644
@@ -491,8 +491,8 @@ static int tegra_plane_state_add(struct tegra_plane
 *plane, clip.y2 = crtc_state->mode.vdisplay;
 
 	/* Check plane state for visibility and calculate clipping bounds */
-	err = drm_plane_helper_check_state(state, &clip, 0, INT_MAX,
-					   true, true);
+	err = drm_plane_helper_check_state(state, crtc_state, &clip,
+					   0, INT_MAX, true, true);
 	if (err < 0)
 		return err;
 
(quoted diff) +0 -0

b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index efa41c086198..d95e7b1c3b11 100644

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -1
@@ -454,7 +454,7 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane
 *plane, clip.y2 = crtc_state->adjusted_mode.vdisplay;
 	}
 
-	ret = drm_plane_helper_check_state(state, &clip,
+	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   DRM_PLANE_HELPER_NO_SCALING,
 					   false, true);
drivers/gpu/drm/zte/zx_plane.c +2 -2
index 18e763493264..ee0002529b8f 100644
@@ -80,7 +80,7 @@ static int zx_vl_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, &clip,
+	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					    min_scale, max_scale,
 					    true, true);
 }
@@ -315,7 +315,7 @@ static int zx_gl_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, &clip,
+	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    false, true);
include/drm/drm_plane_helper.h +2 -1
index 7c8a00ceadb7..41b8309b0a57 100644
@@ -38,7 +38,8 @@
  */
 #define DRM_PLANE_HELPER_NO_SCALING (1<<16)
 
-int drm_plane_helper_check_state(struct drm_plane_state *state,
+int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
+				 const struct drm_crtc_state *crtc_state,
 				 const struct drm_rect *clip,
 				 int min_scale, int max_scale,
 				 bool can_position,
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#17 lore raw

PATCH 5/5 drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

drm_plane_helper_check_update() isn't a transitional helper, so let's rename it to drm_atomic_helper_check_plane_state() and move it into drm_atomic_helper.c.

---
 drivers/gpu/drm/arm/hdlcd_crtc.c            |   8 +--
 drivers/gpu/drm/arm/malidp_planes.c         |   4 +-
 drivers/gpu/drm/drm_atomic_helper.c         |  95 +++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane_helper.c          | 103 ++--------------------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |   9 +--
 drivers/gpu/drm/i915/intel_display.c        |  22 +++---
 drivers/gpu/drm/imx/ipuv3-plane.c           |   8 +--
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |   8 +--
 drivers/gpu/drm/meson/meson_plane.c         |   8 +--
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
 drivers/gpu/drm/nouveau/nv50_display.c      |  20 +++---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c                  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |   8 +--
 drivers/gpu/drm/zte/zx_plane.c              |  15 ++--
 include/drm/drm_atomic_helper.h             |   7 ++
 include/drm/drm_plane_helper.h              |   6 --
 17 files changed, 170 insertions(+), 166 deletions(-)
drivers/gpu/drm/arm/hdlcd_crtc.c +4 -4
index 14721723fa8a..63511a3bbf6c 100644
@@ -252,10 +252,10 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   false, true);
 }
 
 static void hdlcd_plane_atomic_update(struct drm_plane *plane,
drivers/gpu/drm/arm/malidp_planes.c +2 -2
index 492d99dd55d4..72a07950167e 100644
@@ -150,8 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   0, INT_MAX, true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  0, INT_MAX, true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/drm_atomic_helper.c +95 -0

101 lines not on this page · raw message

drivers/gpu/drm/drm_plane_helper.c +4 -99

115 lines not on this page · raw message

drivers/gpu/drm/drm_simple_kms_helper.c +5 -4
index d428c805025c..9f3b1c94802b 100644
@@ -103,10 +103,11 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						  &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/i915/intel_display.c +11 -11
index 4a459726b36b..e0ff599d2090 100644
@@ -9316,12 +9316,12 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
 	u32 offset;
 	int ret;
 
-	ret = drm_plane_helper_check_state(&plane_state->base,
-					   &crtc_state->base,
-					   &plane_state->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(&plane_state->base,
+						  &crtc_state->base,
+						  &plane_state->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  true, true);
 	if (ret)
 		return ret;
 
@@ -12808,11 +12808,11 @@ intel_check_primary_plane(struct intel_plane *plane,
 		can_position = true;
 	}
 
-	ret = drm_plane_helper_check_state(&state->base,
-					   &crtc_state->base,
-					   &state->clip,
-					   min_scale, max_scale,
-					   can_position, true);
+	ret = drm_atomic_helper_check_plane_state(&state->base,
+						  &crtc_state->base,
+						  &state->clip,
+						  min_scale, max_scale,
+						  can_position, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/imx/ipuv3-plane.c +4 -4
index 51b23ac175e3..5a67daedcf4d 100644
@@ -342,10 +342,10 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
 	clip.y1 = 0;
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   can_position, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  can_position, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/mediatek/mtk_drm_plane.c +4 -4
index 7ebb33657704..5ef898b93d8d 100644
@@ -111,10 +111,10 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   true, true);
 }
 
 static void mtk_plane_atomic_update(struct drm_plane *plane,
drivers/gpu/drm/meson/meson_plane.c +4 -4
index 2a00b720c371..d0a6ac8390f3 100644
@@ -61,10 +61,10 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   true, true);
 }
 
 /* Takes a fixed 16.16 number and converts it to integer. */
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +3 -2
index 1c194a9453d9..df3360acacca 100644
@@ -348,8 +348,9 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
 	min_scale = FRAC_16_16(1, 8);
 	max_scale = FRAC_16_16(8, 1);
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   min_scale, max_scale, true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  min_scale, max_scale,
+						  true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/nouveau/nv50_display.c +10 -10
index 7f11a88d0593..8ab0fac3544d 100644
@@ -1143,11 +1143,11 @@ nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 {
 	int ret;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
-					   &asyw->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
+						  &asyw->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  true, true);
 	asyh->curs.visible = asyw->state.visible;
 	if (ret || !asyh->curs.visible)
 		return ret;
@@ -1433,11 +1433,11 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 	if (!fb->format->depth)
 		return -EINVAL;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
-					   &asyw->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
+						  &asyw->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +3 -3
index 36d0f101e30d..ba7505292b78 100644
@@ -659,9 +659,9 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   min_scale, max_scale,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  min_scale, max_scale,
+						  true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/tegra/dc.c +2 -2
index e95d9e2a7f6c..fc70351b9017 100644
@@ -491,8 +491,8 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
 	clip.y2 = crtc_state->mode.vdisplay;
 
 	/* Check plane state for visibility and calculate clipping bounds */
-	err = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   0, INT_MAX, true, true);
+	err = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  0, INT_MAX, true, true);
 	if (err < 0)
 		return err;
 
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +4 -4
index d95e7b1c3b11..a2a93d7e2a04 100644
@@ -454,10 +454,10 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 		clip.y2 = crtc_state->adjusted_mode.vdisplay;
 	}
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 
 	if (!ret && new_fb) {
 		struct drm_crtc *crtc = state->crtc;
drivers/gpu/drm/zte/zx_plane.c +8 -7
index ee0002529b8f..68fd2e2dc78a 100644
@@ -80,9 +80,9 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					    min_scale, max_scale,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						   &clip, min_scale, max_scale,
+						   true, true);
 }
 
 static int zx_vl_get_fmt(uint32_t format)
@@ -315,10 +315,11 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						   &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   false, true);
 }
 
 static int zx_gl_get_fmt(uint32_t format)
include/drm/drm_atomic_helper.h +7 -0
index d2b56cc657e9..4842ee9485ce 100644
@@ -38,6 +38,13 @@ struct drm_private_state;
 
 int drm_atomic_helper_check_modeset(struct drm_device *dev,
 				struct drm_atomic_state *state);
+int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
+					const struct drm_crtc_state *crtc_state,
+					const struct drm_rect *clip,
+					int min_scale,
+					int max_scale,
+					bool can_position,
+					bool can_update_disabled);
 int drm_atomic_helper_check_planes(struct drm_device *dev,
 			       struct drm_atomic_state *state);
 int drm_atomic_helper_check(struct drm_device *dev,
include/drm/drm_plane_helper.h +0 -6
index 41b8309b0a57..8aa49c0ecd4d 100644
@@ -38,12 +38,6 @@
  */
 #define DRM_PLANE_HELPER_NO_SCALING (1<<16)
 
-int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
-				 const struct drm_crtc_state *crtc_state,
-				 const struct drm_rect *clip,
-				 int min_scale, int max_scale,
-				 bool can_position,
-				 bool can_update_disabled);
 int drm_plane_helper_check_update(struct drm_plane *plane,
 				  struct drm_crtc *crtc,
 				  struct drm_framebuffer *fb,
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#18 lore raw

PATCH v2 5/5 drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

From: Ville Syrjälä <[email protected]>

drm_plane_helper_check_update() isn't a transitional helper, so let's rename it to drm_atomic_helper_check_plane_state() and move it into drm_atomic_helper.c.

v2: Fix the WARNs about plane_state->crtc matching crtc_state->crtc

---
 drivers/gpu/drm/arm/hdlcd_crtc.c            |   8 +--
 drivers/gpu/drm/arm/malidp_planes.c         |   4 +-
 drivers/gpu/drm/drm_atomic_helper.c         |  94 +++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane_helper.c          | 102 ++--------------------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |   9 +--
 drivers/gpu/drm/i915/intel_display.c        |  22 +++---
 drivers/gpu/drm/imx/ipuv3-plane.c           |   8 +--
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |   8 +--
 drivers/gpu/drm/meson/meson_plane.c         |   8 +--
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
 drivers/gpu/drm/nouveau/nv50_display.c      |  20 +++---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c                  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |   8 +--
 drivers/gpu/drm/zte/zx_plane.c              |  15 ++--
 include/drm/drm_atomic_helper.h             |   7 ++
 include/drm/drm_plane_helper.h              |   6 --
 17 files changed, 169 insertions(+), 165 deletions(-)
drivers/gpu/drm/arm/hdlcd_crtc.c +4 -4
index 14721723fa8a..63511a3bbf6c 100644
@@ -252,10 +252,10 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   false, true);
 }
 
 static void hdlcd_plane_atomic_update(struct drm_plane *plane,
drivers/gpu/drm/arm/malidp_planes.c +2 -2
index 492d99dd55d4..72a07950167e 100644
@@ -150,8 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   0, INT_MAX, true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  0, INT_MAX, true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/drm_atomic_helper.c +94 -0

100 lines not on this page · raw message

drivers/gpu/drm/drm_plane_helper.c +4 -98

114 lines not on this page · raw message

drivers/gpu/drm/drm_simple_kms_helper.c +5 -4
index d428c805025c..9f3b1c94802b 100644
@@ -103,10 +103,11 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						  &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/i915/intel_display.c +11 -11
index 4a459726b36b..e0ff599d2090 100644
@@ -9316,12 +9316,12 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
 	u32 offset;
 	int ret;
 
-	ret = drm_plane_helper_check_state(&plane_state->base,
-					   &crtc_state->base,
-					   &plane_state->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(&plane_state->base,
+						  &crtc_state->base,
+						  &plane_state->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  true, true);
 	if (ret)
 		return ret;
 
@@ -12808,11 +12808,11 @@ intel_check_primary_plane(struct intel_plane *plane,
 		can_position = true;
 	}
 
-	ret = drm_plane_helper_check_state(&state->base,
-					   &crtc_state->base,
-					   &state->clip,
-					   min_scale, max_scale,
-					   can_position, true);
+	ret = drm_atomic_helper_check_plane_state(&state->base,
+						  &crtc_state->base,
+						  &state->clip,
+						  min_scale, max_scale,
+						  can_position, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/imx/ipuv3-plane.c +4 -4
index 51b23ac175e3..5a67daedcf4d 100644
@@ -342,10 +342,10 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
 	clip.y1 = 0;
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   can_position, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  can_position, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/mediatek/mtk_drm_plane.c +4 -4
index 7ebb33657704..5ef898b93d8d 100644
@@ -111,10 +111,10 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   true, true);
 }
 
 static void mtk_plane_atomic_update(struct drm_plane *plane,
drivers/gpu/drm/meson/meson_plane.c +4 -4
index 2a00b720c371..d0a6ac8390f3 100644
@@ -61,10 +61,10 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   true, true);
 }
 
 /* Takes a fixed 16.16 number and converts it to integer. */
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +3 -2
index 1c194a9453d9..df3360acacca 100644
@@ -348,8 +348,9 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
 	min_scale = FRAC_16_16(1, 8);
 	max_scale = FRAC_16_16(8, 1);
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   min_scale, max_scale, true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  min_scale, max_scale,
+						  true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/nouveau/nv50_display.c +10 -10
index 7f11a88d0593..8ab0fac3544d 100644
@@ -1143,11 +1143,11 @@ nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 {
 	int ret;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
-					   &asyw->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
+						  &asyw->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  true, true);
 	asyh->curs.visible = asyw->state.visible;
 	if (ret || !asyh->curs.visible)
 		return ret;
@@ -1433,11 +1433,11 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 	if (!fb->format->depth)
 		return -EINVAL;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
-					   &asyw->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
+						  &asyw->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +3 -3
index 36d0f101e30d..ba7505292b78 100644
@@ -659,9 +659,9 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   min_scale, max_scale,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  min_scale, max_scale,
+						  true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/tegra/dc.c +2 -2
index e95d9e2a7f6c..fc70351b9017 100644
@@ -491,8 +491,8 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
 	clip.y2 = crtc_state->mode.vdisplay;
 
 	/* Check plane state for visibility and calculate clipping bounds */
-	err = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   0, INT_MAX, true, true);
+	err = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  0, INT_MAX, true, true);
 	if (err < 0)
 		return err;
 
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +4 -4
index d95e7b1c3b11..a2a93d7e2a04 100644
@@ -454,10 +454,10 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 		clip.y2 = crtc_state->adjusted_mode.vdisplay;
 	}
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 
 	if (!ret && new_fb) {
 		struct drm_crtc *crtc = state->crtc;
drivers/gpu/drm/zte/zx_plane.c +8 -7
index ee0002529b8f..68fd2e2dc78a 100644
@@ -80,9 +80,9 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					    min_scale, max_scale,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						   &clip, min_scale, max_scale,
+						   true, true);
 }
 
 static int zx_vl_get_fmt(uint32_t format)
@@ -315,10 +315,11 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						   &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   false, true);
 }
 
 static int zx_gl_get_fmt(uint32_t format)
include/drm/drm_atomic_helper.h +7 -0
index d2b56cc657e9..4842ee9485ce 100644
@@ -38,6 +38,13 @@ struct drm_private_state;
 
 int drm_atomic_helper_check_modeset(struct drm_device *dev,
 				struct drm_atomic_state *state);
+int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
+					const struct drm_crtc_state *crtc_state,
+					const struct drm_rect *clip,
+					int min_scale,
+					int max_scale,
+					bool can_position,
+					bool can_update_disabled);
 int drm_atomic_helper_check_planes(struct drm_device *dev,
 			       struct drm_atomic_state *state);
 int drm_atomic_helper_check(struct drm_device *dev,
include/drm/drm_plane_helper.h +0 -6
index 41b8309b0a57..8aa49c0ecd4d 100644
@@ -38,12 +38,6 @@
  */
 #define DRM_PLANE_HELPER_NO_SCALING (1<<16)
 
-int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
-				 const struct drm_crtc_state *crtc_state,
-				 const struct drm_rect *clip,
-				 int min_scale, int max_scale,
-				 bool can_position,
-				 bool can_update_disabled);
 int drm_plane_helper_check_update(struct drm_plane *plane,
 				  struct drm_crtc *crtc,
 				  struct drm_framebuffer *fb,
Signature · 6 lines
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 5/5
#19 lore raw

Re: [PATCH v2 5/5] drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

Quoted 11 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

drm_plane_helper_check_update() isn't a transitional helper, so let's rename it to drm_atomic_helper_check_plane_state() and move it into drm_atomic_helper.c.

v2: Fix the WARNs about plane_state->crtc matching crtc_state->crtc

I guess I should finally unlazy and split up drm_atomic_helper.c into the different parts, it's getting a bit huge. But after your stuff has landed.

Before pushing pls make sure vmwgfx has been tested, and ofc that our CI approves too.

Cheers, Daniel

Quoted 572 lines
---
 drivers/gpu/drm/arm/hdlcd_crtc.c            |   8 +--
 drivers/gpu/drm/arm/malidp_planes.c         |   4 +-
 drivers/gpu/drm/drm_atomic_helper.c         |  94 +++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane_helper.c          | 102 ++--------------------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |   9 +--
 drivers/gpu/drm/i915/intel_display.c        |  22 +++---
 drivers/gpu/drm/imx/ipuv3-plane.c           |   8 +--
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |   8 +--
 drivers/gpu/drm/meson/meson_plane.c         |   8 +--
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
 drivers/gpu/drm/nouveau/nv50_display.c      |  20 +++---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c                  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |   8 +--
 drivers/gpu/drm/zte/zx_plane.c              |  15 ++--
 include/drm/drm_atomic_helper.h             |   7 ++
 include/drm/drm_plane_helper.h              |   6 --
 17 files changed, 169 insertions(+), 165 deletions(-)
drivers/gpu/drm/arm/hdlcd_crtc.c +4 -4
index 14721723fa8a..63511a3bbf6c 100644
@@ -252,10 +252,10 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   false, true);
 }
 
 static void hdlcd_plane_atomic_update(struct drm_plane *plane,
drivers/gpu/drm/arm/malidp_planes.c +2 -2
index 492d99dd55d4..72a07950167e 100644
@@ -150,8 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   0, INT_MAX, true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  0, INT_MAX, true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/drm_atomic_helper.c +94 -0
index 71d712f1b56a..a381913c894d 100644
@@ -696,6 +696,100 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
 EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
 
 /**
+ * drm_atomic_helper_check_plane_state() - Check plane state for validity
+ * @plane_state: plane state to check
+ * @crtc_state: crtc state to check
+ * @clip: integer clipping coordinates
+ * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
+ * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
+ * @can_position: is it legal to position the plane such that it
+ *                doesn't cover the entire crtc?  This will generally
+ *                only be false for primary planes.
+ * @can_update_disabled: can the plane be updated while the crtc
+ *                       is disabled?
+ *
+ * Checks that a desired plane update is valid, and updates various
+ * bits of derived state (clipped coordinates etc.). Drivers that provide
+ * their own plane handling rather than helper-provided implementations may
+ * still wish to call this function to avoid duplication of error checking
+ * code.
+ *
+ * RETURNS:
+ * Zero if update appears valid, error code on failure
+ */
+int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
+					const struct drm_crtc_state *crtc_state,
+					const struct drm_rect *clip,
+					int min_scale,
+					int max_scale,
+					bool can_position,
+					bool can_update_disabled)
+{
+	struct drm_framebuffer *fb = plane_state->fb;
+	struct drm_rect *src = &plane_state->src;
+	struct drm_rect *dst = &plane_state->dst;
+	unsigned int rotation = plane_state->rotation;
+	int hscale, vscale;
+
+	WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc);
+
+	*src = drm_plane_state_src(plane_state);
+	*dst = drm_plane_state_dest(plane_state);
+
+	if (!fb) {
+		plane_state->visible = false;
+		return 0;
+	}
+
+	/* crtc should only be NULL when disabling (i.e., !fb) */
+	if (WARN_ON(!plane_state->crtc)) {
+		plane_state->visible = false;
+		return 0;
+	}
+
+	if (!crtc_state->enable && !can_update_disabled) {
+		DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
+		return -EINVAL;
+	}
+
+	drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation);
+
+	/* Check scaling */
+	hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
+	vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
+	if (hscale < 0 || vscale < 0) {
+		DRM_DEBUG_KMS("Invalid scaling of plane\n");
+		drm_rect_debug_print("src: ", &plane_state->src, true);
+		drm_rect_debug_print("dst: ", &plane_state->dst, false);
+		return -ERANGE;
+	}
+
+	plane_state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
+
+	drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
+
+	if (!plane_state->visible)
+		/*
+		 * Plane isn't visible; some drivers can handle this
+		 * so we just return success here.  Drivers that can't
+		 * (including those that use the primary plane helper's
+		 * update function) will return an error from their
+		 * update_plane handler.
+		 */
+		return 0;
+
+	if (!can_position && !drm_rect_equals(dst, clip)) {
+		DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
+		drm_rect_debug_print("dst: ", dst, false);
+		drm_rect_debug_print("clip: ", clip, false);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_atomic_helper_check_plane_state);
+
+/**
  * drm_atomic_helper_check_planes - validate state object for planes changes
  * @dev: DRM device
  * @state: the driver state object
drivers/gpu/drm/drm_plane_helper.c +4 -98
index eef0ffcd7ed5..f1be8cd4e387 100644
@@ -100,100 +100,6 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
 }
 
 /**
- * drm_plane_helper_check_state() - Check plane state for validity
- * @plane_state: plane state to check
- * @crtc_state: crtc state to check
- * @clip: integer clipping coordinates
- * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
- * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
- * @can_position: is it legal to position the plane such that it
- *                doesn't cover the entire crtc?  This will generally
- *                only be false for primary planes.
- * @can_update_disabled: can the plane be updated while the crtc
- *                       is disabled?
- *
- * Checks that a desired plane update is valid, and updates various
- * bits of derived state (clipped coordinates etc.). Drivers that provide
- * their own plane handling rather than helper-provided implementations may
- * still wish to call this function to avoid duplication of error checking
- * code.
- *
- * RETURNS:
- * Zero if update appears valid, error code on failure
- */
-int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
-				 const struct drm_crtc_state *crtc_state,
-				 const struct drm_rect *clip,
-				 int min_scale,
-				 int max_scale,
-				 bool can_position,
-				 bool can_update_disabled)
-{
-	struct drm_framebuffer *fb = plane_state->fb;
-	struct drm_rect *src = &plane_state->src;
-	struct drm_rect *dst = &plane_state->dst;
-	unsigned int rotation = plane_state->rotation;
-	int hscale, vscale;
-
-	WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc);
-
-	*src = drm_plane_state_src(plane_state);
-	*dst = drm_plane_state_dest(plane_state);
-
-	if (!fb) {
-		plane_state->visible = false;
-		return 0;
-	}
-
-	/* crtc should only be NULL when disabling (i.e., !fb) */
-	if (WARN_ON(!plane_state->crtc)) {
-		plane_state->visible = false;
-		return 0;
-	}
-
-	if (!crtc_state->enable && !can_update_disabled) {
-		DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
-		return -EINVAL;
-	}
-
-	drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation);
-
-	/* Check scaling */
-	hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
-	vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
-	if (hscale < 0 || vscale < 0) {
-		DRM_DEBUG_KMS("Invalid scaling of plane\n");
-		drm_rect_debug_print("src: ", &plane_state->src, true);
-		drm_rect_debug_print("dst: ", &plane_state->dst, false);
-		return -ERANGE;
-	}
-
-	plane_state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
-
-	drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
-
-	if (!plane_state->visible)
-		/*
-		 * Plane isn't visible; some drivers can handle this
-		 * so we just return success here.  Drivers that can't
-		 * (including those that use the primary plane helper's
-		 * update function) will return an error from their
-		 * update_plane handler.
-		 */
-		return 0;
-
-	if (!can_position && !drm_rect_equals(dst, clip)) {
-		DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
-		drm_rect_debug_print("dst: ", dst, false);
-		drm_rect_debug_print("clip: ", clip, false);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-EXPORT_SYMBOL(drm_plane_helper_check_state);
-
-/**
  * drm_plane_helper_check_update() - Check plane update for validity
  * @plane: plane object to update
  * @crtc: owning CRTC of owning plane
@@ -254,10 +160,10 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
 	};
 	int ret;
 
-	ret = drm_plane_helper_check_state(&plane_state, &crtc_state, clip,
-					   min_scale, max_scale,
-					   can_position,
-					   can_update_disabled);
+	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
+						  clip, min_scale, max_scale,
+						  can_position,
+						  can_update_disabled);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/drm_simple_kms_helper.c +5 -4
index d428c805025c..9f3b1c94802b 100644
@@ -103,10 +103,11 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						  &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/i915/intel_display.c +11 -11
index 4a459726b36b..e0ff599d2090 100644
@@ -9316,12 +9316,12 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
 	u32 offset;
 	int ret;
 
-	ret = drm_plane_helper_check_state(&plane_state->base,
-					   &crtc_state->base,
-					   &plane_state->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(&plane_state->base,
+						  &crtc_state->base,
+						  &plane_state->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  true, true);
 	if (ret)
 		return ret;
 
@@ -12808,11 +12808,11 @@ intel_check_primary_plane(struct intel_plane *plane,
 		can_position = true;
 	}
 
-	ret = drm_plane_helper_check_state(&state->base,
-					   &crtc_state->base,
-					   &state->clip,
-					   min_scale, max_scale,
-					   can_position, true);
+	ret = drm_atomic_helper_check_plane_state(&state->base,
+						  &crtc_state->base,
+						  &state->clip,
+						  min_scale, max_scale,
+						  can_position, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/imx/ipuv3-plane.c +4 -4
index 51b23ac175e3..5a67daedcf4d 100644
@@ -342,10 +342,10 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
 	clip.y1 = 0;
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   can_position, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  can_position, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/mediatek/mtk_drm_plane.c +4 -4
index 7ebb33657704..5ef898b93d8d 100644
@@ -111,10 +111,10 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   true, true);
 }
 
 static void mtk_plane_atomic_update(struct drm_plane *plane,
drivers/gpu/drm/meson/meson_plane.c +4 -4
index 2a00b720c371..d0a6ac8390f3 100644
@@ -61,10 +61,10 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   true, true);
 }
 
 /* Takes a fixed 16.16 number and converts it to integer. */
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +3 -2
index 1c194a9453d9..df3360acacca 100644
@@ -348,8 +348,9 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
 	min_scale = FRAC_16_16(1, 8);
 	max_scale = FRAC_16_16(8, 1);
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   min_scale, max_scale, true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  min_scale, max_scale,
+						  true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/nouveau/nv50_display.c +10 -10
index 7f11a88d0593..8ab0fac3544d 100644
@@ -1143,11 +1143,11 @@ nv50_curs_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 {
 	int ret;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
-					   &asyw->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
+						  &asyw->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  true, true);
 	asyh->curs.visible = asyw->state.visible;
 	if (ret || !asyh->curs.visible)
 		return ret;
@@ -1433,11 +1433,11 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 	if (!fb->format->depth)
 		return -EINVAL;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
-					   &asyw->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
+						  &asyw->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +3 -3
index 36d0f101e30d..ba7505292b78 100644
@@ -659,9 +659,9 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   min_scale, max_scale,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  min_scale, max_scale,
+						  true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/tegra/dc.c +2 -2
index e95d9e2a7f6c..fc70351b9017 100644
@@ -491,8 +491,8 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
 	clip.y2 = crtc_state->mode.vdisplay;
 
 	/* Check plane state for visibility and calculate clipping bounds */
-	err = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   0, INT_MAX, true, true);
+	err = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  0, INT_MAX, true, true);
 	if (err < 0)
 		return err;
 
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +4 -4
index d95e7b1c3b11..a2a93d7e2a04 100644
@@ -454,10 +454,10 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 		clip.y2 = crtc_state->adjusted_mode.vdisplay;
 	}
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 
 	if (!ret && new_fb) {
 		struct drm_crtc *crtc = state->crtc;
drivers/gpu/drm/zte/zx_plane.c +8 -7
index ee0002529b8f..68fd2e2dc78a 100644
@@ -80,9 +80,9 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					    min_scale, max_scale,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						   &clip, min_scale, max_scale,
+						   true, true);
 }
 
 static int zx_vl_get_fmt(uint32_t format)
@@ -315,10 +315,11 @@ static int zx_gl_plane_atomic_check(struct drm_plane *plane,
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						   &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   false, true);
 }
 
 static int zx_gl_get_fmt(uint32_t format)
include/drm/drm_atomic_helper.h +7 -0
index d2b56cc657e9..4842ee9485ce 100644
@@ -38,6 +38,13 @@ struct drm_private_state;
 
 int drm_atomic_helper_check_modeset(struct drm_device *dev,
 				struct drm_atomic_state *state);
+int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
+					const struct drm_crtc_state *crtc_state,
+					const struct drm_rect *clip,
+					int min_scale,
+					int max_scale,
+					bool can_position,
+					bool can_update_disabled);
 int drm_atomic_helper_check_planes(struct drm_device *dev,
 			       struct drm_atomic_state *state);
 int drm_atomic_helper_check(struct drm_device *dev,
include/drm/drm_plane_helper.h +0 -6
index 41b8309b0a57..8aa49c0ecd4d 100644
@@ -38,12 +38,6 @@
  */
 #define DRM_PLANE_HELPER_NO_SCALING (1<<16)
 
-int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
-				 const struct drm_crtc_state *crtc_state,
-				 const struct drm_rect *clip,
-				 int min_scale, int max_scale,
-				 bool can_position,
-				 bool can_update_disabled);
 int drm_plane_helper_check_update(struct drm_plane *plane,
 				  struct drm_crtc *crtc,
 				  struct drm_framebuffer *fb,
Signature · 1 line
2.13.6
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 5/5
#20 lore raw

Re: [PATCH 5/5] drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

In reply to Ville Syrjala

Hi Ville,

Thank you for the patch.

Quoted 9 lines · On Wednesday, 1 November 2017 20:29:20 EET Ville Syrjala wrote:

From: Ville Syrjälä <[email protected]>

drm_plane_helper_check_update() isn't a transitional helper, so let's rename it to drm_atomic_helper_check_plane_state() and move it into drm_atomic_helper.c.

I would move this patch before 4/5 to make it easier to revert 4/5 (for the reason explaining as a reply to that patch).

Quoted 583 lines
---
 drivers/gpu/drm/arm/hdlcd_crtc.c            |   8 +--
 drivers/gpu/drm/arm/malidp_planes.c         |   4 +-
 drivers/gpu/drm/drm_atomic_helper.c         |  95 +++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane_helper.c          | 103 +-----------------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |   9 +--
 drivers/gpu/drm/i915/intel_display.c        |  22 +++---
 drivers/gpu/drm/imx/ipuv3-plane.c           |   8 +--
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |   8 +--
 drivers/gpu/drm/meson/meson_plane.c         |   8 +--
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
 drivers/gpu/drm/nouveau/nv50_display.c      |  20 +++---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c                  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |   8 +--
 drivers/gpu/drm/zte/zx_plane.c              |  15 ++--
 include/drm/drm_atomic_helper.h             |   7 ++
 include/drm/drm_plane_helper.h              |   6 --
 17 files changed, 170 insertions(+), 166 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/arm/hdlcd_crtc.c index 14721723fa8a..63511a3bbf6c 100644

drivers/gpu/drm/arm/hdlcd_crtc.c +4 -4
@@ -252,10 +252,10 @@ static int hdlcd_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   false, true);
 }
 
 static void hdlcd_plane_atomic_update(struct drm_plane *plane,
(quoted diff) +0 -0

b/drivers/gpu/drm/arm/malidp_planes.c index 492d99dd55d4..72a07950167e 100644

drivers/gpu/drm/arm/malidp_planes.c +2 -2
@@ -150,8 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane
 *mp,
 
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   0, INT_MAX, true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  0, INT_MAX, true, true);
 	if (ret)
 		return ret;
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_atomic_helper.c index 71d712f1b56a..7595ad8ad2f3 100644

drivers/gpu/drm/drm_atomic_helper.c +69 -0
@@ -696,6 +696,101 @@ drm_atomic_helper_check_modeset(struct drm_device
 *dev, EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
 
 /**
+ * drm_atomic_helper_check_plane_state() - Check plane state for validity
+ * @plane_state: plane state to check
+ * @crtc_state: crtc state to check
+ * @clip: integer clipping coordinates
+ * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
+ * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
+ * @can_position: is it legal to position the plane such that it
+ *                doesn't cover the entire crtc?  This will generally
+ *                only be false for primary planes.
+ * @can_update_disabled: can the plane be updated while the crtc
+ *                       is disabled?
+ *
+ * Checks that a desired plane update is valid, and updates various
+ * bits of derived state (clipped coordinates etc.). Drivers that provide
+ * their own plane handling rather than helper-provided implementations may
+ * still wish to call this function to avoid duplication of error checking
+ * code.
+ *
+ * RETURNS:
+ * Zero if update appears valid, error code on failure
+ */
+int drm_atomic_helper_check_plane_state(struct drm_plane_state
 *plane_state, +					const struct drm_crtc_state *crtc_state,
+					const struct drm_rect *clip,
+					int min_scale,
+					int max_scale,
+					bool can_position,
+					bool can_update_disabled)
+{
+	struct drm_framebuffer *fb = plane_state->fb;
+	struct drm_rect *src = &plane_state->src;
+	struct drm_rect *dst = &plane_state->dst;
+	unsigned int rotation = plane_state->rotation;
+	int hscale, vscale;
+
+	WARN_ON(!crtc_state != !plane_state->crtc);
+	WARN_ON(crtc_state && crtc_state->crtc != plane_state->crtc);
+
+	*src = drm_plane_state_src(plane_state);
+	*dst = drm_plane_state_dest(plane_state);
+
+	if (!fb) {
+		plane_state->visible = false;
+		return 0;
+	}
+
+	/* crtc should only be NULL when disabling (i.e., !fb) */
+	if (WARN_ON(!plane_state->crtc)) {
+		plane_state->visible = false;
+		return 0;
+	}
+
+	if (!crtc_state->enable && !can_update_disabled) {
+		DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
+		return -EINVAL;
+	}
+
+	drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation);
+
+	/* Check scaling */
+	hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
+	vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
+	if (hscale < 0 || vscale < 0) {
+		DRM_DEBUG_KMS("Invalid scaling of plane\n");
+		drm_rect_debug_print("src: ", &plane_state->src, true);
+		drm_rect_debug_print("dst: ", &plane_state->dst, false);
+		return -ERANGE;
+	}
+
+	plane_state->visible = drm_rect_clip_scaled(src, dst, clip, hscale,

vscale); +

drivers/gpu/drm/drm_atomic_helper.c +24 -0
+	drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
+
+	if (!plane_state->visible)
+		/*
+		 * Plane isn't visible; some drivers can handle this
+		 * so we just return success here.  Drivers that can't
+		 * (including those that use the primary plane helper's
+		 * update function) will return an error from their
+		 * update_plane handler.
+		 */
+		return 0;
+
+	if (!can_position && !drm_rect_equals(dst, clip)) {
+		DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
+		drm_rect_debug_print("dst: ", dst, false);
+		drm_rect_debug_print("clip: ", clip, false);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_atomic_helper_check_plane_state);
+
+/**
  * drm_atomic_helper_check_planes - validate state object for planes

changes * @dev: DRM device
* @state: the driver state object

(quoted diff) +0 -0

b/drivers/gpu/drm/drm_plane_helper.c index adb8d94484f2..f1be8cd4e387 100644

drivers/gpu/drm/drm_plane_helper.c +0 -70
@@ -100,101 +100,6 @@ static int get_connectors_for_crtc(struct drm_crtc
 *crtc, }
 
 /**
- * drm_plane_helper_check_state() - Check plane state for validity
- * @plane_state: plane state to check
- * @crtc_state: crtc state to check
- * @clip: integer clipping coordinates
- * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
- * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
- * @can_position: is it legal to position the plane such that it
- *                doesn't cover the entire crtc?  This will generally
- *                only be false for primary planes.
- * @can_update_disabled: can the plane be updated while the crtc
- *                       is disabled?
- *
- * Checks that a desired plane update is valid, and updates various
- * bits of derived state (clipped coordinates etc.). Drivers that provide
- * their own plane handling rather than helper-provided implementations may
- * still wish to call this function to avoid duplication of error checking
- * code.
- *
- * RETURNS:
- * Zero if update appears valid, error code on failure
- */
-int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
-				 const struct drm_crtc_state *crtc_state,
-				 const struct drm_rect *clip,
-				 int min_scale,
-				 int max_scale,
-				 bool can_position,
-				 bool can_update_disabled)
-{
-	struct drm_framebuffer *fb = plane_state->fb;
-	struct drm_rect *src = &plane_state->src;
-	struct drm_rect *dst = &plane_state->dst;
-	unsigned int rotation = plane_state->rotation;
-	int hscale, vscale;
-
-	WARN_ON(!crtc_state != !plane_state->crtc);
-	WARN_ON(crtc_state && crtc_state->crtc != plane_state->crtc);
-
-	*src = drm_plane_state_src(plane_state);
-	*dst = drm_plane_state_dest(plane_state);
-
-	if (!fb) {
-		plane_state->visible = false;
-		return 0;
-	}
-
-	/* crtc should only be NULL when disabling (i.e., !fb) */
-	if (WARN_ON(!plane_state->crtc)) {
-		plane_state->visible = false;
-		return 0;
-	}
-
-	if (!crtc_state->enable && !can_update_disabled) {
-		DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
-		return -EINVAL;
-	}
-
-	drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation);
-
-	/* Check scaling */
-	hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
-	vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
-	if (hscale < 0 || vscale < 0) {
-		DRM_DEBUG_KMS("Invalid scaling of plane\n");
-		drm_rect_debug_print("src: ", &plane_state->src, true);
-		drm_rect_debug_print("dst: ", &plane_state->dst, false);
-		return -ERANGE;
-	}
-
-	plane_state->visible = drm_rect_clip_scaled(src, dst, clip, hscale,

vscale); -

drivers/gpu/drm/drm_plane_helper.c +4 -28
-	drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
-
-	if (!plane_state->visible)
-		/*
-		 * Plane isn't visible; some drivers can handle this
-		 * so we just return success here.  Drivers that can't
-		 * (including those that use the primary plane helper's
-		 * update function) will return an error from their
-		 * update_plane handler.
-		 */
-		return 0;
-
-	if (!can_position && !drm_rect_equals(dst, clip)) {
-		DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
-		drm_rect_debug_print("dst: ", dst, false);
-		drm_rect_debug_print("clip: ", clip, false);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-EXPORT_SYMBOL(drm_plane_helper_check_state);
-
-/**
  * drm_plane_helper_check_update() - Check plane update for validity
  * @plane: plane object to update
  * @crtc: owning CRTC of owning plane
@@ -255,10 +160,10 @@ int drm_plane_helper_check_update(struct drm_plane
 *plane, };
 	int ret;
 
-	ret = drm_plane_helper_check_state(&plane_state, &crtc_state, clip,
-					   min_scale, max_scale,
-					   can_position,
-					   can_update_disabled);
+	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
+						  clip, min_scale, max_scale,
+						  can_position,
+						  can_update_disabled);
 	if (ret)
 		return ret;
 
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_simple_kms_helper.c index d428c805025c..9f3b1c94802b 100644

drivers/gpu/drm/drm_simple_kms_helper.c +5 -4
@@ -103,10 +103,11 @@ static int drm_simple_kms_plane_atomic_check(struct
 drm_plane *plane, clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						  &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 	if (ret)
 		return ret;
 
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_display.c index 4a459726b36b..e0ff599d2090 100644

drivers/gpu/drm/i915/intel_display.c +11 -11
@@ -9316,12 +9316,12 @@ static int intel_check_cursor(struct
 intel_crtc_state *crtc_state, u32 offset;
 	int ret;
 
-	ret = drm_plane_helper_check_state(&plane_state->base,
-					   &crtc_state->base,
-					   &plane_state->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(&plane_state->base,
+						  &crtc_state->base,
+						  &plane_state->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  true, true);
 	if (ret)
 		return ret;
 
@@ -12808,11 +12808,11 @@ intel_check_primary_plane(struct intel_plane
 *plane, can_position = true;
 	}
 
-	ret = drm_plane_helper_check_state(&state->base,
-					   &crtc_state->base,
-					   &state->clip,
-					   min_scale, max_scale,
-					   can_position, true);
+	ret = drm_atomic_helper_check_plane_state(&state->base,
+						  &crtc_state->base,
+						  &state->clip,
+						  min_scale, max_scale,
+						  can_position, true);
 	if (ret)
 		return ret;
 
(quoted diff) +0 -0

b/drivers/gpu/drm/imx/ipuv3-plane.c index 51b23ac175e3..5a67daedcf4d 100644

drivers/gpu/drm/imx/ipuv3-plane.c +4 -4
@@ -342,10 +342,10 @@ static int ipu_plane_atomic_check(struct drm_plane
 *plane, clip.y1 = 0;
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   can_position, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  can_position, true);
 	if (ret)
 		return ret;
 
(quoted diff) +0 -0

b/drivers/gpu/drm/mediatek/mtk_drm_plane.c index 7ebb33657704..5ef898b93d8d 100644

drivers/gpu/drm/mediatek/mtk_drm_plane.c +4 -4
@@ -111,10 +111,10 @@ static int mtk_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   true, true);
 }
 
 static void mtk_plane_atomic_update(struct drm_plane *plane,
(quoted diff) +0 -0

b/drivers/gpu/drm/meson/meson_plane.c index 2a00b720c371..d0a6ac8390f3 100644

drivers/gpu/drm/meson/meson_plane.c +4 -4
@@ -61,10 +61,10 @@ static int meson_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->mode.hdisplay;
 	clip.y2 = crtc_state->mode.vdisplay;
 
-	return drm_plane_helper_check_state(state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   true, true);
 }
 
 /* Takes a fixed 16.16 number and converts it to integer. */
(quoted diff) +0 -0

b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index
1c194a9453d9..df3360acacca 100644

drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +3 -2
@@ -348,8 +348,9 @@ static int mdp5_plane_atomic_check_with_state(struct
 drm_crtc_state *crtc_state, min_scale = FRAC_16_16(1, 8);
 	max_scale = FRAC_16_16(8, 1);
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   min_scale, max_scale, true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  min_scale, max_scale,
+						  true, true);
 	if (ret)
 		return ret;
 
(quoted diff) +0 -0

b/drivers/gpu/drm/nouveau/nv50_display.c index 7f11a88d0593..8ab0fac3544d 100644

drivers/gpu/drm/nouveau/nv50_display.c +10 -10
@@ -1143,11 +1143,11 @@ nv50_curs_acquire(struct nv50_wndw *wndw, struct
 nv50_wndw_atom *asyw, {
 	int ret;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
-					   &asyw->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
+						  &asyw->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  true, true);
 	asyh->curs.visible = asyw->state.visible;
 	if (ret || !asyh->curs.visible)
 		return ret;
@@ -1433,11 +1433,11 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct
 nv50_wndw_atom *asyw, if (!fb->format->depth)
 		return -EINVAL;
 
-	ret = drm_plane_helper_check_state(&asyw->state, &asyh->state,
-					   &asyw->clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
+						  &asyw->clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 	if (ret)
 		return ret;
 
(quoted diff) +0 -0

b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 36d0f101e30d..ba7505292b78 100644

drivers/gpu/drm/rockchip/rockchip_drm_vop.c +3 -3
@@ -659,9 +659,9 @@ static int vop_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   min_scale, max_scale,
-					   true, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  min_scale, max_scale,
+						  true, true);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/tegra/dc.c +2 -2
index e95d9e2a7f6c..fc70351b9017 100644
@@ -491,8 +491,8 @@ static int tegra_plane_state_add(struct tegra_plane
 *plane, clip.y2 = crtc_state->mode.vdisplay;
 
 	/* Check plane state for visibility and calculate clipping bounds */
-	err = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   0, INT_MAX, true, true);
+	err = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  0, INT_MAX, true, true);
 	if (err < 0)
 		return err;
 
(quoted diff) +0 -0

b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index d95e7b1c3b11..a2a93d7e2a04 100644

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +4 -4
@@ -454,10 +454,10 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane
 *plane, clip.y2 = crtc_state->adjusted_mode.vdisplay;
 	}
 
-	ret = drm_plane_helper_check_state(state, crtc_state, &clip,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   DRM_PLANE_HELPER_NO_SCALING,
-					   false, true);
+	ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
 
 	if (!ret && new_fb) {
 		struct drm_crtc *crtc = state->crtc;
drivers/gpu/drm/zte/zx_plane.c +8 -7
index ee0002529b8f..68fd2e2dc78a 100644
@@ -80,9 +80,9 @@ static int zx_vl_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					    min_scale, max_scale,
-					    true, true);
+	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						   &clip, min_scale, max_scale,
+						   true, true);
 }
 
 static int zx_vl_get_fmt(uint32_t format)
@@ -315,10 +315,11 @@ static int zx_gl_plane_atomic_check(struct drm_plane
 *plane, clip.x2 = crtc_state->adjusted_mode.hdisplay;
 	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-	return drm_plane_helper_check_state(plane_state, crtc_state, &clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true);
+	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						   &clip,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_HELPER_NO_SCALING,
+						   false, true);
 }
 
 static int zx_gl_get_fmt(uint32_t format)
(quoted diff) +0 -0

b/include/drm/drm_atomic_helper.h index d2b56cc657e9..4842ee9485ce 100644

include/drm/drm_atomic_helper.h +6 -0
@@ -38,6 +38,13 @@ struct drm_private_state;
 
 int drm_atomic_helper_check_modeset(struct drm_device *dev,
 				struct drm_atomic_state *state);
+int drm_atomic_helper_check_plane_state(struct drm_plane_state
 *plane_state, +					const struct drm_crtc_state *crtc_state,
+					const struct drm_rect *clip,
+					int min_scale,
+					int max_scale,
+					bool can_position,
+					bool can_update_disabled);
 int drm_atomic_helper_check_planes(struct drm_device *dev,
 			       struct drm_atomic_state *state);
 int drm_atomic_helper_check(struct drm_device *dev,
include/drm/drm_plane_helper.h +0 -6
index 41b8309b0a57..8aa49c0ecd4d 100644
@@ -38,12 +38,6 @@
  */
 #define DRM_PLANE_HELPER_NO_SCALING (1<<16)
 
-int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
-				 const struct drm_crtc_state *crtc_state,
-				 const struct drm_rect *clip,
-				 int min_scale, int max_scale,
-				 bool can_position,
-				 bool can_update_disabled);
 int drm_plane_helper_check_update(struct drm_plane *plane,
 				  struct drm_crtc *crtc,
 				  struct drm_framebuffer *fb,
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#21 lore raw

✗ Fi.CI.BAT: failure for drm: drm_plane_helper_check_state() related stuff

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: drm: drm_plane_helper_check_state() related stuff
URL : https://patchwork.freedesktop.org/series/33002/
State : failure

== Summary ==

Series 33002v1 drm: drm_plane_helper_check_state() related stuff
https://patchwork.freedesktop.org/api/1.0/series/33002/revisions/1/mbox/

Test chamelium:

        Subgroup dp-edid-read:
                pass       -> DMESG-WARN (fi-kbl-7500u) fdo#102672
        Subgroup dp-crc-fast:
                pass       -> DMESG-WARN (fi-kbl-7500u) fdo#102514
        Subgroup hdmi-edid-read:
                pass       -> DMESG-WARN (fi-skl-6700k)
        Subgroup hdmi-crc-fast:
                pass       -> DMESG-WARN (fi-skl-6700k)
        Subgroup common-hpd-after-suspend:
                pass       -> DMESG-WARN (fi-skl-6700k)
Test debugfs_test:
        Subgroup read_all_entries:
                pass       -> DMESG-WARN (fi-gdg-551)
                pass       -> DMESG-WARN (fi-blb-e6850)
                pass       -> DMESG-WARN (fi-pnv-d510)
                pass       -> DMESG-WARN (fi-bwr-2160)
                pass       -> DMESG-WARN (fi-elk-e7500)
                pass       -> DMESG-WARN (fi-ilk-650)
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-snb-2600)
                pass       -> DMESG-WARN (fi-ivb-3520m)
                pass       -> DMESG-WARN (fi-ivb-3770)
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-byt-n2820)
                pass       -> DMESG-WARN (fi-hsw-4770)
                pass       -> DMESG-WARN (fi-hsw-4770r)
                pass       -> DMESG-WARN (fi-bdw-5557u)
                pass       -> DMESG-WARN (fi-bdw-gvtdvm)
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-skl-6260u)
                pass       -> DMESG-WARN (fi-skl-6600u)
                pass       -> DMESG-WARN (fi-skl-6700hq)
                pass       -> DMESG-WARN (fi-skl-6700k)
                pass       -> DMESG-WARN (fi-skl-6770hq)
                pass       -> DMESG-WARN (fi-skl-gvtdvm)
                pass       -> DMESG-WARN (fi-bxt-dsi)
                pass       -> DMESG-WARN (fi-bxt-j4205)
                pass       -> DMESG-WARN (fi-kbl-7500u) fdo#103285
                pass       -> DMESG-WARN (fi-kbl-7560u)
                pass       -> DMESG-WARN (fi-kbl-7567u)
                pass       -> DMESG-WARN (fi-kbl-r)
                pass       -> DMESG-WARN (fi-glk-1)
                pass       -> DMESG-WARN (fi-glk-dsi)
                pass       -> DMESG-WARN (fi-cfl-s) fdo#103186
                pass       -> DMESG-WARN (fi-cnl-y)
Test drv_hangman:
        Subgroup error-state-basic:
                pass       -> DMESG-WARN (fi-gdg-551)
                pass       -> DMESG-WARN (fi-blb-e6850)
                pass       -> DMESG-WARN (fi-pnv-d510)
                pass       -> DMESG-WARN (fi-bwr-2160)
Test gem_busy:
        Subgroup basic-hang-default:
                pass       -> DMESG-WARN (fi-blb-e6850)
                pass       -> DMESG-WARN (fi-pnv-d510)
Test gem_exec_fence:
        Subgroup await-hang-default:
                pass       -> DMESG-WARN (fi-blb-e6850)
                pass       -> DMESG-WARN (fi-pnv-d510)
Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> DMESG-WARN (fi-blb-e6850)
                pass       -> DMESG-WARN (fi-pnv-d510)
                pass       -> DMESG-WARN (fi-elk-e7500)
                pass       -> DMESG-WARN (fi-ilk-650)
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-snb-2600) fdo#102365
                pass       -> DMESG-WARN (fi-ivb-3520m)
                pass       -> DMESG-WARN (fi-ivb-3770)
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-byt-n2820)
                pass       -> DMESG-WARN (fi-hsw-4770)
                pass       -> DMESG-WARN (fi-hsw-4770r)
                pass       -> DMESG-WARN (fi-bdw-5557u)
                pass       -> DMESG-WARN (fi-bdw-gvtdvm)
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-skl-6260u)
                pass       -> DMESG-WARN (fi-skl-6600u)
                pass       -> DMESG-WARN (fi-skl-6700hq)
                pass       -> DMESG-WARN (fi-skl-6700k)
                pass       -> DMESG-WARN (fi-skl-6770hq)
                pass       -> DMESG-WARN (fi-skl-gvtdvm)
                pass       -> DMESG-WARN (fi-bxt-dsi)
                pass       -> DMESG-WARN (fi-bxt-j4205)
                pass       -> DMESG-WARN (fi-kbl-7500u)
                pass       -> DMESG-FAIL (fi-kbl-7560u) fdo#103039
                pass       -> DMESG-WARN (fi-kbl-7567u) fdo#102846 +11
                pass       -> DMESG-WARN (fi-glk-1)
                pass       -> DMESG-WARN (fi-glk-dsi)
                pass       -> DMESG-WARN (fi-cnl-y)
        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-blb-e6850)
                pass       -> DMESG-WARN (fi-pnv-d510)
                pass       -> DMESG-WARN (fi-elk-e7500)
                pass       -> DMESG-WARN (fi-ilk-650)
                pass       -> DMESG-WARN (fi-snb-2520m)

WARNING: Long output truncated

7da46c0a019ebaec3f67a8a6ccc60a56c2d521b1 drm-tip: 2017y-11m-01d-17h-32m-50s UTC integration manifest 6d81deae6f47 drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c a9ff8519c323 drm: Check crtc_state->enable rather than crtc->enabled in drm_plane_helper_check_state() 67d75a7c518d drm/vmwgfx: Try to fix plane clipping
b824112d55f1 drm/vmwgfx: Use drm_plane_helper_check_state()
9e9194d33463 drm/vmwgfx: Remove bogus crtc coords vs fb size check

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6302/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#22 lore raw

Re: ✗ Fi.CI.BAT: failure for drm: drm_plane_helper_check_state() related stuff

Quoted 12 lines · Patchwork

== Series Details ==

Series: drm: drm_plane_helper_check_state() related stuff
URL : https://patchwork.freedesktop.org/series/33002/
State : failure

== Summary ==

Series 33002v1 drm: drm_plane_helper_check_state() related stuff
https://patchwork.freedesktop.org/api/1.0/series/33002/revisions/1/mbox/

Test chamelium:

Quoted 10 lines
        Subgroup dp-edid-read:
                pass       -> DMESG-WARN (fi-kbl-7500u) fdo#102672
        Subgroup dp-crc-fast:
                pass       -> DMESG-WARN (fi-kbl-7500u) fdo#102514
        Subgroup hdmi-edid-read:
                pass       -> DMESG-WARN (fi-skl-6700k)
        Subgroup hdmi-crc-fast:
                pass       -> DMESG-WARN (fi-skl-6700k)
        Subgroup common-hpd-after-suspend:
                pass       -> DMESG-WARN (fi-skl-6700k)

Thinko in my WARNs.

I guess it needs to be something like:

-       WARN_ON(!crtc_state != !plane_state->crtc);
-       WARN_ON(crtc_state && crtc_state->crtc != plane_state->crtc);
+       WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc);

since we grab the crtc from the old plane state if the new plane state doesn't have one. And thus the crtc state we pass around may refer to the old crtc, not the new one (well, there won't be a new one in those cases).

Although I'm not sure how sensible it is to use the crtc state of the old crtc for state computation/checks in general. Feels a bit iffy at least.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#23 lore raw

✓ Fi.CI.BAT: success for drm: drm_plane_helper_check_state() related stuff (rev3)

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: drm: drm_plane_helper_check_state() related stuff (rev3)
URL : https://patchwork.freedesktop.org/series/33002/
State : success

== Summary ==

Series 33002v3 drm: drm_plane_helper_check_state() related stuff
https://patchwork.freedesktop.org/api/1.0/series/33002/revisions/3/mbox/

Test chamelium:

        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514
        Subgroup common-hpd-after-suspend:
                dmesg-warn -> PASS       (fi-kbl-7500u) fdo#102505
Test kms_frontbuffer_tracking:
        Subgroup basic:
                fail       -> PASS       (fi-glk-dsi) fdo#103167

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#102505 https://bugs.freedesktop.org/show_bug.cgi?id=102505
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:442s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:459s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:378s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:539s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:277s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:512s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:500s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:510s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:487s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:546s
fi-cnl-y         total:217  pass:196  dwarn:0   dfail:0   fail:0   skip:20 
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:421s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:269s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:586s
fi-glk-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:489s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:434s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:428s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:424s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:498s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:465s
fi-kbl-7500u     total:289  pass:264  dwarn:0   dfail:0   fail:1   skip:24  time:475s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:575s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:478s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:580s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:574s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:457s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:593s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:652s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:517s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:507s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:459s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:571s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:426s

7da46c0a019ebaec3f67a8a6ccc60a56c2d521b1 drm-tip: 2017y-11m-01d-17h-32m-50s UTC integration manifest 5fd2ee28cd29 drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c f5a1386e738b drm: Check crtc_state->enable rather than crtc->enabled in drm_plane_helper_check_state() 9b967ad53783 drm/vmwgfx: Try to fix plane clipping
6fb4866d13f0 drm/vmwgfx: Use drm_plane_helper_check_state()
488c96ed9533 drm/vmwgfx: Remove bogus crtc coords vs fb size check

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6304/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#24 lore raw

✓ Fi.CI.IGT: success for drm: drm_plane_helper_check_state() related stuff (rev3)

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: drm: drm_plane_helper_check_state() related stuff (rev3)
URL : https://patchwork.freedesktop.org/series/33002/
State : success

== Summary ==

Test drv_module_reload:

        Subgroup basic-reload:
                pass       -> DMESG-WARN (shard-hsw) fdo#102707
Test kms_flip:
        Subgroup modeset-vs-vblank-race-interruptible:
                fail       -> PASS       (shard-hsw) fdo#103060
Test perf:
        Subgroup oa-exponents:
                fail       -> PASS       (shard-hsw) fdo#102254

fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#102254 https://bugs.freedesktop.org/show_bug.cgi?id=102254

shard-hsw total:2539 pass:1431 dwarn:2 dfail:0 fail:9 skip:1097 time:9286s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6304/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#25 lore raw
In reply to Ville Syrjala

Sorry this took so long.

The vmwgfx part: Reviewed-by: Sinclair Yeh <[email protected]>

I've done some testing and the vmwgfx part looks good. Has Daniel already taken these or should I put them in my next request?

Sinclair

Quoted 37 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

While trawling the tree I spotted some issues with the way vmwgfx uses drm_plane_helper_check_state(). Here's my attempt at fixing it. Do note that I haven't actually tested the resulting code at all, but it does build at least.

And while touching that general area I took up Daniel's suggestion from long ago that drm_plane_helper_check_state() should be renamed and relocated to better reflect its status.

Here's a branch with the entire series:
git://github.com/vsyrjala/linux.git atomic_helper_plane_stuff

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Cc Daniel Vetter <[email protected]>

Ville Syrjälä (5):
drm/vmwgfx: Remove bogus crtc coords vs fb size check drm/vmwgfx: Use drm_plane_helper_check_state() drm/vmwgfx: Try to fix plane clipping
drm: Check crtc_state->enable rather than crtc->enabled in
drm_plane_helper_check_state()
drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

 drivers/gpu/drm/arm/hdlcd_crtc.c            |   8 +-
 drivers/gpu/drm/arm/malidp_planes.c         |   3 +-
 drivers/gpu/drm/drm_atomic_helper.c         |  95 ++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane_helper.c          | 111 +++-------------------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |   9 ++-
 drivers/gpu/drm/i915/intel_display.c        |  20 ++---
 drivers/gpu/drm/imx/ipuv3-plane.c           |   8 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |   8 +-
 drivers/gpu/drm/meson/meson_plane.c         |   8 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
Quoted 12 lines
 drivers/gpu/drm/nouveau/nv50_display.c      |  18 +++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c                  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  40 ++++------
 drivers/gpu/drm/zte/zx_plane.c              |  15 ++--
 include/drm/drm_atomic_helper.h             |   7 ++
 include/drm/drm_plane_helper.h              |   5 --
 17 files changed, 187 insertions(+), 183 deletions(-)
Signature · 1 line
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#26 lore raw
Quoted 1 line · Sinclair Yeh

Sorry this took so long.

No worries.

Quoted 5 lines

The vmwgfx part: Reviewed-by: Sinclair Yeh <[email protected]>

I've done some testing and the vmwgfx part looks good. Has Daniel already taken these or should I put them in my next request?

You can take them, or I can push them to drm-misc-next. Whatever works best for you.

And I'll want to revisit this topic soonish and move the clip handling into the helper as discussed with Daniel. But that can wait a bit until we get this round merged somewhere.

Quoted 53 lines

Sinclair

Quoted 49 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

While trawling the tree I spotted some issues with the way vmwgfx uses drm_plane_helper_check_state(). Here's my attempt at fixing it. Do note that I haven't actually tested the resulting code at all, but it does build at least.

And while touching that general area I took up Daniel's suggestion from long ago that drm_plane_helper_check_state() should be renamed and relocated to better reflect its status.

Here's a branch with the entire series:
git://github.com/vsyrjala/linux.git atomic_helper_plane_stuff

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Cc Daniel Vetter <[email protected]>

Ville Syrjälä (5):
drm/vmwgfx: Remove bogus crtc coords vs fb size check drm/vmwgfx: Use drm_plane_helper_check_state() drm/vmwgfx: Try to fix plane clipping
drm: Check crtc_state->enable rather than crtc->enabled in
drm_plane_helper_check_state()
drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

 drivers/gpu/drm/arm/hdlcd_crtc.c            |   8 +-
 drivers/gpu/drm/arm/malidp_planes.c         |   3 +-
 drivers/gpu/drm/drm_atomic_helper.c         |  95 ++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane_helper.c          | 111 +++-------------------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |   9 ++-
 drivers/gpu/drm/i915/intel_display.c        |  20 ++---
 drivers/gpu/drm/imx/ipuv3-plane.c           |   8 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |   8 +-
 drivers/gpu/drm/meson/meson_plane.c         |   8 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
 drivers/gpu/drm/nouveau/nv50_display.c      |  18 +++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c                  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  40 ++++------
 drivers/gpu/drm/zte/zx_plane.c              |  15 ++--
 include/drm/drm_atomic_helper.h             |   7 ++
 include/drm/drm_plane_helper.h              |   5 --
 17 files changed, 187 insertions(+), 183 deletions(-)
Signature · 1 line
2.13.6
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#27 lore raw
Quoted 11 lines · Ville Syrjälä
Quoted 1 line · Sinclair Yeh

Sorry this took so long.

No worries.

Quoted 5 lines

The vmwgfx part: Reviewed-by: Sinclair Yeh <[email protected]>

I've done some testing and the vmwgfx part looks good. Has Daniel already taken these or should I put them in my next request?

Quoted 6 lines

You can take them, or I can push them to drm-misc-next. Whatever works best for you.

And I'll want to revisit this topic soonish and move the clip handling into the helper as discussed with Daniel. But that can wait a bit until we get this round merged somewhere.

Because we're still in the merge window I think it's probably best if we push the entire series in through drm-misc. Tree-coordination in the merge window is always a bit a pain.
-Daniel

Quoted 58 lines
Quoted 54 lines

Sinclair

Quoted 49 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

While trawling the tree I spotted some issues with the way vmwgfx uses drm_plane_helper_check_state(). Here's my attempt at fixing it. Do note that I haven't actually tested the resulting code at all, but it does build at least.

And while touching that general area I took up Daniel's suggestion from long ago that drm_plane_helper_check_state() should be renamed and relocated to better reflect its status.

Here's a branch with the entire series:
git://github.com/vsyrjala/linux.git atomic_helper_plane_stuff

Cc VMware Graphics <[email protected]>
Cc Sinclair Yeh <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Cc Daniel Vetter <[email protected]>

Ville Syrjälä (5):
drm/vmwgfx: Remove bogus crtc coords vs fb size check drm/vmwgfx: Use drm_plane_helper_check_state() drm/vmwgfx: Try to fix plane clipping
drm: Check crtc_state->enable rather than crtc->enabled in
drm_plane_helper_check_state()
drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

 drivers/gpu/drm/arm/hdlcd_crtc.c            |   8 +-
 drivers/gpu/drm/arm/malidp_planes.c         |   3 +-
 drivers/gpu/drm/drm_atomic_helper.c         |  95 ++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane_helper.c          | 111 +++-------------------------
 drivers/gpu/drm/drm_simple_kms_helper.c     |   9 ++-
 drivers/gpu/drm/i915/intel_display.c        |  20 ++---
 drivers/gpu/drm/imx/ipuv3-plane.c           |   8 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c    |   8 +-
 drivers/gpu/drm/meson/meson_plane.c         |   8 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
 drivers/gpu/drm/nouveau/nv50_display.c      |  18 +++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c                  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c         |  40 ++++------
 drivers/gpu/drm/zte/zx_plane.c              |  15 ++--
 include/drm/drm_atomic_helper.h             |   7 ++
 include/drm/drm_plane_helper.h              |   5 --
 17 files changed, 187 insertions(+), 183 deletions(-)
Signature · 1 line
2.13.6
Signature · 2 lines
Ville Syrjälä
Intel OTC
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#28 lore raw
Quoted 15 lines · Daniel Vetter
Quoted 14 lines · Ville Syrjälä
Quoted 1 line · Sinclair Yeh

Sorry this took so long.

No worries.

Quoted 5 lines

The vmwgfx part: Reviewed-by: Sinclair Yeh <[email protected]>

I've done some testing and the vmwgfx part looks good. Has Daniel already taken these or should I put them in my next request?

You can take them, or I can push them to drm-misc-next. Whatever works best for you.

Quoted 8 lines
Quoted 3 lines

And I'll want to revisit this topic soonish and move the clip handling into the helper as discussed with Daniel. But that can wait a bit until we get this round merged somewhere.

Because we're still in the merge window I think it's probably best if we push the entire series in through drm-misc. Tree-coordination in the merge window is always a bit a pain.
-Daniel

Ok, so I'll leave this series to you then.

thanks,

Sinclair

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#29 lore raw
Quoted 20 lines · Sinclair Yeh
Quoted 19 lines · Daniel Vetter
Quoted 17 lines · Ville Syrjälä
Quoted 1 line · Sinclair Yeh

Sorry this took so long.

No worries.

Quoted 5 lines

The vmwgfx part: Reviewed-by: Sinclair Yeh <[email protected]>

I've done some testing and the vmwgfx part looks good. Has Daniel already taken these or should I put them in my next request?

You can take them, or I can push them to drm-misc-next. Whatever works best for you.

And I'll want to revisit this topic soonish and move the clip handling into the helper as discussed with Daniel. But that can wait a bit until we get this round merged somewhere.

Quoted 6 lines
Quoted 4 lines

Because we're still in the merge window I think it's probably best if we push the entire series in through drm-misc. Tree-coordination in the merge window is always a bit a pain.
-Daniel

Ok, so I'll leave this series to you then.

All right. Series pushed to drm-misc-next. Thanks for the reviews.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#30 lore raw

Hi Ville,

Quoted 20 lines · On Monday, 20 November 2017 21:36:46 EET Ville Syrjälä wrote:
Quoted 19 lines · Sinclair Yeh
Quoted 18 lines · Daniel Vetter
Quoted 16 lines · Ville Syrjälä
Quoted 1 line · Sinclair Yeh

Sorry this took so long.

No worries.

Quoted 4 lines

The vmwgfx part: Reviewed-by: Sinclair Yeh <[email protected]>

I've done some testing and the vmwgfx part looks good. Has Daniel already taken these or should I put them in my next request?

You can take them, or I can push them to drm-misc-next. Whatever works best for you.

And I'll want to revisit this topic soonish and move the clip handling into the helper as discussed with Daniel. But that can wait a bit until we get this round merged somewhere.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Because we're still in the merge window I think it's probably best if we push the entire series in through drm-misc. Tree-coordination in the merge window is always a bit a pain.

Ok, so I'll leave this series to you then.

All right. Series pushed to drm-misc-next. Thanks for the reviews.

And I now realize my review comments aren't very useful (apart possibly the one about adding a comment to the drm_plane_helper_check_update() function, feel free to submit a patch for that if you think it's useful) as the series has been merged already :-/ I should really start reading mails in the reverse chronological order.

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel