From: aknautiy <ankit.k.nauti...@intel.com>

A new drm client cap is required to enable user-space to advertise
if it supports modes with aspect-ratio. Based on this cap value, the
kernel will take a call on exposing the aspect ratio information in
modes or not.

This patch adds the client cap for aspect-ratio.

Cc: Ville Syrjala <ville.syrj...@linux.intel.com>
Cc: Shashank Sharma <shashank.sha...@intel.com>
Signed-off-by: aknautiy <ankit.k.nauti...@intel.com>
---
 drivers/gpu/drm/drm_ioctl.c | 5 +++++
 include/drm/drm_file.h      | 7 +++++++
 include/uapi/drm/drm.h      | 7 +++++++
 3 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 4aafe48..e092550 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -325,6 +325,11 @@ drm_setclientcap(struct drm_device *dev, void *data, 
struct drm_file *file_priv)
                file_priv->atomic = req->value;
                file_priv->universal_planes = req->value;
                break;
+       case DRM_CLIENT_CAP_ASPECT_RATIO:
+               if (req->value > 1)
+                       return -EINVAL;
+               file_priv->aspect_ratio_allowed = req->value;
+               break;
        default:
                return -EINVAL;
        }
diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
index 0e0c868..6e0e435 100644
--- a/include/drm/drm_file.h
+++ b/include/drm/drm_file.h
@@ -182,6 +182,13 @@ struct drm_file {
        unsigned atomic:1;
 
        /**
+        * @aspect_ratio_allowed:
+        *
+        * True if client has asked to expose the aspect-ratio flags with mode.
+        */
+       unsigned aspect_ratio_allowed:1;
+
+       /**
         * @is_master:
         *
         * This client is the creator of @master. Protected by struct
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 6fdff59..fe5f531 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -680,6 +680,13 @@ struct drm_get_cap {
  */
 #define DRM_CLIENT_CAP_ATOMIC  3
 
+/**
+ * DRM_CLIENT_CAP_ASPECT_RATIO
+ *
+ * If set to 1, the DRM core will expose aspect ratio flags to userspace.
+ */
+#define DRM_CLIENT_CAP_ASPECT_RATIO    4
+
 /** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
 struct drm_set_client_cap {
        __u64 capability;
-- 
2.7.4

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

Reply via email to