Skip to contentSkip to conversation

drm: Set the plane's crtc before calling disable_plane.

PATCH In review Stéphane Marchesin 3 participants 4 messages Mar 3, 2014

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

PATCH 1/1 drm: Set the plane's crtc before calling disable_plane.

Some drivers like exynos need the crtc to be able to disable the plane, so set it before calling disable_plane.

---
 drivers/gpu/drm/drm_crtc.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_crtc.c +11 -10
index 3b7d32d..0943316 100644
@@ -1947,10 +1947,21 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
 	}
 	plane = obj_to_plane(obj);
 
+	obj = drm_mode_object_find(dev, plane_req->crtc_id,
+				   DRM_MODE_OBJECT_CRTC);
+	if (!obj) {
+		DRM_DEBUG_KMS("Unknown crtc ID %d\n",
+			      plane_req->crtc_id);
+		ret = -ENOENT;
+		goto out;
+	}
+	crtc = obj_to_crtc(obj);
+
 	/* No fb means shut it down */
 	if (!plane_req->fb_id) {
 		drm_modeset_lock_all(dev);
 		old_fb = plane->fb;
+		plane->crtc = crtc;
 		plane->funcs->disable_plane(plane);
 		plane->crtc = NULL;
 		plane->fb = NULL;
@@ -1958,16 +1969,6 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
 		goto out;
 	}
 
-	obj = drm_mode_object_find(dev, plane_req->crtc_id,
-				   DRM_MODE_OBJECT_CRTC);
-	if (!obj) {
-		DRM_DEBUG_KMS("Unknown crtc ID %d\n",
-			      plane_req->crtc_id);
-		ret = -ENOENT;
-		goto out;
-	}
-	crtc = obj_to_crtc(obj);
-
 	fb = drm_framebuffer_lookup(dev, plane_req->fb_id);
 	if (!fb) {
 		DRM_DEBUG_KMS("Unknown framebuffer ID %d\n",
Signature · 6 lines
1.9.0.279.gdc9e3eb

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 41 lines · On Mon, 3 Mar 2014 13:38:36 -0800 Stéphane Marchesin <[email protected]>…

Some drivers like exynos need the crtc to be able to disable the plane, so set it before calling disable_plane.

---
 drivers/gpu/drm/drm_crtc.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_crtc.c +11 -3
index 3b7d32d..0943316 100644
@@ -1947,10 +1947,21 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
 	}
 	plane = obj_to_plane(obj);
 
+	obj = drm_mode_object_find(dev, plane_req->crtc_id,
+				   DRM_MODE_OBJECT_CRTC);
+	if (!obj) {
+		DRM_DEBUG_KMS("Unknown crtc ID %d\n",
+			      plane_req->crtc_id);
+		ret = -ENOENT;
+		goto out;
+	}
+	crtc = obj_to_crtc(obj);
+
 	/* No fb means shut it down */
 	if (!plane_req->fb_id) {
 		drm_modeset_lock_all(dev);
 		old_fb = plane->fb;
+		plane->crtc = crtc;
 		plane->funcs->disable_plane(plane);
 		plane->crtc = NULL;
 		plane->fb = NULL;
@@ -1958,16 +1969,6 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
 		goto out;
 	}
 
-	obj = drm_mode_object_find(dev, plane_req->crtc_id,
-				   DRM_MODE_OBJECT_CRTC);
-	if (!obj) {

drivers/gpu/drm/drm_crtc.c int drm_mode_setplane(struct drm_device *dev, void *data, · line 1974

Quoted 10 lines
drivers/gpu/drm/drm_crtc.c +0 -7
-		DRM_DEBUG_KMS("Unknown crtc ID %d\n",
-			      plane_req->crtc_id);
-		ret = -ENOENT;
-		goto out;
-	}
-	crtc = obj_to_crtc(obj);
-
 	fb = drm_framebuffer_lookup(dev, plane_req->fb_id);
 	if (!fb) {
 		DRM_DEBUG_KMS("Unknown framebuffer ID %d\n",

I'm pretty sure this is ok since we don't have much userspace using this that might fail to pass in a crtc when shutting down a plane...

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 19 lines · Jesse Barnes
Quoted 16 lines · On Mon, 3 Mar 2014 13:38:36 -0800 Stéphane Marchesin <[email protected]>…

Some drivers like exynos need the crtc to be able to disable the plane, so set it before calling disable_plane.

---
 drivers/gpu/drm/drm_crtc.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_crtc.c +0 -0
index 3b7d32d..0943316 100644
@@ -1947,10 +1947,21 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
      }
      plane = obj_to_plane(obj);
 
Quoted 15 lines
Quoted 5 lines
drivers/gpu/drm/drm_crtc.c +5 -0
+     obj = drm_mode_object_find(dev, plane_req->crtc_id,
+                                DRM_MODE_OBJECT_CRTC);
+     if (!obj) {
+             DRM_DEBUG_KMS("Unknown crtc ID %d\n",
+                           plane_req->crtc_id);

drivers/gpu/drm/drm_crtc.c int drm_mode_setplane(struct drm_device *dev, void *data, · line 1964

Quoted 10 lines
drivers/gpu/drm/drm_crtc.c +6 -0
+             ret = -ENOENT;
+             goto out;
+     }
+     crtc = obj_to_crtc(obj);
+
      /* No fb means shut it down */
      if (!plane_req->fb_id) {
              drm_modeset_lock_all(dev);
              old_fb = plane->fb;
+             plane->crtc = crtc;

just curious, but how is the plane ending up enabled *without* a crtc?
That sounds a bit.. odd..

BR,
-R

Quoted 32 lines
Quoted 10 lines
drivers/gpu/drm/drm_crtc.c +0 -3
              plane->funcs->disable_plane(plane);
              plane->crtc = NULL;
              plane->fb = NULL;
@@ -1958,16 +1969,6 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
              goto out;
      }
 
-     obj = drm_mode_object_find(dev, plane_req->crtc_id,
-                                DRM_MODE_OBJECT_CRTC);
-     if (!obj) {

drivers/gpu/drm/drm_crtc.c int drm_mode_setplane(struct drm_device *dev, void *data, · line 1974

Quoted 10 lines
drivers/gpu/drm/drm_crtc.c +0 -7
-             DRM_DEBUG_KMS("Unknown crtc ID %d\n",
-                           plane_req->crtc_id);
-             ret = -ENOENT;
-             goto out;
-     }
-     crtc = obj_to_crtc(obj);
-
      fb = drm_framebuffer_lookup(dev, plane_req->fb_id);
      if (!fb) {
              DRM_DEBUG_KMS("Unknown framebuffer ID %d\n",

I'm pretty sure this is ok since we don't have much userspace using this that might fail to pass in a crtc when shutting down a plane...

--
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 30 lines · Rob Clark
Quoted 29 lines · Jesse Barnes
Quoted 26 lines · On Mon, 3 Mar 2014 13:38:36 -0800 Stéphane Marchesin <[email protected]>…

Some drivers like exynos need the crtc to be able to disable the plane, so set it before calling disable_plane.

---
 drivers/gpu/drm/drm_crtc.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_crtc.c +10 -0
index 3b7d32d..0943316 100644
@@ -1947,10 +1947,21 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
      }
      plane = obj_to_plane(obj);
 
+     obj = drm_mode_object_find(dev, plane_req->crtc_id,
+                                DRM_MODE_OBJECT_CRTC);
+     if (!obj) {
+             DRM_DEBUG_KMS("Unknown crtc ID %d\n",
+                           plane_req->crtc_id);
+             ret = -ENOENT;
+             goto out;
+     }
+     crtc = obj_to_crtc(obj);
+
Quoted 8 lines
Quoted 5 lines

drivers/gpu/drm/drm_crtc.c int drm_mode_setplane(struct drm_device *dev, void *data, · line 1964

Quoted 5 lines
drivers/gpu/drm/drm_crtc.c +1 -0
      /* No fb means shut it down */
      if (!plane_req->fb_id) {
              drm_modeset_lock_all(dev);
              old_fb = plane->fb;
+             plane->crtc = crtc;

just curious, but how is the plane ending up enabled *without* a crtc?
That sounds a bit.. odd..

Yup it has a crtc, but the plane->crtc is set to NULL just before we call disable_plane(), and so disable_plane() can't rely on the crtc...

Stéphane

Quoted 36 lines

BR,
-R

Quoted 32 lines
Quoted 10 lines
drivers/gpu/drm/drm_crtc.c +0 -3
              plane->funcs->disable_plane(plane);
              plane->crtc = NULL;
              plane->fb = NULL;
@@ -1958,16 +1969,6 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
              goto out;
      }
 
-     obj = drm_mode_object_find(dev, plane_req->crtc_id,
-                                DRM_MODE_OBJECT_CRTC);
-     if (!obj) {

drivers/gpu/drm/drm_crtc.c int drm_mode_setplane(struct drm_device *dev, void *data, · line 1974

Quoted 10 lines
drivers/gpu/drm/drm_crtc.c +0 -7
-             DRM_DEBUG_KMS("Unknown crtc ID %d\n",
-                           plane_req->crtc_id);
-             ret = -ENOENT;
-             goto out;
-     }
-     crtc = obj_to_crtc(obj);
-
      fb = drm_framebuffer_lookup(dev, plane_req->fb_id);
      if (!fb) {
              DRM_DEBUG_KMS("Unknown framebuffer ID %d\n",

I'm pretty sure this is ok since we don't have much userspace using this that might fail to pass in a crtc when shutting down a plane...

--
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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