Skip to content

Commit 7595bda

Browse files
aknautiyalmlankhorst
authored andcommitted
drm: Add DRM client cap for aspect-ratio
To enable aspect-ratio support in DRM, blindly exposing the aspect ratio information along with mode, can break things in existing non-atomic user-spaces which have no intention or support to use this aspect ratio information. To avoid this, a new drm client cap is required to enable a non-atomic 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 info in modes or not. This patch adds the client cap for aspect-ratio. Since no atomic-userspaces blow up on receiving aspect-ratio information, the client cap for aspect-ratio is always enabled for atomic clients. Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Cc: Shashank Sharma <shashank.sharma@intel.com> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com> V3: rebase V4: As suggested by Marteen Lankhorst modified the commit message explaining the need to use the DRM cap for aspect-ratio. Also, tweaked the comment lines in the code for better understanding and clarity, as recommended by Shashank Sharma. V5: rebase V6: rebase V7: rebase V8: rebase V9: rebase V10: rebase V11: rebase V12: As suggested by Daniel Vetter and Ville Syrjala, always enable aspect-ratio client cap for atomic userspaces, if no atomic userspace breaks on aspect-ratio bits. V13: rebase V14: rebase Reviewed-by: Shashank Sharma <shashank.sharma@intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/1525777785-9740-7-git-send-email-ankit.k.nautiyal@intel.com
1 parent bfe2e2c commit 7595bda

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

‎drivers/gpu/drm/drm_ioctl.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,15 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
324324
return -EINVAL;
325325
file_priv->atomic = req->value;
326326
file_priv->universal_planes = req->value;
327+
/*
328+
* No atomic user-space blows up on aspect ratio mode bits.
329+
*/
330+
file_priv->aspect_ratio_allowed = req->value;
331+
break;
332+
case DRM_CLIENT_CAP_ASPECT_RATIO:
333+
if (req->value > 1)
334+
return -EINVAL;
335+
file_priv->aspect_ratio_allowed = req->value;
327336
break;
328337
default:
329338
return -EINVAL;

‎include/drm/drm_file.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ struct drm_file {
180180
/** @atomic: True if client understands atomic properties. */
181181
unsigned atomic:1;
182182

183+
/**
184+
* @aspect_ratio_allowed:
185+
*
186+
* True, if client can handle picture aspect ratios, and has requested
187+
* to pass this information along with the mode.
188+
*/
189+
unsigned aspect_ratio_allowed:1;
190+
183191
/**
184192
* @is_master:
185193
*

‎include/uapi/drm/drm.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,13 @@ struct drm_get_cap {
680680
*/
681681
#define DRM_CLIENT_CAP_ATOMIC 3
682682

683+
/**
684+
* DRM_CLIENT_CAP_ASPECT_RATIO
685+
*
686+
* If set to 1, the DRM core will provide aspect ratio information in modes.
687+
*/
688+
#define DRM_CLIENT_CAP_ASPECT_RATIO 4
689+
683690
/** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
684691
struct drm_set_client_cap {
685692
__u64 capability;

0 commit comments

Comments
 (0)