All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] drm: Random pile of core stuff
@ 2019-11-15 19:41 ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:41 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

I found this random pile of stuff lying around. Dusted it off
and tossed in the new selftests.

Ville Syrjälä (7):
  drm: Move page_flip fb lookup earlier
  drm: Allocate the page flip event earlier
  drm: Extract page_flip_{internal,atomic}()
  drm: Simplify the setplane old_fb handling further
  drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
  drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
  drm/atomic: Reduce setplane locking

 drivers/gpu/drm/drm_atomic_uapi.c             |   9 +-
 drivers/gpu/drm/drm_plane.c                   | 285 +++++++++++-------
 drivers/gpu/drm/selftests/Makefile            |   3 +-
 .../gpu/drm/selftests/drm_modeset_selftests.h |   2 +
 .../gpu/drm/selftests/test-drm_atomic_uapi.c  | 110 +++++++
 .../drm/selftests/test-drm_modeset_common.h   |   2 +
 6 files changed, 291 insertions(+), 120 deletions(-)
 create mode 100644 drivers/gpu/drm/selftests/test-drm_atomic_uapi.c

-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* [PATCH 0/7] drm: Random pile of core stuff
@ 2019-11-15 19:41 ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:41 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

I found this random pile of stuff lying around. Dusted it off
and tossed in the new selftests.

Ville Syrjälä (7):
  drm: Move page_flip fb lookup earlier
  drm: Allocate the page flip event earlier
  drm: Extract page_flip_{internal,atomic}()
  drm: Simplify the setplane old_fb handling further
  drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
  drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
  drm/atomic: Reduce setplane locking

 drivers/gpu/drm/drm_atomic_uapi.c             |   9 +-
 drivers/gpu/drm/drm_plane.c                   | 285 +++++++++++-------
 drivers/gpu/drm/selftests/Makefile            |   3 +-
 .../gpu/drm/selftests/drm_modeset_selftests.h |   2 +
 .../gpu/drm/selftests/test-drm_atomic_uapi.c  | 110 +++++++
 .../drm/selftests/test-drm_modeset_common.h   |   2 +
 6 files changed, 291 insertions(+), 120 deletions(-)
 create mode 100644 drivers/gpu/drm/selftests/test-drm_atomic_uapi.c

-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 51+ messages in thread

* [Intel-gfx] [PATCH 0/7] drm: Random pile of core stuff
@ 2019-11-15 19:41 ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:41 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

I found this random pile of stuff lying around. Dusted it off
and tossed in the new selftests.

Ville Syrjälä (7):
  drm: Move page_flip fb lookup earlier
  drm: Allocate the page flip event earlier
  drm: Extract page_flip_{internal,atomic}()
  drm: Simplify the setplane old_fb handling further
  drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
  drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
  drm/atomic: Reduce setplane locking

 drivers/gpu/drm/drm_atomic_uapi.c             |   9 +-
 drivers/gpu/drm/drm_plane.c                   | 285 +++++++++++-------
 drivers/gpu/drm/selftests/Makefile            |   3 +-
 .../gpu/drm/selftests/drm_modeset_selftests.h |   2 +
 .../gpu/drm/selftests/test-drm_atomic_uapi.c  | 110 +++++++
 .../drm/selftests/test-drm_modeset_common.h   |   2 +
 6 files changed, 291 insertions(+), 120 deletions(-)
 create mode 100644 drivers/gpu/drm/selftests/test-drm_atomic_uapi.c

-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* [PATCH 1/7] drm: Move page_flip fb lookup earlier
@ 2019-11-15 19:41   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:41 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

No reason that I can see to delay the fb lookup this late. Moving it
earlier allows us to keep it outside of the lock retry loop. This
makes error handling and whatnot simpler.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index d6ad60ab0d38..14a292d7817d 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1037,7 +1037,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	struct drm_mode_crtc_page_flip_target *page_flip = data;
 	struct drm_crtc *crtc;
 	struct drm_plane *plane;
-	struct drm_framebuffer *fb = NULL, *old_fb;
+	struct drm_framebuffer *fb, *old_fb;
 	struct drm_pending_vblank_event *e = NULL;
 	u32 target_vblank = page_flip->sequence;
 	struct drm_modeset_acquire_ctx ctx;
@@ -1086,16 +1086,16 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 				DRM_DEBUG("Invalid absolute flip target %u, "
 					  "must be <= %u\n", target_vblank,
 					  current_vblank + 1);
-				drm_crtc_vblank_put(crtc);
-				return -EINVAL;
+				ret = -EINVAL;
+				goto put_vblank;
 			}
 			break;
 		case DRM_MODE_PAGE_FLIP_TARGET_RELATIVE:
 			if (target_vblank != 0 && target_vblank != 1) {
 				DRM_DEBUG("Invalid relative flip target %u, "
 					  "must be 0 or 1\n", target_vblank);
-				drm_crtc_vblank_put(crtc);
-				return -EINVAL;
+				ret = -EINVAL;
+				goto put_vblank;
 			}
 			target_vblank += current_vblank;
 			break;
@@ -1106,7 +1106,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		}
 	} else if (crtc->funcs->page_flip == NULL ||
 		   (page_flip->flags & DRM_MODE_PAGE_FLIP_TARGET)) {
-		return -EINVAL;
+		ret = -EINVAL;
+		goto put_vblank;
+	}
+
+	fb = drm_framebuffer_lookup(dev, file_priv, page_flip->fb_id);
+	if (!fb) {
+		ret = -ENOENT;
+		goto put_vblank;
 	}
 
 	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
@@ -1132,12 +1139,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto out;
 	}
 
-	fb = drm_framebuffer_lookup(dev, file_priv, page_flip->fb_id);
-	if (!fb) {
-		ret = -ENOENT;
-		goto out;
-	}
-
 	if (plane->state) {
 		const struct drm_plane_state *state = plane->state;
 
@@ -1201,8 +1202,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	}
 
 out:
-	if (fb)
-		drm_framebuffer_put(fb);
 	if (plane->old_fb)
 		drm_framebuffer_put(plane->old_fb);
 	plane->old_fb = NULL;
@@ -1216,6 +1215,8 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 
+	drm_framebuffer_put(fb);
+put_vblank:
 	if (ret && crtc->funcs->page_flip_target)
 		drm_crtc_vblank_put(crtc);
 
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 1/7] drm: Move page_flip fb lookup earlier
@ 2019-11-15 19:41   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:41 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

No reason that I can see to delay the fb lookup this late. Moving it
earlier allows us to keep it outside of the lock retry loop. This
makes error handling and whatnot simpler.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index d6ad60ab0d38..14a292d7817d 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1037,7 +1037,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	struct drm_mode_crtc_page_flip_target *page_flip = data;
 	struct drm_crtc *crtc;
 	struct drm_plane *plane;
-	struct drm_framebuffer *fb = NULL, *old_fb;
+	struct drm_framebuffer *fb, *old_fb;
 	struct drm_pending_vblank_event *e = NULL;
 	u32 target_vblank = page_flip->sequence;
 	struct drm_modeset_acquire_ctx ctx;
@@ -1086,16 +1086,16 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 				DRM_DEBUG("Invalid absolute flip target %u, "
 					  "must be <= %u\n", target_vblank,
 					  current_vblank + 1);
-				drm_crtc_vblank_put(crtc);
-				return -EINVAL;
+				ret = -EINVAL;
+				goto put_vblank;
 			}
 			break;
 		case DRM_MODE_PAGE_FLIP_TARGET_RELATIVE:
 			if (target_vblank != 0 && target_vblank != 1) {
 				DRM_DEBUG("Invalid relative flip target %u, "
 					  "must be 0 or 1\n", target_vblank);
-				drm_crtc_vblank_put(crtc);
-				return -EINVAL;
+				ret = -EINVAL;
+				goto put_vblank;
 			}
 			target_vblank += current_vblank;
 			break;
@@ -1106,7 +1106,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		}
 	} else if (crtc->funcs->page_flip == NULL ||
 		   (page_flip->flags & DRM_MODE_PAGE_FLIP_TARGET)) {
-		return -EINVAL;
+		ret = -EINVAL;
+		goto put_vblank;
+	}
+
+	fb = drm_framebuffer_lookup(dev, file_priv, page_flip->fb_id);
+	if (!fb) {
+		ret = -ENOENT;
+		goto put_vblank;
 	}
 
 	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
@@ -1132,12 +1139,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto out;
 	}
 
-	fb = drm_framebuffer_lookup(dev, file_priv, page_flip->fb_id);
-	if (!fb) {
-		ret = -ENOENT;
-		goto out;
-	}
-
 	if (plane->state) {
 		const struct drm_plane_state *state = plane->state;
 
@@ -1201,8 +1202,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	}
 
 out:
-	if (fb)
-		drm_framebuffer_put(fb);
 	if (plane->old_fb)
 		drm_framebuffer_put(plane->old_fb);
 	plane->old_fb = NULL;
@@ -1216,6 +1215,8 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 
+	drm_framebuffer_put(fb);
+put_vblank:
 	if (ret && crtc->funcs->page_flip_target)
 		drm_crtc_vblank_put(crtc);
 
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [Intel-gfx] [PATCH 1/7] drm: Move page_flip fb lookup earlier
@ 2019-11-15 19:41   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:41 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

No reason that I can see to delay the fb lookup this late. Moving it
earlier allows us to keep it outside of the lock retry loop. This
makes error handling and whatnot simpler.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index d6ad60ab0d38..14a292d7817d 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1037,7 +1037,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	struct drm_mode_crtc_page_flip_target *page_flip = data;
 	struct drm_crtc *crtc;
 	struct drm_plane *plane;
-	struct drm_framebuffer *fb = NULL, *old_fb;
+	struct drm_framebuffer *fb, *old_fb;
 	struct drm_pending_vblank_event *e = NULL;
 	u32 target_vblank = page_flip->sequence;
 	struct drm_modeset_acquire_ctx ctx;
@@ -1086,16 +1086,16 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 				DRM_DEBUG("Invalid absolute flip target %u, "
 					  "must be <= %u\n", target_vblank,
 					  current_vblank + 1);
-				drm_crtc_vblank_put(crtc);
-				return -EINVAL;
+				ret = -EINVAL;
+				goto put_vblank;
 			}
 			break;
 		case DRM_MODE_PAGE_FLIP_TARGET_RELATIVE:
 			if (target_vblank != 0 && target_vblank != 1) {
 				DRM_DEBUG("Invalid relative flip target %u, "
 					  "must be 0 or 1\n", target_vblank);
-				drm_crtc_vblank_put(crtc);
-				return -EINVAL;
+				ret = -EINVAL;
+				goto put_vblank;
 			}
 			target_vblank += current_vblank;
 			break;
@@ -1106,7 +1106,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		}
 	} else if (crtc->funcs->page_flip == NULL ||
 		   (page_flip->flags & DRM_MODE_PAGE_FLIP_TARGET)) {
-		return -EINVAL;
+		ret = -EINVAL;
+		goto put_vblank;
+	}
+
+	fb = drm_framebuffer_lookup(dev, file_priv, page_flip->fb_id);
+	if (!fb) {
+		ret = -ENOENT;
+		goto put_vblank;
 	}
 
 	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
@@ -1132,12 +1139,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto out;
 	}
 
-	fb = drm_framebuffer_lookup(dev, file_priv, page_flip->fb_id);
-	if (!fb) {
-		ret = -ENOENT;
-		goto out;
-	}
-
 	if (plane->state) {
 		const struct drm_plane_state *state = plane->state;
 
@@ -1201,8 +1202,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	}
 
 out:
-	if (fb)
-		drm_framebuffer_put(fb);
 	if (plane->old_fb)
 		drm_framebuffer_put(plane->old_fb);
 	plane->old_fb = NULL;
@@ -1216,6 +1215,8 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 
+	drm_framebuffer_put(fb);
+put_vblank:
 	if (ret && crtc->funcs->page_flip_target)
 		drm_crtc_vblank_put(crtc);
 
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 2/7] drm: Allocate the page flip event earlier
@ 2019-11-15 19:41   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:41 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Can't see why we need to delay the page flip event allocation until the
last moment. Move it earlier to simplify error handling.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 45 +++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 14a292d7817d..38878da5b704 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1116,6 +1116,26 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto put_vblank;
 	}
 
+	if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
+		e = kzalloc(sizeof(*e), GFP_KERNEL);
+		if (!e) {
+			ret = -ENOMEM;
+			goto put_fb;
+		}
+
+		e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
+		e->event.base.length = sizeof(e->event);
+		e->event.vbl.user_data = page_flip->user_data;
+		e->event.vbl.crtc_id = crtc->base.id;
+
+		ret = drm_event_reserve_init(dev, file_priv, &e->base, &e->event.base);
+		if (ret) {
+			kfree(e);
+			e = NULL;
+			goto put_fb;
+		}
+	}
+
 	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
 retry:
 	ret = drm_modeset_lock(&crtc->mutex, &ctx);
@@ -1160,26 +1180,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto out;
 	}
 
-	if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
-		e = kzalloc(sizeof *e, GFP_KERNEL);
-		if (!e) {
-			ret = -ENOMEM;
-			goto out;
-		}
-
-		e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
-		e->event.base.length = sizeof(e->event);
-		e->event.vbl.user_data = page_flip->user_data;
-		e->event.vbl.crtc_id = crtc->base.id;
-
-		ret = drm_event_reserve_init(dev, file_priv, &e->base, &e->event.base);
-		if (ret) {
-			kfree(e);
-			e = NULL;
-			goto out;
-		}
-	}
-
 	plane->old_fb = plane->fb;
 	if (crtc->funcs->page_flip_target)
 		ret = crtc->funcs->page_flip_target(crtc, fb, e,
@@ -1190,8 +1190,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
 					     &ctx);
 	if (ret) {
-		if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT)
-			drm_event_cancel_free(dev, &e->base);
 		/* Keep the old fb, don't unref it. */
 		plane->old_fb = NULL;
 	} else {
@@ -1215,6 +1213,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 
+	if (ret && e)
+		drm_event_cancel_free(dev, &e->base);
+put_fb:
 	drm_framebuffer_put(fb);
 put_vblank:
 	if (ret && crtc->funcs->page_flip_target)
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 2/7] drm: Allocate the page flip event earlier
@ 2019-11-15 19:41   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:41 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Can't see why we need to delay the page flip event allocation until the
last moment. Move it earlier to simplify error handling.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 45 +++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 14a292d7817d..38878da5b704 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1116,6 +1116,26 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto put_vblank;
 	}
 
+	if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
+		e = kzalloc(sizeof(*e), GFP_KERNEL);
+		if (!e) {
+			ret = -ENOMEM;
+			goto put_fb;
+		}
+
+		e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
+		e->event.base.length = sizeof(e->event);
+		e->event.vbl.user_data = page_flip->user_data;
+		e->event.vbl.crtc_id = crtc->base.id;
+
+		ret = drm_event_reserve_init(dev, file_priv, &e->base, &e->event.base);
+		if (ret) {
+			kfree(e);
+			e = NULL;
+			goto put_fb;
+		}
+	}
+
 	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
 retry:
 	ret = drm_modeset_lock(&crtc->mutex, &ctx);
@@ -1160,26 +1180,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto out;
 	}
 
-	if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
-		e = kzalloc(sizeof *e, GFP_KERNEL);
-		if (!e) {
-			ret = -ENOMEM;
-			goto out;
-		}
-
-		e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
-		e->event.base.length = sizeof(e->event);
-		e->event.vbl.user_data = page_flip->user_data;
-		e->event.vbl.crtc_id = crtc->base.id;
-
-		ret = drm_event_reserve_init(dev, file_priv, &e->base, &e->event.base);
-		if (ret) {
-			kfree(e);
-			e = NULL;
-			goto out;
-		}
-	}
-
 	plane->old_fb = plane->fb;
 	if (crtc->funcs->page_flip_target)
 		ret = crtc->funcs->page_flip_target(crtc, fb, e,
@@ -1190,8 +1190,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
 					     &ctx);
 	if (ret) {
-		if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT)
-			drm_event_cancel_free(dev, &e->base);
 		/* Keep the old fb, don't unref it. */
 		plane->old_fb = NULL;
 	} else {
@@ -1215,6 +1213,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 
+	if (ret && e)
+		drm_event_cancel_free(dev, &e->base);
+put_fb:
 	drm_framebuffer_put(fb);
 put_vblank:
 	if (ret && crtc->funcs->page_flip_target)
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [Intel-gfx] [PATCH 2/7] drm: Allocate the page flip event earlier
@ 2019-11-15 19:41   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:41 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Can't see why we need to delay the page flip event allocation until the
last moment. Move it earlier to simplify error handling.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 45 +++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 14a292d7817d..38878da5b704 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1116,6 +1116,26 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto put_vblank;
 	}
 
+	if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
+		e = kzalloc(sizeof(*e), GFP_KERNEL);
+		if (!e) {
+			ret = -ENOMEM;
+			goto put_fb;
+		}
+
+		e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
+		e->event.base.length = sizeof(e->event);
+		e->event.vbl.user_data = page_flip->user_data;
+		e->event.vbl.crtc_id = crtc->base.id;
+
+		ret = drm_event_reserve_init(dev, file_priv, &e->base, &e->event.base);
+		if (ret) {
+			kfree(e);
+			e = NULL;
+			goto put_fb;
+		}
+	}
+
 	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
 retry:
 	ret = drm_modeset_lock(&crtc->mutex, &ctx);
@@ -1160,26 +1180,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto out;
 	}
 
-	if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
-		e = kzalloc(sizeof *e, GFP_KERNEL);
-		if (!e) {
-			ret = -ENOMEM;
-			goto out;
-		}
-
-		e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
-		e->event.base.length = sizeof(e->event);
-		e->event.vbl.user_data = page_flip->user_data;
-		e->event.vbl.crtc_id = crtc->base.id;
-
-		ret = drm_event_reserve_init(dev, file_priv, &e->base, &e->event.base);
-		if (ret) {
-			kfree(e);
-			e = NULL;
-			goto out;
-		}
-	}
-
 	plane->old_fb = plane->fb;
 	if (crtc->funcs->page_flip_target)
 		ret = crtc->funcs->page_flip_target(crtc, fb, e,
@@ -1190,8 +1190,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
 					     &ctx);
 	if (ret) {
-		if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT)
-			drm_event_cancel_free(dev, &e->base);
 		/* Keep the old fb, don't unref it. */
 		plane->old_fb = NULL;
 	} else {
@@ -1215,6 +1213,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 
+	if (ret && e)
+		drm_event_cancel_free(dev, &e->base);
+put_fb:
 	drm_framebuffer_put(fb);
 put_vblank:
 	if (ret && crtc->funcs->page_flip_target)
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Yank out the code for the plane->fb/old_fb/crtc handling from
the page flip path into page_flip_internal(), and provide a
simpler variant for atomic drivers.

We'll also move the fb vs. src viewport checks into the new
functions as they are slightly different between the two paths.
If the atomic .page_flip() implementations are guaranteed
to call drm_atomic_plane_check() we could even drop the check
entirely from page_flip_atomic(). For now toss in a FIXME.

v2: Bit more polish in page_flip_internal()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
 1 file changed, 102 insertions(+), 57 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 38878da5b704..6052475a20a5 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
 	return drm_mode_cursor_common(dev, req, file_priv);
 }
 
+static int page_flip_check_fbs(const struct drm_framebuffer *fb,
+			       const struct drm_framebuffer *old_fb)
+{
+	/* The framebuffer is currently unbound, presumably
+	 * due to a hotplug event, that userspace has not
+	 * yet discovered.
+	 */
+	if (!old_fb)
+		return -EBUSY;
+
+	if (old_fb->format != fb->format) {
+		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int page_flip_internal(struct drm_crtc *crtc,
+			      struct drm_framebuffer *fb,
+			      struct drm_pending_vblank_event *e,
+			      u32 flags,
+			      u32 target_vblank,
+			      struct drm_modeset_acquire_ctx *ctx)
+{
+	struct drm_plane *plane = crtc->primary;
+	int ret;
+
+	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
+
+	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
+				      &crtc->mode, fb);
+	if (ret)
+		return ret;
+
+	ret = page_flip_check_fbs(fb, plane->fb);
+	if (ret)
+		return ret;
+
+	plane->old_fb = plane->fb;
+	if (crtc->funcs->page_flip_target)
+		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
+						    target_vblank, ctx);
+	else
+		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
+	if (ret) {
+		plane->old_fb = NULL;
+		return ret;
+	}
+
+	plane->fb = fb;
+	drm_framebuffer_get(plane->fb);
+
+	drm_framebuffer_put(plane->old_fb);
+	plane->old_fb = NULL;
+
+	return 0;
+}
+
+static int page_flip_atomic(struct drm_crtc *crtc,
+			    struct drm_framebuffer *fb,
+			    struct drm_pending_vblank_event *e,
+			    u32 flags,
+			    u32 target_vblank,
+			    struct drm_modeset_acquire_ctx *ctx)
+{
+	struct drm_plane *plane = crtc->primary;
+	struct drm_plane_state *plane_state = plane->state;
+	int ret;
+
+	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
+
+	/*
+	 * FIXME: Can we assume all drivers end up calling
+	 * drm_atomic_plane_check() in their page flip paths?
+	 * If so we could remove this.
+	 */
+	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
+					       plane_state->src_y,
+					       plane_state->src_w,
+					       plane_state->src_h,
+					       fb);
+	if (ret)
+		return ret;
+
+	ret = page_flip_check_fbs(fb, plane_state->fb);
+	if (ret)
+		return ret;
+
+	if (crtc->funcs->page_flip_target)
+		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
+						     target_vblank, ctx);
+	else
+		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
+}
+
 int drm_mode_page_flip_ioctl(struct drm_device *dev,
 			     void *data, struct drm_file *file_priv)
 {
 	struct drm_mode_crtc_page_flip_target *page_flip = data;
 	struct drm_crtc *crtc;
 	struct drm_plane *plane;
-	struct drm_framebuffer *fb, *old_fb;
+	struct drm_framebuffer *fb;
 	struct drm_pending_vblank_event *e = NULL;
 	u32 target_vblank = page_flip->sequence;
 	struct drm_modeset_acquire_ctx ctx;
@@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	if (ret)
 		goto out;
 
-	if (plane->state)
-		old_fb = plane->state->fb;
+	if (drm_drv_uses_atomic_modeset(dev))
+		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
+				       target_vblank, &ctx);
 	else
-		old_fb = plane->fb;
-
-	if (old_fb == NULL) {
-		/* The framebuffer is currently unbound, presumably
-		 * due to a hotplug event, that userspace has not
-		 * yet discovered.
-		 */
-		ret = -EBUSY;
-		goto out;
-	}
-
-	if (plane->state) {
-		const struct drm_plane_state *state = plane->state;
-
-		ret = drm_framebuffer_check_src_coords(state->src_x,
-						       state->src_y,
-						       state->src_w,
-						       state->src_h,
-						       fb);
-	} else {
-		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
-					      &crtc->mode, fb);
-	}
-	if (ret)
-		goto out;
-
-	if (old_fb->format != fb->format) {
-		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
-		ret = -EINVAL;
-		goto out;
-	}
-
-	plane->old_fb = plane->fb;
-	if (crtc->funcs->page_flip_target)
-		ret = crtc->funcs->page_flip_target(crtc, fb, e,
-						    page_flip->flags,
-						    target_vblank,
-						    &ctx);
-	else
-		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
-					     &ctx);
-	if (ret) {
-		/* Keep the old fb, don't unref it. */
-		plane->old_fb = NULL;
-	} else {
-		if (!plane->state) {
-			plane->fb = fb;
-			drm_framebuffer_get(fb);
-		}
-	}
+		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
+					 target_vblank, &ctx);
 
 out:
-	if (plane->old_fb)
-		drm_framebuffer_put(plane->old_fb);
-	plane->old_fb = NULL;
-
 	if (ret == -EDEADLK) {
 		ret = drm_modeset_backoff(&ctx);
 		if (!ret)
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 3/7] drm: Extract page_flip_{internal,atomic}()
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Yank out the code for the plane->fb/old_fb/crtc handling from
the page flip path into page_flip_internal(), and provide a
simpler variant for atomic drivers.

We'll also move the fb vs. src viewport checks into the new
functions as they are slightly different between the two paths.
If the atomic .page_flip() implementations are guaranteed
to call drm_atomic_plane_check() we could even drop the check
entirely from page_flip_atomic(). For now toss in a FIXME.

v2: Bit more polish in page_flip_internal()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
 1 file changed, 102 insertions(+), 57 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 38878da5b704..6052475a20a5 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
 	return drm_mode_cursor_common(dev, req, file_priv);
 }
 
+static int page_flip_check_fbs(const struct drm_framebuffer *fb,
+			       const struct drm_framebuffer *old_fb)
+{
+	/* The framebuffer is currently unbound, presumably
+	 * due to a hotplug event, that userspace has not
+	 * yet discovered.
+	 */
+	if (!old_fb)
+		return -EBUSY;
+
+	if (old_fb->format != fb->format) {
+		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int page_flip_internal(struct drm_crtc *crtc,
+			      struct drm_framebuffer *fb,
+			      struct drm_pending_vblank_event *e,
+			      u32 flags,
+			      u32 target_vblank,
+			      struct drm_modeset_acquire_ctx *ctx)
+{
+	struct drm_plane *plane = crtc->primary;
+	int ret;
+
+	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
+
+	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
+				      &crtc->mode, fb);
+	if (ret)
+		return ret;
+
+	ret = page_flip_check_fbs(fb, plane->fb);
+	if (ret)
+		return ret;
+
+	plane->old_fb = plane->fb;
+	if (crtc->funcs->page_flip_target)
+		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
+						    target_vblank, ctx);
+	else
+		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
+	if (ret) {
+		plane->old_fb = NULL;
+		return ret;
+	}
+
+	plane->fb = fb;
+	drm_framebuffer_get(plane->fb);
+
+	drm_framebuffer_put(plane->old_fb);
+	plane->old_fb = NULL;
+
+	return 0;
+}
+
+static int page_flip_atomic(struct drm_crtc *crtc,
+			    struct drm_framebuffer *fb,
+			    struct drm_pending_vblank_event *e,
+			    u32 flags,
+			    u32 target_vblank,
+			    struct drm_modeset_acquire_ctx *ctx)
+{
+	struct drm_plane *plane = crtc->primary;
+	struct drm_plane_state *plane_state = plane->state;
+	int ret;
+
+	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
+
+	/*
+	 * FIXME: Can we assume all drivers end up calling
+	 * drm_atomic_plane_check() in their page flip paths?
+	 * If so we could remove this.
+	 */
+	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
+					       plane_state->src_y,
+					       plane_state->src_w,
+					       plane_state->src_h,
+					       fb);
+	if (ret)
+		return ret;
+
+	ret = page_flip_check_fbs(fb, plane_state->fb);
+	if (ret)
+		return ret;
+
+	if (crtc->funcs->page_flip_target)
+		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
+						     target_vblank, ctx);
+	else
+		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
+}
+
 int drm_mode_page_flip_ioctl(struct drm_device *dev,
 			     void *data, struct drm_file *file_priv)
 {
 	struct drm_mode_crtc_page_flip_target *page_flip = data;
 	struct drm_crtc *crtc;
 	struct drm_plane *plane;
-	struct drm_framebuffer *fb, *old_fb;
+	struct drm_framebuffer *fb;
 	struct drm_pending_vblank_event *e = NULL;
 	u32 target_vblank = page_flip->sequence;
 	struct drm_modeset_acquire_ctx ctx;
@@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	if (ret)
 		goto out;
 
-	if (plane->state)
-		old_fb = plane->state->fb;
+	if (drm_drv_uses_atomic_modeset(dev))
+		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
+				       target_vblank, &ctx);
 	else
-		old_fb = plane->fb;
-
-	if (old_fb == NULL) {
-		/* The framebuffer is currently unbound, presumably
-		 * due to a hotplug event, that userspace has not
-		 * yet discovered.
-		 */
-		ret = -EBUSY;
-		goto out;
-	}
-
-	if (plane->state) {
-		const struct drm_plane_state *state = plane->state;
-
-		ret = drm_framebuffer_check_src_coords(state->src_x,
-						       state->src_y,
-						       state->src_w,
-						       state->src_h,
-						       fb);
-	} else {
-		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
-					      &crtc->mode, fb);
-	}
-	if (ret)
-		goto out;
-
-	if (old_fb->format != fb->format) {
-		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
-		ret = -EINVAL;
-		goto out;
-	}
-
-	plane->old_fb = plane->fb;
-	if (crtc->funcs->page_flip_target)
-		ret = crtc->funcs->page_flip_target(crtc, fb, e,
-						    page_flip->flags,
-						    target_vblank,
-						    &ctx);
-	else
-		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
-					     &ctx);
-	if (ret) {
-		/* Keep the old fb, don't unref it. */
-		plane->old_fb = NULL;
-	} else {
-		if (!plane->state) {
-			plane->fb = fb;
-			drm_framebuffer_get(fb);
-		}
-	}
+		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
+					 target_vblank, &ctx);
 
 out:
-	if (plane->old_fb)
-		drm_framebuffer_put(plane->old_fb);
-	plane->old_fb = NULL;
-
 	if (ret == -EDEADLK) {
 		ret = drm_modeset_backoff(&ctx);
 		if (!ret)
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [Intel-gfx] [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Yank out the code for the plane->fb/old_fb/crtc handling from
the page flip path into page_flip_internal(), and provide a
simpler variant for atomic drivers.

We'll also move the fb vs. src viewport checks into the new
functions as they are slightly different between the two paths.
If the atomic .page_flip() implementations are guaranteed
to call drm_atomic_plane_check() we could even drop the check
entirely from page_flip_atomic(). For now toss in a FIXME.

v2: Bit more polish in page_flip_internal()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
 1 file changed, 102 insertions(+), 57 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 38878da5b704..6052475a20a5 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
 	return drm_mode_cursor_common(dev, req, file_priv);
 }
 
+static int page_flip_check_fbs(const struct drm_framebuffer *fb,
+			       const struct drm_framebuffer *old_fb)
+{
+	/* The framebuffer is currently unbound, presumably
+	 * due to a hotplug event, that userspace has not
+	 * yet discovered.
+	 */
+	if (!old_fb)
+		return -EBUSY;
+
+	if (old_fb->format != fb->format) {
+		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int page_flip_internal(struct drm_crtc *crtc,
+			      struct drm_framebuffer *fb,
+			      struct drm_pending_vblank_event *e,
+			      u32 flags,
+			      u32 target_vblank,
+			      struct drm_modeset_acquire_ctx *ctx)
+{
+	struct drm_plane *plane = crtc->primary;
+	int ret;
+
+	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
+
+	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
+				      &crtc->mode, fb);
+	if (ret)
+		return ret;
+
+	ret = page_flip_check_fbs(fb, plane->fb);
+	if (ret)
+		return ret;
+
+	plane->old_fb = plane->fb;
+	if (crtc->funcs->page_flip_target)
+		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
+						    target_vblank, ctx);
+	else
+		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
+	if (ret) {
+		plane->old_fb = NULL;
+		return ret;
+	}
+
+	plane->fb = fb;
+	drm_framebuffer_get(plane->fb);
+
+	drm_framebuffer_put(plane->old_fb);
+	plane->old_fb = NULL;
+
+	return 0;
+}
+
+static int page_flip_atomic(struct drm_crtc *crtc,
+			    struct drm_framebuffer *fb,
+			    struct drm_pending_vblank_event *e,
+			    u32 flags,
+			    u32 target_vblank,
+			    struct drm_modeset_acquire_ctx *ctx)
+{
+	struct drm_plane *plane = crtc->primary;
+	struct drm_plane_state *plane_state = plane->state;
+	int ret;
+
+	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
+
+	/*
+	 * FIXME: Can we assume all drivers end up calling
+	 * drm_atomic_plane_check() in their page flip paths?
+	 * If so we could remove this.
+	 */
+	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
+					       plane_state->src_y,
+					       plane_state->src_w,
+					       plane_state->src_h,
+					       fb);
+	if (ret)
+		return ret;
+
+	ret = page_flip_check_fbs(fb, plane_state->fb);
+	if (ret)
+		return ret;
+
+	if (crtc->funcs->page_flip_target)
+		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
+						     target_vblank, ctx);
+	else
+		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
+}
+
 int drm_mode_page_flip_ioctl(struct drm_device *dev,
 			     void *data, struct drm_file *file_priv)
 {
 	struct drm_mode_crtc_page_flip_target *page_flip = data;
 	struct drm_crtc *crtc;
 	struct drm_plane *plane;
-	struct drm_framebuffer *fb, *old_fb;
+	struct drm_framebuffer *fb;
 	struct drm_pending_vblank_event *e = NULL;
 	u32 target_vblank = page_flip->sequence;
 	struct drm_modeset_acquire_ctx ctx;
@@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	if (ret)
 		goto out;
 
-	if (plane->state)
-		old_fb = plane->state->fb;
+	if (drm_drv_uses_atomic_modeset(dev))
+		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
+				       target_vblank, &ctx);
 	else
-		old_fb = plane->fb;
-
-	if (old_fb == NULL) {
-		/* The framebuffer is currently unbound, presumably
-		 * due to a hotplug event, that userspace has not
-		 * yet discovered.
-		 */
-		ret = -EBUSY;
-		goto out;
-	}
-
-	if (plane->state) {
-		const struct drm_plane_state *state = plane->state;
-
-		ret = drm_framebuffer_check_src_coords(state->src_x,
-						       state->src_y,
-						       state->src_w,
-						       state->src_h,
-						       fb);
-	} else {
-		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
-					      &crtc->mode, fb);
-	}
-	if (ret)
-		goto out;
-
-	if (old_fb->format != fb->format) {
-		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
-		ret = -EINVAL;
-		goto out;
-	}
-
-	plane->old_fb = plane->fb;
-	if (crtc->funcs->page_flip_target)
-		ret = crtc->funcs->page_flip_target(crtc, fb, e,
-						    page_flip->flags,
-						    target_vblank,
-						    &ctx);
-	else
-		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
-					     &ctx);
-	if (ret) {
-		/* Keep the old fb, don't unref it. */
-		plane->old_fb = NULL;
-	} else {
-		if (!plane->state) {
-			plane->fb = fb;
-			drm_framebuffer_get(fb);
-		}
-	}
+		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
+					 target_vblank, &ctx);
 
 out:
-	if (plane->old_fb)
-		drm_framebuffer_put(plane->old_fb);
-	plane->old_fb = NULL;
-
 	if (ret == -EDEADLK) {
 		ret = drm_modeset_backoff(&ctx);
 		if (!ret)
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 4/7] drm: Simplify the setplane old_fb handling further
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Instead of doing the things in a convoluted way with the failure and
success paths mixed up let's just clear old_fb when we encounter an
error and bail out immediately. We already did this for the pageflip
path.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 6052475a20a5..ef0cc33b43ce 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -688,12 +688,13 @@ static int __setplane_internal(struct drm_plane *plane,
 	if (!fb) {
 		plane->old_fb = plane->fb;
 		ret = plane->funcs->disable_plane(plane, ctx);
-		if (!ret) {
-			plane->crtc = NULL;
-			plane->fb = NULL;
-		} else {
+		if (ret) {
 			plane->old_fb = NULL;
+			return ret;
 		}
+
+		plane->crtc = NULL;
+		plane->fb = NULL;
 		goto out;
 	}
 
@@ -701,26 +702,27 @@ static int __setplane_internal(struct drm_plane *plane,
 			       crtc_x, crtc_y, crtc_w, crtc_h,
 			       src_x, src_y, src_w, src_h);
 	if (ret)
-		goto out;
+		return ret;
 
 	plane->old_fb = plane->fb;
 	ret = plane->funcs->update_plane(plane, crtc, fb,
 					 crtc_x, crtc_y, crtc_w, crtc_h,
 					 src_x, src_y, src_w, src_h, ctx);
-	if (!ret) {
-		plane->crtc = crtc;
-		plane->fb = fb;
-		drm_framebuffer_get(plane->fb);
-	} else {
+	if (ret) {
 		plane->old_fb = NULL;
+		return ret;
 	}
 
+	plane->crtc = crtc;
+	plane->fb = fb;
+	drm_framebuffer_get(plane->fb);
+
 out:
 	if (plane->old_fb)
 		drm_framebuffer_put(plane->old_fb);
 	plane->old_fb = NULL;
 
-	return ret;
+	return 0;
 }
 
 static int __setplane_atomic(struct drm_plane *plane,
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 4/7] drm: Simplify the setplane old_fb handling further
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Instead of doing the things in a convoluted way with the failure and
success paths mixed up let's just clear old_fb when we encounter an
error and bail out immediately. We already did this for the pageflip
path.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 6052475a20a5..ef0cc33b43ce 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -688,12 +688,13 @@ static int __setplane_internal(struct drm_plane *plane,
 	if (!fb) {
 		plane->old_fb = plane->fb;
 		ret = plane->funcs->disable_plane(plane, ctx);
-		if (!ret) {
-			plane->crtc = NULL;
-			plane->fb = NULL;
-		} else {
+		if (ret) {
 			plane->old_fb = NULL;
+			return ret;
 		}
+
+		plane->crtc = NULL;
+		plane->fb = NULL;
 		goto out;
 	}
 
@@ -701,26 +702,27 @@ static int __setplane_internal(struct drm_plane *plane,
 			       crtc_x, crtc_y, crtc_w, crtc_h,
 			       src_x, src_y, src_w, src_h);
 	if (ret)
-		goto out;
+		return ret;
 
 	plane->old_fb = plane->fb;
 	ret = plane->funcs->update_plane(plane, crtc, fb,
 					 crtc_x, crtc_y, crtc_w, crtc_h,
 					 src_x, src_y, src_w, src_h, ctx);
-	if (!ret) {
-		plane->crtc = crtc;
-		plane->fb = fb;
-		drm_framebuffer_get(plane->fb);
-	} else {
+	if (ret) {
 		plane->old_fb = NULL;
+		return ret;
 	}
 
+	plane->crtc = crtc;
+	plane->fb = fb;
+	drm_framebuffer_get(plane->fb);
+
 out:
 	if (plane->old_fb)
 		drm_framebuffer_put(plane->old_fb);
 	plane->old_fb = NULL;
 
-	return ret;
+	return 0;
 }
 
 static int __setplane_atomic(struct drm_plane *plane,
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [Intel-gfx] [PATCH 4/7] drm: Simplify the setplane old_fb handling further
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Instead of doing the things in a convoluted way with the failure and
success paths mixed up let's just clear old_fb when we encounter an
error and bail out immediately. We already did this for the pageflip
path.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 6052475a20a5..ef0cc33b43ce 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -688,12 +688,13 @@ static int __setplane_internal(struct drm_plane *plane,
 	if (!fb) {
 		plane->old_fb = plane->fb;
 		ret = plane->funcs->disable_plane(plane, ctx);
-		if (!ret) {
-			plane->crtc = NULL;
-			plane->fb = NULL;
-		} else {
+		if (ret) {
 			plane->old_fb = NULL;
+			return ret;
 		}
+
+		plane->crtc = NULL;
+		plane->fb = NULL;
 		goto out;
 	}
 
@@ -701,26 +702,27 @@ static int __setplane_internal(struct drm_plane *plane,
 			       crtc_x, crtc_y, crtc_w, crtc_h,
 			       src_x, src_y, src_w, src_h);
 	if (ret)
-		goto out;
+		return ret;
 
 	plane->old_fb = plane->fb;
 	ret = plane->funcs->update_plane(plane, crtc, fb,
 					 crtc_x, crtc_y, crtc_w, crtc_h,
 					 src_x, src_y, src_w, src_h, ctx);
-	if (!ret) {
-		plane->crtc = crtc;
-		plane->fb = fb;
-		drm_framebuffer_get(plane->fb);
-	} else {
+	if (ret) {
 		plane->old_fb = NULL;
+		return ret;
 	}
 
+	plane->crtc = crtc;
+	plane->fb = fb;
+	drm_framebuffer_get(plane->fb);
+
 out:
 	if (plane->old_fb)
 		drm_framebuffer_put(plane->old_fb);
 	plane->old_fb = NULL;
 
-	return ret;
+	return 0;
 }
 
 static int __setplane_atomic(struct drm_plane *plane,
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 5/7] drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Test the basics of drm_atomic_set_mode_for_crtc(), and in particular
verify that the function doesn't take the shortcut incorrectly.

Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/selftests/Makefile            |   3 +-
 .../gpu/drm/selftests/drm_modeset_selftests.h |   2 +
 .../gpu/drm/selftests/test-drm_atomic_uapi.c  | 110 ++++++++++++++++++
 .../drm/selftests/test-drm_modeset_common.h   |   2 +
 4 files changed, 116 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/selftests/test-drm_atomic_uapi.c

diff --git a/drivers/gpu/drm/selftests/Makefile b/drivers/gpu/drm/selftests/Makefile
index d2137342b371..a5adc25bd345 100644
--- a/drivers/gpu/drm/selftests/Makefile
+++ b/drivers/gpu/drm/selftests/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o \
                       test-drm_format.o test-drm_framebuffer.o \
-		      test-drm_damage_helper.o test-drm_dp_mst_helper.o
+		      test-drm_damage_helper.o test-drm_dp_mst_helper.o \
+		      test-drm_atomic_uapi.o
 
 obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o test-drm_cmdline_parser.o
diff --git a/drivers/gpu/drm/selftests/drm_modeset_selftests.h b/drivers/gpu/drm/selftests/drm_modeset_selftests.h
index 1898de0b4a4d..2cc4e2f43286 100644
--- a/drivers/gpu/drm/selftests/drm_modeset_selftests.h
+++ b/drivers/gpu/drm/selftests/drm_modeset_selftests.h
@@ -6,6 +6,8 @@
  *
  * Tests are executed in order by igt/drm_selftests_helper
  */
+selftest(atomic_set_mode_for_crtc, igt_atomic_set_mode_for_crtc)
+selftest(atomic_set_zeroed_mode_for_crtc, igt_atomic_set_zeroed_mode_for_crtc)
 selftest(check_plane_state, igt_check_plane_state)
 selftest(check_drm_format_block_width, igt_check_drm_format_block_width)
 selftest(check_drm_format_block_height, igt_check_drm_format_block_height)
diff --git a/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c b/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
new file mode 100644
index 000000000000..0f9a4d0d2541
--- /dev/null
+++ b/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Test cases for the drm_atomic_uapi functions
+ */
+
+#define pr_fmt(fmt) "drm_atomic_uapi: " fmt
+
+#include <drm/drm_atomic_uapi.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_modes.h>
+
+#include "test-drm_modeset_common.h"
+
+static const struct drm_display_mode zeroed_mode;
+
+static struct drm_driver mock_driver;
+static struct drm_device mock_device;
+static struct drm_crtc mock_crtc;
+
+static void init(void)
+{
+	memset(&mock_driver, 0, sizeof(mock_driver));
+	memset(&mock_device, 0, sizeof(mock_device));
+	memset(&mock_crtc, 0, sizeof(mock_crtc));
+
+	mock_device.driver = &mock_driver;
+	mock_crtc.dev = &mock_device;
+
+	drm_mode_config_init(&mock_device);
+}
+
+static void cleanup(void)
+{
+	drm_mode_config_cleanup(&mock_device);
+}
+
+int igt_atomic_set_mode_for_crtc(void *ignored)
+{
+	static const struct drm_display_mode mode1 = {
+		DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175,
+			 640, 656, 752, 800, 0, 480, 490, 492, 525, 0,
+			 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC)
+	};
+	static const struct drm_display_mode mode2 = {
+		DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000,
+			 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0,
+			 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC)
+	};
+	struct drm_crtc_state crtc_state = {
+		.crtc = &mock_crtc,
+	};
+	int ret;
+
+	init();
+
+	/*
+	 * Make	sure drm_atomic_set_mode_for_crtc()
+	 * updates the crtc state correctly.
+	 */
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &mode1);
+	FAIL(ret < 0, "Unable to set mode on crtc\n");
+	FAIL_ON(!crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &mode1, sizeof(mode1)));
+
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &mode2);
+	FAIL(ret < 0, "Unable to set mode on crtc\n");
+	FAIL_ON(!crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &mode2, sizeof(mode2)));
+
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, NULL);
+	FAIL(ret < 0, "Unable to unset mode on crtc\n");
+	FAIL_ON(crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
+
+	cleanup();
+
+	return 0;
+}
+
+int igt_atomic_set_zeroed_mode_for_crtc(void *ignored)
+{
+	struct drm_crtc_state crtc_state = {
+		.crtc = &mock_crtc,
+	};
+	int ret;
+
+	init();
+
+	/*
+	 * Make sure drm_atomic_set_mode_for_crtc() doesn't
+	 * take the shortcut and fail to update crtc_state.enable
+	 * when passed a zeroed mode (which is technically not
+	 * valid, but as drm_atomic_set_mode_for_crtc() does no
+	 * mode validation it should still work).
+	 */
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &zeroed_mode);
+	FAIL(ret < 0, "Unable to set mode on crtc\n");
+	FAIL_ON(!crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
+
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, NULL);
+	FAIL(ret < 0, "Unable to unset mode on crtc\n");
+	FAIL_ON(crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
+
+	cleanup();
+
+	return 0;
+}
diff --git a/drivers/gpu/drm/selftests/test-drm_modeset_common.h b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
index 0fcb8bbc6a1b..a1248abf86f9 100644
--- a/drivers/gpu/drm/selftests/test-drm_modeset_common.h
+++ b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
@@ -13,6 +13,8 @@
 
 #define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n")
 
+int igt_atomic_set_mode_for_crtc(void *ignored);
+int igt_atomic_set_zeroed_mode_for_crtc(void *ignored);
 int igt_check_plane_state(void *ignored);
 int igt_check_drm_format_block_width(void *ignored);
 int igt_check_drm_format_block_height(void *ignored);
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 5/7] drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Test the basics of drm_atomic_set_mode_for_crtc(), and in particular
verify that the function doesn't take the shortcut incorrectly.

Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/selftests/Makefile            |   3 +-
 .../gpu/drm/selftests/drm_modeset_selftests.h |   2 +
 .../gpu/drm/selftests/test-drm_atomic_uapi.c  | 110 ++++++++++++++++++
 .../drm/selftests/test-drm_modeset_common.h   |   2 +
 4 files changed, 116 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/selftests/test-drm_atomic_uapi.c

diff --git a/drivers/gpu/drm/selftests/Makefile b/drivers/gpu/drm/selftests/Makefile
index d2137342b371..a5adc25bd345 100644
--- a/drivers/gpu/drm/selftests/Makefile
+++ b/drivers/gpu/drm/selftests/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o \
                       test-drm_format.o test-drm_framebuffer.o \
-		      test-drm_damage_helper.o test-drm_dp_mst_helper.o
+		      test-drm_damage_helper.o test-drm_dp_mst_helper.o \
+		      test-drm_atomic_uapi.o
 
 obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o test-drm_cmdline_parser.o
diff --git a/drivers/gpu/drm/selftests/drm_modeset_selftests.h b/drivers/gpu/drm/selftests/drm_modeset_selftests.h
index 1898de0b4a4d..2cc4e2f43286 100644
--- a/drivers/gpu/drm/selftests/drm_modeset_selftests.h
+++ b/drivers/gpu/drm/selftests/drm_modeset_selftests.h
@@ -6,6 +6,8 @@
  *
  * Tests are executed in order by igt/drm_selftests_helper
  */
+selftest(atomic_set_mode_for_crtc, igt_atomic_set_mode_for_crtc)
+selftest(atomic_set_zeroed_mode_for_crtc, igt_atomic_set_zeroed_mode_for_crtc)
 selftest(check_plane_state, igt_check_plane_state)
 selftest(check_drm_format_block_width, igt_check_drm_format_block_width)
 selftest(check_drm_format_block_height, igt_check_drm_format_block_height)
diff --git a/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c b/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
new file mode 100644
index 000000000000..0f9a4d0d2541
--- /dev/null
+++ b/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Test cases for the drm_atomic_uapi functions
+ */
+
+#define pr_fmt(fmt) "drm_atomic_uapi: " fmt
+
+#include <drm/drm_atomic_uapi.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_modes.h>
+
+#include "test-drm_modeset_common.h"
+
+static const struct drm_display_mode zeroed_mode;
+
+static struct drm_driver mock_driver;
+static struct drm_device mock_device;
+static struct drm_crtc mock_crtc;
+
+static void init(void)
+{
+	memset(&mock_driver, 0, sizeof(mock_driver));
+	memset(&mock_device, 0, sizeof(mock_device));
+	memset(&mock_crtc, 0, sizeof(mock_crtc));
+
+	mock_device.driver = &mock_driver;
+	mock_crtc.dev = &mock_device;
+
+	drm_mode_config_init(&mock_device);
+}
+
+static void cleanup(void)
+{
+	drm_mode_config_cleanup(&mock_device);
+}
+
+int igt_atomic_set_mode_for_crtc(void *ignored)
+{
+	static const struct drm_display_mode mode1 = {
+		DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175,
+			 640, 656, 752, 800, 0, 480, 490, 492, 525, 0,
+			 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC)
+	};
+	static const struct drm_display_mode mode2 = {
+		DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000,
+			 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0,
+			 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC)
+	};
+	struct drm_crtc_state crtc_state = {
+		.crtc = &mock_crtc,
+	};
+	int ret;
+
+	init();
+
+	/*
+	 * Make	sure drm_atomic_set_mode_for_crtc()
+	 * updates the crtc state correctly.
+	 */
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &mode1);
+	FAIL(ret < 0, "Unable to set mode on crtc\n");
+	FAIL_ON(!crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &mode1, sizeof(mode1)));
+
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &mode2);
+	FAIL(ret < 0, "Unable to set mode on crtc\n");
+	FAIL_ON(!crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &mode2, sizeof(mode2)));
+
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, NULL);
+	FAIL(ret < 0, "Unable to unset mode on crtc\n");
+	FAIL_ON(crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
+
+	cleanup();
+
+	return 0;
+}
+
+int igt_atomic_set_zeroed_mode_for_crtc(void *ignored)
+{
+	struct drm_crtc_state crtc_state = {
+		.crtc = &mock_crtc,
+	};
+	int ret;
+
+	init();
+
+	/*
+	 * Make sure drm_atomic_set_mode_for_crtc() doesn't
+	 * take the shortcut and fail to update crtc_state.enable
+	 * when passed a zeroed mode (which is technically not
+	 * valid, but as drm_atomic_set_mode_for_crtc() does no
+	 * mode validation it should still work).
+	 */
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &zeroed_mode);
+	FAIL(ret < 0, "Unable to set mode on crtc\n");
+	FAIL_ON(!crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
+
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, NULL);
+	FAIL(ret < 0, "Unable to unset mode on crtc\n");
+	FAIL_ON(crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
+
+	cleanup();
+
+	return 0;
+}
diff --git a/drivers/gpu/drm/selftests/test-drm_modeset_common.h b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
index 0fcb8bbc6a1b..a1248abf86f9 100644
--- a/drivers/gpu/drm/selftests/test-drm_modeset_common.h
+++ b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
@@ -13,6 +13,8 @@
 
 #define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n")
 
+int igt_atomic_set_mode_for_crtc(void *ignored);
+int igt_atomic_set_zeroed_mode_for_crtc(void *ignored);
 int igt_check_plane_state(void *ignored);
 int igt_check_drm_format_block_width(void *ignored);
 int igt_check_drm_format_block_height(void *ignored);
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [Intel-gfx] [PATCH 5/7] drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Test the basics of drm_atomic_set_mode_for_crtc(), and in particular
verify that the function doesn't take the shortcut incorrectly.

Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/selftests/Makefile            |   3 +-
 .../gpu/drm/selftests/drm_modeset_selftests.h |   2 +
 .../gpu/drm/selftests/test-drm_atomic_uapi.c  | 110 ++++++++++++++++++
 .../drm/selftests/test-drm_modeset_common.h   |   2 +
 4 files changed, 116 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/selftests/test-drm_atomic_uapi.c

diff --git a/drivers/gpu/drm/selftests/Makefile b/drivers/gpu/drm/selftests/Makefile
index d2137342b371..a5adc25bd345 100644
--- a/drivers/gpu/drm/selftests/Makefile
+++ b/drivers/gpu/drm/selftests/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o \
                       test-drm_format.o test-drm_framebuffer.o \
-		      test-drm_damage_helper.o test-drm_dp_mst_helper.o
+		      test-drm_damage_helper.o test-drm_dp_mst_helper.o \
+		      test-drm_atomic_uapi.o
 
 obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o test-drm_cmdline_parser.o
diff --git a/drivers/gpu/drm/selftests/drm_modeset_selftests.h b/drivers/gpu/drm/selftests/drm_modeset_selftests.h
index 1898de0b4a4d..2cc4e2f43286 100644
--- a/drivers/gpu/drm/selftests/drm_modeset_selftests.h
+++ b/drivers/gpu/drm/selftests/drm_modeset_selftests.h
@@ -6,6 +6,8 @@
  *
  * Tests are executed in order by igt/drm_selftests_helper
  */
+selftest(atomic_set_mode_for_crtc, igt_atomic_set_mode_for_crtc)
+selftest(atomic_set_zeroed_mode_for_crtc, igt_atomic_set_zeroed_mode_for_crtc)
 selftest(check_plane_state, igt_check_plane_state)
 selftest(check_drm_format_block_width, igt_check_drm_format_block_width)
 selftest(check_drm_format_block_height, igt_check_drm_format_block_height)
diff --git a/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c b/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
new file mode 100644
index 000000000000..0f9a4d0d2541
--- /dev/null
+++ b/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Test cases for the drm_atomic_uapi functions
+ */
+
+#define pr_fmt(fmt) "drm_atomic_uapi: " fmt
+
+#include <drm/drm_atomic_uapi.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_modes.h>
+
+#include "test-drm_modeset_common.h"
+
+static const struct drm_display_mode zeroed_mode;
+
+static struct drm_driver mock_driver;
+static struct drm_device mock_device;
+static struct drm_crtc mock_crtc;
+
+static void init(void)
+{
+	memset(&mock_driver, 0, sizeof(mock_driver));
+	memset(&mock_device, 0, sizeof(mock_device));
+	memset(&mock_crtc, 0, sizeof(mock_crtc));
+
+	mock_device.driver = &mock_driver;
+	mock_crtc.dev = &mock_device;
+
+	drm_mode_config_init(&mock_device);
+}
+
+static void cleanup(void)
+{
+	drm_mode_config_cleanup(&mock_device);
+}
+
+int igt_atomic_set_mode_for_crtc(void *ignored)
+{
+	static const struct drm_display_mode mode1 = {
+		DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175,
+			 640, 656, 752, 800, 0, 480, 490, 492, 525, 0,
+			 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC)
+	};
+	static const struct drm_display_mode mode2 = {
+		DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000,
+			 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0,
+			 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC)
+	};
+	struct drm_crtc_state crtc_state = {
+		.crtc = &mock_crtc,
+	};
+	int ret;
+
+	init();
+
+	/*
+	 * Make	sure drm_atomic_set_mode_for_crtc()
+	 * updates the crtc state correctly.
+	 */
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &mode1);
+	FAIL(ret < 0, "Unable to set mode on crtc\n");
+	FAIL_ON(!crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &mode1, sizeof(mode1)));
+
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &mode2);
+	FAIL(ret < 0, "Unable to set mode on crtc\n");
+	FAIL_ON(!crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &mode2, sizeof(mode2)));
+
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, NULL);
+	FAIL(ret < 0, "Unable to unset mode on crtc\n");
+	FAIL_ON(crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
+
+	cleanup();
+
+	return 0;
+}
+
+int igt_atomic_set_zeroed_mode_for_crtc(void *ignored)
+{
+	struct drm_crtc_state crtc_state = {
+		.crtc = &mock_crtc,
+	};
+	int ret;
+
+	init();
+
+	/*
+	 * Make sure drm_atomic_set_mode_for_crtc() doesn't
+	 * take the shortcut and fail to update crtc_state.enable
+	 * when passed a zeroed mode (which is technically not
+	 * valid, but as drm_atomic_set_mode_for_crtc() does no
+	 * mode validation it should still work).
+	 */
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &zeroed_mode);
+	FAIL(ret < 0, "Unable to set mode on crtc\n");
+	FAIL_ON(!crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
+
+	ret = drm_atomic_set_mode_for_crtc(&crtc_state, NULL);
+	FAIL(ret < 0, "Unable to unset mode on crtc\n");
+	FAIL_ON(crtc_state.enable);
+	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
+
+	cleanup();
+
+	return 0;
+}
diff --git a/drivers/gpu/drm/selftests/test-drm_modeset_common.h b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
index 0fcb8bbc6a1b..a1248abf86f9 100644
--- a/drivers/gpu/drm/selftests/test-drm_modeset_common.h
+++ b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
@@ -13,6 +13,8 @@
 
 #define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n")
 
+int igt_atomic_set_mode_for_crtc(void *ignored);
+int igt_atomic_set_zeroed_mode_for_crtc(void *ignored);
 int igt_check_plane_state(void *ignored);
 int igt_check_drm_format_block_width(void *ignored);
 int igt_check_drm_format_block_height(void *ignored);
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 6/7] drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The early return in drm_atomic_set_mode_for_crtc() isn't quite
right. It would mistakenly return and fail to update
crtc_state->enable if someone actually tried to set a zeroed
mode on a currently disabled crtc. That should never actually
happen in response to any userspace request as the zeroed mode
would get rejected earlier. However there is some chance of this
happening internally (eg. during hw state readout) so it seems
best to not let the state become totally inconsistent.

Additionally the early return will not be taken if we're trying to
disable an already disabled crtc. While that is not actually
harmful it is inconsistent, so let's handle that case as well.

Testcase: igt/kms_selftest/check_atomic_set_mode_for_crtc
Testcase: igt/kms_selftest/check_atomic_set_zeroed_mode_fort_crtc
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 0d466d3b0809..a3a6a8137af4 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -68,8 +68,13 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
 	struct drm_mode_modeinfo umode;
 
 	/* Early return for no change. */
-	if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
-		return 0;
+	if (state->enable) {
+		if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
+			return 0;
+	} else {
+		if (!mode)
+			return 0;
+	}
 
 	drm_property_blob_put(state->mode_blob);
 	state->mode_blob = NULL;
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [Intel-gfx] [PATCH 6/7] drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The early return in drm_atomic_set_mode_for_crtc() isn't quite
right. It would mistakenly return and fail to update
crtc_state->enable if someone actually tried to set a zeroed
mode on a currently disabled crtc. That should never actually
happen in response to any userspace request as the zeroed mode
would get rejected earlier. However there is some chance of this
happening internally (eg. during hw state readout) so it seems
best to not let the state become totally inconsistent.

Additionally the early return will not be taken if we're trying to
disable an already disabled crtc. While that is not actually
harmful it is inconsistent, so let's handle that case as well.

Testcase: igt/kms_selftest/check_atomic_set_mode_for_crtc
Testcase: igt/kms_selftest/check_atomic_set_zeroed_mode_fort_crtc
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 0d466d3b0809..a3a6a8137af4 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -68,8 +68,13 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
 	struct drm_mode_modeinfo umode;
 
 	/* Early return for no change. */
-	if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
-		return 0;
+	if (state->enable) {
+		if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
+			return 0;
+	} else {
+		if (!mode)
+			return 0;
+	}
 
 	drm_property_blob_put(state->mode_blob);
 	state->mode_blob = NULL;
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 7/7] drm/atomic: Reduce setplane locking
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Currently setplane grabs all modeset locks, which seems a bit
excessive. Let's reduce that to just the locks we really need
on atomic drivers. For non-atomic drivers let's stick to the
current scheme for now.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 56 +++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index ef0cc33b43ce..e40d8a93294b 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -680,10 +680,14 @@ static int __setplane_internal(struct drm_plane *plane,
 			       uint32_t src_w, uint32_t src_h,
 			       struct drm_modeset_acquire_ctx *ctx)
 {
-	int ret = 0;
+	int ret;
 
 	WARN_ON(drm_drv_uses_atomic_modeset(plane->dev));
 
+	ret = drm_modeset_lock_all_ctx(plane->dev, ctx);
+	if (ret)
+		return ret;
+
 	/* No fb means shut it down */
 	if (!fb) {
 		plane->old_fb = plane->fb;
@@ -767,32 +771,24 @@ static int setplane_internal(struct drm_plane *plane,
 			     uint32_t crtc_w, uint32_t crtc_h,
 			     /* src_{x,y,w,h} values are 16.16 fixed point */
 			     uint32_t src_x, uint32_t src_y,
-			     uint32_t src_w, uint32_t src_h)
+			     uint32_t src_w, uint32_t src_h,
+			     struct drm_modeset_acquire_ctx *ctx)
 {
-	struct drm_modeset_acquire_ctx ctx;
-	int ret;
-
-	DRM_MODESET_LOCK_ALL_BEGIN(plane->dev, ctx,
-				   DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
-
 	if (drm_drv_uses_atomic_modeset(plane->dev))
-		ret = __setplane_atomic(plane, crtc, fb,
-					crtc_x, crtc_y, crtc_w, crtc_h,
-					src_x, src_y, src_w, src_h, &ctx);
+		return __setplane_atomic(plane, crtc, fb,
+					 crtc_x, crtc_y, crtc_w, crtc_h,
+					 src_x, src_y, src_w, src_h, ctx);
 	else
-		ret = __setplane_internal(plane, crtc, fb,
-					  crtc_x, crtc_y, crtc_w, crtc_h,
-					  src_x, src_y, src_w, src_h, &ctx);
-
-	DRM_MODESET_LOCK_ALL_END(ctx, ret);
-
-	return ret;
+		return __setplane_internal(plane, crtc, fb,
+					   crtc_x, crtc_y, crtc_w, crtc_h,
+					   src_x, src_y, src_w, src_h, ctx);
 }
 
 int drm_mode_setplane(struct drm_device *dev, void *data,
 		      struct drm_file *file_priv)
 {
 	struct drm_mode_set_plane *plane_req = data;
+	struct drm_modeset_acquire_ctx ctx;
 	struct drm_plane *plane;
 	struct drm_crtc *crtc = NULL;
 	struct drm_framebuffer *fb = NULL;
@@ -829,11 +825,22 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
 		}
 	}
 
+	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
+
+retry:
 	ret = setplane_internal(plane, crtc, fb,
 				plane_req->crtc_x, plane_req->crtc_y,
 				plane_req->crtc_w, plane_req->crtc_h,
 				plane_req->src_x, plane_req->src_y,
-				plane_req->src_w, plane_req->src_h);
+				plane_req->src_w, plane_req->src_h, &ctx);
+	if (ret == -EDEADLK) {
+		ret = drm_modeset_backoff(&ctx);
+		if (!ret)
+			goto retry;
+	}
+
+	drm_modeset_drop_locks(&ctx);
+	drm_modeset_acquire_fini(&ctx);
 
 	if (fb)
 		drm_framebuffer_put(fb);
@@ -907,14 +914,9 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 		src_h = fb->height << 16;
 	}
 
-	if (drm_drv_uses_atomic_modeset(dev))
-		ret = __setplane_atomic(plane, crtc, fb,
-					crtc_x, crtc_y, crtc_w, crtc_h,
-					0, 0, src_w, src_h, ctx);
-	else
-		ret = __setplane_internal(plane, crtc, fb,
-					  crtc_x, crtc_y, crtc_w, crtc_h,
-					  0, 0, src_w, src_h, ctx);
+	ret = setplane_internal(plane, crtc, fb,
+				crtc_x, crtc_y, crtc_w, crtc_h,
+				0, 0, src_w, src_h, ctx);
 
 	if (fb)
 		drm_framebuffer_put(fb);
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [Intel-gfx] [PATCH 7/7] drm/atomic: Reduce setplane locking
@ 2019-11-15 19:42   ` Ville Syrjala
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjala @ 2019-11-15 19:42 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Currently setplane grabs all modeset locks, which seems a bit
excessive. Let's reduce that to just the locks we really need
on atomic drivers. For non-atomic drivers let's stick to the
current scheme for now.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 56 +++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index ef0cc33b43ce..e40d8a93294b 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -680,10 +680,14 @@ static int __setplane_internal(struct drm_plane *plane,
 			       uint32_t src_w, uint32_t src_h,
 			       struct drm_modeset_acquire_ctx *ctx)
 {
-	int ret = 0;
+	int ret;
 
 	WARN_ON(drm_drv_uses_atomic_modeset(plane->dev));
 
+	ret = drm_modeset_lock_all_ctx(plane->dev, ctx);
+	if (ret)
+		return ret;
+
 	/* No fb means shut it down */
 	if (!fb) {
 		plane->old_fb = plane->fb;
@@ -767,32 +771,24 @@ static int setplane_internal(struct drm_plane *plane,
 			     uint32_t crtc_w, uint32_t crtc_h,
 			     /* src_{x,y,w,h} values are 16.16 fixed point */
 			     uint32_t src_x, uint32_t src_y,
-			     uint32_t src_w, uint32_t src_h)
+			     uint32_t src_w, uint32_t src_h,
+			     struct drm_modeset_acquire_ctx *ctx)
 {
-	struct drm_modeset_acquire_ctx ctx;
-	int ret;
-
-	DRM_MODESET_LOCK_ALL_BEGIN(plane->dev, ctx,
-				   DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
-
 	if (drm_drv_uses_atomic_modeset(plane->dev))
-		ret = __setplane_atomic(plane, crtc, fb,
-					crtc_x, crtc_y, crtc_w, crtc_h,
-					src_x, src_y, src_w, src_h, &ctx);
+		return __setplane_atomic(plane, crtc, fb,
+					 crtc_x, crtc_y, crtc_w, crtc_h,
+					 src_x, src_y, src_w, src_h, ctx);
 	else
-		ret = __setplane_internal(plane, crtc, fb,
-					  crtc_x, crtc_y, crtc_w, crtc_h,
-					  src_x, src_y, src_w, src_h, &ctx);
-
-	DRM_MODESET_LOCK_ALL_END(ctx, ret);
-
-	return ret;
+		return __setplane_internal(plane, crtc, fb,
+					   crtc_x, crtc_y, crtc_w, crtc_h,
+					   src_x, src_y, src_w, src_h, ctx);
 }
 
 int drm_mode_setplane(struct drm_device *dev, void *data,
 		      struct drm_file *file_priv)
 {
 	struct drm_mode_set_plane *plane_req = data;
+	struct drm_modeset_acquire_ctx ctx;
 	struct drm_plane *plane;
 	struct drm_crtc *crtc = NULL;
 	struct drm_framebuffer *fb = NULL;
@@ -829,11 +825,22 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
 		}
 	}
 
+	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
+
+retry:
 	ret = setplane_internal(plane, crtc, fb,
 				plane_req->crtc_x, plane_req->crtc_y,
 				plane_req->crtc_w, plane_req->crtc_h,
 				plane_req->src_x, plane_req->src_y,
-				plane_req->src_w, plane_req->src_h);
+				plane_req->src_w, plane_req->src_h, &ctx);
+	if (ret == -EDEADLK) {
+		ret = drm_modeset_backoff(&ctx);
+		if (!ret)
+			goto retry;
+	}
+
+	drm_modeset_drop_locks(&ctx);
+	drm_modeset_acquire_fini(&ctx);
 
 	if (fb)
 		drm_framebuffer_put(fb);
@@ -907,14 +914,9 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 		src_h = fb->height << 16;
 	}
 
-	if (drm_drv_uses_atomic_modeset(dev))
-		ret = __setplane_atomic(plane, crtc, fb,
-					crtc_x, crtc_y, crtc_w, crtc_h,
-					0, 0, src_w, src_h, ctx);
-	else
-		ret = __setplane_internal(plane, crtc, fb,
-					  crtc_x, crtc_y, crtc_w, crtc_h,
-					  0, 0, src_w, src_h, ctx);
+	ret = setplane_internal(plane, crtc, fb,
+				crtc_x, crtc_y, crtc_w, crtc_h,
+				0, 0, src_w, src_h, ctx);
 
 	if (fb)
 		drm_framebuffer_put(fb);
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 51+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm: Random pile of core stuff
@ 2019-11-15 22:59   ` Patchwork
  0 siblings, 0 replies; 51+ messages in thread
From: Patchwork @ 2019-11-15 22:59 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm: Random pile of core stuff
URL   : https://patchwork.freedesktop.org/series/69554/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
ef6f78a9b185 drm: Move page_flip fb lookup earlier
053159ad20d8 drm: Allocate the page flip event earlier
a3d996b446f7 drm: Extract page_flip_{internal, atomic}()
11e549c2d712 drm: Simplify the setplane old_fb handling further
301d030d9e74 drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
-:43: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#43: 
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 134 lines checked
0ebd8e3b54c7 drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
f529cab5955d drm/atomic: Reduce setplane locking
-:41: CHECK:PREFER_KERNEL_TYPES: Prefer kernel type 'u32' over 'uint32_t'
#41: FILE: drivers/gpu/drm/drm_plane.c:774:
+			     uint32_t src_w, uint32_t src_h,

total: 0 errors, 0 warnings, 1 checks, 96 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Random pile of core stuff
@ 2019-11-15 22:59   ` Patchwork
  0 siblings, 0 replies; 51+ messages in thread
From: Patchwork @ 2019-11-15 22:59 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm: Random pile of core stuff
URL   : https://patchwork.freedesktop.org/series/69554/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
ef6f78a9b185 drm: Move page_flip fb lookup earlier
053159ad20d8 drm: Allocate the page flip event earlier
a3d996b446f7 drm: Extract page_flip_{internal, atomic}()
11e549c2d712 drm: Simplify the setplane old_fb handling further
301d030d9e74 drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
-:43: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#43: 
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 134 lines checked
0ebd8e3b54c7 drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
f529cab5955d drm/atomic: Reduce setplane locking
-:41: CHECK:PREFER_KERNEL_TYPES: Prefer kernel type 'u32' over 'uint32_t'
#41: FILE: drivers/gpu/drm/drm_plane.c:774:
+			     uint32_t src_w, uint32_t src_h,

total: 0 errors, 0 warnings, 1 checks, 96 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* ✓ Fi.CI.BAT: success for drm: Random pile of core stuff
@ 2019-11-15 23:20   ` Patchwork
  0 siblings, 0 replies; 51+ messages in thread
From: Patchwork @ 2019-11-15 23:20 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm: Random pile of core stuff
URL   : https://patchwork.freedesktop.org/series/69554/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_7357 -> Patchwork_15297
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/index.html

Known issues
------------

  Here are the changes found in Patchwork_15297 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_pm_rpm@module-reload:
    - fi-skl-6770hq:      [PASS][1] -> [DMESG-WARN][2] ([fdo#112261])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-skl-6770hq/igt@i915_pm_rpm@module-reload.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-skl-6770hq/igt@i915_pm_rpm@module-reload.html

  * igt@i915_selftest@live_blt:
    - fi-bsw-n3050:       [PASS][3] -> [DMESG-FAIL][4] ([fdo#112176])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-bsw-n3050/igt@i915_selftest@live_blt.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-bsw-n3050/igt@i915_selftest@live_blt.html

  
#### Possible fixes ####

  * igt@i915_module_load@reload-no-display:
    - fi-skl-lmem:        [DMESG-WARN][5] ([fdo#112261]) -> [PASS][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-skl-lmem/igt@i915_module_load@reload-no-display.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-skl-lmem/igt@i915_module_load@reload-no-display.html

  * igt@i915_pm_rpm@module-reload:
    - {fi-kbl-7560u}:     [FAIL][7] ([fdo#112269]) -> [PASS][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-kbl-7560u/igt@i915_pm_rpm@module-reload.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-kbl-7560u/igt@i915_pm_rpm@module-reload.html

  * igt@kms_chamelium@hdmi-crc-fast:
    - fi-icl-u2:          [FAIL][9] ([fdo#109635 ]) -> [PASS][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-icl-u2/igt@kms_chamelium@hdmi-crc-fast.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-icl-u2/igt@kms_chamelium@hdmi-crc-fast.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-kbl-7500u:       [FAIL][11] ([fdo#109483]) -> [PASS][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html

  * igt@kms_frontbuffer_tracking@basic:
    - fi-hsw-peppy:       [DMESG-WARN][13] ([fdo#102614]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-hsw-peppy/igt@kms_frontbuffer_tracking@basic.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-hsw-peppy/igt@kms_frontbuffer_tracking@basic.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
  [fdo#109483]: https://bugs.freedesktop.org/show_bug.cgi?id=109483
  [fdo#109635 ]: https://bugs.freedesktop.org/show_bug.cgi?id=109635 
  [fdo#112176]: https://bugs.freedesktop.org/show_bug.cgi?id=112176
  [fdo#112261]: https://bugs.freedesktop.org/show_bug.cgi?id=112261
  [fdo#112269]: https://bugs.freedesktop.org/show_bug.cgi?id=112269


Participating hosts (51 -> 45)
------------------------------

  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus 


Build changes
-------------

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_7357 -> Patchwork_15297

  CI-20190529: 20190529
  CI_DRM_7357: 315d68345bfe8da7b034123352106c6edbcc380d @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5288: ff4551e36cd8e573ceb1e450d17a12e3298dc04c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_15297: f529cab5955d8d69c521109c7cc8d999b4f2decb @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

f529cab5955d drm/atomic: Reduce setplane locking
0ebd8e3b54c7 drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
301d030d9e74 drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
11e549c2d712 drm: Simplify the setplane old_fb handling further
a3d996b446f7 drm: Extract page_flip_{internal, atomic}()
053159ad20d8 drm: Allocate the page flip event earlier
ef6f78a9b185 drm: Move page_flip fb lookup earlier

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* [Intel-gfx] ✓ Fi.CI.BAT: success for drm: Random pile of core stuff
@ 2019-11-15 23:20   ` Patchwork
  0 siblings, 0 replies; 51+ messages in thread
From: Patchwork @ 2019-11-15 23:20 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm: Random pile of core stuff
URL   : https://patchwork.freedesktop.org/series/69554/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_7357 -> Patchwork_15297
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/index.html

Known issues
------------

  Here are the changes found in Patchwork_15297 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_pm_rpm@module-reload:
    - fi-skl-6770hq:      [PASS][1] -> [DMESG-WARN][2] ([fdo#112261])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-skl-6770hq/igt@i915_pm_rpm@module-reload.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-skl-6770hq/igt@i915_pm_rpm@module-reload.html

  * igt@i915_selftest@live_blt:
    - fi-bsw-n3050:       [PASS][3] -> [DMESG-FAIL][4] ([fdo#112176])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-bsw-n3050/igt@i915_selftest@live_blt.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-bsw-n3050/igt@i915_selftest@live_blt.html

  
#### Possible fixes ####

  * igt@i915_module_load@reload-no-display:
    - fi-skl-lmem:        [DMESG-WARN][5] ([fdo#112261]) -> [PASS][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-skl-lmem/igt@i915_module_load@reload-no-display.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-skl-lmem/igt@i915_module_load@reload-no-display.html

  * igt@i915_pm_rpm@module-reload:
    - {fi-kbl-7560u}:     [FAIL][7] ([fdo#112269]) -> [PASS][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-kbl-7560u/igt@i915_pm_rpm@module-reload.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-kbl-7560u/igt@i915_pm_rpm@module-reload.html

  * igt@kms_chamelium@hdmi-crc-fast:
    - fi-icl-u2:          [FAIL][9] ([fdo#109635 ]) -> [PASS][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-icl-u2/igt@kms_chamelium@hdmi-crc-fast.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-icl-u2/igt@kms_chamelium@hdmi-crc-fast.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-kbl-7500u:       [FAIL][11] ([fdo#109483]) -> [PASS][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html

  * igt@kms_frontbuffer_tracking@basic:
    - fi-hsw-peppy:       [DMESG-WARN][13] ([fdo#102614]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/fi-hsw-peppy/igt@kms_frontbuffer_tracking@basic.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/fi-hsw-peppy/igt@kms_frontbuffer_tracking@basic.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
  [fdo#109483]: https://bugs.freedesktop.org/show_bug.cgi?id=109483
  [fdo#109635 ]: https://bugs.freedesktop.org/show_bug.cgi?id=109635 
  [fdo#112176]: https://bugs.freedesktop.org/show_bug.cgi?id=112176
  [fdo#112261]: https://bugs.freedesktop.org/show_bug.cgi?id=112261
  [fdo#112269]: https://bugs.freedesktop.org/show_bug.cgi?id=112269


Participating hosts (51 -> 45)
------------------------------

  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus 


Build changes
-------------

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_7357 -> Patchwork_15297

  CI-20190529: 20190529
  CI_DRM_7357: 315d68345bfe8da7b034123352106c6edbcc380d @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5288: ff4551e36cd8e573ceb1e450d17a12e3298dc04c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_15297: f529cab5955d8d69c521109c7cc8d999b4f2decb @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

f529cab5955d drm/atomic: Reduce setplane locking
0ebd8e3b54c7 drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
301d030d9e74 drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
11e549c2d712 drm: Simplify the setplane old_fb handling further
a3d996b446f7 drm: Extract page_flip_{internal, atomic}()
053159ad20d8 drm: Allocate the page flip event earlier
ef6f78a9b185 drm: Move page_flip fb lookup earlier

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* ✗ Fi.CI.IGT: failure for drm: Random pile of core stuff
@ 2019-11-17 12:20   ` Patchwork
  0 siblings, 0 replies; 51+ messages in thread
From: Patchwork @ 2019-11-17 12:20 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm: Random pile of core stuff
URL   : https://patchwork.freedesktop.org/series/69554/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7357_full -> Patchwork_15297_full
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_15297_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_15297_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_15297_full:

### IGT changes ###

#### Possible regressions ####

  * igt@gem_persistent_relocs@forked-faulting-reloc-thrash-inactive:
    - shard-apl:          [PASS][1] -> [DMESG-FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-apl8/igt@gem_persistent_relocs@forked-faulting-reloc-thrash-inactive.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-apl6/igt@gem_persistent_relocs@forked-faulting-reloc-thrash-inactive.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * {igt@gem_exec_parse_blt@bb-secure}:
    - shard-tglb:         NOTRUN -> [SKIP][3]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb9/igt@gem_exec_parse_blt@bb-secure.html

  
New tests
---------

  New tests have been introduced between CI_DRM_7357_full and Patchwork_15297_full:

### New IGT tests (2) ###

  * igt@kms_selftest@atomic_set_mode_for_crtc:
    - Statuses : 7 pass(s)
    - Exec time: [0.03, 0.07] s

  * igt@kms_selftest@atomic_set_zeroed_mode_for_crtc:
    - Statuses : 7 pass(s)
    - Exec time: [0.03, 0.06] s

  

Known issues
------------

  Here are the changes found in Patchwork_15297_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_ctx_persistence@vcs1-mixed-process:
    - shard-iclb:         [PASS][4] -> [SKIP][5] ([fdo#109276] / [fdo#112080])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb1/igt@gem_ctx_persistence@vcs1-mixed-process.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb6/igt@gem_ctx_persistence@vcs1-mixed-process.html

  * igt@gem_ctx_shared@q-smoketest-bsd:
    - shard-tglb:         [PASS][6] -> [INCOMPLETE][7] ([fdo# 111852 ])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb1/igt@gem_ctx_shared@q-smoketest-bsd.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb6/igt@gem_ctx_shared@q-smoketest-bsd.html

  * igt@gem_eio@kms:
    - shard-snb:          [PASS][8] -> [DMESG-WARN][9] ([fdo# 112000 ] / [fdo#111781])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-snb7/igt@gem_eio@kms.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-snb2/igt@gem_eio@kms.html

  * igt@gem_exec_parallel@vcs0:
    - shard-tglb:         [PASS][10] -> [INCOMPLETE][11] ([fdo#111593])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb8/igt@gem_exec_parallel@vcs0.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb6/igt@gem_exec_parallel@vcs0.html

  * igt@gem_exec_schedule@preemptive-hang-bsd:
    - shard-iclb:         [PASS][12] -> [SKIP][13] ([fdo#112146]) +1 similar issue
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb3/igt@gem_exec_schedule@preemptive-hang-bsd.html
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb1/igt@gem_exec_schedule@preemptive-hang-bsd.html

  * igt@gem_sync@basic-store-all:
    - shard-tglb:         [PASS][14] -> [INCOMPLETE][15] ([fdo#111647])
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb1/igt@gem_sync@basic-store-all.html
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb6/igt@gem_sync@basic-store-all.html

  * igt@gem_tiled_blits@interruptible:
    - shard-hsw:          [PASS][16] -> [INCOMPLETE][17] ([fdo#103540])
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-hsw5/igt@gem_tiled_blits@interruptible.html
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-hsw1/igt@gem_tiled_blits@interruptible.html

  * igt@gem_userptr_blits@map-fixed-invalidate-busy-gup:
    - shard-hsw:          [PASS][18] -> [DMESG-WARN][19] ([fdo#111870]) +1 similar issue
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-hsw1/igt@gem_userptr_blits@map-fixed-invalidate-busy-gup.html
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-hsw1/igt@gem_userptr_blits@map-fixed-invalidate-busy-gup.html
    - shard-snb:          [PASS][20] -> [DMESG-WARN][21] ([fdo#111870])
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-snb5/igt@gem_userptr_blits@map-fixed-invalidate-busy-gup.html
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-snb2/igt@gem_userptr_blits@map-fixed-invalidate-busy-gup.html

  * igt@i915_suspend@fence-restore-tiled2untiled:
    - shard-apl:          [PASS][22] -> [DMESG-WARN][23] ([fdo#108566]) +1 similar issue
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-apl1/igt@i915_suspend@fence-restore-tiled2untiled.html
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-apl4/igt@i915_suspend@fence-restore-tiled2untiled.html

  * igt@kms_color@pipe-c-gamma:
    - shard-skl:          [PASS][24] -> [FAIL][25] ([fdo#104782])
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl4/igt@kms_color@pipe-c-gamma.html
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl2/igt@kms_color@pipe-c-gamma.html

  * igt@kms_flip@flip-vs-expired-vblank:
    - shard-skl:          [PASS][26] -> [FAIL][27] ([fdo#105363])
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl9/igt@kms_flip@flip-vs-expired-vblank.html
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl1/igt@kms_flip@flip-vs-expired-vblank.html

  * igt@kms_flip@flip-vs-suspend:
    - shard-skl:          [PASS][28] -> [INCOMPLETE][29] ([fdo#109507])
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl4/igt@kms_flip@flip-vs-suspend.html
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl8/igt@kms_flip@flip-vs-suspend.html

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-msflip-blt:
    - shard-tglb:         [PASS][30] -> [FAIL][31] ([fdo#103167]) +2 similar issues
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb9/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-msflip-blt.html
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb4/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-msflip-blt.html

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
    - shard-iclb:         [PASS][32] -> [FAIL][33] ([fdo#103167]) +6 similar issues
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb4/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
    - shard-tglb:         [PASS][34] -> [INCOMPLETE][35] ([fdo#111832] / [fdo#111850]) +1 similar issue
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb3/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb8/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html

  * igt@kms_psr@psr2_no_drrs:
    - shard-iclb:         [PASS][36] -> [SKIP][37] ([fdo#109441]) +3 similar issues
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb2/igt@kms_psr@psr2_no_drrs.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb7/igt@kms_psr@psr2_no_drrs.html

  * igt@kms_vblank@pipe-d-ts-continuation-suspend:
    - shard-tglb:         [PASS][38] -> [INCOMPLETE][39] ([fdo#111850])
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb2/igt@kms_vblank@pipe-d-ts-continuation-suspend.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb1/igt@kms_vblank@pipe-d-ts-continuation-suspend.html

  * igt@perf_pmu@busy-no-semaphores-vcs1:
    - shard-iclb:         [PASS][40] -> [SKIP][41] ([fdo#112080]) +8 similar issues
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb1/igt@perf_pmu@busy-no-semaphores-vcs1.html
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb6/igt@perf_pmu@busy-no-semaphores-vcs1.html

  * igt@prime_busy@hang-bsd2:
    - shard-iclb:         [PASS][42] -> [SKIP][43] ([fdo#109276]) +18 similar issues
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb2/igt@prime_busy@hang-bsd2.html
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb7/igt@prime_busy@hang-bsd2.html

  
#### Possible fixes ####

  * igt@gem_ctx_exec@basic-invalid-context-vcs1:
    - shard-iclb:         [SKIP][44] ([fdo#112080]) -> [PASS][45] +9 similar issues
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb7/igt@gem_ctx_exec@basic-invalid-context-vcs1.html
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@gem_ctx_exec@basic-invalid-context-vcs1.html

  * igt@gem_ctx_isolation@bcs0-s3:
    - shard-tglb:         [INCOMPLETE][46] ([fdo#111832]) -> [PASS][47] +1 similar issue
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb4/igt@gem_ctx_isolation@bcs0-s3.html
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb5/igt@gem_ctx_isolation@bcs0-s3.html
    - shard-kbl:          [DMESG-WARN][48] ([fdo#108566]) -> [PASS][49] +1 similar issue
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-kbl4/igt@gem_ctx_isolation@bcs0-s3.html
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-kbl6/igt@gem_ctx_isolation@bcs0-s3.html

  * igt@gem_ctx_persistence@vcs1-persistence:
    - shard-iclb:         [SKIP][50] ([fdo#109276] / [fdo#112080]) -> [PASS][51]
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb3/igt@gem_ctx_persistence@vcs1-persistence.html
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb1/igt@gem_ctx_persistence@vcs1-persistence.html

  * igt@gem_ctx_shared@q-smoketest-all:
    - shard-tglb:         [INCOMPLETE][52] ([fdo#111735]) -> [PASS][53]
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb4/igt@gem_ctx_shared@q-smoketest-all.html
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb7/igt@gem_ctx_shared@q-smoketest-all.html

  * igt@gem_eio@in-flight-1us:
    - shard-snb:          [FAIL][54] ([fdo#111946]) -> [PASS][55]
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-snb7/igt@gem_eio@in-flight-1us.html
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-snb4/igt@gem_eio@in-flight-1us.html

  * igt@gem_eio@in-flight-suspend:
    - shard-tglb:         [INCOMPLETE][56] ([fdo#111832] / [fdo#111850] / [fdo#112081]) -> [PASS][57]
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb1/igt@gem_eio@in-flight-suspend.html
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb1/igt@gem_eio@in-flight-suspend.html

  * igt@gem_eio@unwedge-stress:
    - shard-snb:          [FAIL][58] ([fdo#109661]) -> [PASS][59]
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-snb1/igt@gem_eio@unwedge-stress.html
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-snb7/igt@gem_eio@unwedge-stress.html

  * igt@gem_exec_schedule@preempt-queue-render:
    - shard-tglb:         [INCOMPLETE][60] ([fdo#111606] / [fdo#111677]) -> [PASS][61] +1 similar issue
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb6/igt@gem_exec_schedule@preempt-queue-render.html
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb9/igt@gem_exec_schedule@preempt-queue-render.html

  * igt@gem_exec_schedule@wide-bsd:
    - shard-iclb:         [SKIP][62] ([fdo#112146]) -> [PASS][63] +3 similar issues
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb1/igt@gem_exec_schedule@wide-bsd.html
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb6/igt@gem_exec_schedule@wide-bsd.html

  * igt@gem_exec_suspend@basic-s3:
    - shard-tglb:         [INCOMPLETE][64] ([fdo#111736] / [fdo#111850]) -> [PASS][65]
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb5/igt@gem_exec_suspend@basic-s3.html
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb5/igt@gem_exec_suspend@basic-s3.html

  * igt@gem_persistent_relocs@forked-interruptible-thrash-inactive:
    - shard-iclb:         [TIMEOUT][66] ([fdo#112068 ]) -> [PASS][67]
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb8/igt@gem_persistent_relocs@forked-interruptible-thrash-inactive.html
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb5/igt@gem_persistent_relocs@forked-interruptible-thrash-inactive.html

  * igt@gem_userptr_blits@sync-unmap-after-close:
    - shard-hsw:          [DMESG-WARN][68] ([fdo#111870]) -> [PASS][69]
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-hsw1/igt@gem_userptr_blits@sync-unmap-after-close.html
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-hsw5/igt@gem_userptr_blits@sync-unmap-after-close.html

  * igt@i915_pm_dc@dc5-dpms:
    - shard-iclb:         [FAIL][70] ([fdo#111795 ]) -> [PASS][71]
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb3/igt@i915_pm_dc@dc5-dpms.html
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb5/igt@i915_pm_dc@dc5-dpms.html

  * igt@i915_suspend@sysfs-reader:
    - shard-tglb:         [INCOMPLETE][72] ([fdo#111832] / [fdo#111850]) -> [PASS][73] +1 similar issue
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb1/igt@i915_suspend@sysfs-reader.html
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb5/igt@i915_suspend@sysfs-reader.html

  * igt@kms_flip_tiling@flip-to-y-tiled:
    - shard-skl:          [FAIL][74] ([fdo#107931] / [fdo#108134]) -> [PASS][75]
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl7/igt@kms_flip_tiling@flip-to-y-tiled.html
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl10/igt@kms_flip_tiling@flip-to-y-tiled.html

  * igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-blt:
    - shard-iclb:         [FAIL][76] ([fdo#103167]) -> [PASS][77] +4 similar issues
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb2/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-blt.html
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb1/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-blt.html

  * igt@kms_frontbuffer_tracking@fbcpsr-stridechange:
    - shard-tglb:         [FAIL][78] ([fdo#103167]) -> [PASS][79] +4 similar issues
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb8/igt@kms_frontbuffer_tracking@fbcpsr-stridechange.html
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb1/igt@kms_frontbuffer_tracking@fbcpsr-stridechange.html

  * igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
    - shard-apl:          [DMESG-WARN][80] ([fdo#108566]) -> [PASS][81] +2 similar issues
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-apl6/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes.html
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-apl2/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes.html
    - shard-skl:          [INCOMPLETE][82] ([fdo#104108]) -> [PASS][83]
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl2/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes.html
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl7/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes.html

  * igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
    - shard-skl:          [FAIL][84] ([fdo#108145] / [fdo#110403]) -> [PASS][85]
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl9/igt@kms_plane_alpha_blend@pipe-b-coverage-7efc.html
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl6/igt@kms_plane_alpha_blend@pipe-b-coverage-7efc.html

  * igt@kms_plane_lowres@pipe-a-tiling-x:
    - shard-iclb:         [FAIL][86] ([fdo#103166]) -> [PASS][87]
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb5/igt@kms_plane_lowres@pipe-a-tiling-x.html
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@kms_plane_lowres@pipe-a-tiling-x.html

  * igt@kms_psr2_su@page_flip:
    - shard-iclb:         [SKIP][88] ([fdo#109642] / [fdo#111068]) -> [PASS][89]
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb5/igt@kms_psr2_su@page_flip.html
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@kms_psr2_su@page_flip.html

  * igt@kms_psr@psr2_cursor_render:
    - shard-iclb:         [SKIP][90] ([fdo#109441]) -> [PASS][91] +1 similar issue
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb4/igt@kms_psr@psr2_cursor_render.html
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@kms_psr@psr2_cursor_render.html

  * igt@prime_vgem@fence-wait-bsd2:
    - shard-iclb:         [SKIP][92] ([fdo#109276]) -> [PASS][93] +6 similar issues
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb7/igt@prime_vgem@fence-wait-bsd2.html
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb4/igt@prime_vgem@fence-wait-bsd2.html

  
#### Warnings ####

  * igt@gem_ctx_isolation@vcs2-dirty-create:
    - shard-tglb:         [SKIP][94] ([fdo#111912] / [fdo#112080]) -> [SKIP][95] ([fdo#112080])
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb5/igt@gem_ctx_isolation@vcs2-dirty-create.html
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb9/igt@gem_ctx_isolation@vcs2-dirty-create.html

  * igt@i915_pm_dc@dc6-dpms:
    - shard-tglb:         [FAIL][96] ([fdo#111830 ]) -> [SKIP][97] ([fdo#111865])
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb5/igt@i915_pm_dc@dc6-dpms.html
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb6/igt@i915_pm_dc@dc6-dpms.html

  * igt@kms_dp_dsc@basic-dsc-enable-edp:
    - shard-tglb:         [DMESG-WARN][98] ([fdo#111600]) -> [INCOMPLETE][99] ([fdo#111600] / [fdo#112036])
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb9/igt@kms_dp_dsc@basic-dsc-enable-edp.html
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb2/igt@kms_dp_dsc@basic-dsc-enable-edp.html

  * igt@kms_psr@psr2_suspend:
    - shard-iclb:         [SKIP][100] ([fdo#109441]) -> [DMESG-WARN][101] ([fdo#107724])
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb5/igt@kms_psr@psr2_suspend.html
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@kms_psr@psr2_suspend.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo# 111852 ]: https://bugs.freedesktop.org/show_bug.cgi?id= 111852 
  [fdo# 112000 ]: https://bugs.freedesktop.org/show_bug.cgi?id= 112000 
  [fdo#103166]: https://bugs.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* [Intel-gfx] ✗ Fi.CI.IGT: failure for drm: Random pile of core stuff
@ 2019-11-17 12:20   ` Patchwork
  0 siblings, 0 replies; 51+ messages in thread
From: Patchwork @ 2019-11-17 12:20 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm: Random pile of core stuff
URL   : https://patchwork.freedesktop.org/series/69554/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7357_full -> Patchwork_15297_full
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_15297_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_15297_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_15297_full:

### IGT changes ###

#### Possible regressions ####

  * igt@gem_persistent_relocs@forked-faulting-reloc-thrash-inactive:
    - shard-apl:          [PASS][1] -> [DMESG-FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-apl8/igt@gem_persistent_relocs@forked-faulting-reloc-thrash-inactive.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-apl6/igt@gem_persistent_relocs@forked-faulting-reloc-thrash-inactive.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * {igt@gem_exec_parse_blt@bb-secure}:
    - shard-tglb:         NOTRUN -> [SKIP][3]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb9/igt@gem_exec_parse_blt@bb-secure.html

  
New tests
---------

  New tests have been introduced between CI_DRM_7357_full and Patchwork_15297_full:

### New IGT tests (2) ###

  * igt@kms_selftest@atomic_set_mode_for_crtc:
    - Statuses : 7 pass(s)
    - Exec time: [0.03, 0.07] s

  * igt@kms_selftest@atomic_set_zeroed_mode_for_crtc:
    - Statuses : 7 pass(s)
    - Exec time: [0.03, 0.06] s

  

Known issues
------------

  Here are the changes found in Patchwork_15297_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_ctx_persistence@vcs1-mixed-process:
    - shard-iclb:         [PASS][4] -> [SKIP][5] ([fdo#109276] / [fdo#112080])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb1/igt@gem_ctx_persistence@vcs1-mixed-process.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb6/igt@gem_ctx_persistence@vcs1-mixed-process.html

  * igt@gem_ctx_shared@q-smoketest-bsd:
    - shard-tglb:         [PASS][6] -> [INCOMPLETE][7] ([fdo# 111852 ])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb1/igt@gem_ctx_shared@q-smoketest-bsd.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb6/igt@gem_ctx_shared@q-smoketest-bsd.html

  * igt@gem_eio@kms:
    - shard-snb:          [PASS][8] -> [DMESG-WARN][9] ([fdo# 112000 ] / [fdo#111781])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-snb7/igt@gem_eio@kms.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-snb2/igt@gem_eio@kms.html

  * igt@gem_exec_parallel@vcs0:
    - shard-tglb:         [PASS][10] -> [INCOMPLETE][11] ([fdo#111593])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb8/igt@gem_exec_parallel@vcs0.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb6/igt@gem_exec_parallel@vcs0.html

  * igt@gem_exec_schedule@preemptive-hang-bsd:
    - shard-iclb:         [PASS][12] -> [SKIP][13] ([fdo#112146]) +1 similar issue
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb3/igt@gem_exec_schedule@preemptive-hang-bsd.html
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb1/igt@gem_exec_schedule@preemptive-hang-bsd.html

  * igt@gem_sync@basic-store-all:
    - shard-tglb:         [PASS][14] -> [INCOMPLETE][15] ([fdo#111647])
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb1/igt@gem_sync@basic-store-all.html
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb6/igt@gem_sync@basic-store-all.html

  * igt@gem_tiled_blits@interruptible:
    - shard-hsw:          [PASS][16] -> [INCOMPLETE][17] ([fdo#103540])
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-hsw5/igt@gem_tiled_blits@interruptible.html
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-hsw1/igt@gem_tiled_blits@interruptible.html

  * igt@gem_userptr_blits@map-fixed-invalidate-busy-gup:
    - shard-hsw:          [PASS][18] -> [DMESG-WARN][19] ([fdo#111870]) +1 similar issue
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-hsw1/igt@gem_userptr_blits@map-fixed-invalidate-busy-gup.html
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-hsw1/igt@gem_userptr_blits@map-fixed-invalidate-busy-gup.html
    - shard-snb:          [PASS][20] -> [DMESG-WARN][21] ([fdo#111870])
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-snb5/igt@gem_userptr_blits@map-fixed-invalidate-busy-gup.html
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-snb2/igt@gem_userptr_blits@map-fixed-invalidate-busy-gup.html

  * igt@i915_suspend@fence-restore-tiled2untiled:
    - shard-apl:          [PASS][22] -> [DMESG-WARN][23] ([fdo#108566]) +1 similar issue
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-apl1/igt@i915_suspend@fence-restore-tiled2untiled.html
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-apl4/igt@i915_suspend@fence-restore-tiled2untiled.html

  * igt@kms_color@pipe-c-gamma:
    - shard-skl:          [PASS][24] -> [FAIL][25] ([fdo#104782])
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl4/igt@kms_color@pipe-c-gamma.html
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl2/igt@kms_color@pipe-c-gamma.html

  * igt@kms_flip@flip-vs-expired-vblank:
    - shard-skl:          [PASS][26] -> [FAIL][27] ([fdo#105363])
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl9/igt@kms_flip@flip-vs-expired-vblank.html
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl1/igt@kms_flip@flip-vs-expired-vblank.html

  * igt@kms_flip@flip-vs-suspend:
    - shard-skl:          [PASS][28] -> [INCOMPLETE][29] ([fdo#109507])
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl4/igt@kms_flip@flip-vs-suspend.html
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl8/igt@kms_flip@flip-vs-suspend.html

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-msflip-blt:
    - shard-tglb:         [PASS][30] -> [FAIL][31] ([fdo#103167]) +2 similar issues
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb9/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-msflip-blt.html
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb4/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-msflip-blt.html

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
    - shard-iclb:         [PASS][32] -> [FAIL][33] ([fdo#103167]) +6 similar issues
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb4/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
    - shard-tglb:         [PASS][34] -> [INCOMPLETE][35] ([fdo#111832] / [fdo#111850]) +1 similar issue
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb3/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb8/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html

  * igt@kms_psr@psr2_no_drrs:
    - shard-iclb:         [PASS][36] -> [SKIP][37] ([fdo#109441]) +3 similar issues
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb2/igt@kms_psr@psr2_no_drrs.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb7/igt@kms_psr@psr2_no_drrs.html

  * igt@kms_vblank@pipe-d-ts-continuation-suspend:
    - shard-tglb:         [PASS][38] -> [INCOMPLETE][39] ([fdo#111850])
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb2/igt@kms_vblank@pipe-d-ts-continuation-suspend.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb1/igt@kms_vblank@pipe-d-ts-continuation-suspend.html

  * igt@perf_pmu@busy-no-semaphores-vcs1:
    - shard-iclb:         [PASS][40] -> [SKIP][41] ([fdo#112080]) +8 similar issues
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb1/igt@perf_pmu@busy-no-semaphores-vcs1.html
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb6/igt@perf_pmu@busy-no-semaphores-vcs1.html

  * igt@prime_busy@hang-bsd2:
    - shard-iclb:         [PASS][42] -> [SKIP][43] ([fdo#109276]) +18 similar issues
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb2/igt@prime_busy@hang-bsd2.html
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb7/igt@prime_busy@hang-bsd2.html

  
#### Possible fixes ####

  * igt@gem_ctx_exec@basic-invalid-context-vcs1:
    - shard-iclb:         [SKIP][44] ([fdo#112080]) -> [PASS][45] +9 similar issues
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb7/igt@gem_ctx_exec@basic-invalid-context-vcs1.html
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@gem_ctx_exec@basic-invalid-context-vcs1.html

  * igt@gem_ctx_isolation@bcs0-s3:
    - shard-tglb:         [INCOMPLETE][46] ([fdo#111832]) -> [PASS][47] +1 similar issue
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb4/igt@gem_ctx_isolation@bcs0-s3.html
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb5/igt@gem_ctx_isolation@bcs0-s3.html
    - shard-kbl:          [DMESG-WARN][48] ([fdo#108566]) -> [PASS][49] +1 similar issue
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-kbl4/igt@gem_ctx_isolation@bcs0-s3.html
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-kbl6/igt@gem_ctx_isolation@bcs0-s3.html

  * igt@gem_ctx_persistence@vcs1-persistence:
    - shard-iclb:         [SKIP][50] ([fdo#109276] / [fdo#112080]) -> [PASS][51]
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb3/igt@gem_ctx_persistence@vcs1-persistence.html
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb1/igt@gem_ctx_persistence@vcs1-persistence.html

  * igt@gem_ctx_shared@q-smoketest-all:
    - shard-tglb:         [INCOMPLETE][52] ([fdo#111735]) -> [PASS][53]
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb4/igt@gem_ctx_shared@q-smoketest-all.html
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb7/igt@gem_ctx_shared@q-smoketest-all.html

  * igt@gem_eio@in-flight-1us:
    - shard-snb:          [FAIL][54] ([fdo#111946]) -> [PASS][55]
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-snb7/igt@gem_eio@in-flight-1us.html
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-snb4/igt@gem_eio@in-flight-1us.html

  * igt@gem_eio@in-flight-suspend:
    - shard-tglb:         [INCOMPLETE][56] ([fdo#111832] / [fdo#111850] / [fdo#112081]) -> [PASS][57]
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb1/igt@gem_eio@in-flight-suspend.html
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb1/igt@gem_eio@in-flight-suspend.html

  * igt@gem_eio@unwedge-stress:
    - shard-snb:          [FAIL][58] ([fdo#109661]) -> [PASS][59]
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-snb1/igt@gem_eio@unwedge-stress.html
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-snb7/igt@gem_eio@unwedge-stress.html

  * igt@gem_exec_schedule@preempt-queue-render:
    - shard-tglb:         [INCOMPLETE][60] ([fdo#111606] / [fdo#111677]) -> [PASS][61] +1 similar issue
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb6/igt@gem_exec_schedule@preempt-queue-render.html
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb9/igt@gem_exec_schedule@preempt-queue-render.html

  * igt@gem_exec_schedule@wide-bsd:
    - shard-iclb:         [SKIP][62] ([fdo#112146]) -> [PASS][63] +3 similar issues
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb1/igt@gem_exec_schedule@wide-bsd.html
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb6/igt@gem_exec_schedule@wide-bsd.html

  * igt@gem_exec_suspend@basic-s3:
    - shard-tglb:         [INCOMPLETE][64] ([fdo#111736] / [fdo#111850]) -> [PASS][65]
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb5/igt@gem_exec_suspend@basic-s3.html
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb5/igt@gem_exec_suspend@basic-s3.html

  * igt@gem_persistent_relocs@forked-interruptible-thrash-inactive:
    - shard-iclb:         [TIMEOUT][66] ([fdo#112068 ]) -> [PASS][67]
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb8/igt@gem_persistent_relocs@forked-interruptible-thrash-inactive.html
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb5/igt@gem_persistent_relocs@forked-interruptible-thrash-inactive.html

  * igt@gem_userptr_blits@sync-unmap-after-close:
    - shard-hsw:          [DMESG-WARN][68] ([fdo#111870]) -> [PASS][69]
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-hsw1/igt@gem_userptr_blits@sync-unmap-after-close.html
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-hsw5/igt@gem_userptr_blits@sync-unmap-after-close.html

  * igt@i915_pm_dc@dc5-dpms:
    - shard-iclb:         [FAIL][70] ([fdo#111795 ]) -> [PASS][71]
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb3/igt@i915_pm_dc@dc5-dpms.html
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb5/igt@i915_pm_dc@dc5-dpms.html

  * igt@i915_suspend@sysfs-reader:
    - shard-tglb:         [INCOMPLETE][72] ([fdo#111832] / [fdo#111850]) -> [PASS][73] +1 similar issue
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb1/igt@i915_suspend@sysfs-reader.html
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb5/igt@i915_suspend@sysfs-reader.html

  * igt@kms_flip_tiling@flip-to-y-tiled:
    - shard-skl:          [FAIL][74] ([fdo#107931] / [fdo#108134]) -> [PASS][75]
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl7/igt@kms_flip_tiling@flip-to-y-tiled.html
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl10/igt@kms_flip_tiling@flip-to-y-tiled.html

  * igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-blt:
    - shard-iclb:         [FAIL][76] ([fdo#103167]) -> [PASS][77] +4 similar issues
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb2/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-blt.html
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb1/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-blt.html

  * igt@kms_frontbuffer_tracking@fbcpsr-stridechange:
    - shard-tglb:         [FAIL][78] ([fdo#103167]) -> [PASS][79] +4 similar issues
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb8/igt@kms_frontbuffer_tracking@fbcpsr-stridechange.html
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb1/igt@kms_frontbuffer_tracking@fbcpsr-stridechange.html

  * igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
    - shard-apl:          [DMESG-WARN][80] ([fdo#108566]) -> [PASS][81] +2 similar issues
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-apl6/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes.html
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-apl2/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes.html
    - shard-skl:          [INCOMPLETE][82] ([fdo#104108]) -> [PASS][83]
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl2/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes.html
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl7/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes.html

  * igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
    - shard-skl:          [FAIL][84] ([fdo#108145] / [fdo#110403]) -> [PASS][85]
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-skl9/igt@kms_plane_alpha_blend@pipe-b-coverage-7efc.html
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-skl6/igt@kms_plane_alpha_blend@pipe-b-coverage-7efc.html

  * igt@kms_plane_lowres@pipe-a-tiling-x:
    - shard-iclb:         [FAIL][86] ([fdo#103166]) -> [PASS][87]
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb5/igt@kms_plane_lowres@pipe-a-tiling-x.html
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@kms_plane_lowres@pipe-a-tiling-x.html

  * igt@kms_psr2_su@page_flip:
    - shard-iclb:         [SKIP][88] ([fdo#109642] / [fdo#111068]) -> [PASS][89]
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb5/igt@kms_psr2_su@page_flip.html
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@kms_psr2_su@page_flip.html

  * igt@kms_psr@psr2_cursor_render:
    - shard-iclb:         [SKIP][90] ([fdo#109441]) -> [PASS][91] +1 similar issue
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb4/igt@kms_psr@psr2_cursor_render.html
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@kms_psr@psr2_cursor_render.html

  * igt@prime_vgem@fence-wait-bsd2:
    - shard-iclb:         [SKIP][92] ([fdo#109276]) -> [PASS][93] +6 similar issues
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb7/igt@prime_vgem@fence-wait-bsd2.html
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb4/igt@prime_vgem@fence-wait-bsd2.html

  
#### Warnings ####

  * igt@gem_ctx_isolation@vcs2-dirty-create:
    - shard-tglb:         [SKIP][94] ([fdo#111912] / [fdo#112080]) -> [SKIP][95] ([fdo#112080])
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb5/igt@gem_ctx_isolation@vcs2-dirty-create.html
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb9/igt@gem_ctx_isolation@vcs2-dirty-create.html

  * igt@i915_pm_dc@dc6-dpms:
    - shard-tglb:         [FAIL][96] ([fdo#111830 ]) -> [SKIP][97] ([fdo#111865])
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb5/igt@i915_pm_dc@dc6-dpms.html
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb6/igt@i915_pm_dc@dc6-dpms.html

  * igt@kms_dp_dsc@basic-dsc-enable-edp:
    - shard-tglb:         [DMESG-WARN][98] ([fdo#111600]) -> [INCOMPLETE][99] ([fdo#111600] / [fdo#112036])
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-tglb9/igt@kms_dp_dsc@basic-dsc-enable-edp.html
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-tglb2/igt@kms_dp_dsc@basic-dsc-enable-edp.html

  * igt@kms_psr@psr2_suspend:
    - shard-iclb:         [SKIP][100] ([fdo#109441]) -> [DMESG-WARN][101] ([fdo#107724])
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7357/shard-iclb5/igt@kms_psr@psr2_suspend.html
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/shard-iclb2/igt@kms_psr@psr2_suspend.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo# 111852 ]: https://bugs.freedesktop.org/show_bug.cgi?id= 111852 
  [fdo# 112000 ]: https://bugs.freedesktop.org/show_bug.cgi?id= 112000 
  [fdo#103166]: https://bugs.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15297/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-19 10:14     ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-19 10:14 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Yank out the code for the plane->fb/old_fb/crtc handling from
> the page flip path into page_flip_internal(), and provide a
> simpler variant for atomic drivers.
> 
> We'll also move the fb vs. src viewport checks into the new
> functions as they are slightly different between the two paths.
> If the atomic .page_flip() implementations are guaranteed
> to call drm_atomic_plane_check() we could even drop the check
> entirely from page_flip_atomic(). For now toss in a FIXME.
> 
> v2: Bit more polish in page_flip_internal()
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
>  1 file changed, 102 insertions(+), 57 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 38878da5b704..6052475a20a5 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
>  	return drm_mode_cursor_common(dev, req, file_priv);
>  }
>  
> +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> +			       const struct drm_framebuffer *old_fb)
> +{
> +	/* The framebuffer is currently unbound, presumably
> +	 * due to a hotplug event, that userspace has not
> +	 * yet discovered.
> +	 */
> +	if (!old_fb)
> +		return -EBUSY;
> +
> +	if (old_fb->format != fb->format) {
> +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
> +static int page_flip_internal(struct drm_crtc *crtc,
> +			      struct drm_framebuffer *fb,
> +			      struct drm_pending_vblank_event *e,
> +			      u32 flags,
> +			      u32 target_vblank,
> +			      struct drm_modeset_acquire_ctx *ctx)
> +{
> +	struct drm_plane *plane = crtc->primary;
> +	int ret;
> +
> +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> +
> +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> +				      &crtc->mode, fb);
> +	if (ret)
> +		return ret;
> +
> +	ret = page_flip_check_fbs(fb, plane->fb);
> +	if (ret)
> +		return ret;
> +
> +	plane->old_fb = plane->fb;
> +	if (crtc->funcs->page_flip_target)
> +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> +						    target_vblank, ctx);
> +	else
> +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> +	if (ret) {
> +		plane->old_fb = NULL;
> +		return ret;
> +	}
> +
> +	plane->fb = fb;
> +	drm_framebuffer_get(plane->fb);
> +
> +	drm_framebuffer_put(plane->old_fb);
> +	plane->old_fb = NULL;
> +
> +	return 0;
> +}
> +
> +static int page_flip_atomic(struct drm_crtc *crtc,
> +			    struct drm_framebuffer *fb,
> +			    struct drm_pending_vblank_event *e,
> +			    u32 flags,
> +			    u32 target_vblank,
> +			    struct drm_modeset_acquire_ctx *ctx)
> +{
> +	struct drm_plane *plane = crtc->primary;
> +	struct drm_plane_state *plane_state = plane->state;
> +	int ret;
> +
> +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> +
> +	/*
> +	 * FIXME: Can we assume all drivers end up calling
> +	 * drm_atomic_plane_check() in their page flip paths?
> +	 * If so we could remove this.
> +	 */

This is definitely wrong, core has to check these. Currently no driver
checks this at all. I think you're thinking of
drm_atomic_helper_check_plane_state().

That aside I'm kinda not getting the point of the shuffling/cleanup in the
first 4 patches here, so will skip them.
-Daniel

> +	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
> +					       plane_state->src_y,
> +					       plane_state->src_w,
> +					       plane_state->src_h,
> +					       fb);
> +	if (ret)
> +		return ret;
> +
> +	ret = page_flip_check_fbs(fb, plane_state->fb);
> +	if (ret)
> +		return ret;
> +
> +	if (crtc->funcs->page_flip_target)
> +		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
> +						     target_vblank, ctx);
> +	else
> +		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> +}
> +
>  int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  			     void *data, struct drm_file *file_priv)
>  {
>  	struct drm_mode_crtc_page_flip_target *page_flip = data;
>  	struct drm_crtc *crtc;
>  	struct drm_plane *plane;
> -	struct drm_framebuffer *fb, *old_fb;
> +	struct drm_framebuffer *fb;
>  	struct drm_pending_vblank_event *e = NULL;
>  	u32 target_vblank = page_flip->sequence;
>  	struct drm_modeset_acquire_ctx ctx;
> @@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	if (ret)
>  		goto out;
>  
> -	if (plane->state)
> -		old_fb = plane->state->fb;
> +	if (drm_drv_uses_atomic_modeset(dev))
> +		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
> +				       target_vblank, &ctx);
>  	else
> -		old_fb = plane->fb;
> -
> -	if (old_fb == NULL) {
> -		/* The framebuffer is currently unbound, presumably
> -		 * due to a hotplug event, that userspace has not
> -		 * yet discovered.
> -		 */
> -		ret = -EBUSY;
> -		goto out;
> -	}
> -
> -	if (plane->state) {
> -		const struct drm_plane_state *state = plane->state;
> -
> -		ret = drm_framebuffer_check_src_coords(state->src_x,
> -						       state->src_y,
> -						       state->src_w,
> -						       state->src_h,
> -						       fb);
> -	} else {
> -		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> -					      &crtc->mode, fb);
> -	}
> -	if (ret)
> -		goto out;
> -
> -	if (old_fb->format != fb->format) {
> -		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> -		ret = -EINVAL;
> -		goto out;
> -	}
> -
> -	plane->old_fb = plane->fb;
> -	if (crtc->funcs->page_flip_target)
> -		ret = crtc->funcs->page_flip_target(crtc, fb, e,
> -						    page_flip->flags,
> -						    target_vblank,
> -						    &ctx);
> -	else
> -		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
> -					     &ctx);
> -	if (ret) {
> -		/* Keep the old fb, don't unref it. */
> -		plane->old_fb = NULL;
> -	} else {
> -		if (!plane->state) {
> -			plane->fb = fb;
> -			drm_framebuffer_get(fb);
> -		}
> -	}
> +		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
> +					 target_vblank, &ctx);
>  
>  out:
> -	if (plane->old_fb)
> -		drm_framebuffer_put(plane->old_fb);
> -	plane->old_fb = NULL;
> -
>  	if (ret == -EDEADLK) {
>  		ret = drm_modeset_backoff(&ctx);
>  		if (!ret)
> -- 
> 2.23.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-19 10:14     ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-19 10:14 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Yank out the code for the plane->fb/old_fb/crtc handling from
> the page flip path into page_flip_internal(), and provide a
> simpler variant for atomic drivers.
> 
> We'll also move the fb vs. src viewport checks into the new
> functions as they are slightly different between the two paths.
> If the atomic .page_flip() implementations are guaranteed
> to call drm_atomic_plane_check() we could even drop the check
> entirely from page_flip_atomic(). For now toss in a FIXME.
> 
> v2: Bit more polish in page_flip_internal()
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
>  1 file changed, 102 insertions(+), 57 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 38878da5b704..6052475a20a5 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
>  	return drm_mode_cursor_common(dev, req, file_priv);
>  }
>  
> +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> +			       const struct drm_framebuffer *old_fb)
> +{
> +	/* The framebuffer is currently unbound, presumably
> +	 * due to a hotplug event, that userspace has not
> +	 * yet discovered.
> +	 */
> +	if (!old_fb)
> +		return -EBUSY;
> +
> +	if (old_fb->format != fb->format) {
> +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
> +static int page_flip_internal(struct drm_crtc *crtc,
> +			      struct drm_framebuffer *fb,
> +			      struct drm_pending_vblank_event *e,
> +			      u32 flags,
> +			      u32 target_vblank,
> +			      struct drm_modeset_acquire_ctx *ctx)
> +{
> +	struct drm_plane *plane = crtc->primary;
> +	int ret;
> +
> +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> +
> +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> +				      &crtc->mode, fb);
> +	if (ret)
> +		return ret;
> +
> +	ret = page_flip_check_fbs(fb, plane->fb);
> +	if (ret)
> +		return ret;
> +
> +	plane->old_fb = plane->fb;
> +	if (crtc->funcs->page_flip_target)
> +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> +						    target_vblank, ctx);
> +	else
> +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> +	if (ret) {
> +		plane->old_fb = NULL;
> +		return ret;
> +	}
> +
> +	plane->fb = fb;
> +	drm_framebuffer_get(plane->fb);
> +
> +	drm_framebuffer_put(plane->old_fb);
> +	plane->old_fb = NULL;
> +
> +	return 0;
> +}
> +
> +static int page_flip_atomic(struct drm_crtc *crtc,
> +			    struct drm_framebuffer *fb,
> +			    struct drm_pending_vblank_event *e,
> +			    u32 flags,
> +			    u32 target_vblank,
> +			    struct drm_modeset_acquire_ctx *ctx)
> +{
> +	struct drm_plane *plane = crtc->primary;
> +	struct drm_plane_state *plane_state = plane->state;
> +	int ret;
> +
> +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> +
> +	/*
> +	 * FIXME: Can we assume all drivers end up calling
> +	 * drm_atomic_plane_check() in their page flip paths?
> +	 * If so we could remove this.
> +	 */

This is definitely wrong, core has to check these. Currently no driver
checks this at all. I think you're thinking of
drm_atomic_helper_check_plane_state().

That aside I'm kinda not getting the point of the shuffling/cleanup in the
first 4 patches here, so will skip them.
-Daniel

> +	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
> +					       plane_state->src_y,
> +					       plane_state->src_w,
> +					       plane_state->src_h,
> +					       fb);
> +	if (ret)
> +		return ret;
> +
> +	ret = page_flip_check_fbs(fb, plane_state->fb);
> +	if (ret)
> +		return ret;
> +
> +	if (crtc->funcs->page_flip_target)
> +		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
> +						     target_vblank, ctx);
> +	else
> +		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> +}
> +
>  int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  			     void *data, struct drm_file *file_priv)
>  {
>  	struct drm_mode_crtc_page_flip_target *page_flip = data;
>  	struct drm_crtc *crtc;
>  	struct drm_plane *plane;
> -	struct drm_framebuffer *fb, *old_fb;
> +	struct drm_framebuffer *fb;
>  	struct drm_pending_vblank_event *e = NULL;
>  	u32 target_vblank = page_flip->sequence;
>  	struct drm_modeset_acquire_ctx ctx;
> @@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	if (ret)
>  		goto out;
>  
> -	if (plane->state)
> -		old_fb = plane->state->fb;
> +	if (drm_drv_uses_atomic_modeset(dev))
> +		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
> +				       target_vblank, &ctx);
>  	else
> -		old_fb = plane->fb;
> -
> -	if (old_fb == NULL) {
> -		/* The framebuffer is currently unbound, presumably
> -		 * due to a hotplug event, that userspace has not
> -		 * yet discovered.
> -		 */
> -		ret = -EBUSY;
> -		goto out;
> -	}
> -
> -	if (plane->state) {
> -		const struct drm_plane_state *state = plane->state;
> -
> -		ret = drm_framebuffer_check_src_coords(state->src_x,
> -						       state->src_y,
> -						       state->src_w,
> -						       state->src_h,
> -						       fb);
> -	} else {
> -		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> -					      &crtc->mode, fb);
> -	}
> -	if (ret)
> -		goto out;
> -
> -	if (old_fb->format != fb->format) {
> -		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> -		ret = -EINVAL;
> -		goto out;
> -	}
> -
> -	plane->old_fb = plane->fb;
> -	if (crtc->funcs->page_flip_target)
> -		ret = crtc->funcs->page_flip_target(crtc, fb, e,
> -						    page_flip->flags,
> -						    target_vblank,
> -						    &ctx);
> -	else
> -		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
> -					     &ctx);
> -	if (ret) {
> -		/* Keep the old fb, don't unref it. */
> -		plane->old_fb = NULL;
> -	} else {
> -		if (!plane->state) {
> -			plane->fb = fb;
> -			drm_framebuffer_get(fb);
> -		}
> -	}
> +		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
> +					 target_vblank, &ctx);
>  
>  out:
> -	if (plane->old_fb)
> -		drm_framebuffer_put(plane->old_fb);
> -	plane->old_fb = NULL;
> -
>  	if (ret == -EDEADLK) {
>  		ret = drm_modeset_backoff(&ctx);
>  		if (!ret)
> -- 
> 2.23.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-19 10:14     ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-19 10:14 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Yank out the code for the plane->fb/old_fb/crtc handling from
> the page flip path into page_flip_internal(), and provide a
> simpler variant for atomic drivers.
> 
> We'll also move the fb vs. src viewport checks into the new
> functions as they are slightly different between the two paths.
> If the atomic .page_flip() implementations are guaranteed
> to call drm_atomic_plane_check() we could even drop the check
> entirely from page_flip_atomic(). For now toss in a FIXME.
> 
> v2: Bit more polish in page_flip_internal()
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
>  1 file changed, 102 insertions(+), 57 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 38878da5b704..6052475a20a5 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
>  	return drm_mode_cursor_common(dev, req, file_priv);
>  }
>  
> +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> +			       const struct drm_framebuffer *old_fb)
> +{
> +	/* The framebuffer is currently unbound, presumably
> +	 * due to a hotplug event, that userspace has not
> +	 * yet discovered.
> +	 */
> +	if (!old_fb)
> +		return -EBUSY;
> +
> +	if (old_fb->format != fb->format) {
> +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
> +static int page_flip_internal(struct drm_crtc *crtc,
> +			      struct drm_framebuffer *fb,
> +			      struct drm_pending_vblank_event *e,
> +			      u32 flags,
> +			      u32 target_vblank,
> +			      struct drm_modeset_acquire_ctx *ctx)
> +{
> +	struct drm_plane *plane = crtc->primary;
> +	int ret;
> +
> +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> +
> +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> +				      &crtc->mode, fb);
> +	if (ret)
> +		return ret;
> +
> +	ret = page_flip_check_fbs(fb, plane->fb);
> +	if (ret)
> +		return ret;
> +
> +	plane->old_fb = plane->fb;
> +	if (crtc->funcs->page_flip_target)
> +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> +						    target_vblank, ctx);
> +	else
> +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> +	if (ret) {
> +		plane->old_fb = NULL;
> +		return ret;
> +	}
> +
> +	plane->fb = fb;
> +	drm_framebuffer_get(plane->fb);
> +
> +	drm_framebuffer_put(plane->old_fb);
> +	plane->old_fb = NULL;
> +
> +	return 0;
> +}
> +
> +static int page_flip_atomic(struct drm_crtc *crtc,
> +			    struct drm_framebuffer *fb,
> +			    struct drm_pending_vblank_event *e,
> +			    u32 flags,
> +			    u32 target_vblank,
> +			    struct drm_modeset_acquire_ctx *ctx)
> +{
> +	struct drm_plane *plane = crtc->primary;
> +	struct drm_plane_state *plane_state = plane->state;
> +	int ret;
> +
> +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> +
> +	/*
> +	 * FIXME: Can we assume all drivers end up calling
> +	 * drm_atomic_plane_check() in their page flip paths?
> +	 * If so we could remove this.
> +	 */

This is definitely wrong, core has to check these. Currently no driver
checks this at all. I think you're thinking of
drm_atomic_helper_check_plane_state().

That aside I'm kinda not getting the point of the shuffling/cleanup in the
first 4 patches here, so will skip them.
-Daniel

> +	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
> +					       plane_state->src_y,
> +					       plane_state->src_w,
> +					       plane_state->src_h,
> +					       fb);
> +	if (ret)
> +		return ret;
> +
> +	ret = page_flip_check_fbs(fb, plane_state->fb);
> +	if (ret)
> +		return ret;
> +
> +	if (crtc->funcs->page_flip_target)
> +		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
> +						     target_vblank, ctx);
> +	else
> +		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> +}
> +
>  int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  			     void *data, struct drm_file *file_priv)
>  {
>  	struct drm_mode_crtc_page_flip_target *page_flip = data;
>  	struct drm_crtc *crtc;
>  	struct drm_plane *plane;
> -	struct drm_framebuffer *fb, *old_fb;
> +	struct drm_framebuffer *fb;
>  	struct drm_pending_vblank_event *e = NULL;
>  	u32 target_vblank = page_flip->sequence;
>  	struct drm_modeset_acquire_ctx ctx;
> @@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	if (ret)
>  		goto out;
>  
> -	if (plane->state)
> -		old_fb = plane->state->fb;
> +	if (drm_drv_uses_atomic_modeset(dev))
> +		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
> +				       target_vblank, &ctx);
>  	else
> -		old_fb = plane->fb;
> -
> -	if (old_fb == NULL) {
> -		/* The framebuffer is currently unbound, presumably
> -		 * due to a hotplug event, that userspace has not
> -		 * yet discovered.
> -		 */
> -		ret = -EBUSY;
> -		goto out;
> -	}
> -
> -	if (plane->state) {
> -		const struct drm_plane_state *state = plane->state;
> -
> -		ret = drm_framebuffer_check_src_coords(state->src_x,
> -						       state->src_y,
> -						       state->src_w,
> -						       state->src_h,
> -						       fb);
> -	} else {
> -		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> -					      &crtc->mode, fb);
> -	}
> -	if (ret)
> -		goto out;
> -
> -	if (old_fb->format != fb->format) {
> -		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> -		ret = -EINVAL;
> -		goto out;
> -	}
> -
> -	plane->old_fb = plane->fb;
> -	if (crtc->funcs->page_flip_target)
> -		ret = crtc->funcs->page_flip_target(crtc, fb, e,
> -						    page_flip->flags,
> -						    target_vblank,
> -						    &ctx);
> -	else
> -		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
> -					     &ctx);
> -	if (ret) {
> -		/* Keep the old fb, don't unref it. */
> -		plane->old_fb = NULL;
> -	} else {
> -		if (!plane->state) {
> -			plane->fb = fb;
> -			drm_framebuffer_get(fb);
> -		}
> -	}
> +		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
> +					 target_vblank, &ctx);
>  
>  out:
> -	if (plane->old_fb)
> -		drm_framebuffer_put(plane->old_fb);
> -	plane->old_fb = NULL;
> -
>  	if (ret == -EDEADLK) {
>  		ret = drm_modeset_backoff(&ctx);
>  		if (!ret)
> -- 
> 2.23.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 6/7] drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
@ 2019-11-19 10:20     ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-19 10:20 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Fri, Nov 15, 2019 at 09:42:03PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The early return in drm_atomic_set_mode_for_crtc() isn't quite
> right. It would mistakenly return and fail to update
> crtc_state->enable if someone actually tried to set a zeroed
> mode on a currently disabled crtc. That should never actually
> happen in response to any userspace request as the zeroed mode
> would get rejected earlier. However there is some chance of this
> happening internally (eg. during hw state readout) so it seems
> best to not let the state become totally inconsistent.
> 
> Additionally the early return will not be taken if we're trying to
> disable an already disabled crtc. While that is not actually
> harmful it is inconsistent, so let's handle that case as well.
> 
> Testcase: igt/kms_selftest/check_atomic_set_mode_for_crtc
> Testcase: igt/kms_selftest/check_atomic_set_zeroed_mode_fort_crtc
> Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_atomic_uapi.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 0d466d3b0809..a3a6a8137af4 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -68,8 +68,13 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
>  	struct drm_mode_modeinfo umode;
>  
>  	/* Early return for no change. */
> -	if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
> -		return 0;
> +	if (state->enable) {

Hm I think this would be clearer if you go with

	if (state->enable == !!mode &&
	    (!mode || memcmp(&state->mode, mode, sizeof(*mode)) == 0))
	    	return 0;

But also somewhat a bikeshed. I'm also wondering whether we shouldn't just
declare this a driver bug (it means enable and mode are already out of
sync), but I guess hw state readout is special sometimes.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +		if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
> +			return 0;
> +	} else {
> +		if (!mode)
> +			return 0;
> +	}
>  
>  	drm_property_blob_put(state->mode_blob);
>  	state->mode_blob = NULL;
> -- 
> 2.23.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 6/7] drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
@ 2019-11-19 10:20     ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-19 10:20 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Fri, Nov 15, 2019 at 09:42:03PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The early return in drm_atomic_set_mode_for_crtc() isn't quite
> right. It would mistakenly return and fail to update
> crtc_state->enable if someone actually tried to set a zeroed
> mode on a currently disabled crtc. That should never actually
> happen in response to any userspace request as the zeroed mode
> would get rejected earlier. However there is some chance of this
> happening internally (eg. during hw state readout) so it seems
> best to not let the state become totally inconsistent.
> 
> Additionally the early return will not be taken if we're trying to
> disable an already disabled crtc. While that is not actually
> harmful it is inconsistent, so let's handle that case as well.
> 
> Testcase: igt/kms_selftest/check_atomic_set_mode_for_crtc
> Testcase: igt/kms_selftest/check_atomic_set_zeroed_mode_fort_crtc
> Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_atomic_uapi.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 0d466d3b0809..a3a6a8137af4 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -68,8 +68,13 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
>  	struct drm_mode_modeinfo umode;
>  
>  	/* Early return for no change. */
> -	if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
> -		return 0;
> +	if (state->enable) {

Hm I think this would be clearer if you go with

	if (state->enable == !!mode &&
	    (!mode || memcmp(&state->mode, mode, sizeof(*mode)) == 0))
	    	return 0;

But also somewhat a bikeshed. I'm also wondering whether we shouldn't just
declare this a driver bug (it means enable and mode are already out of
sync), but I guess hw state readout is special sometimes.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +		if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
> +			return 0;
> +	} else {
> +		if (!mode)
> +			return 0;
> +	}
>  
>  	drm_property_blob_put(state->mode_blob);
>  	state->mode_blob = NULL;
> -- 
> 2.23.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 6/7] drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
@ 2019-11-19 10:20     ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-19 10:20 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Fri, Nov 15, 2019 at 09:42:03PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The early return in drm_atomic_set_mode_for_crtc() isn't quite
> right. It would mistakenly return and fail to update
> crtc_state->enable if someone actually tried to set a zeroed
> mode on a currently disabled crtc. That should never actually
> happen in response to any userspace request as the zeroed mode
> would get rejected earlier. However there is some chance of this
> happening internally (eg. during hw state readout) so it seems
> best to not let the state become totally inconsistent.
> 
> Additionally the early return will not be taken if we're trying to
> disable an already disabled crtc. While that is not actually
> harmful it is inconsistent, so let's handle that case as well.
> 
> Testcase: igt/kms_selftest/check_atomic_set_mode_for_crtc
> Testcase: igt/kms_selftest/check_atomic_set_zeroed_mode_fort_crtc
> Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_atomic_uapi.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 0d466d3b0809..a3a6a8137af4 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -68,8 +68,13 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
>  	struct drm_mode_modeinfo umode;
>  
>  	/* Early return for no change. */
> -	if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
> -		return 0;
> +	if (state->enable) {

Hm I think this would be clearer if you go with

	if (state->enable == !!mode &&
	    (!mode || memcmp(&state->mode, mode, sizeof(*mode)) == 0))
	    	return 0;

But also somewhat a bikeshed. I'm also wondering whether we shouldn't just
declare this a driver bug (it means enable and mode are already out of
sync), but I guess hw state readout is special sometimes.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +		if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
> +			return 0;
> +	} else {
> +		if (!mode)
> +			return 0;
> +	}
>  
>  	drm_property_blob_put(state->mode_blob);
>  	state->mode_blob = NULL;
> -- 
> 2.23.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 5/7] drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
@ 2019-11-19 10:39     ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-19 10:39 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Fri, Nov 15, 2019 at 09:42:02PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Test the basics of drm_atomic_set_mode_for_crtc(), and in particular
> verify that the function doesn't take the shortcut incorrectly.
> 
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/selftests/Makefile            |   3 +-
>  .../gpu/drm/selftests/drm_modeset_selftests.h |   2 +
>  .../gpu/drm/selftests/test-drm_atomic_uapi.c  | 110 ++++++++++++++++++
>  .../drm/selftests/test-drm_modeset_common.h   |   2 +
>  4 files changed, 116 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
> 
> diff --git a/drivers/gpu/drm/selftests/Makefile b/drivers/gpu/drm/selftests/Makefile
> index d2137342b371..a5adc25bd345 100644
> --- a/drivers/gpu/drm/selftests/Makefile
> +++ b/drivers/gpu/drm/selftests/Makefile
> @@ -1,6 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o \
>                        test-drm_format.o test-drm_framebuffer.o \
> -		      test-drm_damage_helper.o test-drm_dp_mst_helper.o
> +		      test-drm_damage_helper.o test-drm_dp_mst_helper.o \
> +		      test-drm_atomic_uapi.o
>  
>  obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o test-drm_cmdline_parser.o
> diff --git a/drivers/gpu/drm/selftests/drm_modeset_selftests.h b/drivers/gpu/drm/selftests/drm_modeset_selftests.h
> index 1898de0b4a4d..2cc4e2f43286 100644
> --- a/drivers/gpu/drm/selftests/drm_modeset_selftests.h
> +++ b/drivers/gpu/drm/selftests/drm_modeset_selftests.h
> @@ -6,6 +6,8 @@
>   *
>   * Tests are executed in order by igt/drm_selftests_helper
>   */
> +selftest(atomic_set_mode_for_crtc, igt_atomic_set_mode_for_crtc)
> +selftest(atomic_set_zeroed_mode_for_crtc, igt_atomic_set_zeroed_mode_for_crtc)
>  selftest(check_plane_state, igt_check_plane_state)
>  selftest(check_drm_format_block_width, igt_check_drm_format_block_width)
>  selftest(check_drm_format_block_height, igt_check_drm_format_block_height)
> diff --git a/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c b/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
> new file mode 100644
> index 000000000000..0f9a4d0d2541
> --- /dev/null
> +++ b/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
> @@ -0,0 +1,110 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Test cases for the drm_atomic_uapi functions
> + */
> +
> +#define pr_fmt(fmt) "drm_atomic_uapi: " fmt
> +
> +#include <drm/drm_atomic_uapi.h>
> +#include <drm/drm_drv.h>
> +#include <drm/drm_crtc.h>
> +#include <drm/drm_modes.h>
> +
> +#include "test-drm_modeset_common.h"
> +
> +static const struct drm_display_mode zeroed_mode;
> +
> +static struct drm_driver mock_driver;
> +static struct drm_device mock_device;
> +static struct drm_crtc mock_crtc;
> +
> +static void init(void)
> +{
> +	memset(&mock_driver, 0, sizeof(mock_driver));
> +	memset(&mock_device, 0, sizeof(mock_device));
> +	memset(&mock_crtc, 0, sizeof(mock_crtc));
> +
> +	mock_device.driver = &mock_driver;
> +	mock_crtc.dev = &mock_device;
> +
> +	drm_mode_config_init(&mock_device);
> +}

Hm some todof for a real mock_driver would be nice. I think the static
stuff is a bit too icky, I think we should go a proper mock_drm_device a
la mock_gem_device in i915 selftests. and mock_drm_crtc. But meh ...

> +
> +static void cleanup(void)
> +{
> +	drm_mode_config_cleanup(&mock_device);
> +}
> +
> +int igt_atomic_set_mode_for_crtc(void *ignored)
> +{
> +	static const struct drm_display_mode mode1 = {
> +		DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175,
> +			 640, 656, 752, 800, 0, 480, 490, 492, 525, 0,
> +			 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC)
> +	};
> +	static const struct drm_display_mode mode2 = {
> +		DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000,
> +			 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0,
> +			 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC)
> +	};
> +	struct drm_crtc_state crtc_state = {
> +		.crtc = &mock_crtc,
> +	};
> +	int ret;
> +
> +	init();
> +
> +	/*
> +	 * Make	sure drm_atomic_set_mode_for_crtc()
> +	 * updates the crtc state correctly.
> +	 */
> +	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &mode1);
> +	FAIL(ret < 0, "Unable to set mode on crtc\n");
> +	FAIL_ON(!crtc_state.enable);
> +	FAIL_ON(memcmp(&crtc_state.mode, &mode1, sizeof(mode1)));
> +
> +	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &mode2);
> +	FAIL(ret < 0, "Unable to set mode on crtc\n");
> +	FAIL_ON(!crtc_state.enable);
> +	FAIL_ON(memcmp(&crtc_state.mode, &mode2, sizeof(mode2)));
> +
> +	ret = drm_atomic_set_mode_for_crtc(&crtc_state, NULL);
> +	FAIL(ret < 0, "Unable to unset mode on crtc\n");
> +	FAIL_ON(crtc_state.enable);
> +	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
> +
> +	cleanup();
> +
> +	return 0;
> +}
> +
> +int igt_atomic_set_zeroed_mode_for_crtc(void *ignored)
> +{
> +	struct drm_crtc_state crtc_state = {
> +		.crtc = &mock_crtc,
> +	};
> +	int ret;
> +
> +	init();
> +
> +	/*
> +	 * Make sure drm_atomic_set_mode_for_crtc() doesn't
> +	 * take the shortcut and fail to update crtc_state.enable
> +	 * when passed a zeroed mode (which is technically not
> +	 * valid, but as drm_atomic_set_mode_for_crtc() does no
> +	 * mode validation it should still work).
> +	 */
> +	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &zeroed_mode);
> +	FAIL(ret < 0, "Unable to set mode on crtc\n");
> +	FAIL_ON(!crtc_state.enable);
> +	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
> +
> +	ret = drm_atomic_set_mode_for_crtc(&crtc_state, NULL);
> +	FAIL(ret < 0, "Unable to unset mode on crtc\n");
> +	FAIL_ON(crtc_state.enable);
> +	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));

Not really seeing the point of why we have to be careful here, but I guess
silly stuff can happen, and better to not be accidentally inconsistent.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> +
> +	cleanup();
> +
> +	return 0;
> +}
> diff --git a/drivers/gpu/drm/selftests/test-drm_modeset_common.h b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
> index 0fcb8bbc6a1b..a1248abf86f9 100644
> --- a/drivers/gpu/drm/selftests/test-drm_modeset_common.h
> +++ b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
> @@ -13,6 +13,8 @@
>  
>  #define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n")
>  
> +int igt_atomic_set_mode_for_crtc(void *ignored);
> +int igt_atomic_set_zeroed_mode_for_crtc(void *ignored);
>  int igt_check_plane_state(void *ignored);
>  int igt_check_drm_format_block_width(void *ignored);
>  int igt_check_drm_format_block_height(void *ignored);
> -- 
> 2.23.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 5/7] drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc()
@ 2019-11-19 10:39     ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-19 10:39 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Fri, Nov 15, 2019 at 09:42:02PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Test the basics of drm_atomic_set_mode_for_crtc(), and in particular
> verify that the function doesn't take the shortcut incorrectly.
> 
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/selftests/Makefile            |   3 +-
>  .../gpu/drm/selftests/drm_modeset_selftests.h |   2 +
>  .../gpu/drm/selftests/test-drm_atomic_uapi.c  | 110 ++++++++++++++++++
>  .../drm/selftests/test-drm_modeset_common.h   |   2 +
>  4 files changed, 116 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
> 
> diff --git a/drivers/gpu/drm/selftests/Makefile b/drivers/gpu/drm/selftests/Makefile
> index d2137342b371..a5adc25bd345 100644
> --- a/drivers/gpu/drm/selftests/Makefile
> +++ b/drivers/gpu/drm/selftests/Makefile
> @@ -1,6 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o \
>                        test-drm_format.o test-drm_framebuffer.o \
> -		      test-drm_damage_helper.o test-drm_dp_mst_helper.o
> +		      test-drm_damage_helper.o test-drm_dp_mst_helper.o \
> +		      test-drm_atomic_uapi.o
>  
>  obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o test-drm_cmdline_parser.o
> diff --git a/drivers/gpu/drm/selftests/drm_modeset_selftests.h b/drivers/gpu/drm/selftests/drm_modeset_selftests.h
> index 1898de0b4a4d..2cc4e2f43286 100644
> --- a/drivers/gpu/drm/selftests/drm_modeset_selftests.h
> +++ b/drivers/gpu/drm/selftests/drm_modeset_selftests.h
> @@ -6,6 +6,8 @@
>   *
>   * Tests are executed in order by igt/drm_selftests_helper
>   */
> +selftest(atomic_set_mode_for_crtc, igt_atomic_set_mode_for_crtc)
> +selftest(atomic_set_zeroed_mode_for_crtc, igt_atomic_set_zeroed_mode_for_crtc)
>  selftest(check_plane_state, igt_check_plane_state)
>  selftest(check_drm_format_block_width, igt_check_drm_format_block_width)
>  selftest(check_drm_format_block_height, igt_check_drm_format_block_height)
> diff --git a/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c b/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
> new file mode 100644
> index 000000000000..0f9a4d0d2541
> --- /dev/null
> +++ b/drivers/gpu/drm/selftests/test-drm_atomic_uapi.c
> @@ -0,0 +1,110 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Test cases for the drm_atomic_uapi functions
> + */
> +
> +#define pr_fmt(fmt) "drm_atomic_uapi: " fmt
> +
> +#include <drm/drm_atomic_uapi.h>
> +#include <drm/drm_drv.h>
> +#include <drm/drm_crtc.h>
> +#include <drm/drm_modes.h>
> +
> +#include "test-drm_modeset_common.h"
> +
> +static const struct drm_display_mode zeroed_mode;
> +
> +static struct drm_driver mock_driver;
> +static struct drm_device mock_device;
> +static struct drm_crtc mock_crtc;
> +
> +static void init(void)
> +{
> +	memset(&mock_driver, 0, sizeof(mock_driver));
> +	memset(&mock_device, 0, sizeof(mock_device));
> +	memset(&mock_crtc, 0, sizeof(mock_crtc));
> +
> +	mock_device.driver = &mock_driver;
> +	mock_crtc.dev = &mock_device;
> +
> +	drm_mode_config_init(&mock_device);
> +}

Hm some todof for a real mock_driver would be nice. I think the static
stuff is a bit too icky, I think we should go a proper mock_drm_device a
la mock_gem_device in i915 selftests. and mock_drm_crtc. But meh ...

> +
> +static void cleanup(void)
> +{
> +	drm_mode_config_cleanup(&mock_device);
> +}
> +
> +int igt_atomic_set_mode_for_crtc(void *ignored)
> +{
> +	static const struct drm_display_mode mode1 = {
> +		DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175,
> +			 640, 656, 752, 800, 0, 480, 490, 492, 525, 0,
> +			 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC)
> +	};
> +	static const struct drm_display_mode mode2 = {
> +		DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000,
> +			 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0,
> +			 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC)
> +	};
> +	struct drm_crtc_state crtc_state = {
> +		.crtc = &mock_crtc,
> +	};
> +	int ret;
> +
> +	init();
> +
> +	/*
> +	 * Make	sure drm_atomic_set_mode_for_crtc()
> +	 * updates the crtc state correctly.
> +	 */
> +	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &mode1);
> +	FAIL(ret < 0, "Unable to set mode on crtc\n");
> +	FAIL_ON(!crtc_state.enable);
> +	FAIL_ON(memcmp(&crtc_state.mode, &mode1, sizeof(mode1)));
> +
> +	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &mode2);
> +	FAIL(ret < 0, "Unable to set mode on crtc\n");
> +	FAIL_ON(!crtc_state.enable);
> +	FAIL_ON(memcmp(&crtc_state.mode, &mode2, sizeof(mode2)));
> +
> +	ret = drm_atomic_set_mode_for_crtc(&crtc_state, NULL);
> +	FAIL(ret < 0, "Unable to unset mode on crtc\n");
> +	FAIL_ON(crtc_state.enable);
> +	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
> +
> +	cleanup();
> +
> +	return 0;
> +}
> +
> +int igt_atomic_set_zeroed_mode_for_crtc(void *ignored)
> +{
> +	struct drm_crtc_state crtc_state = {
> +		.crtc = &mock_crtc,
> +	};
> +	int ret;
> +
> +	init();
> +
> +	/*
> +	 * Make sure drm_atomic_set_mode_for_crtc() doesn't
> +	 * take the shortcut and fail to update crtc_state.enable
> +	 * when passed a zeroed mode (which is technically not
> +	 * valid, but as drm_atomic_set_mode_for_crtc() does no
> +	 * mode validation it should still work).
> +	 */
> +	ret = drm_atomic_set_mode_for_crtc(&crtc_state, &zeroed_mode);
> +	FAIL(ret < 0, "Unable to set mode on crtc\n");
> +	FAIL_ON(!crtc_state.enable);
> +	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));
> +
> +	ret = drm_atomic_set_mode_for_crtc(&crtc_state, NULL);
> +	FAIL(ret < 0, "Unable to unset mode on crtc\n");
> +	FAIL_ON(crtc_state.enable);
> +	FAIL_ON(memcmp(&crtc_state.mode, &zeroed_mode, sizeof(zeroed_mode)));

Not really seeing the point of why we have to be careful here, but I guess
silly stuff can happen, and better to not be accidentally inconsistent.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> +
> +	cleanup();
> +
> +	return 0;
> +}
> diff --git a/drivers/gpu/drm/selftests/test-drm_modeset_common.h b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
> index 0fcb8bbc6a1b..a1248abf86f9 100644
> --- a/drivers/gpu/drm/selftests/test-drm_modeset_common.h
> +++ b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
> @@ -13,6 +13,8 @@
>  
>  #define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n")
>  
> +int igt_atomic_set_mode_for_crtc(void *ignored);
> +int igt_atomic_set_zeroed_mode_for_crtc(void *ignored);
>  int igt_check_plane_state(void *ignored);
>  int igt_check_drm_format_block_width(void *ignored);
>  int igt_check_drm_format_block_height(void *ignored);
> -- 
> 2.23.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 7/7] drm/atomic: Reduce setplane locking
@ 2019-11-19 10:47     ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-19 10:47 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Fri, Nov 15, 2019 at 09:42:04PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Currently setplane grabs all modeset locks, which seems a bit
> excessive. Let's reduce that to just the locks we really need
> on atomic drivers. For non-atomic drivers let's stick to the
> current scheme for now.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c | 56 +++++++++++++++++++------------------
>  1 file changed, 29 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index ef0cc33b43ce..e40d8a93294b 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -680,10 +680,14 @@ static int __setplane_internal(struct drm_plane *plane,
>  			       uint32_t src_w, uint32_t src_h,
>  			       struct drm_modeset_acquire_ctx *ctx)
>  {
> -	int ret = 0;
> +	int ret;
>  
>  	WARN_ON(drm_drv_uses_atomic_modeset(plane->dev));
>  
> +	ret = drm_modeset_lock_all_ctx(plane->dev, ctx);
> +	if (ret)
> +		return ret;

There's pre-nv50 nouveau and shmob which have planes and aren't atomic (if
I checked correctly), so we could probably forgo this, but also feels
like totally not worth the audit trouble.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +
>  	/* No fb means shut it down */
>  	if (!fb) {
>  		plane->old_fb = plane->fb;
> @@ -767,32 +771,24 @@ static int setplane_internal(struct drm_plane *plane,
>  			     uint32_t crtc_w, uint32_t crtc_h,
>  			     /* src_{x,y,w,h} values are 16.16 fixed point */
>  			     uint32_t src_x, uint32_t src_y,
> -			     uint32_t src_w, uint32_t src_h)
> +			     uint32_t src_w, uint32_t src_h,
> +			     struct drm_modeset_acquire_ctx *ctx)
>  {
> -	struct drm_modeset_acquire_ctx ctx;
> -	int ret;
> -
> -	DRM_MODESET_LOCK_ALL_BEGIN(plane->dev, ctx,
> -				   DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
> -
>  	if (drm_drv_uses_atomic_modeset(plane->dev))
> -		ret = __setplane_atomic(plane, crtc, fb,
> -					crtc_x, crtc_y, crtc_w, crtc_h,
> -					src_x, src_y, src_w, src_h, &ctx);
> +		return __setplane_atomic(plane, crtc, fb,
> +					 crtc_x, crtc_y, crtc_w, crtc_h,
> +					 src_x, src_y, src_w, src_h, ctx);
>  	else
> -		ret = __setplane_internal(plane, crtc, fb,
> -					  crtc_x, crtc_y, crtc_w, crtc_h,
> -					  src_x, src_y, src_w, src_h, &ctx);
> -
> -	DRM_MODESET_LOCK_ALL_END(ctx, ret);
> -
> -	return ret;
> +		return __setplane_internal(plane, crtc, fb,
> +					   crtc_x, crtc_y, crtc_w, crtc_h,
> +					   src_x, src_y, src_w, src_h, ctx);
>  }
>  
>  int drm_mode_setplane(struct drm_device *dev, void *data,
>  		      struct drm_file *file_priv)
>  {
>  	struct drm_mode_set_plane *plane_req = data;
> +	struct drm_modeset_acquire_ctx ctx;
>  	struct drm_plane *plane;
>  	struct drm_crtc *crtc = NULL;
>  	struct drm_framebuffer *fb = NULL;
> @@ -829,11 +825,22 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
>  		}
>  	}
>  
> +	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
> +
> +retry:
>  	ret = setplane_internal(plane, crtc, fb,
>  				plane_req->crtc_x, plane_req->crtc_y,
>  				plane_req->crtc_w, plane_req->crtc_h,
>  				plane_req->src_x, plane_req->src_y,
> -				plane_req->src_w, plane_req->src_h);
> +				plane_req->src_w, plane_req->src_h, &ctx);
> +	if (ret == -EDEADLK) {
> +		ret = drm_modeset_backoff(&ctx);
> +		if (!ret)
> +			goto retry;
> +	}
> +
> +	drm_modeset_drop_locks(&ctx);
> +	drm_modeset_acquire_fini(&ctx);
>  
>  	if (fb)
>  		drm_framebuffer_put(fb);
> @@ -907,14 +914,9 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
>  		src_h = fb->height << 16;
>  	}
>  
> -	if (drm_drv_uses_atomic_modeset(dev))
> -		ret = __setplane_atomic(plane, crtc, fb,
> -					crtc_x, crtc_y, crtc_w, crtc_h,
> -					0, 0, src_w, src_h, ctx);
> -	else
> -		ret = __setplane_internal(plane, crtc, fb,
> -					  crtc_x, crtc_y, crtc_w, crtc_h,
> -					  0, 0, src_w, src_h, ctx);
> +	ret = setplane_internal(plane, crtc, fb,
> +				crtc_x, crtc_y, crtc_w, crtc_h,
> +				0, 0, src_w, src_h, ctx);
>  
>  	if (fb)
>  		drm_framebuffer_put(fb);
> -- 
> 2.23.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 7/7] drm/atomic: Reduce setplane locking
@ 2019-11-19 10:47     ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-19 10:47 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Fri, Nov 15, 2019 at 09:42:04PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Currently setplane grabs all modeset locks, which seems a bit
> excessive. Let's reduce that to just the locks we really need
> on atomic drivers. For non-atomic drivers let's stick to the
> current scheme for now.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c | 56 +++++++++++++++++++------------------
>  1 file changed, 29 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index ef0cc33b43ce..e40d8a93294b 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -680,10 +680,14 @@ static int __setplane_internal(struct drm_plane *plane,
>  			       uint32_t src_w, uint32_t src_h,
>  			       struct drm_modeset_acquire_ctx *ctx)
>  {
> -	int ret = 0;
> +	int ret;
>  
>  	WARN_ON(drm_drv_uses_atomic_modeset(plane->dev));
>  
> +	ret = drm_modeset_lock_all_ctx(plane->dev, ctx);
> +	if (ret)
> +		return ret;

There's pre-nv50 nouveau and shmob which have planes and aren't atomic (if
I checked correctly), so we could probably forgo this, but also feels
like totally not worth the audit trouble.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +
>  	/* No fb means shut it down */
>  	if (!fb) {
>  		plane->old_fb = plane->fb;
> @@ -767,32 +771,24 @@ static int setplane_internal(struct drm_plane *plane,
>  			     uint32_t crtc_w, uint32_t crtc_h,
>  			     /* src_{x,y,w,h} values are 16.16 fixed point */
>  			     uint32_t src_x, uint32_t src_y,
> -			     uint32_t src_w, uint32_t src_h)
> +			     uint32_t src_w, uint32_t src_h,
> +			     struct drm_modeset_acquire_ctx *ctx)
>  {
> -	struct drm_modeset_acquire_ctx ctx;
> -	int ret;
> -
> -	DRM_MODESET_LOCK_ALL_BEGIN(plane->dev, ctx,
> -				   DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
> -
>  	if (drm_drv_uses_atomic_modeset(plane->dev))
> -		ret = __setplane_atomic(plane, crtc, fb,
> -					crtc_x, crtc_y, crtc_w, crtc_h,
> -					src_x, src_y, src_w, src_h, &ctx);
> +		return __setplane_atomic(plane, crtc, fb,
> +					 crtc_x, crtc_y, crtc_w, crtc_h,
> +					 src_x, src_y, src_w, src_h, ctx);
>  	else
> -		ret = __setplane_internal(plane, crtc, fb,
> -					  crtc_x, crtc_y, crtc_w, crtc_h,
> -					  src_x, src_y, src_w, src_h, &ctx);
> -
> -	DRM_MODESET_LOCK_ALL_END(ctx, ret);
> -
> -	return ret;
> +		return __setplane_internal(plane, crtc, fb,
> +					   crtc_x, crtc_y, crtc_w, crtc_h,
> +					   src_x, src_y, src_w, src_h, ctx);
>  }
>  
>  int drm_mode_setplane(struct drm_device *dev, void *data,
>  		      struct drm_file *file_priv)
>  {
>  	struct drm_mode_set_plane *plane_req = data;
> +	struct drm_modeset_acquire_ctx ctx;
>  	struct drm_plane *plane;
>  	struct drm_crtc *crtc = NULL;
>  	struct drm_framebuffer *fb = NULL;
> @@ -829,11 +825,22 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
>  		}
>  	}
>  
> +	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
> +
> +retry:
>  	ret = setplane_internal(plane, crtc, fb,
>  				plane_req->crtc_x, plane_req->crtc_y,
>  				plane_req->crtc_w, plane_req->crtc_h,
>  				plane_req->src_x, plane_req->src_y,
> -				plane_req->src_w, plane_req->src_h);
> +				plane_req->src_w, plane_req->src_h, &ctx);
> +	if (ret == -EDEADLK) {
> +		ret = drm_modeset_backoff(&ctx);
> +		if (!ret)
> +			goto retry;
> +	}
> +
> +	drm_modeset_drop_locks(&ctx);
> +	drm_modeset_acquire_fini(&ctx);
>  
>  	if (fb)
>  		drm_framebuffer_put(fb);
> @@ -907,14 +914,9 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
>  		src_h = fb->height << 16;
>  	}
>  
> -	if (drm_drv_uses_atomic_modeset(dev))
> -		ret = __setplane_atomic(plane, crtc, fb,
> -					crtc_x, crtc_y, crtc_w, crtc_h,
> -					0, 0, src_w, src_h, ctx);
> -	else
> -		ret = __setplane_internal(plane, crtc, fb,
> -					  crtc_x, crtc_y, crtc_w, crtc_h,
> -					  0, 0, src_w, src_h, ctx);
> +	ret = setplane_internal(plane, crtc, fb,
> +				crtc_x, crtc_y, crtc_w, crtc_h,
> +				0, 0, src_w, src_h, ctx);
>  
>  	if (fb)
>  		drm_framebuffer_put(fb);
> -- 
> 2.23.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 7/7] drm/atomic: Reduce setplane locking
@ 2019-11-19 10:47     ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-19 10:47 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Fri, Nov 15, 2019 at 09:42:04PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Currently setplane grabs all modeset locks, which seems a bit
> excessive. Let's reduce that to just the locks we really need
> on atomic drivers. For non-atomic drivers let's stick to the
> current scheme for now.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c | 56 +++++++++++++++++++------------------
>  1 file changed, 29 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index ef0cc33b43ce..e40d8a93294b 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -680,10 +680,14 @@ static int __setplane_internal(struct drm_plane *plane,
>  			       uint32_t src_w, uint32_t src_h,
>  			       struct drm_modeset_acquire_ctx *ctx)
>  {
> -	int ret = 0;
> +	int ret;
>  
>  	WARN_ON(drm_drv_uses_atomic_modeset(plane->dev));
>  
> +	ret = drm_modeset_lock_all_ctx(plane->dev, ctx);
> +	if (ret)
> +		return ret;

There's pre-nv50 nouveau and shmob which have planes and aren't atomic (if
I checked correctly), so we could probably forgo this, but also feels
like totally not worth the audit trouble.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +
>  	/* No fb means shut it down */
>  	if (!fb) {
>  		plane->old_fb = plane->fb;
> @@ -767,32 +771,24 @@ static int setplane_internal(struct drm_plane *plane,
>  			     uint32_t crtc_w, uint32_t crtc_h,
>  			     /* src_{x,y,w,h} values are 16.16 fixed point */
>  			     uint32_t src_x, uint32_t src_y,
> -			     uint32_t src_w, uint32_t src_h)
> +			     uint32_t src_w, uint32_t src_h,
> +			     struct drm_modeset_acquire_ctx *ctx)
>  {
> -	struct drm_modeset_acquire_ctx ctx;
> -	int ret;
> -
> -	DRM_MODESET_LOCK_ALL_BEGIN(plane->dev, ctx,
> -				   DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
> -
>  	if (drm_drv_uses_atomic_modeset(plane->dev))
> -		ret = __setplane_atomic(plane, crtc, fb,
> -					crtc_x, crtc_y, crtc_w, crtc_h,
> -					src_x, src_y, src_w, src_h, &ctx);
> +		return __setplane_atomic(plane, crtc, fb,
> +					 crtc_x, crtc_y, crtc_w, crtc_h,
> +					 src_x, src_y, src_w, src_h, ctx);
>  	else
> -		ret = __setplane_internal(plane, crtc, fb,
> -					  crtc_x, crtc_y, crtc_w, crtc_h,
> -					  src_x, src_y, src_w, src_h, &ctx);
> -
> -	DRM_MODESET_LOCK_ALL_END(ctx, ret);
> -
> -	return ret;
> +		return __setplane_internal(plane, crtc, fb,
> +					   crtc_x, crtc_y, crtc_w, crtc_h,
> +					   src_x, src_y, src_w, src_h, ctx);
>  }
>  
>  int drm_mode_setplane(struct drm_device *dev, void *data,
>  		      struct drm_file *file_priv)
>  {
>  	struct drm_mode_set_plane *plane_req = data;
> +	struct drm_modeset_acquire_ctx ctx;
>  	struct drm_plane *plane;
>  	struct drm_crtc *crtc = NULL;
>  	struct drm_framebuffer *fb = NULL;
> @@ -829,11 +825,22 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
>  		}
>  	}
>  
> +	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
> +
> +retry:
>  	ret = setplane_internal(plane, crtc, fb,
>  				plane_req->crtc_x, plane_req->crtc_y,
>  				plane_req->crtc_w, plane_req->crtc_h,
>  				plane_req->src_x, plane_req->src_y,
> -				plane_req->src_w, plane_req->src_h);
> +				plane_req->src_w, plane_req->src_h, &ctx);
> +	if (ret == -EDEADLK) {
> +		ret = drm_modeset_backoff(&ctx);
> +		if (!ret)
> +			goto retry;
> +	}
> +
> +	drm_modeset_drop_locks(&ctx);
> +	drm_modeset_acquire_fini(&ctx);
>  
>  	if (fb)
>  		drm_framebuffer_put(fb);
> @@ -907,14 +914,9 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
>  		src_h = fb->height << 16;
>  	}
>  
> -	if (drm_drv_uses_atomic_modeset(dev))
> -		ret = __setplane_atomic(plane, crtc, fb,
> -					crtc_x, crtc_y, crtc_w, crtc_h,
> -					0, 0, src_w, src_h, ctx);
> -	else
> -		ret = __setplane_internal(plane, crtc, fb,
> -					  crtc_x, crtc_y, crtc_w, crtc_h,
> -					  0, 0, src_w, src_h, ctx);
> +	ret = setplane_internal(plane, crtc, fb,
> +				crtc_x, crtc_y, crtc_w, crtc_h,
> +				0, 0, src_w, src_h, ctx);
>  
>  	if (fb)
>  		drm_framebuffer_put(fb);
> -- 
> 2.23.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-22 18:35       ` Ville Syrjälä
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjälä @ 2019-11-22 18:35 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx, dri-devel

On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Yank out the code for the plane->fb/old_fb/crtc handling from
> > the page flip path into page_flip_internal(), and provide a
> > simpler variant for atomic drivers.
> > 
> > We'll also move the fb vs. src viewport checks into the new
> > functions as they are slightly different between the two paths.
> > If the atomic .page_flip() implementations are guaranteed
> > to call drm_atomic_plane_check() we could even drop the check
> > entirely from page_flip_atomic(). For now toss in a FIXME.
> > 
> > v2: Bit more polish in page_flip_internal()
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> >  1 file changed, 102 insertions(+), 57 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > index 38878da5b704..6052475a20a5 100644
> > --- a/drivers/gpu/drm/drm_plane.c
> > +++ b/drivers/gpu/drm/drm_plane.c
> > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> >  	return drm_mode_cursor_common(dev, req, file_priv);
> >  }
> >  
> > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > +			       const struct drm_framebuffer *old_fb)
> > +{
> > +	/* The framebuffer is currently unbound, presumably
> > +	 * due to a hotplug event, that userspace has not
> > +	 * yet discovered.
> > +	 */
> > +	if (!old_fb)
> > +		return -EBUSY;
> > +
> > +	if (old_fb->format != fb->format) {
> > +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static int page_flip_internal(struct drm_crtc *crtc,
> > +			      struct drm_framebuffer *fb,
> > +			      struct drm_pending_vblank_event *e,
> > +			      u32 flags,
> > +			      u32 target_vblank,
> > +			      struct drm_modeset_acquire_ctx *ctx)
> > +{
> > +	struct drm_plane *plane = crtc->primary;
> > +	int ret;
> > +
> > +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > +
> > +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > +				      &crtc->mode, fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = page_flip_check_fbs(fb, plane->fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	plane->old_fb = plane->fb;
> > +	if (crtc->funcs->page_flip_target)
> > +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > +						    target_vblank, ctx);
> > +	else
> > +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > +	if (ret) {
> > +		plane->old_fb = NULL;
> > +		return ret;
> > +	}
> > +
> > +	plane->fb = fb;
> > +	drm_framebuffer_get(plane->fb);
> > +
> > +	drm_framebuffer_put(plane->old_fb);
> > +	plane->old_fb = NULL;
> > +
> > +	return 0;
> > +}
> > +
> > +static int page_flip_atomic(struct drm_crtc *crtc,
> > +			    struct drm_framebuffer *fb,
> > +			    struct drm_pending_vblank_event *e,
> > +			    u32 flags,
> > +			    u32 target_vblank,
> > +			    struct drm_modeset_acquire_ctx *ctx)
> > +{
> > +	struct drm_plane *plane = crtc->primary;
> > +	struct drm_plane_state *plane_state = plane->state;
> > +	int ret;
> > +
> > +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > +
> > +	/*
> > +	 * FIXME: Can we assume all drivers end up calling
> > +	 * drm_atomic_plane_check() in their page flip paths?
> > +	 * If so we could remove this.
> > +	 */
> 
> This is definitely wrong, core has to check these. Currently no driver
> checks this at all. I think you're thinking of
> drm_atomic_helper_check_plane_state().

No, I'm thinking of drm_atomic_plane_check(). That one already does the
"does the src rect fit into the fb" check. It gets called from
drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
drivers might take some short circuit path past that for page_flip().

> 
> That aside I'm kinda not getting the point of the shuffling/cleanup in the
> first 4 patches here, so will skip them.

The point was to get that legacy plane->fb/old_fb stuff totally
out from the atomic codepath. Right now it's polluting the
supposedly higher level code shared by both atomic and legacy
drivers.

> -Daniel
> 
> > +	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
> > +					       plane_state->src_y,
> > +					       plane_state->src_w,
> > +					       plane_state->src_h,
> > +					       fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = page_flip_check_fbs(fb, plane_state->fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	if (crtc->funcs->page_flip_target)
> > +		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > +						     target_vblank, ctx);
> > +	else
> > +		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > +}
> > +
> >  int drm_mode_page_flip_ioctl(struct drm_device *dev,
> >  			     void *data, struct drm_file *file_priv)
> >  {
> >  	struct drm_mode_crtc_page_flip_target *page_flip = data;
> >  	struct drm_crtc *crtc;
> >  	struct drm_plane *plane;
> > -	struct drm_framebuffer *fb, *old_fb;
> > +	struct drm_framebuffer *fb;
> >  	struct drm_pending_vblank_event *e = NULL;
> >  	u32 target_vblank = page_flip->sequence;
> >  	struct drm_modeset_acquire_ctx ctx;
> > @@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> >  	if (ret)
> >  		goto out;
> >  
> > -	if (plane->state)
> > -		old_fb = plane->state->fb;
> > +	if (drm_drv_uses_atomic_modeset(dev))
> > +		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
> > +				       target_vblank, &ctx);
> >  	else
> > -		old_fb = plane->fb;
> > -
> > -	if (old_fb == NULL) {
> > -		/* The framebuffer is currently unbound, presumably
> > -		 * due to a hotplug event, that userspace has not
> > -		 * yet discovered.
> > -		 */
> > -		ret = -EBUSY;
> > -		goto out;
> > -	}
> > -
> > -	if (plane->state) {
> > -		const struct drm_plane_state *state = plane->state;
> > -
> > -		ret = drm_framebuffer_check_src_coords(state->src_x,
> > -						       state->src_y,
> > -						       state->src_w,
> > -						       state->src_h,
> > -						       fb);
> > -	} else {
> > -		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > -					      &crtc->mode, fb);
> > -	}
> > -	if (ret)
> > -		goto out;
> > -
> > -	if (old_fb->format != fb->format) {
> > -		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > -		ret = -EINVAL;
> > -		goto out;
> > -	}
> > -
> > -	plane->old_fb = plane->fb;
> > -	if (crtc->funcs->page_flip_target)
> > -		ret = crtc->funcs->page_flip_target(crtc, fb, e,
> > -						    page_flip->flags,
> > -						    target_vblank,
> > -						    &ctx);
> > -	else
> > -		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
> > -					     &ctx);
> > -	if (ret) {
> > -		/* Keep the old fb, don't unref it. */
> > -		plane->old_fb = NULL;
> > -	} else {
> > -		if (!plane->state) {
> > -			plane->fb = fb;
> > -			drm_framebuffer_get(fb);
> > -		}
> > -	}
> > +		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
> > +					 target_vblank, &ctx);
> >  
> >  out:
> > -	if (plane->old_fb)
> > -		drm_framebuffer_put(plane->old_fb);
> > -	plane->old_fb = NULL;
> > -
> >  	if (ret == -EDEADLK) {
> >  		ret = drm_modeset_backoff(&ctx);
> >  		if (!ret)
> > -- 
> > 2.23.0
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-22 18:35       ` Ville Syrjälä
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjälä @ 2019-11-22 18:35 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx, dri-devel

On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Yank out the code for the plane->fb/old_fb/crtc handling from
> > the page flip path into page_flip_internal(), and provide a
> > simpler variant for atomic drivers.
> > 
> > We'll also move the fb vs. src viewport checks into the new
> > functions as they are slightly different between the two paths.
> > If the atomic .page_flip() implementations are guaranteed
> > to call drm_atomic_plane_check() we could even drop the check
> > entirely from page_flip_atomic(). For now toss in a FIXME.
> > 
> > v2: Bit more polish in page_flip_internal()
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> >  1 file changed, 102 insertions(+), 57 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > index 38878da5b704..6052475a20a5 100644
> > --- a/drivers/gpu/drm/drm_plane.c
> > +++ b/drivers/gpu/drm/drm_plane.c
> > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> >  	return drm_mode_cursor_common(dev, req, file_priv);
> >  }
> >  
> > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > +			       const struct drm_framebuffer *old_fb)
> > +{
> > +	/* The framebuffer is currently unbound, presumably
> > +	 * due to a hotplug event, that userspace has not
> > +	 * yet discovered.
> > +	 */
> > +	if (!old_fb)
> > +		return -EBUSY;
> > +
> > +	if (old_fb->format != fb->format) {
> > +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static int page_flip_internal(struct drm_crtc *crtc,
> > +			      struct drm_framebuffer *fb,
> > +			      struct drm_pending_vblank_event *e,
> > +			      u32 flags,
> > +			      u32 target_vblank,
> > +			      struct drm_modeset_acquire_ctx *ctx)
> > +{
> > +	struct drm_plane *plane = crtc->primary;
> > +	int ret;
> > +
> > +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > +
> > +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > +				      &crtc->mode, fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = page_flip_check_fbs(fb, plane->fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	plane->old_fb = plane->fb;
> > +	if (crtc->funcs->page_flip_target)
> > +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > +						    target_vblank, ctx);
> > +	else
> > +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > +	if (ret) {
> > +		plane->old_fb = NULL;
> > +		return ret;
> > +	}
> > +
> > +	plane->fb = fb;
> > +	drm_framebuffer_get(plane->fb);
> > +
> > +	drm_framebuffer_put(plane->old_fb);
> > +	plane->old_fb = NULL;
> > +
> > +	return 0;
> > +}
> > +
> > +static int page_flip_atomic(struct drm_crtc *crtc,
> > +			    struct drm_framebuffer *fb,
> > +			    struct drm_pending_vblank_event *e,
> > +			    u32 flags,
> > +			    u32 target_vblank,
> > +			    struct drm_modeset_acquire_ctx *ctx)
> > +{
> > +	struct drm_plane *plane = crtc->primary;
> > +	struct drm_plane_state *plane_state = plane->state;
> > +	int ret;
> > +
> > +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > +
> > +	/*
> > +	 * FIXME: Can we assume all drivers end up calling
> > +	 * drm_atomic_plane_check() in their page flip paths?
> > +	 * If so we could remove this.
> > +	 */
> 
> This is definitely wrong, core has to check these. Currently no driver
> checks this at all. I think you're thinking of
> drm_atomic_helper_check_plane_state().

No, I'm thinking of drm_atomic_plane_check(). That one already does the
"does the src rect fit into the fb" check. It gets called from
drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
drivers might take some short circuit path past that for page_flip().

> 
> That aside I'm kinda not getting the point of the shuffling/cleanup in the
> first 4 patches here, so will skip them.

The point was to get that legacy plane->fb/old_fb stuff totally
out from the atomic codepath. Right now it's polluting the
supposedly higher level code shared by both atomic and legacy
drivers.

> -Daniel
> 
> > +	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
> > +					       plane_state->src_y,
> > +					       plane_state->src_w,
> > +					       plane_state->src_h,
> > +					       fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = page_flip_check_fbs(fb, plane_state->fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	if (crtc->funcs->page_flip_target)
> > +		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > +						     target_vblank, ctx);
> > +	else
> > +		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > +}
> > +
> >  int drm_mode_page_flip_ioctl(struct drm_device *dev,
> >  			     void *data, struct drm_file *file_priv)
> >  {
> >  	struct drm_mode_crtc_page_flip_target *page_flip = data;
> >  	struct drm_crtc *crtc;
> >  	struct drm_plane *plane;
> > -	struct drm_framebuffer *fb, *old_fb;
> > +	struct drm_framebuffer *fb;
> >  	struct drm_pending_vblank_event *e = NULL;
> >  	u32 target_vblank = page_flip->sequence;
> >  	struct drm_modeset_acquire_ctx ctx;
> > @@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> >  	if (ret)
> >  		goto out;
> >  
> > -	if (plane->state)
> > -		old_fb = plane->state->fb;
> > +	if (drm_drv_uses_atomic_modeset(dev))
> > +		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
> > +				       target_vblank, &ctx);
> >  	else
> > -		old_fb = plane->fb;
> > -
> > -	if (old_fb == NULL) {
> > -		/* The framebuffer is currently unbound, presumably
> > -		 * due to a hotplug event, that userspace has not
> > -		 * yet discovered.
> > -		 */
> > -		ret = -EBUSY;
> > -		goto out;
> > -	}
> > -
> > -	if (plane->state) {
> > -		const struct drm_plane_state *state = plane->state;
> > -
> > -		ret = drm_framebuffer_check_src_coords(state->src_x,
> > -						       state->src_y,
> > -						       state->src_w,
> > -						       state->src_h,
> > -						       fb);
> > -	} else {
> > -		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > -					      &crtc->mode, fb);
> > -	}
> > -	if (ret)
> > -		goto out;
> > -
> > -	if (old_fb->format != fb->format) {
> > -		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > -		ret = -EINVAL;
> > -		goto out;
> > -	}
> > -
> > -	plane->old_fb = plane->fb;
> > -	if (crtc->funcs->page_flip_target)
> > -		ret = crtc->funcs->page_flip_target(crtc, fb, e,
> > -						    page_flip->flags,
> > -						    target_vblank,
> > -						    &ctx);
> > -	else
> > -		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
> > -					     &ctx);
> > -	if (ret) {
> > -		/* Keep the old fb, don't unref it. */
> > -		plane->old_fb = NULL;
> > -	} else {
> > -		if (!plane->state) {
> > -			plane->fb = fb;
> > -			drm_framebuffer_get(fb);
> > -		}
> > -	}
> > +		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
> > +					 target_vblank, &ctx);
> >  
> >  out:
> > -	if (plane->old_fb)
> > -		drm_framebuffer_put(plane->old_fb);
> > -	plane->old_fb = NULL;
> > -
> >  	if (ret == -EDEADLK) {
> >  		ret = drm_modeset_backoff(&ctx);
> >  		if (!ret)
> > -- 
> > 2.23.0
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-22 18:35       ` Ville Syrjälä
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjälä @ 2019-11-22 18:35 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx, dri-devel

On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Yank out the code for the plane->fb/old_fb/crtc handling from
> > the page flip path into page_flip_internal(), and provide a
> > simpler variant for atomic drivers.
> > 
> > We'll also move the fb vs. src viewport checks into the new
> > functions as they are slightly different between the two paths.
> > If the atomic .page_flip() implementations are guaranteed
> > to call drm_atomic_plane_check() we could even drop the check
> > entirely from page_flip_atomic(). For now toss in a FIXME.
> > 
> > v2: Bit more polish in page_flip_internal()
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> >  1 file changed, 102 insertions(+), 57 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > index 38878da5b704..6052475a20a5 100644
> > --- a/drivers/gpu/drm/drm_plane.c
> > +++ b/drivers/gpu/drm/drm_plane.c
> > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> >  	return drm_mode_cursor_common(dev, req, file_priv);
> >  }
> >  
> > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > +			       const struct drm_framebuffer *old_fb)
> > +{
> > +	/* The framebuffer is currently unbound, presumably
> > +	 * due to a hotplug event, that userspace has not
> > +	 * yet discovered.
> > +	 */
> > +	if (!old_fb)
> > +		return -EBUSY;
> > +
> > +	if (old_fb->format != fb->format) {
> > +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static int page_flip_internal(struct drm_crtc *crtc,
> > +			      struct drm_framebuffer *fb,
> > +			      struct drm_pending_vblank_event *e,
> > +			      u32 flags,
> > +			      u32 target_vblank,
> > +			      struct drm_modeset_acquire_ctx *ctx)
> > +{
> > +	struct drm_plane *plane = crtc->primary;
> > +	int ret;
> > +
> > +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > +
> > +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > +				      &crtc->mode, fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = page_flip_check_fbs(fb, plane->fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	plane->old_fb = plane->fb;
> > +	if (crtc->funcs->page_flip_target)
> > +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > +						    target_vblank, ctx);
> > +	else
> > +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > +	if (ret) {
> > +		plane->old_fb = NULL;
> > +		return ret;
> > +	}
> > +
> > +	plane->fb = fb;
> > +	drm_framebuffer_get(plane->fb);
> > +
> > +	drm_framebuffer_put(plane->old_fb);
> > +	plane->old_fb = NULL;
> > +
> > +	return 0;
> > +}
> > +
> > +static int page_flip_atomic(struct drm_crtc *crtc,
> > +			    struct drm_framebuffer *fb,
> > +			    struct drm_pending_vblank_event *e,
> > +			    u32 flags,
> > +			    u32 target_vblank,
> > +			    struct drm_modeset_acquire_ctx *ctx)
> > +{
> > +	struct drm_plane *plane = crtc->primary;
> > +	struct drm_plane_state *plane_state = plane->state;
> > +	int ret;
> > +
> > +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > +
> > +	/*
> > +	 * FIXME: Can we assume all drivers end up calling
> > +	 * drm_atomic_plane_check() in their page flip paths?
> > +	 * If so we could remove this.
> > +	 */
> 
> This is definitely wrong, core has to check these. Currently no driver
> checks this at all. I think you're thinking of
> drm_atomic_helper_check_plane_state().

No, I'm thinking of drm_atomic_plane_check(). That one already does the
"does the src rect fit into the fb" check. It gets called from
drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
drivers might take some short circuit path past that for page_flip().

> 
> That aside I'm kinda not getting the point of the shuffling/cleanup in the
> first 4 patches here, so will skip them.

The point was to get that legacy plane->fb/old_fb stuff totally
out from the atomic codepath. Right now it's polluting the
supposedly higher level code shared by both atomic and legacy
drivers.

> -Daniel
> 
> > +	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
> > +					       plane_state->src_y,
> > +					       plane_state->src_w,
> > +					       plane_state->src_h,
> > +					       fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = page_flip_check_fbs(fb, plane_state->fb);
> > +	if (ret)
> > +		return ret;
> > +
> > +	if (crtc->funcs->page_flip_target)
> > +		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > +						     target_vblank, ctx);
> > +	else
> > +		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > +}
> > +
> >  int drm_mode_page_flip_ioctl(struct drm_device *dev,
> >  			     void *data, struct drm_file *file_priv)
> >  {
> >  	struct drm_mode_crtc_page_flip_target *page_flip = data;
> >  	struct drm_crtc *crtc;
> >  	struct drm_plane *plane;
> > -	struct drm_framebuffer *fb, *old_fb;
> > +	struct drm_framebuffer *fb;
> >  	struct drm_pending_vblank_event *e = NULL;
> >  	u32 target_vblank = page_flip->sequence;
> >  	struct drm_modeset_acquire_ctx ctx;
> > @@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> >  	if (ret)
> >  		goto out;
> >  
> > -	if (plane->state)
> > -		old_fb = plane->state->fb;
> > +	if (drm_drv_uses_atomic_modeset(dev))
> > +		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
> > +				       target_vblank, &ctx);
> >  	else
> > -		old_fb = plane->fb;
> > -
> > -	if (old_fb == NULL) {
> > -		/* The framebuffer is currently unbound, presumably
> > -		 * due to a hotplug event, that userspace has not
> > -		 * yet discovered.
> > -		 */
> > -		ret = -EBUSY;
> > -		goto out;
> > -	}
> > -
> > -	if (plane->state) {
> > -		const struct drm_plane_state *state = plane->state;
> > -
> > -		ret = drm_framebuffer_check_src_coords(state->src_x,
> > -						       state->src_y,
> > -						       state->src_w,
> > -						       state->src_h,
> > -						       fb);
> > -	} else {
> > -		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > -					      &crtc->mode, fb);
> > -	}
> > -	if (ret)
> > -		goto out;
> > -
> > -	if (old_fb->format != fb->format) {
> > -		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > -		ret = -EINVAL;
> > -		goto out;
> > -	}
> > -
> > -	plane->old_fb = plane->fb;
> > -	if (crtc->funcs->page_flip_target)
> > -		ret = crtc->funcs->page_flip_target(crtc, fb, e,
> > -						    page_flip->flags,
> > -						    target_vblank,
> > -						    &ctx);
> > -	else
> > -		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
> > -					     &ctx);
> > -	if (ret) {
> > -		/* Keep the old fb, don't unref it. */
> > -		plane->old_fb = NULL;
> > -	} else {
> > -		if (!plane->state) {
> > -			plane->fb = fb;
> > -			drm_framebuffer_get(fb);
> > -		}
> > -	}
> > +		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
> > +					 target_vblank, &ctx);
> >  
> >  out:
> > -	if (plane->old_fb)
> > -		drm_framebuffer_put(plane->old_fb);
> > -	plane->old_fb = NULL;
> > -
> >  	if (ret == -EDEADLK) {
> >  		ret = drm_modeset_backoff(&ctx);
> >  		if (!ret)
> > -- 
> > 2.23.0
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-25  9:02         ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-25  9:02 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

On Fri, Nov 22, 2019 at 08:35:13PM +0200, Ville Syrjälä wrote:
> On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> > On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > Yank out the code for the plane->fb/old_fb/crtc handling from
> > > the page flip path into page_flip_internal(), and provide a
> > > simpler variant for atomic drivers.
> > > 
> > > We'll also move the fb vs. src viewport checks into the new
> > > functions as they are slightly different between the two paths.
> > > If the atomic .page_flip() implementations are guaranteed
> > > to call drm_atomic_plane_check() we could even drop the check
> > > entirely from page_flip_atomic(). For now toss in a FIXME.
> > > 
> > > v2: Bit more polish in page_flip_internal()
> > > 
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> > >  1 file changed, 102 insertions(+), 57 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > > index 38878da5b704..6052475a20a5 100644
> > > --- a/drivers/gpu/drm/drm_plane.c
> > > +++ b/drivers/gpu/drm/drm_plane.c
> > > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> > >  	return drm_mode_cursor_common(dev, req, file_priv);
> > >  }
> > >  
> > > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > > +			       const struct drm_framebuffer *old_fb)
> > > +{
> > > +	/* The framebuffer is currently unbound, presumably
> > > +	 * due to a hotplug event, that userspace has not
> > > +	 * yet discovered.
> > > +	 */
> > > +	if (!old_fb)
> > > +		return -EBUSY;
> > > +
> > > +	if (old_fb->format != fb->format) {
> > > +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > +		return -EINVAL;
> > > +	}
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static int page_flip_internal(struct drm_crtc *crtc,
> > > +			      struct drm_framebuffer *fb,
> > > +			      struct drm_pending_vblank_event *e,
> > > +			      u32 flags,
> > > +			      u32 target_vblank,
> > > +			      struct drm_modeset_acquire_ctx *ctx)
> > > +{
> > > +	struct drm_plane *plane = crtc->primary;
> > > +	int ret;
> > > +
> > > +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > > +
> > > +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > +				      &crtc->mode, fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	ret = page_flip_check_fbs(fb, plane->fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	plane->old_fb = plane->fb;
> > > +	if (crtc->funcs->page_flip_target)
> > > +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > +						    target_vblank, ctx);
> > > +	else
> > > +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > +	if (ret) {
> > > +		plane->old_fb = NULL;
> > > +		return ret;
> > > +	}
> > > +
> > > +	plane->fb = fb;
> > > +	drm_framebuffer_get(plane->fb);
> > > +
> > > +	drm_framebuffer_put(plane->old_fb);
> > > +	plane->old_fb = NULL;
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static int page_flip_atomic(struct drm_crtc *crtc,
> > > +			    struct drm_framebuffer *fb,
> > > +			    struct drm_pending_vblank_event *e,
> > > +			    u32 flags,
> > > +			    u32 target_vblank,
> > > +			    struct drm_modeset_acquire_ctx *ctx)
> > > +{
> > > +	struct drm_plane *plane = crtc->primary;
> > > +	struct drm_plane_state *plane_state = plane->state;
> > > +	int ret;
> > > +
> > > +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > > +
> > > +	/*
> > > +	 * FIXME: Can we assume all drivers end up calling
> > > +	 * drm_atomic_plane_check() in their page flip paths?
> > > +	 * If so we could remove this.
> > > +	 */
> > 
> > This is definitely wrong, core has to check these. Currently no driver
> > checks this at all. I think you're thinking of
> > drm_atomic_helper_check_plane_state().
> 
> No, I'm thinking of drm_atomic_plane_check(). That one already does the
> "does the src rect fit into the fb" check. It gets called from
> drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
> drivers might take some short circuit path past that for page_flip().

tbh if you're worried about this, I'm tempted to rip out the option for
atomic drivers to overwrite their page_flip implementation, and force the
default function onto everyone (drm_atomic_helper_page_flip_target and
friends would need to be moved to drm_plane.c for that ofc).

We seem to have 0 need for hacks for old userspace in this area, which is
great. So the option to overwrite could only lead to trouble.

> > That aside I'm kinda not getting the point of the shuffling/cleanup in the
> > first 4 patches here, so will skip them.
> 
> The point was to get that legacy plane->fb/old_fb stuff totally
> out from the atomic codepath. Right now it's polluting the
> supposedly higher level code shared by both atomic and legacy
> drivers.

Hm ... I think if you sell it like that, and maybe even go one further and
inline page_flip for all atomic drivers, I can be sold on this. As-is I
just didn't really get why you're reworking all this.
-Daniel

> 
> > -Daniel
> > 
> > > +	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
> > > +					       plane_state->src_y,
> > > +					       plane_state->src_w,
> > > +					       plane_state->src_h,
> > > +					       fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	ret = page_flip_check_fbs(fb, plane_state->fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	if (crtc->funcs->page_flip_target)
> > > +		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > +						     target_vblank, ctx);
> > > +	else
> > > +		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > +}
> > > +
> > >  int drm_mode_page_flip_ioctl(struct drm_device *dev,
> > >  			     void *data, struct drm_file *file_priv)
> > >  {
> > >  	struct drm_mode_crtc_page_flip_target *page_flip = data;
> > >  	struct drm_crtc *crtc;
> > >  	struct drm_plane *plane;
> > > -	struct drm_framebuffer *fb, *old_fb;
> > > +	struct drm_framebuffer *fb;
> > >  	struct drm_pending_vblank_event *e = NULL;
> > >  	u32 target_vblank = page_flip->sequence;
> > >  	struct drm_modeset_acquire_ctx ctx;
> > > @@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> > >  	if (ret)
> > >  		goto out;
> > >  
> > > -	if (plane->state)
> > > -		old_fb = plane->state->fb;
> > > +	if (drm_drv_uses_atomic_modeset(dev))
> > > +		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
> > > +				       target_vblank, &ctx);
> > >  	else
> > > -		old_fb = plane->fb;
> > > -
> > > -	if (old_fb == NULL) {
> > > -		/* The framebuffer is currently unbound, presumably
> > > -		 * due to a hotplug event, that userspace has not
> > > -		 * yet discovered.
> > > -		 */
> > > -		ret = -EBUSY;
> > > -		goto out;
> > > -	}
> > > -
> > > -	if (plane->state) {
> > > -		const struct drm_plane_state *state = plane->state;
> > > -
> > > -		ret = drm_framebuffer_check_src_coords(state->src_x,
> > > -						       state->src_y,
> > > -						       state->src_w,
> > > -						       state->src_h,
> > > -						       fb);
> > > -	} else {
> > > -		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > -					      &crtc->mode, fb);
> > > -	}
> > > -	if (ret)
> > > -		goto out;
> > > -
> > > -	if (old_fb->format != fb->format) {
> > > -		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > -		ret = -EINVAL;
> > > -		goto out;
> > > -	}
> > > -
> > > -	plane->old_fb = plane->fb;
> > > -	if (crtc->funcs->page_flip_target)
> > > -		ret = crtc->funcs->page_flip_target(crtc, fb, e,
> > > -						    page_flip->flags,
> > > -						    target_vblank,
> > > -						    &ctx);
> > > -	else
> > > -		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
> > > -					     &ctx);
> > > -	if (ret) {
> > > -		/* Keep the old fb, don't unref it. */
> > > -		plane->old_fb = NULL;
> > > -	} else {
> > > -		if (!plane->state) {
> > > -			plane->fb = fb;
> > > -			drm_framebuffer_get(fb);
> > > -		}
> > > -	}
> > > +		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
> > > +					 target_vblank, &ctx);
> > >  
> > >  out:
> > > -	if (plane->old_fb)
> > > -		drm_framebuffer_put(plane->old_fb);
> > > -	plane->old_fb = NULL;
> > > -
> > >  	if (ret == -EDEADLK) {
> > >  		ret = drm_modeset_backoff(&ctx);
> > >  		if (!ret)
> > > -- 
> > > 2.23.0
> > > 
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> 
> -- 
> Ville Syrjälä
> Intel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-25  9:02         ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-25  9:02 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

On Fri, Nov 22, 2019 at 08:35:13PM +0200, Ville Syrjälä wrote:
> On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> > On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > Yank out the code for the plane->fb/old_fb/crtc handling from
> > > the page flip path into page_flip_internal(), and provide a
> > > simpler variant for atomic drivers.
> > > 
> > > We'll also move the fb vs. src viewport checks into the new
> > > functions as they are slightly different between the two paths.
> > > If the atomic .page_flip() implementations are guaranteed
> > > to call drm_atomic_plane_check() we could even drop the check
> > > entirely from page_flip_atomic(). For now toss in a FIXME.
> > > 
> > > v2: Bit more polish in page_flip_internal()
> > > 
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> > >  1 file changed, 102 insertions(+), 57 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > > index 38878da5b704..6052475a20a5 100644
> > > --- a/drivers/gpu/drm/drm_plane.c
> > > +++ b/drivers/gpu/drm/drm_plane.c
> > > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> > >  	return drm_mode_cursor_common(dev, req, file_priv);
> > >  }
> > >  
> > > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > > +			       const struct drm_framebuffer *old_fb)
> > > +{
> > > +	/* The framebuffer is currently unbound, presumably
> > > +	 * due to a hotplug event, that userspace has not
> > > +	 * yet discovered.
> > > +	 */
> > > +	if (!old_fb)
> > > +		return -EBUSY;
> > > +
> > > +	if (old_fb->format != fb->format) {
> > > +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > +		return -EINVAL;
> > > +	}
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static int page_flip_internal(struct drm_crtc *crtc,
> > > +			      struct drm_framebuffer *fb,
> > > +			      struct drm_pending_vblank_event *e,
> > > +			      u32 flags,
> > > +			      u32 target_vblank,
> > > +			      struct drm_modeset_acquire_ctx *ctx)
> > > +{
> > > +	struct drm_plane *plane = crtc->primary;
> > > +	int ret;
> > > +
> > > +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > > +
> > > +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > +				      &crtc->mode, fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	ret = page_flip_check_fbs(fb, plane->fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	plane->old_fb = plane->fb;
> > > +	if (crtc->funcs->page_flip_target)
> > > +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > +						    target_vblank, ctx);
> > > +	else
> > > +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > +	if (ret) {
> > > +		plane->old_fb = NULL;
> > > +		return ret;
> > > +	}
> > > +
> > > +	plane->fb = fb;
> > > +	drm_framebuffer_get(plane->fb);
> > > +
> > > +	drm_framebuffer_put(plane->old_fb);
> > > +	plane->old_fb = NULL;
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static int page_flip_atomic(struct drm_crtc *crtc,
> > > +			    struct drm_framebuffer *fb,
> > > +			    struct drm_pending_vblank_event *e,
> > > +			    u32 flags,
> > > +			    u32 target_vblank,
> > > +			    struct drm_modeset_acquire_ctx *ctx)
> > > +{
> > > +	struct drm_plane *plane = crtc->primary;
> > > +	struct drm_plane_state *plane_state = plane->state;
> > > +	int ret;
> > > +
> > > +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > > +
> > > +	/*
> > > +	 * FIXME: Can we assume all drivers end up calling
> > > +	 * drm_atomic_plane_check() in their page flip paths?
> > > +	 * If so we could remove this.
> > > +	 */
> > 
> > This is definitely wrong, core has to check these. Currently no driver
> > checks this at all. I think you're thinking of
> > drm_atomic_helper_check_plane_state().
> 
> No, I'm thinking of drm_atomic_plane_check(). That one already does the
> "does the src rect fit into the fb" check. It gets called from
> drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
> drivers might take some short circuit path past that for page_flip().

tbh if you're worried about this, I'm tempted to rip out the option for
atomic drivers to overwrite their page_flip implementation, and force the
default function onto everyone (drm_atomic_helper_page_flip_target and
friends would need to be moved to drm_plane.c for that ofc).

We seem to have 0 need for hacks for old userspace in this area, which is
great. So the option to overwrite could only lead to trouble.

> > That aside I'm kinda not getting the point of the shuffling/cleanup in the
> > first 4 patches here, so will skip them.
> 
> The point was to get that legacy plane->fb/old_fb stuff totally
> out from the atomic codepath. Right now it's polluting the
> supposedly higher level code shared by both atomic and legacy
> drivers.

Hm ... I think if you sell it like that, and maybe even go one further and
inline page_flip for all atomic drivers, I can be sold on this. As-is I
just didn't really get why you're reworking all this.
-Daniel

> 
> > -Daniel
> > 
> > > +	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
> > > +					       plane_state->src_y,
> > > +					       plane_state->src_w,
> > > +					       plane_state->src_h,
> > > +					       fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	ret = page_flip_check_fbs(fb, plane_state->fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	if (crtc->funcs->page_flip_target)
> > > +		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > +						     target_vblank, ctx);
> > > +	else
> > > +		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > +}
> > > +
> > >  int drm_mode_page_flip_ioctl(struct drm_device *dev,
> > >  			     void *data, struct drm_file *file_priv)
> > >  {
> > >  	struct drm_mode_crtc_page_flip_target *page_flip = data;
> > >  	struct drm_crtc *crtc;
> > >  	struct drm_plane *plane;
> > > -	struct drm_framebuffer *fb, *old_fb;
> > > +	struct drm_framebuffer *fb;
> > >  	struct drm_pending_vblank_event *e = NULL;
> > >  	u32 target_vblank = page_flip->sequence;
> > >  	struct drm_modeset_acquire_ctx ctx;
> > > @@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> > >  	if (ret)
> > >  		goto out;
> > >  
> > > -	if (plane->state)
> > > -		old_fb = plane->state->fb;
> > > +	if (drm_drv_uses_atomic_modeset(dev))
> > > +		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
> > > +				       target_vblank, &ctx);
> > >  	else
> > > -		old_fb = plane->fb;
> > > -
> > > -	if (old_fb == NULL) {
> > > -		/* The framebuffer is currently unbound, presumably
> > > -		 * due to a hotplug event, that userspace has not
> > > -		 * yet discovered.
> > > -		 */
> > > -		ret = -EBUSY;
> > > -		goto out;
> > > -	}
> > > -
> > > -	if (plane->state) {
> > > -		const struct drm_plane_state *state = plane->state;
> > > -
> > > -		ret = drm_framebuffer_check_src_coords(state->src_x,
> > > -						       state->src_y,
> > > -						       state->src_w,
> > > -						       state->src_h,
> > > -						       fb);
> > > -	} else {
> > > -		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > -					      &crtc->mode, fb);
> > > -	}
> > > -	if (ret)
> > > -		goto out;
> > > -
> > > -	if (old_fb->format != fb->format) {
> > > -		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > -		ret = -EINVAL;
> > > -		goto out;
> > > -	}
> > > -
> > > -	plane->old_fb = plane->fb;
> > > -	if (crtc->funcs->page_flip_target)
> > > -		ret = crtc->funcs->page_flip_target(crtc, fb, e,
> > > -						    page_flip->flags,
> > > -						    target_vblank,
> > > -						    &ctx);
> > > -	else
> > > -		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
> > > -					     &ctx);
> > > -	if (ret) {
> > > -		/* Keep the old fb, don't unref it. */
> > > -		plane->old_fb = NULL;
> > > -	} else {
> > > -		if (!plane->state) {
> > > -			plane->fb = fb;
> > > -			drm_framebuffer_get(fb);
> > > -		}
> > > -	}
> > > +		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
> > > +					 target_vblank, &ctx);
> > >  
> > >  out:
> > > -	if (plane->old_fb)
> > > -		drm_framebuffer_put(plane->old_fb);
> > > -	plane->old_fb = NULL;
> > > -
> > >  	if (ret == -EDEADLK) {
> > >  		ret = drm_modeset_backoff(&ctx);
> > >  		if (!ret)
> > > -- 
> > > 2.23.0
> > > 
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> 
> -- 
> Ville Syrjälä
> Intel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-25  9:02         ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-25  9:02 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

On Fri, Nov 22, 2019 at 08:35:13PM +0200, Ville Syrjälä wrote:
> On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> > On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > Yank out the code for the plane->fb/old_fb/crtc handling from
> > > the page flip path into page_flip_internal(), and provide a
> > > simpler variant for atomic drivers.
> > > 
> > > We'll also move the fb vs. src viewport checks into the new
> > > functions as they are slightly different between the two paths.
> > > If the atomic .page_flip() implementations are guaranteed
> > > to call drm_atomic_plane_check() we could even drop the check
> > > entirely from page_flip_atomic(). For now toss in a FIXME.
> > > 
> > > v2: Bit more polish in page_flip_internal()
> > > 
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> > >  1 file changed, 102 insertions(+), 57 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > > index 38878da5b704..6052475a20a5 100644
> > > --- a/drivers/gpu/drm/drm_plane.c
> > > +++ b/drivers/gpu/drm/drm_plane.c
> > > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> > >  	return drm_mode_cursor_common(dev, req, file_priv);
> > >  }
> > >  
> > > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > > +			       const struct drm_framebuffer *old_fb)
> > > +{
> > > +	/* The framebuffer is currently unbound, presumably
> > > +	 * due to a hotplug event, that userspace has not
> > > +	 * yet discovered.
> > > +	 */
> > > +	if (!old_fb)
> > > +		return -EBUSY;
> > > +
> > > +	if (old_fb->format != fb->format) {
> > > +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > +		return -EINVAL;
> > > +	}
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static int page_flip_internal(struct drm_crtc *crtc,
> > > +			      struct drm_framebuffer *fb,
> > > +			      struct drm_pending_vblank_event *e,
> > > +			      u32 flags,
> > > +			      u32 target_vblank,
> > > +			      struct drm_modeset_acquire_ctx *ctx)
> > > +{
> > > +	struct drm_plane *plane = crtc->primary;
> > > +	int ret;
> > > +
> > > +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > > +
> > > +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > +				      &crtc->mode, fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	ret = page_flip_check_fbs(fb, plane->fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	plane->old_fb = plane->fb;
> > > +	if (crtc->funcs->page_flip_target)
> > > +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > +						    target_vblank, ctx);
> > > +	else
> > > +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > +	if (ret) {
> > > +		plane->old_fb = NULL;
> > > +		return ret;
> > > +	}
> > > +
> > > +	plane->fb = fb;
> > > +	drm_framebuffer_get(plane->fb);
> > > +
> > > +	drm_framebuffer_put(plane->old_fb);
> > > +	plane->old_fb = NULL;
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static int page_flip_atomic(struct drm_crtc *crtc,
> > > +			    struct drm_framebuffer *fb,
> > > +			    struct drm_pending_vblank_event *e,
> > > +			    u32 flags,
> > > +			    u32 target_vblank,
> > > +			    struct drm_modeset_acquire_ctx *ctx)
> > > +{
> > > +	struct drm_plane *plane = crtc->primary;
> > > +	struct drm_plane_state *plane_state = plane->state;
> > > +	int ret;
> > > +
> > > +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > > +
> > > +	/*
> > > +	 * FIXME: Can we assume all drivers end up calling
> > > +	 * drm_atomic_plane_check() in their page flip paths?
> > > +	 * If so we could remove this.
> > > +	 */
> > 
> > This is definitely wrong, core has to check these. Currently no driver
> > checks this at all. I think you're thinking of
> > drm_atomic_helper_check_plane_state().
> 
> No, I'm thinking of drm_atomic_plane_check(). That one already does the
> "does the src rect fit into the fb" check. It gets called from
> drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
> drivers might take some short circuit path past that for page_flip().

tbh if you're worried about this, I'm tempted to rip out the option for
atomic drivers to overwrite their page_flip implementation, and force the
default function onto everyone (drm_atomic_helper_page_flip_target and
friends would need to be moved to drm_plane.c for that ofc).

We seem to have 0 need for hacks for old userspace in this area, which is
great. So the option to overwrite could only lead to trouble.

> > That aside I'm kinda not getting the point of the shuffling/cleanup in the
> > first 4 patches here, so will skip them.
> 
> The point was to get that legacy plane->fb/old_fb stuff totally
> out from the atomic codepath. Right now it's polluting the
> supposedly higher level code shared by both atomic and legacy
> drivers.

Hm ... I think if you sell it like that, and maybe even go one further and
inline page_flip for all atomic drivers, I can be sold on this. As-is I
just didn't really get why you're reworking all this.
-Daniel

> 
> > -Daniel
> > 
> > > +	ret = drm_framebuffer_check_src_coords(plane_state->src_x,
> > > +					       plane_state->src_y,
> > > +					       plane_state->src_w,
> > > +					       plane_state->src_h,
> > > +					       fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	ret = page_flip_check_fbs(fb, plane_state->fb);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	if (crtc->funcs->page_flip_target)
> > > +		return crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > +						     target_vblank, ctx);
> > > +	else
> > > +		return crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > +}
> > > +
> > >  int drm_mode_page_flip_ioctl(struct drm_device *dev,
> > >  			     void *data, struct drm_file *file_priv)
> > >  {
> > >  	struct drm_mode_crtc_page_flip_target *page_flip = data;
> > >  	struct drm_crtc *crtc;
> > >  	struct drm_plane *plane;
> > > -	struct drm_framebuffer *fb, *old_fb;
> > > +	struct drm_framebuffer *fb;
> > >  	struct drm_pending_vblank_event *e = NULL;
> > >  	u32 target_vblank = page_flip->sequence;
> > >  	struct drm_modeset_acquire_ctx ctx;
> > > @@ -1145,65 +1241,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> > >  	if (ret)
> > >  		goto out;
> > >  
> > > -	if (plane->state)
> > > -		old_fb = plane->state->fb;
> > > +	if (drm_drv_uses_atomic_modeset(dev))
> > > +		ret = page_flip_atomic(crtc, fb, e, page_flip->flags,
> > > +				       target_vblank, &ctx);
> > >  	else
> > > -		old_fb = plane->fb;
> > > -
> > > -	if (old_fb == NULL) {
> > > -		/* The framebuffer is currently unbound, presumably
> > > -		 * due to a hotplug event, that userspace has not
> > > -		 * yet discovered.
> > > -		 */
> > > -		ret = -EBUSY;
> > > -		goto out;
> > > -	}
> > > -
> > > -	if (plane->state) {
> > > -		const struct drm_plane_state *state = plane->state;
> > > -
> > > -		ret = drm_framebuffer_check_src_coords(state->src_x,
> > > -						       state->src_y,
> > > -						       state->src_w,
> > > -						       state->src_h,
> > > -						       fb);
> > > -	} else {
> > > -		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > -					      &crtc->mode, fb);
> > > -	}
> > > -	if (ret)
> > > -		goto out;
> > > -
> > > -	if (old_fb->format != fb->format) {
> > > -		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > -		ret = -EINVAL;
> > > -		goto out;
> > > -	}
> > > -
> > > -	plane->old_fb = plane->fb;
> > > -	if (crtc->funcs->page_flip_target)
> > > -		ret = crtc->funcs->page_flip_target(crtc, fb, e,
> > > -						    page_flip->flags,
> > > -						    target_vblank,
> > > -						    &ctx);
> > > -	else
> > > -		ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags,
> > > -					     &ctx);
> > > -	if (ret) {
> > > -		/* Keep the old fb, don't unref it. */
> > > -		plane->old_fb = NULL;
> > > -	} else {
> > > -		if (!plane->state) {
> > > -			plane->fb = fb;
> > > -			drm_framebuffer_get(fb);
> > > -		}
> > > -	}
> > > +		ret = page_flip_internal(crtc, fb, e, page_flip->flags,
> > > +					 target_vblank, &ctx);
> > >  
> > >  out:
> > > -	if (plane->old_fb)
> > > -		drm_framebuffer_put(plane->old_fb);
> > > -	plane->old_fb = NULL;
> > > -
> > >  	if (ret == -EDEADLK) {
> > >  		ret = drm_modeset_backoff(&ctx);
> > >  		if (!ret)
> > > -- 
> > > 2.23.0
> > > 
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> 
> -- 
> Ville Syrjälä
> Intel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-25 15:05           ` Ville Syrjälä
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjälä @ 2019-11-25 15:05 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx, dri-devel

On Mon, Nov 25, 2019 at 10:02:38AM +0100, Daniel Vetter wrote:
> On Fri, Nov 22, 2019 at 08:35:13PM +0200, Ville Syrjälä wrote:
> > On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> > > On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > 
> > > > Yank out the code for the plane->fb/old_fb/crtc handling from
> > > > the page flip path into page_flip_internal(), and provide a
> > > > simpler variant for atomic drivers.
> > > > 
> > > > We'll also move the fb vs. src viewport checks into the new
> > > > functions as they are slightly different between the two paths.
> > > > If the atomic .page_flip() implementations are guaranteed
> > > > to call drm_atomic_plane_check() we could even drop the check
> > > > entirely from page_flip_atomic(). For now toss in a FIXME.
> > > > 
> > > > v2: Bit more polish in page_flip_internal()
> > > > 
> > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > ---
> > > >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> > > >  1 file changed, 102 insertions(+), 57 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > > > index 38878da5b704..6052475a20a5 100644
> > > > --- a/drivers/gpu/drm/drm_plane.c
> > > > +++ b/drivers/gpu/drm/drm_plane.c
> > > > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> > > >  	return drm_mode_cursor_common(dev, req, file_priv);
> > > >  }
> > > >  
> > > > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > > > +			       const struct drm_framebuffer *old_fb)
> > > > +{
> > > > +	/* The framebuffer is currently unbound, presumably
> > > > +	 * due to a hotplug event, that userspace has not
> > > > +	 * yet discovered.
> > > > +	 */
> > > > +	if (!old_fb)
> > > > +		return -EBUSY;
> > > > +
> > > > +	if (old_fb->format != fb->format) {
> > > > +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > > +		return -EINVAL;
> > > > +	}
> > > > +
> > > > +	return 0;
> > > > +}
> > > > +
> > > > +static int page_flip_internal(struct drm_crtc *crtc,
> > > > +			      struct drm_framebuffer *fb,
> > > > +			      struct drm_pending_vblank_event *e,
> > > > +			      u32 flags,
> > > > +			      u32 target_vblank,
> > > > +			      struct drm_modeset_acquire_ctx *ctx)
> > > > +{
> > > > +	struct drm_plane *plane = crtc->primary;
> > > > +	int ret;
> > > > +
> > > > +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > > > +
> > > > +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > > +				      &crtc->mode, fb);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	ret = page_flip_check_fbs(fb, plane->fb);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	plane->old_fb = plane->fb;
> > > > +	if (crtc->funcs->page_flip_target)
> > > > +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > > +						    target_vblank, ctx);
> > > > +	else
> > > > +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > > +	if (ret) {
> > > > +		plane->old_fb = NULL;
> > > > +		return ret;
> > > > +	}
> > > > +
> > > > +	plane->fb = fb;
> > > > +	drm_framebuffer_get(plane->fb);
> > > > +
> > > > +	drm_framebuffer_put(plane->old_fb);
> > > > +	plane->old_fb = NULL;
> > > > +
> > > > +	return 0;
> > > > +}
> > > > +
> > > > +static int page_flip_atomic(struct drm_crtc *crtc,
> > > > +			    struct drm_framebuffer *fb,
> > > > +			    struct drm_pending_vblank_event *e,
> > > > +			    u32 flags,
> > > > +			    u32 target_vblank,
> > > > +			    struct drm_modeset_acquire_ctx *ctx)
> > > > +{
> > > > +	struct drm_plane *plane = crtc->primary;
> > > > +	struct drm_plane_state *plane_state = plane->state;
> > > > +	int ret;
> > > > +
> > > > +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > > > +
> > > > +	/*
> > > > +	 * FIXME: Can we assume all drivers end up calling
> > > > +	 * drm_atomic_plane_check() in their page flip paths?
> > > > +	 * If so we could remove this.
> > > > +	 */
> > > 
> > > This is definitely wrong, core has to check these. Currently no driver
> > > checks this at all. I think you're thinking of
> > > drm_atomic_helper_check_plane_state().
> > 
> > No, I'm thinking of drm_atomic_plane_check(). That one already does the
> > "does the src rect fit into the fb" check. It gets called from
> > drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
> > drivers might take some short circuit path past that for page_flip().
> 
> tbh if you're worried about this, I'm tempted to rip out the option for
> atomic drivers to overwrite their page_flip implementation, and force the
> default function onto everyone (drm_atomic_helper_page_flip_target and
> friends would need to be moved to drm_plane.c for that ofc).
> 
> We seem to have 0 need for hacks for old userspace in this area, which is
> great. So the option to overwrite could only lead to trouble.
> 
> > > That aside I'm kinda not getting the point of the shuffling/cleanup in the
> > > first 4 patches here, so will skip them.
> > 
> > The point was to get that legacy plane->fb/old_fb stuff totally
> > out from the atomic codepath. Right now it's polluting the
> > supposedly higher level code shared by both atomic and legacy
> > drivers.
> 
> Hm ... I think if you sell it like that, and maybe even go one further and
> inline page_flip for all atomic drivers, I can be sold on this. As-is I
> just didn't really get why you're reworking all this.

Hmm. Inlining doesn't look like 100% trivial code shufling due to
.page_flip_target. We'd need some other mechanism for the driver to
indicate support for that.

OTOH I'm not sure we even support that stuff on any atomic driver.
We have the helper but no one actually uses it. And as ususal I'm
totally unusre what amdgpu is doing since I keep forgetting which
parts of it are atomic and which are not.

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-25 15:05           ` Ville Syrjälä
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjälä @ 2019-11-25 15:05 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx, dri-devel

On Mon, Nov 25, 2019 at 10:02:38AM +0100, Daniel Vetter wrote:
> On Fri, Nov 22, 2019 at 08:35:13PM +0200, Ville Syrjälä wrote:
> > On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> > > On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > 
> > > > Yank out the code for the plane->fb/old_fb/crtc handling from
> > > > the page flip path into page_flip_internal(), and provide a
> > > > simpler variant for atomic drivers.
> > > > 
> > > > We'll also move the fb vs. src viewport checks into the new
> > > > functions as they are slightly different between the two paths.
> > > > If the atomic .page_flip() implementations are guaranteed
> > > > to call drm_atomic_plane_check() we could even drop the check
> > > > entirely from page_flip_atomic(). For now toss in a FIXME.
> > > > 
> > > > v2: Bit more polish in page_flip_internal()
> > > > 
> > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > ---
> > > >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> > > >  1 file changed, 102 insertions(+), 57 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > > > index 38878da5b704..6052475a20a5 100644
> > > > --- a/drivers/gpu/drm/drm_plane.c
> > > > +++ b/drivers/gpu/drm/drm_plane.c
> > > > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> > > >  	return drm_mode_cursor_common(dev, req, file_priv);
> > > >  }
> > > >  
> > > > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > > > +			       const struct drm_framebuffer *old_fb)
> > > > +{
> > > > +	/* The framebuffer is currently unbound, presumably
> > > > +	 * due to a hotplug event, that userspace has not
> > > > +	 * yet discovered.
> > > > +	 */
> > > > +	if (!old_fb)
> > > > +		return -EBUSY;
> > > > +
> > > > +	if (old_fb->format != fb->format) {
> > > > +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > > +		return -EINVAL;
> > > > +	}
> > > > +
> > > > +	return 0;
> > > > +}
> > > > +
> > > > +static int page_flip_internal(struct drm_crtc *crtc,
> > > > +			      struct drm_framebuffer *fb,
> > > > +			      struct drm_pending_vblank_event *e,
> > > > +			      u32 flags,
> > > > +			      u32 target_vblank,
> > > > +			      struct drm_modeset_acquire_ctx *ctx)
> > > > +{
> > > > +	struct drm_plane *plane = crtc->primary;
> > > > +	int ret;
> > > > +
> > > > +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > > > +
> > > > +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > > +				      &crtc->mode, fb);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	ret = page_flip_check_fbs(fb, plane->fb);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	plane->old_fb = plane->fb;
> > > > +	if (crtc->funcs->page_flip_target)
> > > > +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > > +						    target_vblank, ctx);
> > > > +	else
> > > > +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > > +	if (ret) {
> > > > +		plane->old_fb = NULL;
> > > > +		return ret;
> > > > +	}
> > > > +
> > > > +	plane->fb = fb;
> > > > +	drm_framebuffer_get(plane->fb);
> > > > +
> > > > +	drm_framebuffer_put(plane->old_fb);
> > > > +	plane->old_fb = NULL;
> > > > +
> > > > +	return 0;
> > > > +}
> > > > +
> > > > +static int page_flip_atomic(struct drm_crtc *crtc,
> > > > +			    struct drm_framebuffer *fb,
> > > > +			    struct drm_pending_vblank_event *e,
> > > > +			    u32 flags,
> > > > +			    u32 target_vblank,
> > > > +			    struct drm_modeset_acquire_ctx *ctx)
> > > > +{
> > > > +	struct drm_plane *plane = crtc->primary;
> > > > +	struct drm_plane_state *plane_state = plane->state;
> > > > +	int ret;
> > > > +
> > > > +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > > > +
> > > > +	/*
> > > > +	 * FIXME: Can we assume all drivers end up calling
> > > > +	 * drm_atomic_plane_check() in their page flip paths?
> > > > +	 * If so we could remove this.
> > > > +	 */
> > > 
> > > This is definitely wrong, core has to check these. Currently no driver
> > > checks this at all. I think you're thinking of
> > > drm_atomic_helper_check_plane_state().
> > 
> > No, I'm thinking of drm_atomic_plane_check(). That one already does the
> > "does the src rect fit into the fb" check. It gets called from
> > drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
> > drivers might take some short circuit path past that for page_flip().
> 
> tbh if you're worried about this, I'm tempted to rip out the option for
> atomic drivers to overwrite their page_flip implementation, and force the
> default function onto everyone (drm_atomic_helper_page_flip_target and
> friends would need to be moved to drm_plane.c for that ofc).
> 
> We seem to have 0 need for hacks for old userspace in this area, which is
> great. So the option to overwrite could only lead to trouble.
> 
> > > That aside I'm kinda not getting the point of the shuffling/cleanup in the
> > > first 4 patches here, so will skip them.
> > 
> > The point was to get that legacy plane->fb/old_fb stuff totally
> > out from the atomic codepath. Right now it's polluting the
> > supposedly higher level code shared by both atomic and legacy
> > drivers.
> 
> Hm ... I think if you sell it like that, and maybe even go one further and
> inline page_flip for all atomic drivers, I can be sold on this. As-is I
> just didn't really get why you're reworking all this.

Hmm. Inlining doesn't look like 100% trivial code shufling due to
.page_flip_target. We'd need some other mechanism for the driver to
indicate support for that.

OTOH I'm not sure we even support that stuff on any atomic driver.
We have the helper but no one actually uses it. And as ususal I'm
totally unusre what amdgpu is doing since I keep forgetting which
parts of it are atomic and which are not.

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-25 15:05           ` Ville Syrjälä
  0 siblings, 0 replies; 51+ messages in thread
From: Ville Syrjälä @ 2019-11-25 15:05 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx, dri-devel

On Mon, Nov 25, 2019 at 10:02:38AM +0100, Daniel Vetter wrote:
> On Fri, Nov 22, 2019 at 08:35:13PM +0200, Ville Syrjälä wrote:
> > On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> > > On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > 
> > > > Yank out the code for the plane->fb/old_fb/crtc handling from
> > > > the page flip path into page_flip_internal(), and provide a
> > > > simpler variant for atomic drivers.
> > > > 
> > > > We'll also move the fb vs. src viewport checks into the new
> > > > functions as they are slightly different between the two paths.
> > > > If the atomic .page_flip() implementations are guaranteed
> > > > to call drm_atomic_plane_check() we could even drop the check
> > > > entirely from page_flip_atomic(). For now toss in a FIXME.
> > > > 
> > > > v2: Bit more polish in page_flip_internal()
> > > > 
> > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > ---
> > > >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> > > >  1 file changed, 102 insertions(+), 57 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > > > index 38878da5b704..6052475a20a5 100644
> > > > --- a/drivers/gpu/drm/drm_plane.c
> > > > +++ b/drivers/gpu/drm/drm_plane.c
> > > > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> > > >  	return drm_mode_cursor_common(dev, req, file_priv);
> > > >  }
> > > >  
> > > > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > > > +			       const struct drm_framebuffer *old_fb)
> > > > +{
> > > > +	/* The framebuffer is currently unbound, presumably
> > > > +	 * due to a hotplug event, that userspace has not
> > > > +	 * yet discovered.
> > > > +	 */
> > > > +	if (!old_fb)
> > > > +		return -EBUSY;
> > > > +
> > > > +	if (old_fb->format != fb->format) {
> > > > +		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > > +		return -EINVAL;
> > > > +	}
> > > > +
> > > > +	return 0;
> > > > +}
> > > > +
> > > > +static int page_flip_internal(struct drm_crtc *crtc,
> > > > +			      struct drm_framebuffer *fb,
> > > > +			      struct drm_pending_vblank_event *e,
> > > > +			      u32 flags,
> > > > +			      u32 target_vblank,
> > > > +			      struct drm_modeset_acquire_ctx *ctx)
> > > > +{
> > > > +	struct drm_plane *plane = crtc->primary;
> > > > +	int ret;
> > > > +
> > > > +	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > > > +
> > > > +	ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > > +				      &crtc->mode, fb);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	ret = page_flip_check_fbs(fb, plane->fb);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	plane->old_fb = plane->fb;
> > > > +	if (crtc->funcs->page_flip_target)
> > > > +		ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > > +						    target_vblank, ctx);
> > > > +	else
> > > > +		ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > > +	if (ret) {
> > > > +		plane->old_fb = NULL;
> > > > +		return ret;
> > > > +	}
> > > > +
> > > > +	plane->fb = fb;
> > > > +	drm_framebuffer_get(plane->fb);
> > > > +
> > > > +	drm_framebuffer_put(plane->old_fb);
> > > > +	plane->old_fb = NULL;
> > > > +
> > > > +	return 0;
> > > > +}
> > > > +
> > > > +static int page_flip_atomic(struct drm_crtc *crtc,
> > > > +			    struct drm_framebuffer *fb,
> > > > +			    struct drm_pending_vblank_event *e,
> > > > +			    u32 flags,
> > > > +			    u32 target_vblank,
> > > > +			    struct drm_modeset_acquire_ctx *ctx)
> > > > +{
> > > > +	struct drm_plane *plane = crtc->primary;
> > > > +	struct drm_plane_state *plane_state = plane->state;
> > > > +	int ret;
> > > > +
> > > > +	WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > > > +
> > > > +	/*
> > > > +	 * FIXME: Can we assume all drivers end up calling
> > > > +	 * drm_atomic_plane_check() in their page flip paths?
> > > > +	 * If so we could remove this.
> > > > +	 */
> > > 
> > > This is definitely wrong, core has to check these. Currently no driver
> > > checks this at all. I think you're thinking of
> > > drm_atomic_helper_check_plane_state().
> > 
> > No, I'm thinking of drm_atomic_plane_check(). That one already does the
> > "does the src rect fit into the fb" check. It gets called from
> > drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
> > drivers might take some short circuit path past that for page_flip().
> 
> tbh if you're worried about this, I'm tempted to rip out the option for
> atomic drivers to overwrite their page_flip implementation, and force the
> default function onto everyone (drm_atomic_helper_page_flip_target and
> friends would need to be moved to drm_plane.c for that ofc).
> 
> We seem to have 0 need for hacks for old userspace in this area, which is
> great. So the option to overwrite could only lead to trouble.
> 
> > > That aside I'm kinda not getting the point of the shuffling/cleanup in the
> > > first 4 patches here, so will skip them.
> > 
> > The point was to get that legacy plane->fb/old_fb stuff totally
> > out from the atomic codepath. Right now it's polluting the
> > supposedly higher level code shared by both atomic and legacy
> > drivers.
> 
> Hm ... I think if you sell it like that, and maybe even go one further and
> inline page_flip for all atomic drivers, I can be sold on this. As-is I
> just didn't really get why you're reworking all this.

Hmm. Inlining doesn't look like 100% trivial code shufling due to
.page_flip_target. We'd need some other mechanism for the driver to
indicate support for that.

OTOH I'm not sure we even support that stuff on any atomic driver.
We have the helper but no one actually uses it. And as ususal I'm
totally unusre what amdgpu is doing since I keep forgetting which
parts of it are atomic and which are not.

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-25 17:24             ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-25 17:24 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

On Mon, Nov 25, 2019 at 4:05 PM Ville Syrjälä
<ville.syrjala@linux.intel.com> wrote:
>
> On Mon, Nov 25, 2019 at 10:02:38AM +0100, Daniel Vetter wrote:
> > On Fri, Nov 22, 2019 at 08:35:13PM +0200, Ville Syrjälä wrote:
> > > On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> > > > On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > >
> > > > > Yank out the code for the plane->fb/old_fb/crtc handling from
> > > > > the page flip path into page_flip_internal(), and provide a
> > > > > simpler variant for atomic drivers.
> > > > >
> > > > > We'll also move the fb vs. src viewport checks into the new
> > > > > functions as they are slightly different between the two paths.
> > > > > If the atomic .page_flip() implementations are guaranteed
> > > > > to call drm_atomic_plane_check() we could even drop the check
> > > > > entirely from page_flip_atomic(). For now toss in a FIXME.
> > > > >
> > > > > v2: Bit more polish in page_flip_internal()
> > > > >
> > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > ---
> > > > >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> > > > >  1 file changed, 102 insertions(+), 57 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > > > > index 38878da5b704..6052475a20a5 100644
> > > > > --- a/drivers/gpu/drm/drm_plane.c
> > > > > +++ b/drivers/gpu/drm/drm_plane.c
> > > > > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> > > > >         return drm_mode_cursor_common(dev, req, file_priv);
> > > > >  }
> > > > >
> > > > > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > > > > +                              const struct drm_framebuffer *old_fb)
> > > > > +{
> > > > > +       /* The framebuffer is currently unbound, presumably
> > > > > +        * due to a hotplug event, that userspace has not
> > > > > +        * yet discovered.
> > > > > +        */
> > > > > +       if (!old_fb)
> > > > > +               return -EBUSY;
> > > > > +
> > > > > +       if (old_fb->format != fb->format) {
> > > > > +               DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > > > +               return -EINVAL;
> > > > > +       }
> > > > > +
> > > > > +       return 0;
> > > > > +}
> > > > > +
> > > > > +static int page_flip_internal(struct drm_crtc *crtc,
> > > > > +                             struct drm_framebuffer *fb,
> > > > > +                             struct drm_pending_vblank_event *e,
> > > > > +                             u32 flags,
> > > > > +                             u32 target_vblank,
> > > > > +                             struct drm_modeset_acquire_ctx *ctx)
> > > > > +{
> > > > > +       struct drm_plane *plane = crtc->primary;
> > > > > +       int ret;
> > > > > +
> > > > > +       WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > > > > +
> > > > > +       ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > > > +                                     &crtc->mode, fb);
> > > > > +       if (ret)
> > > > > +               return ret;
> > > > > +
> > > > > +       ret = page_flip_check_fbs(fb, plane->fb);
> > > > > +       if (ret)
> > > > > +               return ret;
> > > > > +
> > > > > +       plane->old_fb = plane->fb;
> > > > > +       if (crtc->funcs->page_flip_target)
> > > > > +               ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > > > +                                                   target_vblank, ctx);
> > > > > +       else
> > > > > +               ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > > > +       if (ret) {
> > > > > +               plane->old_fb = NULL;
> > > > > +               return ret;
> > > > > +       }
> > > > > +
> > > > > +       plane->fb = fb;
> > > > > +       drm_framebuffer_get(plane->fb);
> > > > > +
> > > > > +       drm_framebuffer_put(plane->old_fb);
> > > > > +       plane->old_fb = NULL;
> > > > > +
> > > > > +       return 0;
> > > > > +}
> > > > > +
> > > > > +static int page_flip_atomic(struct drm_crtc *crtc,
> > > > > +                           struct drm_framebuffer *fb,
> > > > > +                           struct drm_pending_vblank_event *e,
> > > > > +                           u32 flags,
> > > > > +                           u32 target_vblank,
> > > > > +                           struct drm_modeset_acquire_ctx *ctx)
> > > > > +{
> > > > > +       struct drm_plane *plane = crtc->primary;
> > > > > +       struct drm_plane_state *plane_state = plane->state;
> > > > > +       int ret;
> > > > > +
> > > > > +       WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > > > > +
> > > > > +       /*
> > > > > +        * FIXME: Can we assume all drivers end up calling
> > > > > +        * drm_atomic_plane_check() in their page flip paths?
> > > > > +        * If so we could remove this.
> > > > > +        */
> > > >
> > > > This is definitely wrong, core has to check these. Currently no driver
> > > > checks this at all. I think you're thinking of
> > > > drm_atomic_helper_check_plane_state().
> > >
> > > No, I'm thinking of drm_atomic_plane_check(). That one already does the
> > > "does the src rect fit into the fb" check. It gets called from
> > > drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
> > > drivers might take some short circuit path past that for page_flip().
> >
> > tbh if you're worried about this, I'm tempted to rip out the option for
> > atomic drivers to overwrite their page_flip implementation, and force the
> > default function onto everyone (drm_atomic_helper_page_flip_target and
> > friends would need to be moved to drm_plane.c for that ofc).
> >
> > We seem to have 0 need for hacks for old userspace in this area, which is
> > great. So the option to overwrite could only lead to trouble.
> >
> > > > That aside I'm kinda not getting the point of the shuffling/cleanup in the
> > > > first 4 patches here, so will skip them.
> > >
> > > The point was to get that legacy plane->fb/old_fb stuff totally
> > > out from the atomic codepath. Right now it's polluting the
> > > supposedly higher level code shared by both atomic and legacy
> > > drivers.
> >
> > Hm ... I think if you sell it like that, and maybe even go one further and
> > inline page_flip for all atomic drivers, I can be sold on this. As-is I
> > just didn't really get why you're reworking all this.
>
> Hmm. Inlining doesn't look like 100% trivial code shufling due to
> .page_flip_target. We'd need some other mechanism for the driver to
> indicate support for that.

Ah right, I forgot about that one.

> OTOH I'm not sure we even support that stuff on any atomic driver.
> We have the helper but no one actually uses it. And as ususal I'm
> totally unusre what amdgpu is doing since I keep forgetting which
> parts of it are atomic and which are not.

amdgpu/DC does. I guess the simplest soulution would be to add
mode_config->has_flip_target. It's all wired through atomic states,
just not yet exposed as a property. Until that's done we need a
separate flag.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-25 17:24             ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-25 17:24 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

On Mon, Nov 25, 2019 at 4:05 PM Ville Syrjälä
<ville.syrjala@linux.intel.com> wrote:
>
> On Mon, Nov 25, 2019 at 10:02:38AM +0100, Daniel Vetter wrote:
> > On Fri, Nov 22, 2019 at 08:35:13PM +0200, Ville Syrjälä wrote:
> > > On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> > > > On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > >
> > > > > Yank out the code for the plane->fb/old_fb/crtc handling from
> > > > > the page flip path into page_flip_internal(), and provide a
> > > > > simpler variant for atomic drivers.
> > > > >
> > > > > We'll also move the fb vs. src viewport checks into the new
> > > > > functions as they are slightly different between the two paths.
> > > > > If the atomic .page_flip() implementations are guaranteed
> > > > > to call drm_atomic_plane_check() we could even drop the check
> > > > > entirely from page_flip_atomic(). For now toss in a FIXME.
> > > > >
> > > > > v2: Bit more polish in page_flip_internal()
> > > > >
> > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > ---
> > > > >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> > > > >  1 file changed, 102 insertions(+), 57 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > > > > index 38878da5b704..6052475a20a5 100644
> > > > > --- a/drivers/gpu/drm/drm_plane.c
> > > > > +++ b/drivers/gpu/drm/drm_plane.c
> > > > > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> > > > >         return drm_mode_cursor_common(dev, req, file_priv);
> > > > >  }
> > > > >
> > > > > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > > > > +                              const struct drm_framebuffer *old_fb)
> > > > > +{
> > > > > +       /* The framebuffer is currently unbound, presumably
> > > > > +        * due to a hotplug event, that userspace has not
> > > > > +        * yet discovered.
> > > > > +        */
> > > > > +       if (!old_fb)
> > > > > +               return -EBUSY;
> > > > > +
> > > > > +       if (old_fb->format != fb->format) {
> > > > > +               DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > > > +               return -EINVAL;
> > > > > +       }
> > > > > +
> > > > > +       return 0;
> > > > > +}
> > > > > +
> > > > > +static int page_flip_internal(struct drm_crtc *crtc,
> > > > > +                             struct drm_framebuffer *fb,
> > > > > +                             struct drm_pending_vblank_event *e,
> > > > > +                             u32 flags,
> > > > > +                             u32 target_vblank,
> > > > > +                             struct drm_modeset_acquire_ctx *ctx)
> > > > > +{
> > > > > +       struct drm_plane *plane = crtc->primary;
> > > > > +       int ret;
> > > > > +
> > > > > +       WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > > > > +
> > > > > +       ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > > > +                                     &crtc->mode, fb);
> > > > > +       if (ret)
> > > > > +               return ret;
> > > > > +
> > > > > +       ret = page_flip_check_fbs(fb, plane->fb);
> > > > > +       if (ret)
> > > > > +               return ret;
> > > > > +
> > > > > +       plane->old_fb = plane->fb;
> > > > > +       if (crtc->funcs->page_flip_target)
> > > > > +               ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > > > +                                                   target_vblank, ctx);
> > > > > +       else
> > > > > +               ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > > > +       if (ret) {
> > > > > +               plane->old_fb = NULL;
> > > > > +               return ret;
> > > > > +       }
> > > > > +
> > > > > +       plane->fb = fb;
> > > > > +       drm_framebuffer_get(plane->fb);
> > > > > +
> > > > > +       drm_framebuffer_put(plane->old_fb);
> > > > > +       plane->old_fb = NULL;
> > > > > +
> > > > > +       return 0;
> > > > > +}
> > > > > +
> > > > > +static int page_flip_atomic(struct drm_crtc *crtc,
> > > > > +                           struct drm_framebuffer *fb,
> > > > > +                           struct drm_pending_vblank_event *e,
> > > > > +                           u32 flags,
> > > > > +                           u32 target_vblank,
> > > > > +                           struct drm_modeset_acquire_ctx *ctx)
> > > > > +{
> > > > > +       struct drm_plane *plane = crtc->primary;
> > > > > +       struct drm_plane_state *plane_state = plane->state;
> > > > > +       int ret;
> > > > > +
> > > > > +       WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > > > > +
> > > > > +       /*
> > > > > +        * FIXME: Can we assume all drivers end up calling
> > > > > +        * drm_atomic_plane_check() in their page flip paths?
> > > > > +        * If so we could remove this.
> > > > > +        */
> > > >
> > > > This is definitely wrong, core has to check these. Currently no driver
> > > > checks this at all. I think you're thinking of
> > > > drm_atomic_helper_check_plane_state().
> > >
> > > No, I'm thinking of drm_atomic_plane_check(). That one already does the
> > > "does the src rect fit into the fb" check. It gets called from
> > > drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
> > > drivers might take some short circuit path past that for page_flip().
> >
> > tbh if you're worried about this, I'm tempted to rip out the option for
> > atomic drivers to overwrite their page_flip implementation, and force the
> > default function onto everyone (drm_atomic_helper_page_flip_target and
> > friends would need to be moved to drm_plane.c for that ofc).
> >
> > We seem to have 0 need for hacks for old userspace in this area, which is
> > great. So the option to overwrite could only lead to trouble.
> >
> > > > That aside I'm kinda not getting the point of the shuffling/cleanup in the
> > > > first 4 patches here, so will skip them.
> > >
> > > The point was to get that legacy plane->fb/old_fb stuff totally
> > > out from the atomic codepath. Right now it's polluting the
> > > supposedly higher level code shared by both atomic and legacy
> > > drivers.
> >
> > Hm ... I think if you sell it like that, and maybe even go one further and
> > inline page_flip for all atomic drivers, I can be sold on this. As-is I
> > just didn't really get why you're reworking all this.
>
> Hmm. Inlining doesn't look like 100% trivial code shufling due to
> .page_flip_target. We'd need some other mechanism for the driver to
> indicate support for that.

Ah right, I forgot about that one.

> OTOH I'm not sure we even support that stuff on any atomic driver.
> We have the helper but no one actually uses it. And as ususal I'm
> totally unusre what amdgpu is doing since I keep forgetting which
> parts of it are atomic and which are not.

amdgpu/DC does. I guess the simplest soulution would be to add
mode_config->has_flip_target. It's all wired through atomic states,
just not yet exposed as a property. Until that's done we need a
separate flag.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [Intel-gfx] [PATCH 3/7] drm: Extract page_flip_{internal, atomic}()
@ 2019-11-25 17:24             ` Daniel Vetter
  0 siblings, 0 replies; 51+ messages in thread
From: Daniel Vetter @ 2019-11-25 17:24 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

On Mon, Nov 25, 2019 at 4:05 PM Ville Syrjälä
<ville.syrjala@linux.intel.com> wrote:
>
> On Mon, Nov 25, 2019 at 10:02:38AM +0100, Daniel Vetter wrote:
> > On Fri, Nov 22, 2019 at 08:35:13PM +0200, Ville Syrjälä wrote:
> > > On Tue, Nov 19, 2019 at 11:14:43AM +0100, Daniel Vetter wrote:
> > > > On Fri, Nov 15, 2019 at 09:42:00PM +0200, Ville Syrjala wrote:
> > > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > >
> > > > > Yank out the code for the plane->fb/old_fb/crtc handling from
> > > > > the page flip path into page_flip_internal(), and provide a
> > > > > simpler variant for atomic drivers.
> > > > >
> > > > > We'll also move the fb vs. src viewport checks into the new
> > > > > functions as they are slightly different between the two paths.
> > > > > If the atomic .page_flip() implementations are guaranteed
> > > > > to call drm_atomic_plane_check() we could even drop the check
> > > > > entirely from page_flip_atomic(). For now toss in a FIXME.
> > > > >
> > > > > v2: Bit more polish in page_flip_internal()
> > > > >
> > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > ---
> > > > >  drivers/gpu/drm/drm_plane.c | 159 +++++++++++++++++++++++-------------
> > > > >  1 file changed, 102 insertions(+), 57 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > > > > index 38878da5b704..6052475a20a5 100644
> > > > > --- a/drivers/gpu/drm/drm_plane.c
> > > > > +++ b/drivers/gpu/drm/drm_plane.c
> > > > > @@ -1031,13 +1031,109 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> > > > >         return drm_mode_cursor_common(dev, req, file_priv);
> > > > >  }
> > > > >
> > > > > +static int page_flip_check_fbs(const struct drm_framebuffer *fb,
> > > > > +                              const struct drm_framebuffer *old_fb)
> > > > > +{
> > > > > +       /* The framebuffer is currently unbound, presumably
> > > > > +        * due to a hotplug event, that userspace has not
> > > > > +        * yet discovered.
> > > > > +        */
> > > > > +       if (!old_fb)
> > > > > +               return -EBUSY;
> > > > > +
> > > > > +       if (old_fb->format != fb->format) {
> > > > > +               DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> > > > > +               return -EINVAL;
> > > > > +       }
> > > > > +
> > > > > +       return 0;
> > > > > +}
> > > > > +
> > > > > +static int page_flip_internal(struct drm_crtc *crtc,
> > > > > +                             struct drm_framebuffer *fb,
> > > > > +                             struct drm_pending_vblank_event *e,
> > > > > +                             u32 flags,
> > > > > +                             u32 target_vblank,
> > > > > +                             struct drm_modeset_acquire_ctx *ctx)
> > > > > +{
> > > > > +       struct drm_plane *plane = crtc->primary;
> > > > > +       int ret;
> > > > > +
> > > > > +       WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
> > > > > +
> > > > > +       ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> > > > > +                                     &crtc->mode, fb);
> > > > > +       if (ret)
> > > > > +               return ret;
> > > > > +
> > > > > +       ret = page_flip_check_fbs(fb, plane->fb);
> > > > > +       if (ret)
> > > > > +               return ret;
> > > > > +
> > > > > +       plane->old_fb = plane->fb;
> > > > > +       if (crtc->funcs->page_flip_target)
> > > > > +               ret = crtc->funcs->page_flip_target(crtc, fb, e, flags,
> > > > > +                                                   target_vblank, ctx);
> > > > > +       else
> > > > > +               ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
> > > > > +       if (ret) {
> > > > > +               plane->old_fb = NULL;
> > > > > +               return ret;
> > > > > +       }
> > > > > +
> > > > > +       plane->fb = fb;
> > > > > +       drm_framebuffer_get(plane->fb);
> > > > > +
> > > > > +       drm_framebuffer_put(plane->old_fb);
> > > > > +       plane->old_fb = NULL;
> > > > > +
> > > > > +       return 0;
> > > > > +}
> > > > > +
> > > > > +static int page_flip_atomic(struct drm_crtc *crtc,
> > > > > +                           struct drm_framebuffer *fb,
> > > > > +                           struct drm_pending_vblank_event *e,
> > > > > +                           u32 flags,
> > > > > +                           u32 target_vblank,
> > > > > +                           struct drm_modeset_acquire_ctx *ctx)
> > > > > +{
> > > > > +       struct drm_plane *plane = crtc->primary;
> > > > > +       struct drm_plane_state *plane_state = plane->state;
> > > > > +       int ret;
> > > > > +
> > > > > +       WARN_ON(!drm_drv_uses_atomic_modeset(crtc->dev));
> > > > > +
> > > > > +       /*
> > > > > +        * FIXME: Can we assume all drivers end up calling
> > > > > +        * drm_atomic_plane_check() in their page flip paths?
> > > > > +        * If so we could remove this.
> > > > > +        */
> > > >
> > > > This is definitely wrong, core has to check these. Currently no driver
> > > > checks this at all. I think you're thinking of
> > > > drm_atomic_helper_check_plane_state().
> > >
> > > No, I'm thinking of drm_atomic_plane_check(). That one already does the
> > > "does the src rect fit into the fb" check. It gets called from
> > > drm_atomic_commit()->drm_atomic_check_only() but I wasn't sure if some
> > > drivers might take some short circuit path past that for page_flip().
> >
> > tbh if you're worried about this, I'm tempted to rip out the option for
> > atomic drivers to overwrite their page_flip implementation, and force the
> > default function onto everyone (drm_atomic_helper_page_flip_target and
> > friends would need to be moved to drm_plane.c for that ofc).
> >
> > We seem to have 0 need for hacks for old userspace in this area, which is
> > great. So the option to overwrite could only lead to trouble.
> >
> > > > That aside I'm kinda not getting the point of the shuffling/cleanup in the
> > > > first 4 patches here, so will skip them.
> > >
> > > The point was to get that legacy plane->fb/old_fb stuff totally
> > > out from the atomic codepath. Right now it's polluting the
> > > supposedly higher level code shared by both atomic and legacy
> > > drivers.
> >
> > Hm ... I think if you sell it like that, and maybe even go one further and
> > inline page_flip for all atomic drivers, I can be sold on this. As-is I
> > just didn't really get why you're reworking all this.
>
> Hmm. Inlining doesn't look like 100% trivial code shufling due to
> .page_flip_target. We'd need some other mechanism for the driver to
> indicate support for that.

Ah right, I forgot about that one.

> OTOH I'm not sure we even support that stuff on any atomic driver.
> We have the helper but no one actually uses it. And as ususal I'm
> totally unusre what amdgpu is doing since I keep forgetting which
> parts of it are atomic and which are not.

amdgpu/DC does. I guess the simplest soulution would be to add
mode_config->has_flip_target. It's all wired through atomic states,
just not yet exposed as a property. Until that's done we need a
separate flag.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 51+ messages in thread

end of thread, other threads:[~2019-11-25 17:25 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15 19:41 [PATCH 0/7] drm: Random pile of core stuff Ville Syrjala
2019-11-15 19:41 ` [Intel-gfx] " Ville Syrjala
2019-11-15 19:41 ` Ville Syrjala
2019-11-15 19:41 ` [PATCH 1/7] drm: Move page_flip fb lookup earlier Ville Syrjala
2019-11-15 19:41   ` [Intel-gfx] " Ville Syrjala
2019-11-15 19:41   ` Ville Syrjala
2019-11-15 19:41 ` [PATCH 2/7] drm: Allocate the page flip event earlier Ville Syrjala
2019-11-15 19:41   ` [Intel-gfx] " Ville Syrjala
2019-11-15 19:41   ` Ville Syrjala
2019-11-15 19:42 ` [PATCH 3/7] drm: Extract page_flip_{internal, atomic}() Ville Syrjala
2019-11-15 19:42   ` [Intel-gfx] " Ville Syrjala
2019-11-15 19:42   ` [PATCH 3/7] drm: Extract page_flip_{internal,atomic}() Ville Syrjala
2019-11-19 10:14   ` [PATCH 3/7] drm: Extract page_flip_{internal, atomic}() Daniel Vetter
2019-11-19 10:14     ` [Intel-gfx] " Daniel Vetter
2019-11-19 10:14     ` Daniel Vetter
2019-11-22 18:35     ` Ville Syrjälä
2019-11-22 18:35       ` [Intel-gfx] " Ville Syrjälä
2019-11-22 18:35       ` Ville Syrjälä
2019-11-25  9:02       ` Daniel Vetter
2019-11-25  9:02         ` [Intel-gfx] " Daniel Vetter
2019-11-25  9:02         ` Daniel Vetter
2019-11-25 15:05         ` Ville Syrjälä
2019-11-25 15:05           ` [Intel-gfx] " Ville Syrjälä
2019-11-25 15:05           ` Ville Syrjälä
2019-11-25 17:24           ` Daniel Vetter
2019-11-25 17:24             ` [Intel-gfx] " Daniel Vetter
2019-11-25 17:24             ` Daniel Vetter
2019-11-15 19:42 ` [PATCH 4/7] drm: Simplify the setplane old_fb handling further Ville Syrjala
2019-11-15 19:42   ` [Intel-gfx] " Ville Syrjala
2019-11-15 19:42   ` Ville Syrjala
2019-11-15 19:42 ` [PATCH 5/7] drm/selftests: Add some selftests for drm_atomic_set_mode_for_crtc() Ville Syrjala
2019-11-15 19:42   ` [Intel-gfx] " Ville Syrjala
2019-11-15 19:42   ` Ville Syrjala
2019-11-19 10:39   ` Daniel Vetter
2019-11-19 10:39     ` [Intel-gfx] " Daniel Vetter
2019-11-15 19:42 ` [PATCH 6/7] drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc() Ville Syrjala
2019-11-15 19:42   ` [Intel-gfx] " Ville Syrjala
2019-11-19 10:20   ` Daniel Vetter
2019-11-19 10:20     ` [Intel-gfx] " Daniel Vetter
2019-11-19 10:20     ` Daniel Vetter
2019-11-15 19:42 ` [PATCH 7/7] drm/atomic: Reduce setplane locking Ville Syrjala
2019-11-15 19:42   ` [Intel-gfx] " Ville Syrjala
2019-11-19 10:47   ` Daniel Vetter
2019-11-19 10:47     ` [Intel-gfx] " Daniel Vetter
2019-11-19 10:47     ` Daniel Vetter
2019-11-15 22:59 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Random pile of core stuff Patchwork
2019-11-15 22:59   ` [Intel-gfx] " Patchwork
2019-11-15 23:20 ` ✓ Fi.CI.BAT: success " Patchwork
2019-11-15 23:20   ` [Intel-gfx] " Patchwork
2019-11-17 12:20 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-11-17 12:20   ` [Intel-gfx] " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.