Add a new property for enabling/disabling async flip on a plane for
atomic path. Certain vendors have support for async flip on more than
one plane and with the present implementation using the flag, async flip
can be enabled on only one plane.
Adding a plane property for async flip enables driver to allow async
flip on multiple planes in atomic path.

Signed-off-by: Arun R Murthy <[email protected]>
---
 drivers/gpu/drm/drm_atomic_uapi.c |  4 ++++
 drivers/gpu/drm/drm_plane.c       | 31 +++++++++++++++++++++++++++++++
 include/drm/drm_plane.h           | 12 ++++++++++++
 3 files changed, 47 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c 
b/drivers/gpu/drm/drm_atomic_uapi.c
index 
85dbdaa4a2e25878c953b9b41539c8566d55c6d9..7773e0057302fccb57df8067f417b23a9cb9fcde
 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -550,6 +550,8 @@ static int drm_atomic_plane_set_property(struct drm_plane 
*plane,
                return ret;
        } else if (property == plane->scaling_filter_property) {
                state->scaling_filter = val;
+       } else if (property == plane->async_flip_property) {
+               state->async_flip = val;
        } else if (plane->funcs->atomic_set_property) {
                return plane->funcs->atomic_set_property(plane, state,
                                property, val);
@@ -627,6 +629,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
                        state->fb_damage_clips->base.id : 0;
        } else if (property == plane->scaling_filter_property) {
                *val = state->scaling_filter;
+       } else if (property == plane->async_flip_property) {
+               *val = state->async_flip;
        } else if (plane->funcs->atomic_get_property) {
                return plane->funcs->atomic_get_property(plane, state, 
property, val);
        } else if (property == plane->hotspot_x_property) {
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 
38f82391bfda578d532499585066dd85ff573910..da486defed87eeb01dd9ad5f3d791900286f9f34
 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1820,3 +1820,34 @@ int drm_plane_add_size_hints_property(struct drm_plane 
*plane,
        return 0;
 }
 EXPORT_SYMBOL(drm_plane_add_size_hints_property);
+
+/**
+ * drm_plane_create_async_flip_property - create asynchronous flip property
+ *
+ * @plane: drm plane
+ *
+ * Create a property to enable/disable asynchronous flip on the plane.
+ *
+ * RETURNS:
+ * Zero for success or -errno
+ */
+int drm_plane_create_async_flip_property(struct drm_plane *plane)
+{
+       struct drm_property *prop;
+
+       prop = drm_property_create_bool(plane->dev, DRM_MODE_PROP_IMMUTABLE,
+                                       "async_flip");
+
+       if (!prop)
+               return -ENOMEM;
+
+       drm_object_attach_property(&plane->base, prop, false);
+
+       plane->async_flip_property = prop;
+
+       if (plane->state)
+               plane->state->async_flip = false;
+
+       return 0;
+}
+EXPORT_SYMBOL(drm_plane_create_async_flip_property);
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 
01479dd94e76a8389a0c9e9d6744400aa2291064..b649c57437a8303be094e652ed5be7a735f6f5e0
 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -260,6 +260,12 @@ struct drm_plane_state {
         * flow.
         */
        bool color_mgmt_changed : 1;
+
+       /**
+        * @async_flip: Indicate that the present plane is asynchronous flip
+        * mode.
+        */
+       bool async_flip;
 };
 
 static inline struct drm_rect
@@ -799,6 +805,11 @@ struct drm_plane {
         */
        struct drm_property *hotspot_y_property;
 
+       /**
+        * @async_flip_property: property to set asynchronous flip on the plane
+        */
+       struct drm_property *async_flip_property;
+
        /**
         * @kmsg_panic: Used to register a panic notifier for this plane
         */
@@ -1005,5 +1016,6 @@ int drm_plane_create_scaling_filter_property(struct 
drm_plane *plane,
 int drm_plane_add_size_hints_property(struct drm_plane *plane,
                                      const struct drm_plane_size_hint *hints,
                                      int num_hints);
+int drm_plane_create_async_flip_property(struct drm_plane *plane);
 
 #endif

-- 
2.25.1

Reply via email to