Skip to contentSkip to conversation

Additional drm properties patches

PATCH In review Rob Clark 2 participants 6 messages May 16, 2012 – May 17, 2012

Subsystems (2)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

cover Additional drm properties patches

From: Rob Clark <[email protected]>

Additional drm properties support, the libdrm part. These apply on top of Paulo's libdrm properties patches, and add support for bitmask properties, and additional support in modetest.

Rob Clark (3):
Add support for bitmask properties
modetest: support bitmask properties
modetest: support plane properties

 include/drm/drm_mode.h    |    1 +
 tests/modetest/modetest.c |   22 ++++++++++++++++++++++
 xf86drmMode.c             |    4 ++--
 3 files changed, 25 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/3 Add support for bitmask properties

From: Rob Clark <[email protected]>

A bitmask property is similar to an enum. The enum value is a bit position (0-63), and valid property values consist of a mask of zero or more of (1 << enum_val[n]).

---
 include/drm/drm_mode.h |    1 +
 xf86drmMode.c          |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
include/drm/drm_mode.h +1 -0
index f303d94..62ba997 100644
@@ -226,6 +226,7 @@ struct drm_mode_get_connector {
 #define DRM_MODE_PROP_IMMUTABLE	(1<<2)
 #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 */
 
 struct drm_mode_property_enum {
 	__u64 value;
xf86drmMode.c +2 -2
index a60c7cb..04fdf1f 100644
@@ -575,7 +575,7 @@ drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
 	if (prop.count_values)
 		prop.values_ptr = VOID2U64(drmMalloc(prop.count_values * sizeof(uint64_t)));
 
-	if (prop.count_enum_blobs && (prop.flags & DRM_MODE_PROP_ENUM))
+	if (prop.count_enum_blobs && (prop.flags & (DRM_MODE_PROP_ENUM | DRM_MODE_PROP_BITMASK)))
 		prop.enum_blob_ptr = VOID2U64(drmMalloc(prop.count_enum_blobs * sizeof(struct drm_mode_property_enum)));
 
 	if (prop.count_enum_blobs && (prop.flags & DRM_MODE_PROP_BLOB)) {
@@ -597,7 +597,7 @@ drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
 	r->flags = prop.flags;
 	if (prop.count_values)
 		r->values = drmAllocCpy(U642VOID(prop.values_ptr), prop.count_values, sizeof(uint64_t));
-	if (prop.flags & DRM_MODE_PROP_ENUM) {
+	if (prop.flags & (DRM_MODE_PROP_ENUM | DRM_MODE_PROP_BITMASK)) {
 		r->count_enums = prop.count_enum_blobs;
 		r->enums = drmAllocCpy(U642VOID(prop.enum_blob_ptr), prop.count_enum_blobs, sizeof(struct drm_mode_property_enum));
 	} else if (prop.flags & DRM_MODE_PROP_BLOB) {
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/3 modetest: support bitmask properties

In reply to Rob Clark

From: Rob Clark <[email protected]>

Add support to display bitmask properties.

---
 tests/modetest/modetest.c |    8 ++++++++
 1 file changed, 8 insertions(+)
tests/modetest/modetest.c +8 -0
index ce57e65..dea271a 100644
@@ -207,6 +207,8 @@ dump_prop(uint32_t prop_id, uint64_t value)
 		printf(" immutable");
 	if (prop->flags & DRM_MODE_PROP_ENUM)
 		printf(" enum");
+	if (prop->flags & DRM_MODE_PROP_BITMASK)
+		printf(" bitmask");
 	if (prop->flags & DRM_MODE_PROP_BLOB)
 		printf(" blob");
 	printf("\n");
@@ -224,6 +226,12 @@ dump_prop(uint32_t prop_id, uint64_t value)
 			printf(" %s=%llu", prop->enums[i].name,
 			       prop->enums[i].value);
 		printf("\n");
+	} else if (prop->flags & DRM_MODE_PROP_BITMASK) {
+		printf("\t\tvalues:");
+		for (i = 0; i < prop->count_enums; i++)
+			printf(" %s=0x%llx", prop->enums[i].name,
+			       (1LL << prop->enums[i].value));
+		printf("\n");
 	} else {
 		assert(prop->count_enums == 0);
 	}
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH 3/3 modetest: support plane properties

In reply to Rob Clark

From: Rob Clark <[email protected]>

Add support to display plane properties.

---
 tests/modetest/modetest.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
tests/modetest/modetest.c +14 -0
index dea271a..dc84cf3 100644
@@ -369,6 +369,7 @@ void dump_framebuffers(void)
 
 static void dump_planes(void)
 {
+	drmModeObjectPropertiesPtr props;
 	drmModePlaneRes *plane_resources;
 	drmModePlane *ovr;
 	unsigned int i, j;
@@ -403,6 +404,19 @@ static void dump_planes(void)
 			printf(" %4.4s", (char *)&ovr->formats[j]);
 		printf("\n");
 
+		printf("  props:\n");
+		props = drmModeObjectGetProperties(fd, ovr->plane_id,
+						   DRM_MODE_OBJECT_PLANE);
+		if (props) {
+			for (j = 0; j < props->count_props; j++)
+				dump_prop(props->props[j],
+					  props->prop_values[j]);
+			drmModeFreeObjectProperties(props);
+		} else {
+			printf("\tcould not get plane properties: %s\n",
+			       strerror(errno));
+		}
+
 		drmModeFreePlane(ovr);
 	}
 	printf("\n");
Signature · 1 line
1.7.9.5
Reviewed-by on the v1 series
#4 lore raw
In reply to Rob Clark

2012/5/16 Rob Clark <[email protected]>:

Quoted 10 lines

From: Rob Clark <[email protected]>

Additional drm properties support, the libdrm part.  These apply on top of Paulo's libdrm properties patches, and add support for bitmask properties, and additional support in modetest.

Rob Clark (3):
 Add support for bitmask properties
 modetest: support bitmask properties
 modetest: support plane properties

For the 3 patches:

You might want to create patch 0004 adding support for the proptest tool... It might help you test stuff.

Quoted 13 lines

 include/drm/drm_mode.h    |    1 + tests/modetest/modetest.c |   22 ++++++++++++++++++++++ xf86drmMode.c             |    4 ++--

 3 files changed, 25 insertions(+), 2 deletions(-)

--
1.7.9.5

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 1 line
Paulo Zanoni
author
#5 lore raw
Quoted 13 lines · Paulo Zanoni

2012/5/16 Rob Clark <[email protected]>:

Quoted 10 lines

From: Rob Clark <[email protected]>

Additional drm properties support, the libdrm part.  These apply on top of Paulo's libdrm properties patches, and add support for bitmask properties, and additional support in modetest.

Rob Clark (3):
 Add support for bitmask properties
 modetest: support bitmask properties
 modetest: support plane properties

Quoted 5 lines

For the 3 patches:

You might want to create patch 0004 adding support for the proptest tool... It might help you test stuff.

oh, yeah, that is a good idea.. it might be some days before I have a chance to do this, but I guess it doesn't hold anything up. I'll certainly add it when I get a chance.

BR,
-R

Quoted 22 lines
Quoted 6 lines

 include/drm/drm_mode.h    |    1 + tests/modetest/modetest.c |   22 ++++++++++++++++++++++ xf86drmMode.c             |    4 ++--

 3 files changed, 25 insertions(+), 2 deletions(-)
Quoted 7 lines

--
1.7.9.5

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Paulo Zanoni
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel