All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: [PATCH v13 06/10] drm: Add DRM client cap for aspect-ratio
Date: Wed,  2 May 2018 12:20:18 +0530	[thread overview]
Message-ID: <1525243822-19308-7-git-send-email-ankit.k.nautiyal@intel.com> (raw)
In-Reply-To: <1525243822-19308-1-git-send-email-ankit.k.nautiyal@intel.com>

From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>

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

Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/drm_ioctl.c | 9 +++++++++
 include/drm/drm_file.h      | 8 ++++++++
 include/uapi/drm/drm.h      | 7 +++++++
 3 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index af78291..0379983 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -324,6 +324,15 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
 			return -EINVAL;
 		file_priv->atomic = req->value;
 		file_priv->universal_planes = req->value;
+		/*
+		 * No atomic user-space blows up on aspect ratio mode bits.
+		 */
+		file_priv->aspect_ratio_allowed = 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 5176c37..02b7dde 100644
--- a/include/drm/drm_file.h
+++ b/include/drm/drm_file.h
@@ -182,6 +182,14 @@ struct drm_file {
 	unsigned atomic:1;
 
 	/**
+	 * @aspect_ratio_allowed:
+	 *
+	 * True, if client can handle picture aspect ratios, and has requested
+	 * to pass this information along with the 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..9c660e1 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 provide aspect ratio information in modes.
+ */
+#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

  parent reply	other threads:[~2018-05-02  6:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02  6:50 [PATCH v13 00/10] Aspect ratio support in DRM layer Nautiyal, Ankit K
2018-05-02  6:50 ` [PATCH v13 01/10] drm/modes: Introduce drm_mode_match() Nautiyal, Ankit K
2018-05-02  6:50 ` [PATCH v13 02/10] drm/edid: Use drm_mode_match_no_clocks_no_stereo() for consistentcy Nautiyal, Ankit K
2018-05-02  6:50 ` [PATCH v13 03/10] drm/edid: Fix cea mode aspect ratio handling Nautiyal, Ankit K
2018-05-02  6:50 ` [PATCH v13 04/10] drm/edid: Don't send bogus aspect ratios in AVI infoframes Nautiyal, Ankit K
2018-05-02  6:50 ` [PATCH v13 05/10] video/hdmi: Reject illegal picture aspect ratios Nautiyal, Ankit K
2018-05-02  6:50 ` Nautiyal, Ankit K [this message]
2018-05-02  7:52   ` [Intel-gfx] [PATCH v13 06/10] drm: Add DRM client cap for aspect-ratio Daniel Vetter
2018-05-02  6:50 ` [PATCH v13 07/10] drm: Handle aspect ratio info in legacy modeset path Nautiyal, Ankit K
2018-05-02  7:56   ` [Intel-gfx] " Daniel Vetter
2018-05-02  6:50 ` [PATCH v13 08/10] drm: Expose modes with aspect ratio, only if requested Nautiyal, Ankit K
2018-05-03  6:26   ` Daniel Vetter
2018-05-04 20:19     ` Ville Syrjälä
2018-05-07  5:04       ` Nautiyal, Ankit K
2018-05-07 12:28         ` Ville Syrjälä
2018-05-07 12:52           ` Nautiyal, Ankit K
2018-05-07 13:36       ` Daniel Vetter
2018-05-02  6:50 ` [PATCH v13 09/10] drm: Add aspect ratio parsing in DRM layer Nautiyal, Ankit K
2018-05-02  6:50 ` [PATCH v13 10/10] drm: Add and handle new aspect ratios " Nautiyal, Ankit K
2018-05-02 10:00 ` ✗ Fi.CI.CHECKPATCH: warning for Aspect ratio support " Patchwork
2018-05-02 10:15 ` ✓ Fi.CI.BAT: success " Patchwork
2018-05-02 12:44 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1525243822-19308-7-git-send-email-ankit.k.nautiyal@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.