Skip to contentSkip to conversation

drm: fix plane rotation when restoring fbdev configuration

PATCH Superseded Thomas Wood 2 participants 8 messages Aug 14, 2014 – Aug 20, 2014

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

PATCH 1/1 drm: fix plane rotation when restoring fbdev configuration

Make sure plane rotation is reset correctly when restoring the fbdev configuration by using drm_mode_plane_set_obj_prop. This calls the driver's set_property callback and ensures the rotation is actually changed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82236

---
 drivers/gpu/drm/drm_crtc.c      | 25 ++++++++++++++++++++-----
 drivers/gpu/drm/drm_fb_helper.c |  6 +++---
 include/drm/drm_crtc.h          |  3 +++
 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_crtc.c +20 -5
index f09b752..95f330a 100644
@@ -4175,12 +4175,25 @@ static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
 	return ret;
 }
 
-static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
-				      struct drm_property *property,
-				      uint64_t value)
+/**
+ * drm_mode_plane_set_obj_prop - set the value of a property
+ * @plane: drm plane object to set property value for
+ * @property: property to set
+ * @val: value the property should be set to
+ *
+ * This functions sets a given property on a given plane object. This function
+ * calls the driver's ->set_property callback and changes the software state of
+ * the property if the callback succeeds.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+				struct drm_property *property,
+				uint64_t value)
 {
 	int ret = -EINVAL;
-	struct drm_plane *plane = obj_to_plane(obj);
+	struct drm_mode_object *obj = &plane->base;
 
 	if (plane->funcs->set_property)
 		ret = plane->funcs->set_property(plane, property, value);
@@ -4189,6 +4202,7 @@ static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
 
 	return ret;
 }
+EXPORT_SYMBOL(drm_mode_plane_set_obj_prop);
 
 /**
  * drm_mode_getproperty_ioctl - get the current value of a object's property
@@ -4327,7 +4341,8 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
 		ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value);
 		break;
 	case DRM_MODE_OBJECT_PLANE:
-		ret = drm_mode_plane_set_obj_prop(arg_obj, property, arg->value);
+		ret = drm_mode_plane_set_obj_prop(obj_to_plane(arg_obj),
+						  property, arg->value);
 		break;
 	}
 
drivers/gpu/drm/drm_fb_helper.c +3 -3
index 63d7b8e..0c0c39b 100644
@@ -296,9 +296,9 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 			drm_plane_force_disable(plane);
 
 		if (dev->mode_config.rotation_property) {
-			drm_object_property_set_value(&plane->base,
-					dev->mode_config.rotation_property,
-					BIT(DRM_ROTATE_0));
+			drm_mode_plane_set_obj_prop(plane,
+						    dev->mode_config.rotation_property,
+						    BIT(DRM_ROTATE_0));
 		}
 	}
 
include/drm/drm_crtc.h +3 -0
index 0375d75..31344bf 100644
@@ -1127,6 +1127,9 @@ extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 					     struct drm_file *file_priv);
 extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
 					   struct drm_file *file_priv);
+extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+				       struct drm_property *property,
+				       uint64_t value);
 
 extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
 				 int *bpp);
Signature · 1 line
1.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Thomas Wood

Make sure plane rotation is reset correctly when restoring the fbdev configuration by using drm_mode_plane_set_obj_prop. This calls the driver's set_property callback and ensures the rotation is actually changed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82236

Commit message is missing the citation of the offending commit that introduced this. With that addressed this is

And please cc all the people involved in the offending commit next time around, too.
-Daniel

Quoted 96 lines
---
 drivers/gpu/drm/drm_crtc.c      | 25 ++++++++++++++++++++-----
 drivers/gpu/drm/drm_fb_helper.c |  6 +++---
 include/drm/drm_crtc.h          |  3 +++
 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_crtc.c +20 -5
index f09b752..95f330a 100644
@@ -4175,12 +4175,25 @@ static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
 	return ret;
 }
 
-static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
-				      struct drm_property *property,
-				      uint64_t value)
+/**
+ * drm_mode_plane_set_obj_prop - set the value of a property
+ * @plane: drm plane object to set property value for
+ * @property: property to set
+ * @val: value the property should be set to
+ *
+ * This functions sets a given property on a given plane object. This function
+ * calls the driver's ->set_property callback and changes the software state of
+ * the property if the callback succeeds.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+				struct drm_property *property,
+				uint64_t value)
 {
 	int ret = -EINVAL;
-	struct drm_plane *plane = obj_to_plane(obj);
+	struct drm_mode_object *obj = &plane->base;
 
 	if (plane->funcs->set_property)
 		ret = plane->funcs->set_property(plane, property, value);
@@ -4189,6 +4202,7 @@ static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
 
 	return ret;
 }
+EXPORT_SYMBOL(drm_mode_plane_set_obj_prop);
 
 /**
  * drm_mode_getproperty_ioctl - get the current value of a object's property
@@ -4327,7 +4341,8 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
 		ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value);
 		break;
 	case DRM_MODE_OBJECT_PLANE:
-		ret = drm_mode_plane_set_obj_prop(arg_obj, property, arg->value);
+		ret = drm_mode_plane_set_obj_prop(obj_to_plane(arg_obj),
+						  property, arg->value);
 		break;
 	}
 
drivers/gpu/drm/drm_fb_helper.c +3 -3
index 63d7b8e..0c0c39b 100644
@@ -296,9 +296,9 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 			drm_plane_force_disable(plane);
 
 		if (dev->mode_config.rotation_property) {
-			drm_object_property_set_value(&plane->base,
-					dev->mode_config.rotation_property,
-					BIT(DRM_ROTATE_0));
+			drm_mode_plane_set_obj_prop(plane,
+						    dev->mode_config.rotation_property,
+						    BIT(DRM_ROTATE_0));
 		}
 	}
 
include/drm/drm_crtc.h +3 -0
index 0375d75..31344bf 100644
@@ -1127,6 +1127,9 @@ extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 					     struct drm_file *file_priv);
 extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
 					   struct drm_file *file_priv);
+extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+				       struct drm_property *property,
+				       uint64_t value);
 
 extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
 				 int *bpp);
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw
Quoted 9 lines · Daniel Vetter
Quoted 7 lines · Thomas Wood

Make sure plane rotation is reset correctly when restoring the fbdev configuration by using drm_mode_plane_set_obj_prop. This calls the driver's set_property callback and ensures the rotation is actually changed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82236

Quoted 7 lines

Commit message is missing the citation of the offending commit that introduced this. With that addressed this is

And please cc all the people involved in the offending commit next time around, too.

The "reset" feature was introduced in commit 9783de2 (drm: Resetting rotation property), although it also looks like the issue was originally addressed in a previous version of the patch:

http://lists.freedesktop.org/archives/dri-devel/2014-July/062981.html

Although this version calls the driver's set_property directly rather than exporting drm_mode_plane_set_obj_prop.

The final version of the patch contains a different change:

Quoted 106 lines

-Daniel

Quoted 92 lines
---
 drivers/gpu/drm/drm_crtc.c      | 25 ++++++++++++++++++++-----
 drivers/gpu/drm/drm_fb_helper.c |  6 +++---
 include/drm/drm_crtc.h          |  3 +++
 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_crtc.c +20 -5
index f09b752..95f330a 100644
@@ -4175,12 +4175,25 @@ static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
      return ret;
 }
 
-static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
-                                   struct drm_property *property,
-                                   uint64_t value)
+/**
+ * drm_mode_plane_set_obj_prop - set the value of a property
+ * @plane: drm plane object to set property value for
+ * @property: property to set
+ * @val: value the property should be set to
+ *
+ * This functions sets a given property on a given plane object. This function
+ * calls the driver's ->set_property callback and changes the software state of
+ * the property if the callback succeeds.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+                             struct drm_property *property,
+                             uint64_t value)
 {
      int ret = -EINVAL;
-     struct drm_plane *plane = obj_to_plane(obj);
+     struct drm_mode_object *obj = &plane->base;
 
      if (plane->funcs->set_property)
              ret = plane->funcs->set_property(plane, property, value);
@@ -4189,6 +4202,7 @@ static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
 
      return ret;
 }
+EXPORT_SYMBOL(drm_mode_plane_set_obj_prop);
 
 /**
  * drm_mode_getproperty_ioctl - get the current value of a object's property
@@ -4327,7 +4341,8 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
              ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value);
              break;
      case DRM_MODE_OBJECT_PLANE:
-             ret = drm_mode_plane_set_obj_prop(arg_obj, property, arg->value);
+             ret = drm_mode_plane_set_obj_prop(obj_to_plane(arg_obj),
+                                               property, arg->value);
              break;
      }
 
drivers/gpu/drm/drm_fb_helper.c +3 -3
index 63d7b8e..0c0c39b 100644
@@ -296,9 +296,9 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
                      drm_plane_force_disable(plane);
 
              if (dev->mode_config.rotation_property) {
-                     drm_object_property_set_value(&plane->base,
-                                     dev->mode_config.rotation_property,
-                                     BIT(DRM_ROTATE_0));
+                     drm_mode_plane_set_obj_prop(plane,
+                                                 dev->mode_config.rotation_property,
+                                                 BIT(DRM_ROTATE_0));
              }
      }
 
include/drm/drm_crtc.h +3 -1
index 0375d75..31344bf 100644
@@ -1127,6 +1127,9 @@ extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
                                           struct drm_file *file_priv);
 extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
                                         struct drm_file *file_priv);
+extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+                                    struct drm_property *property,
+                                    uint64_t value);
 
 extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
                               int *bpp);
--

1.9.3

Quoted 4 lines

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

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 22 lines · Thomas Wood
Quoted 9 lines · Daniel Vetter
Quoted 7 lines · Thomas Wood

Make sure plane rotation is reset correctly when restoring the fbdev configuration by using drm_mode_plane_set_obj_prop. This calls the driver's set_property callback and ensures the rotation is actually changed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82236

Quoted 7 lines

Commit message is missing the citation of the offending commit that introduced this. With that addressed this is

And please cc all the people involved in the offending commit next time around, too.

The "reset" feature was introduced in commit 9783de2 (drm: Resetting rotation property), although it also looks like the issue was originally addressed in a previous version of the patch:

Quoted 6 lines

http://lists.freedesktop.org/archives/dri-devel/2014-July/062981.html

Although this version calls the driver's set_property directly rather than exporting drm_mode_plane_set_obj_prop.

The final version of the patch contains a different change:

http://lists.freedesktop.org/archives/dri-devel/2014-August/065728.html

So there were actually two different "v2" versions of the patch.

Quoted 107 lines
Quoted 107 lines

-Daniel

Quoted 92 lines
---
 drivers/gpu/drm/drm_crtc.c      | 25 ++++++++++++++++++++-----
 drivers/gpu/drm/drm_fb_helper.c |  6 +++---
 include/drm/drm_crtc.h          |  3 +++
 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_crtc.c +20 -5
index f09b752..95f330a 100644
@@ -4175,12 +4175,25 @@ static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
      return ret;
 }
 
-static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
-                                   struct drm_property *property,
-                                   uint64_t value)
+/**
+ * drm_mode_plane_set_obj_prop - set the value of a property
+ * @plane: drm plane object to set property value for
+ * @property: property to set
+ * @val: value the property should be set to
+ *
+ * This functions sets a given property on a given plane object. This function
+ * calls the driver's ->set_property callback and changes the software state of
+ * the property if the callback succeeds.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+                             struct drm_property *property,
+                             uint64_t value)
 {
      int ret = -EINVAL;
-     struct drm_plane *plane = obj_to_plane(obj);
+     struct drm_mode_object *obj = &plane->base;
 
      if (plane->funcs->set_property)
              ret = plane->funcs->set_property(plane, property, value);
@@ -4189,6 +4202,7 @@ static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
 
      return ret;
 }
+EXPORT_SYMBOL(drm_mode_plane_set_obj_prop);
 
 /**
  * drm_mode_getproperty_ioctl - get the current value of a object's property
@@ -4327,7 +4341,8 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
              ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value);
              break;
      case DRM_MODE_OBJECT_PLANE:
-             ret = drm_mode_plane_set_obj_prop(arg_obj, property, arg->value);
+             ret = drm_mode_plane_set_obj_prop(obj_to_plane(arg_obj),
+                                               property, arg->value);
              break;
      }
 
drivers/gpu/drm/drm_fb_helper.c +3 -3
index 63d7b8e..0c0c39b 100644
@@ -296,9 +296,9 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
                      drm_plane_force_disable(plane);
 
              if (dev->mode_config.rotation_property) {
-                     drm_object_property_set_value(&plane->base,
-                                     dev->mode_config.rotation_property,
-                                     BIT(DRM_ROTATE_0));
+                     drm_mode_plane_set_obj_prop(plane,
+                                                 dev->mode_config.rotation_property,
+                                                 BIT(DRM_ROTATE_0));
              }
      }
 
include/drm/drm_crtc.h +3 -1
index 0375d75..31344bf 100644
@@ -1127,6 +1127,9 @@ extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
                                           struct drm_file *file_priv);
 extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
                                         struct drm_file *file_priv);
+extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+                                    struct drm_property *property,
+                                    uint64_t value);
 
 extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
                               int *bpp);
--

1.9.3

Quoted 4 lines

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

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 25 lines · Thomas Wood
Quoted 24 lines · Thomas Wood
Quoted 9 lines · Daniel Vetter
Quoted 7 lines · Thomas Wood

Make sure plane rotation is reset correctly when restoring the fbdev configuration by using drm_mode_plane_set_obj_prop. This calls the driver's set_property callback and ensures the rotation is actually changed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82236

Quoted 7 lines

Commit message is missing the citation of the offending commit that introduced this. With that addressed this is

And please cc all the people involved in the offending commit next time around, too.

The "reset" feature was introduced in commit 9783de2 (drm: Resetting rotation property), although it also looks like the issue was originally addressed in a previous version of the patch:

http://lists.freedesktop.org/archives/dri-devel/2014-July/062981.html

Quoted 8 lines
Quoted 4 lines

Although this version calls the driver's set_property directly rather than exporting drm_mode_plane_set_obj_prop.

The final version of the patch contains a different change:

http://lists.freedesktop.org/archives/dri-devel/2014-August/065728.html

So there were actually two different "v2" versions of the patch.

Somehow I've thought this is for -fixes, but the patch is only in dinq. So merged, thanks.
-Daniel

Quoted 110 lines
Quoted 110 lines
Quoted 110 lines

-Daniel

Quoted 92 lines
---
 drivers/gpu/drm/drm_crtc.c      | 25 ++++++++++++++++++++-----
 drivers/gpu/drm/drm_fb_helper.c |  6 +++---
 include/drm/drm_crtc.h          |  3 +++
 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_crtc.c +20 -5
index f09b752..95f330a 100644
@@ -4175,12 +4175,25 @@ static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
      return ret;
 }
 
-static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
-                                   struct drm_property *property,
-                                   uint64_t value)
+/**
+ * drm_mode_plane_set_obj_prop - set the value of a property
+ * @plane: drm plane object to set property value for
+ * @property: property to set
+ * @val: value the property should be set to
+ *
+ * This functions sets a given property on a given plane object. This function
+ * calls the driver's ->set_property callback and changes the software state of
+ * the property if the callback succeeds.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+                             struct drm_property *property,
+                             uint64_t value)
 {
      int ret = -EINVAL;
-     struct drm_plane *plane = obj_to_plane(obj);
+     struct drm_mode_object *obj = &plane->base;
 
      if (plane->funcs->set_property)
              ret = plane->funcs->set_property(plane, property, value);
@@ -4189,6 +4202,7 @@ static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
 
      return ret;
 }
+EXPORT_SYMBOL(drm_mode_plane_set_obj_prop);
 
 /**
  * drm_mode_getproperty_ioctl - get the current value of a object's property
@@ -4327,7 +4341,8 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
              ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value);
              break;
      case DRM_MODE_OBJECT_PLANE:
-             ret = drm_mode_plane_set_obj_prop(arg_obj, property, arg->value);
+             ret = drm_mode_plane_set_obj_prop(obj_to_plane(arg_obj),
+                                               property, arg->value);
              break;
      }
 
drivers/gpu/drm/drm_fb_helper.c +3 -3
index 63d7b8e..0c0c39b 100644
@@ -296,9 +296,9 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
                      drm_plane_force_disable(plane);
 
              if (dev->mode_config.rotation_property) {
-                     drm_object_property_set_value(&plane->base,
-                                     dev->mode_config.rotation_property,
-                                     BIT(DRM_ROTATE_0));
+                     drm_mode_plane_set_obj_prop(plane,
+                                                 dev->mode_config.rotation_property,
+                                                 BIT(DRM_ROTATE_0));
              }
      }
 
include/drm/drm_crtc.h +3 -1
index 0375d75..31344bf 100644
@@ -1127,6 +1127,9 @@ extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
                                           struct drm_file *file_priv);
 extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
                                         struct drm_file *file_priv);
+extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+                                    struct drm_property *property,
+                                    uint64_t value);
 
 extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
                               int *bpp);
--

1.9.3

Quoted 4 lines

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

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#5 lore raw
Quoted 31 lines · Daniel Vetter
Quoted 30 lines · Thomas Wood
Quoted 28 lines · Thomas Wood
Quoted 9 lines · Daniel Vetter
Quoted 7 lines · Thomas Wood

Make sure plane rotation is reset correctly when restoring the fbdev configuration by using drm_mode_plane_set_obj_prop. This calls the driver's set_property callback and ensures the rotation is actually changed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82236

Quoted 7 lines

Commit message is missing the citation of the offending commit that introduced this. With that addressed this is

And please cc all the people involved in the offending commit next time around, too.

The "reset" feature was introduced in commit 9783de2 (drm: Resetting rotation property), although it also looks like the issue was originally addressed in a previous version of the patch:

http://lists.freedesktop.org/archives/dri-devel/2014-July/062981.html

Although this version calls the driver's set_property directly rather than exporting drm_mode_plane_set_obj_prop.

The final version of the patch contains a different change:

Quoted 7 lines
Quoted 3 lines

http://lists.freedesktop.org/archives/dri-devel/2014-August/065728.html

So there were actually two different "v2" versions of the patch.

Somehow I've thought this is for -fixes, but the patch is only in dinq. So merged, thanks.
-Daniel

Is there any preference to calling set_property directly (as originally fixed), as opposed to exporting and using drm_mode_plane_set_obj_prop?

I have also pushed a patch for igt/kms_rotate_crc to add a testcase for this issue:

http://lists.freedesktop.org/archives/intel-gfx/2014-August/050775.html

Quoted 116 lines
Quoted 98 lines
Quoted 98 lines
Quoted 98 lines

-Daniel

Quoted 92 lines
---
 drivers/gpu/drm/drm_crtc.c      | 25 ++++++++++++++++++++-----
 drivers/gpu/drm/drm_fb_helper.c |  6 +++---
 include/drm/drm_crtc.h          |  3 +++
 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_crtc.c +20 -5
index f09b752..95f330a 100644
@@ -4175,12 +4175,25 @@ static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
      return ret;
 }
 
-static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
-                                   struct drm_property *property,
-                                   uint64_t value)
+/**
+ * drm_mode_plane_set_obj_prop - set the value of a property
+ * @plane: drm plane object to set property value for
+ * @property: property to set
+ * @val: value the property should be set to
+ *
+ * This functions sets a given property on a given plane object. This function
+ * calls the driver's ->set_property callback and changes the software state of
+ * the property if the callback succeeds.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+                             struct drm_property *property,
+                             uint64_t value)
 {
      int ret = -EINVAL;
-     struct drm_plane *plane = obj_to_plane(obj);
+     struct drm_mode_object *obj = &plane->base;
 
      if (plane->funcs->set_property)
              ret = plane->funcs->set_property(plane, property, value);
@@ -4189,6 +4202,7 @@ static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
 
      return ret;
 }
+EXPORT_SYMBOL(drm_mode_plane_set_obj_prop);
 
 /**
  * drm_mode_getproperty_ioctl - get the current value of a object's property
@@ -4327,7 +4341,8 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
              ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value);
              break;
      case DRM_MODE_OBJECT_PLANE:
-             ret = drm_mode_plane_set_obj_prop(arg_obj, property, arg->value);
+             ret = drm_mode_plane_set_obj_prop(obj_to_plane(arg_obj),
+                                               property, arg->value);
              break;
      }
 
drivers/gpu/drm/drm_fb_helper.c +3 -3
index 63d7b8e..0c0c39b 100644
@@ -296,9 +296,9 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
                      drm_plane_force_disable(plane);
 
              if (dev->mode_config.rotation_property) {
-                     drm_object_property_set_value(&plane->base,
-                                     dev->mode_config.rotation_property,
-                                     BIT(DRM_ROTATE_0));
+                     drm_mode_plane_set_obj_prop(plane,
+                                                 dev->mode_config.rotation_property,
+                                                 BIT(DRM_ROTATE_0));
              }
      }
 
include/drm/drm_crtc.h +3 -1
index 0375d75..31344bf 100644
@@ -1127,6 +1127,9 @@ extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
                                           struct drm_file *file_priv);
 extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
                                         struct drm_file *file_priv);
+extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+                                    struct drm_property *property,
+                                    uint64_t value);
 
 extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
                               int *bpp);
--

1.9.3

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

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

Quoted 8 lines
Quoted 8 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

#6 lore raw

PATCH v2 1/1 drm: fix plane rotation when restoring fbdev configuration

Make sure plane rotation is reset correctly when restoring the fbdev configuration by using drm_mode_plane_set_obj_prop which calls the driver's set_property callback.

The rotation reset feature was introduced in commit 9783de2 (drm:
Resetting rotation property) and the callback issue was originally addressed in a previous version of the patch, but the fix was not present in the final version.

v2: Fix documentation warning
Add some more details to the commit message (Daniel Vetter)

Testcase: igt/kms_rotation_crc
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82236

Cc Sonika Jindal <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_crtc.c      | 25 ++++++++++++++++++++-----
 drivers/gpu/drm/drm_fb_helper.c |  6 +++---
 include/drm/drm_crtc.h          |  3 +++
 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_crtc.c +20 -5
index f09b752..7d7c1fd 100644
@@ -4175,12 +4175,25 @@ static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
 	return ret;
 }
 
-static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
-				      struct drm_property *property,
-				      uint64_t value)
+/**
+ * drm_mode_plane_set_obj_prop - set the value of a property
+ * @plane: drm plane object to set property value for
+ * @property: property to set
+ * @value: value the property should be set to
+ *
+ * This functions sets a given property on a given plane object. This function
+ * calls the driver's ->set_property callback and changes the software state of
+ * the property if the callback succeeds.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+				struct drm_property *property,
+				uint64_t value)
 {
 	int ret = -EINVAL;
-	struct drm_plane *plane = obj_to_plane(obj);
+	struct drm_mode_object *obj = &plane->base;
 
 	if (plane->funcs->set_property)
 		ret = plane->funcs->set_property(plane, property, value);
@@ -4189,6 +4202,7 @@ static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
 
 	return ret;
 }
+EXPORT_SYMBOL(drm_mode_plane_set_obj_prop);
 
 /**
  * drm_mode_getproperty_ioctl - get the current value of a object's property
@@ -4327,7 +4341,8 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
 		ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value);
 		break;
 	case DRM_MODE_OBJECT_PLANE:
-		ret = drm_mode_plane_set_obj_prop(arg_obj, property, arg->value);
+		ret = drm_mode_plane_set_obj_prop(obj_to_plane(arg_obj),
+						  property, arg->value);
 		break;
 	}
 
drivers/gpu/drm/drm_fb_helper.c +3 -3
index 63d7b8e..0c0c39b 100644
@@ -296,9 +296,9 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 			drm_plane_force_disable(plane);
 
 		if (dev->mode_config.rotation_property) {
-			drm_object_property_set_value(&plane->base,
-					dev->mode_config.rotation_property,
-					BIT(DRM_ROTATE_0));
+			drm_mode_plane_set_obj_prop(plane,
+						    dev->mode_config.rotation_property,
+						    BIT(DRM_ROTATE_0));
 		}
 	}
 
include/drm/drm_crtc.h +3 -0
index 0375d75..31344bf 100644
@@ -1127,6 +1127,9 @@ extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 					     struct drm_file *file_priv);
 extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
 					   struct drm_file *file_priv);
+extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+				       struct drm_property *property,
+				       uint64_t value);
 
 extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
 				 int *bpp);
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw
Quoted 12 lines · Thomas Wood

Make sure plane rotation is reset correctly when restoring the fbdev configuration by using drm_mode_plane_set_obj_prop which calls the driver's set_property callback.

The rotation reset feature was introduced in commit 9783de2 (drm:
Resetting rotation property) and the callback issue was originally addressed in a previous version of the patch, but the fix was not present in the final version.

v2: Fix documentation warning
Add some more details to the commit message (Daniel Vetter)

Quoted 7 lines

Testcase: igt/kms_rotation_crc
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82236

Cc Sonika Jindal <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

Queued for -next, thanks for the patch.

Aside: If I've picked up a patch already, I prefer just the fixup diff to squash in. I've kicked out your v1, but if I've frozen down my queue as drm-intel-next already (or done a merge or something else that freezes history) I need the fixup. And squashing in the fixup is not more work than doing the rebase to kick out the old version anyway. And the fixup is easier to review.

Thanks, Daniel

Quoted 92 lines
---
 drivers/gpu/drm/drm_crtc.c      | 25 ++++++++++++++++++++-----
 drivers/gpu/drm/drm_fb_helper.c |  6 +++---
 include/drm/drm_crtc.h          |  3 +++
 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_crtc.c +20 -5
index f09b752..7d7c1fd 100644
@@ -4175,12 +4175,25 @@ static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
 	return ret;
 }
 
-static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
-				      struct drm_property *property,
-				      uint64_t value)
+/**
+ * drm_mode_plane_set_obj_prop - set the value of a property
+ * @plane: drm plane object to set property value for
+ * @property: property to set
+ * @value: value the property should be set to
+ *
+ * This functions sets a given property on a given plane object. This function
+ * calls the driver's ->set_property callback and changes the software state of
+ * the property if the callback succeeds.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+				struct drm_property *property,
+				uint64_t value)
 {
 	int ret = -EINVAL;
-	struct drm_plane *plane = obj_to_plane(obj);
+	struct drm_mode_object *obj = &plane->base;
 
 	if (plane->funcs->set_property)
 		ret = plane->funcs->set_property(plane, property, value);
@@ -4189,6 +4202,7 @@ static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
 
 	return ret;
 }
+EXPORT_SYMBOL(drm_mode_plane_set_obj_prop);
 
 /**
  * drm_mode_getproperty_ioctl - get the current value of a object's property
@@ -4327,7 +4341,8 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
 		ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value);
 		break;
 	case DRM_MODE_OBJECT_PLANE:
-		ret = drm_mode_plane_set_obj_prop(arg_obj, property, arg->value);
+		ret = drm_mode_plane_set_obj_prop(obj_to_plane(arg_obj),
+						  property, arg->value);
 		break;
 	}
 
drivers/gpu/drm/drm_fb_helper.c +3 -3
index 63d7b8e..0c0c39b 100644
@@ -296,9 +296,9 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 			drm_plane_force_disable(plane);
 
 		if (dev->mode_config.rotation_property) {
-			drm_object_property_set_value(&plane->base,
-					dev->mode_config.rotation_property,
-					BIT(DRM_ROTATE_0));
+			drm_mode_plane_set_obj_prop(plane,
+						    dev->mode_config.rotation_property,
+						    BIT(DRM_ROTATE_0));
 		}
 	}
 
include/drm/drm_crtc.h +3 -0
index 0375d75..31344bf 100644
@@ -1127,6 +1127,9 @@ extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 					     struct drm_file *file_priv);
 extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
 					   struct drm_file *file_priv);
+extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
+				       struct drm_property *property,
+				       uint64_t value);
 
 extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
 				 int *bpp);
Signature · 1 line
1.9.3
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch