All of lore.kernel.org
 help / color / mirror / Atom feed
From: sagar.a.kamble@intel.com
To: intel-gfx@lists.freedesktop.org
Cc: Sagar Kamble <sagar.a.kamble@intel.com>,
	airlied@linux.ie, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/4] drm: Adding new flag to restrict bitmask drm properties as 32 bit type and 32 bit value pair
Date: Tue, 25 Mar 2014 20:02:24 +0530	[thread overview]
Message-ID: <1395757947-16492-1-git-send-email-sagar.a.kamble@intel.com> (raw)
In-Reply-To: <20140320135151.GO6912@strange.amr.corp.intel.com>

From: Sagar Kamble <sagar.a.kamble@intel.com>

With this patch new flag DRM_MODE_PROP_32BIT_PAIR is added that will help make use
of 64 bit value of bitmask property as two 32 bit values.

Cc: airlied@linux.ie
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sagar Kamble <sagar.a.kamble@intel.com>
---
 drivers/gpu/drm/drm_crtc.c  | 22 ++++++++++++++++------
 include/uapi/drm/drm_mode.h |  3 +++
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 4e43fc2..d0d03ec 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2993,10 +2993,13 @@ int drm_property_add_enum(struct drm_property *property, int index,
 
 	/*
 	 * Bitmask enum properties have the additional constraint of values
-	 * from 0 to 63
+	 * from 0 to 63. For properties with 32BIT_PAIR Flag set this constraint
+	 * range is 0 to 31.
 	 */
-	if ((property->flags & DRM_MODE_PROP_BITMASK) && (value > 63))
-		return -EINVAL;
+	if (property->flags & DRM_MODE_PROP_BITMASK)
+		if (((property->flags & DRM_MODE_PROP_32BIT_PAIR) && (value > 31)) ||
+		    (value > 63))
+			return -EINVAL;
 
 	if (!list_empty(&property->enum_blob_list)) {
 		list_for_each_entry(prop_enum, &property->enum_blob_list, head) {
@@ -3305,9 +3308,16 @@ static bool drm_property_change_is_valid(struct drm_property *property,
 	} else if (property->flags & DRM_MODE_PROP_BITMASK) {
 		int i;
 		uint64_t valid_mask = 0;
-		for (i = 0; i < property->num_values; i++)
-			valid_mask |= (1ULL << property->values[i]);
-		return !(value & ~valid_mask);
+		uint32_t valid_32bit_mask = 0;
+		if (property->flags & DRM_MODE_PROP_32BIT_PAIR) {
+			for (i = 0; i < property->num_values; i++)
+				valid_32bit_mask |= (1UL << property->values[i]);
+			return !((value & 0xFFFFFFFF) & ~valid_32bit_mask);
+		} else {
+			for (i = 0; i < property->num_values; i++)
+				valid_mask |= (1ULL << property->values[i]);
+			return !(value & ~valid_mask);
+		}
 	} else if (property->flags & DRM_MODE_PROP_BLOB) {
 		/* Only the driver knows */
 		return true;
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index f104c26..5e3a7d9 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -250,6 +250,9 @@ struct drm_mode_get_connector {
 #define DRM_MODE_PROP_ENUM	(1<<3) /* enumerated type with text strings */
 #define DRM_MODE_PROP_BLOB	(1<<4)
 #define DRM_MODE_PROP_BITMASK	(1<<5) /* bitmask of enumerated types */
+#define DRM_MODE_PROP_32BIT_PAIR (1<<6) /* 32 bit bitmask of enumerated types
+					 * and 32 bit of value of the type */
+
 
 struct drm_mode_property_enum {
 	__u64 value;
-- 
1.8.5


WARNING: multiple messages have this Message-ID (diff)
From: sagar.a.kamble@intel.com
To: intel-gfx@lists.freedesktop.org
Cc: airlied@linux.ie, Sagar Kamble <sagar.a.kamble@intel.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [PATCH v2 1/4] drm: Adding new flag to restrict bitmask drm properties as 32 bit type and 32 bit value pair
Date: Tue, 25 Mar 2014 20:02:24 +0530	[thread overview]
Message-ID: <1395757947-16492-1-git-send-email-sagar.a.kamble@intel.com> (raw)
In-Reply-To: <20140320135151.GO6912@strange.amr.corp.intel.com>

From: Sagar Kamble <sagar.a.kamble@intel.com>

With this patch new flag DRM_MODE_PROP_32BIT_PAIR is added that will help make use
of 64 bit value of bitmask property as two 32 bit values.

Cc: airlied@linux.ie
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sagar Kamble <sagar.a.kamble@intel.com>
---
 drivers/gpu/drm/drm_crtc.c  | 22 ++++++++++++++++------
 include/uapi/drm/drm_mode.h |  3 +++
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 4e43fc2..d0d03ec 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2993,10 +2993,13 @@ int drm_property_add_enum(struct drm_property *property, int index,
 
 	/*
 	 * Bitmask enum properties have the additional constraint of values
-	 * from 0 to 63
+	 * from 0 to 63. For properties with 32BIT_PAIR Flag set this constraint
+	 * range is 0 to 31.
 	 */
-	if ((property->flags & DRM_MODE_PROP_BITMASK) && (value > 63))
-		return -EINVAL;
+	if (property->flags & DRM_MODE_PROP_BITMASK)
+		if (((property->flags & DRM_MODE_PROP_32BIT_PAIR) && (value > 31)) ||
+		    (value > 63))
+			return -EINVAL;
 
 	if (!list_empty(&property->enum_blob_list)) {
 		list_for_each_entry(prop_enum, &property->enum_blob_list, head) {
@@ -3305,9 +3308,16 @@ static bool drm_property_change_is_valid(struct drm_property *property,
 	} else if (property->flags & DRM_MODE_PROP_BITMASK) {
 		int i;
 		uint64_t valid_mask = 0;
-		for (i = 0; i < property->num_values; i++)
-			valid_mask |= (1ULL << property->values[i]);
-		return !(value & ~valid_mask);
+		uint32_t valid_32bit_mask = 0;
+		if (property->flags & DRM_MODE_PROP_32BIT_PAIR) {
+			for (i = 0; i < property->num_values; i++)
+				valid_32bit_mask |= (1UL << property->values[i]);
+			return !((value & 0xFFFFFFFF) & ~valid_32bit_mask);
+		} else {
+			for (i = 0; i < property->num_values; i++)
+				valid_mask |= (1ULL << property->values[i]);
+			return !(value & ~valid_mask);
+		}
 	} else if (property->flags & DRM_MODE_PROP_BLOB) {
 		/* Only the driver knows */
 		return true;
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index f104c26..5e3a7d9 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -250,6 +250,9 @@ struct drm_mode_get_connector {
 #define DRM_MODE_PROP_ENUM	(1<<3) /* enumerated type with text strings */
 #define DRM_MODE_PROP_BLOB	(1<<4)
 #define DRM_MODE_PROP_BITMASK	(1<<5) /* bitmask of enumerated types */
+#define DRM_MODE_PROP_32BIT_PAIR (1<<6) /* 32 bit bitmask of enumerated types
+					 * and 32 bit of value of the type */
+
 
 struct drm_mode_property_enum {
 	__u64 value;
-- 
1.8.5

  reply	other threads:[~2014-03-25 14:31 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19 10:08 [RFC 1/1] drm/i915: Added support for setting plane alpha through drm property sagar.a.kamble
2014-02-24 15:44 ` Sagar Arun Kamble
2014-03-06 12:03   ` Damien Lespiau
2014-03-06 12:09     ` Damien Lespiau
2014-02-25 18:18 ` Ville Syrjälä
2014-03-04  9:42   ` [Intel-gfx] " Daniel Vetter
2014-03-04 12:06     ` Ville Syrjälä
2014-03-06 10:28       ` [Intel-gfx] " Sagar Arun Kamble
2014-03-06 11:24         ` Daniel Vetter
2014-03-08  8:21           ` [PATCH 0/4] Adding support for plane alpha/color blending " sagar.a.kamble
2014-03-08  8:21             ` [PATCH 1/4] drm: Added plane alpha and color blending property sagar.a.kamble
2014-03-08  8:21               ` sagar.a.kamble
2014-03-20 11:58               ` [Intel-gfx] " Damien Lespiau
2014-03-20 11:58                 ` Damien Lespiau
2014-03-20 14:21               ` [Intel-gfx] " Damien Lespiau
2014-03-08  8:21             ` [PATCH 2/4] drm/i915: Enabling constant alpha drm property sagar.a.kamble
2014-03-20 13:51               ` Damien Lespiau
2014-03-25 14:32                 ` sagar.a.kamble [this message]
2014-03-25 14:32                   ` [PATCH v2 1/4] drm: Adding new flag to restrict bitmask drm properties as 32 bit type and 32 bit value pair sagar.a.kamble
2014-03-25 14:32                   ` [PATCH v2 2/4] drm: Added plane alpha and color blending property sagar.a.kamble
2014-03-25 14:32                     ` sagar.a.kamble
2014-03-25 14:32                   ` [PATCH v2 3/4] drm/i915: Enabling constant alpha drm property sagar.a.kamble
2014-04-01  4:51                     ` Sagar Arun Kamble
2014-04-02  6:12                       ` Sagar Arun Kamble
2014-04-03  5:43                         ` Sagar Arun Kamble
2014-04-15  9:44                           ` Sagar Arun Kamble
2014-04-15 10:35                             ` Ville Syrjälä
2014-04-15 11:23                               ` Sagar Arun Kamble
2014-04-15 11:44                                 ` Ville Syrjälä
2014-03-25 14:32                   ` [PATCH v2 4/4] Documentation: drm: describing plane alpha and color blending property sagar.a.kamble
2014-03-26 12:30                     ` David Herrmann
2014-03-27  9:03                       ` [PATCH v3 1/1] " sagar.a.kamble
2014-03-27  9:50                         ` sagar.a.kamble
2014-03-27 12:38                           ` David Herrmann
2014-03-27 17:31                             ` [PATCH v4 " sagar.a.kamble
2014-04-10 10:39                   ` [PATCH v2 1/4] drm: Adding new flag to restrict bitmask drm properties as 32 bit type and 32 bit value pair Sagar Arun Kamble
2014-04-10 10:39                     ` Sagar Arun Kamble
2014-03-08  8:21             ` [PATCH 3/4] drm/i915: Enabling pre-multiplied alpha drm property sagar.a.kamble
2014-03-19 15:10               ` Damien Lespiau
2014-03-20  9:59                 ` Sagar Arun Kamble
2014-03-20 11:38                   ` Damien Lespiau
2014-03-20 13:51                     ` Daniel Vetter
2014-03-20 14:00                       ` Damien Lespiau
2014-03-08  8:21             ` [PATCH 4/4] Documentation: drm: describing plane alpha and color blending property sagar.a.kamble
2014-03-10 14:43               ` Laurent Pinchart
2014-03-20 14:11             ` [PATCH 0/4] Adding support for plane alpha/color blending through drm property Damien Lespiau
2014-03-20 14:45               ` Damien Lespiau
2014-03-21 13:36                 ` Sagar Arun Kamble
2014-03-21 19:23                   ` Damien Lespiau
2014-04-02 19:36                     ` Ville Syrjälä
2014-03-25 10:03                   ` Sagar Arun Kamble
2014-03-25 10:51                     ` Daniel Vetter
2014-03-25 12:26                       ` Damien Lespiau

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=1395757947-16492-1-git-send-email-sagar.a.kamble@intel.com \
    --to=sagar.a.kamble@intel.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.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.