Skip to contentSkip to conversation

Latest properties patches

PATCH In review Rob Clark 2 participants 12 messages Jun 5, 2012 – Jun 7, 2012

Subsystems (2)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

cover Latest properties patches

From: Rob Clark <[email protected]>

The first 6 patches are a re-send of what has already been sent by Paulo and myself, and the last two add bitmask and plane properties support to proptest as suggested by Paulo.

I can push these to libdrm git tree if ok.

Paulo Zanoni (3):
Add support for generic object properties IOCTLs
modetest: print CRTC properties
tests: add proptest

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

 configure.ac               |    1 +
 include/drm/drm.h          |    2 +
 include/drm/drm_mode.h     |   25 ++++
 tests/Makefile.am          |    2 +-
 tests/modetest/modetest.c  |   37 +++++
 tests/proptest/Makefile.am |   11 ++
 tests/proptest/proptest.c  |  357 ++++++++++++++++++++++++++++++++++++++++++++
 xf86drmMode.c              |   87 ++++++++++-
 xf86drmMode.h              |   14 ++
 9 files changed, 533 insertions(+), 3 deletions(-)
 create mode 100644 tests/proptest/Makefile.am
 create mode 100644 tests/proptest/proptest.c
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/8 Add support for generic object properties IOCTLs

From: Paulo Zanoni <[email protected]>

New library calls:
- drmModeObjectGetProperties
- drmModeFreeObjectProperties
- drmModeObjectSetProperties

---
 include/drm/drm.h      |    2 ++
 include/drm/drm_mode.h |   24 ++++++++++++++
 xf86drmMode.c          |   83 ++++++++++++++++++++++++++++++++++++++++++++++++
 xf86drmMode.h          |   14 ++++++++
 4 files changed, 123 insertions(+)
include/drm/drm.h +2 -0
index 753d2fc..5e6cd29 100644
@@ -731,6 +731,8 @@ struct drm_prime_handle {
 #define DRM_IOCTL_MODE_GETPLANE	DRM_IOWR(0xB6, struct drm_mode_get_plane)
 #define DRM_IOCTL_MODE_SETPLANE	DRM_IOWR(0xB7, struct drm_mode_set_plane)
 #define DRM_IOCTL_MODE_ADDFB2		DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
+#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES	DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)
+#define DRM_IOCTL_MODE_OBJ_SETPROPERTY	DRM_IOWR(0xBA, struct drm_mode_obj_set_property)
 
 /**
  * Device specific ioctls should only be in their respective headers
include/drm/drm_mode.h +24 -0
index f36c61a..f303d94 100644
@@ -250,6 +250,30 @@ struct drm_mode_connector_set_property {
 	__u32 connector_id;
 };
 
+#define DRM_MODE_OBJECT_CRTC 0xcccccccc
+#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
+#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
+#define DRM_MODE_OBJECT_MODE 0xdededede
+#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
+#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
+#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
+#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
+
+struct drm_mode_obj_get_properties {
+	__u64 props_ptr;
+	__u64 prop_values_ptr;
+	__u32 count_props;
+	__u32 obj_id;
+	__u32 obj_type;
+};
+
+struct drm_mode_obj_set_property {
+	__u64 value;
+	__u32 prop_id;
+	__u32 obj_id;
+	__u32 obj_type;
+};
+
 struct drm_mode_get_blob {
 	__u32 blob_id;
 	__u32 length;
xf86drmMode.c +83 -0

86 lines not on this page · raw message

xf86drmMode.h +14 -0
index 991e3f9..8e40034 100644
@@ -281,6 +281,12 @@ typedef struct _drmModeConnector {
 	uint32_t *encoders; /**< List of encoder ids */
 } drmModeConnector, *drmModeConnectorPtr;
 
+typedef struct _drmModeObjectProperties {
+	uint32_t count_props;
+	uint32_t *props;
+	uint64_t *prop_values;
+} drmModeObjectProperties, *drmModeObjectPropertiesPtr;
+
 typedef struct _drmModePlane {
 	uint32_t count_formats;
 	uint32_t *formats;
@@ -428,6 +434,14 @@ extern int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
 			   uint32_t src_x, uint32_t src_y,
 			   uint32_t src_w, uint32_t src_h);
 
+extern drmModeObjectPropertiesPtr drmModeObjectGetProperties(int fd,
+							uint32_t object_id,
+							uint32_t object_type);
+extern void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr);
+extern int drmModeObjectSetProperty(int fd, uint32_t object_id,
+				    uint32_t object_type, uint32_t property_id,
+				    uint64_t value);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/8 modetest: print CRTC properties

In reply to Rob Clark

From: Paulo Zanoni <[email protected]>

---
 tests/modetest/modetest.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
tests/modetest/modetest.c +15 -0
index 8012ecc..ce57e65 100644
@@ -295,7 +295,9 @@ void dump_connectors(void)
 void dump_crtcs(void)
 {
 	drmModeCrtc *crtc;
+	drmModeObjectPropertiesPtr props;
 	int i;
+	uint32_t j;
 
 	printf("CRTCs:\n");
 	printf("id\tfb\tpos\tsize\n");
@@ -314,6 +316,19 @@ void dump_crtcs(void)
 		       crtc->width, crtc->height);
 		dump_mode(&crtc->mode);
 
+		printf("  props:\n");
+		props = drmModeObjectGetProperties(fd, crtc->crtc_id,
+						   DRM_MODE_OBJECT_CRTC);
+		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 crtc properties: %s\n",
+			       strerror(errno));
+		}
+
 		drmModeFreeCrtc(crtc);
 	}
 	printf("\n");
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH 3/8 tests: add proptest

In reply to Rob Clark

From: Paulo Zanoni <[email protected]>

A small program that allows us to see and modify properties.

---
 configure.ac               |    1 +
 tests/Makefile.am          |    2 +-
 tests/proptest/Makefile.am |   11 ++
 tests/proptest/proptest.c  |  317 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 330 insertions(+), 1 deletion(-)
 create mode 100644 tests/proptest/Makefile.am
 create mode 100644 tests/proptest/proptest.c
configure.ac +1 -0
index e6e9a9f..73558ce 100644
@@ -329,6 +329,7 @@ AC_CONFIG_FILES([
 	tests/modeprint/Makefile
 	tests/modetest/Makefile
 	tests/kmstest/Makefile
+	tests/proptest/Makefile
 	tests/radeon/Makefile
 	tests/vbltest/Makefile
 	include/Makefile
tests/Makefile.am +1 -1
index a3a59bd..1442854 100644
@@ -10,7 +10,7 @@ check_PROGRAMS = \
 	dristat \
 	drmstat
 
-SUBDIRS = modeprint
+SUBDIRS = modeprint proptest
 
 if HAVE_LIBKMS
 SUBDIRS += kmstest modetest
tests/proptest/Makefile.am new file +11 -0
new file mode 100644
index 0000000..f81a3c0
@@ -0,0 +1,11 @@
+AM_CFLAGS = \
+	-I$(top_srcdir)/include/drm \
+	-I$(top_srcdir)
+
+noinst_PROGRAMS = \
+	proptest
+
+proptest_SOURCES = \
+	proptest.c
+proptest_LDADD = \
+	$(top_builddir)/libdrm.la
tests/proptest/proptest.c new file +317 -0

317 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#4 lore raw

Re: [PATCH libdrm 3/8] tests: add proptest

Hi, Rob and Paulo.

Quoted 205 lines · Rob Clark

From: Paulo Zanoni<[email protected]>

A small program that allows us to see and modify properties.

---
  configure.ac               |    1 +
  tests/Makefile.am          |    2 +-
  tests/proptest/Makefile.am |   11 ++
  tests/proptest/proptest.c  |  317 ++++++++++++++++++++++++++++++++++++++++++++
  4 files changed, 330 insertions(+), 1 deletion(-)

create mode 100644 tests/proptest/Makefile.am
create mode 100644 tests/proptest/proptest.c

configure.ac +1 -0
index e6e9a9f..73558ce 100644
@@ -329,6 +329,7 @@ AC_CONFIG_FILES([
  	tests/modeprint/Makefile
  	tests/modetest/Makefile
  	tests/kmstest/Makefile
+	tests/proptest/Makefile
  	tests/radeon/Makefile
  	tests/vbltest/Makefile
  	include/Makefile
tests/Makefile.am +1 -1
index a3a59bd..1442854 100644
@@ -10,7 +10,7 @@ check_PROGRAMS = \
  	dristat \
  	drmstat
 
-SUBDIRS = modeprint
+SUBDIRS = modeprint proptest
 
  if HAVE_LIBKMS
  SUBDIRS += kmstest modetest
tests/proptest/Makefile.am new file +11 -0
new file mode 100644
index 0000000..f81a3c0
@@ -0,0 +1,11 @@
+AM_CFLAGS = \
+	-I$(top_srcdir)/include/drm \
+	-I$(top_srcdir)
+
+noinst_PROGRAMS = \
+	proptest
+
+proptest_SOURCES = \
+	proptest.c
+proptest_LDADD = \
+	$(top_builddir)/libdrm.la
tests/proptest/proptest.c new file +142 -0
new file mode 100644
index 0000000..52896fe
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Paulo Zanoni<[email protected]>
+ *
+ */
+
+#include<assert.h>
+#include<errno.h>
+#include<inttypes.h>
+#include<stdlib.h>
+#include<stdio.h>
+#include<string.h>
+
+#include "xf86drm.h"
+#include "xf86drmMode.h"
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+int fd;
+drmModeResPtr res = NULL;
+
+const char *connector_type_str(uint32_t type)
+{
+	switch (type) {
+	case DRM_MODE_CONNECTOR_Unknown:
+		return "Unknown";
+	case DRM_MODE_CONNECTOR_VGA:
+		return "VGA";
+	case DRM_MODE_CONNECTOR_DVII:
+		return "DVI-I";
+	case DRM_MODE_CONNECTOR_DVID:
+		return "DVI-D";
+	case DRM_MODE_CONNECTOR_DVIA:
+		return "DVI-A";
+	case DRM_MODE_CONNECTOR_Composite:
+		return "Composite";
+	case DRM_MODE_CONNECTOR_SVIDEO:
+		return "SVIDEO";
+	case DRM_MODE_CONNECTOR_LVDS:
+		return "LVDS";
+	case DRM_MODE_CONNECTOR_Component:
+		return "Component";
+	case DRM_MODE_CONNECTOR_9PinDIN:
+		return "9PinDin";
+	case DRM_MODE_CONNECTOR_DisplayPort:
+		return "DisplayPort";
+	case DRM_MODE_CONNECTOR_HDMIA:
+		return "HDMI-A";
+	case DRM_MODE_CONNECTOR_HDMIB:
+		return "HDMI-B";
+	case DRM_MODE_CONNECTOR_TV:
+		return "TV";
+	case DRM_MODE_CONNECTOR_eDP:
+		return "eDP";
+	default:
+		return "Invalid";
+	}
+}
+
+/* dump_blob and dump_prop shamelessly copied from ../modetest/modetest.c */
+static void
+dump_blob(uint32_t blob_id)
+{
+	uint32_t i;
+	unsigned char *blob_data;
+	drmModePropertyBlobPtr blob;
+
+	blob = drmModeGetPropertyBlob(fd, blob_id);
+	if (!blob)
+		return;
+
+	blob_data = blob->data;
+
+	for (i = 0; i<  blob->length; i++) {
+		if (i % 16 == 0)
+			printf("\n\t\t\t");
+		printf("%.2hhx", blob_data[i]);
+	}
+	printf("\n");
+
+	drmModeFreePropertyBlob(blob);
+}
+
+static void
+dump_prop(uint32_t prop_id, uint64_t value)
+{
+	int i;
+	drmModePropertyPtr prop;
+
+	prop = drmModeGetProperty(fd, prop_id);
+
+	printf("\t%d", prop_id);
+	if (!prop) {
+		printf("\n");
+		return;
+	}
+
+	printf(" %s:\n", prop->name);
+
+	printf("\t\tflags:");
+	if (prop->flags&  DRM_MODE_PROP_PENDING)
+		printf(" pending");
+	if (prop->flags&  DRM_MODE_PROP_RANGE)
+		printf(" range");
+	if (prop->flags&  DRM_MODE_PROP_IMMUTABLE)
+		printf(" immutable");
+	if (prop->flags&  DRM_MODE_PROP_ENUM)
+		printf(" enum");
+	if (prop->flags&  DRM_MODE_PROP_BLOB)
+		printf(" blob");
+	printf("\n");
+
+	if (prop->flags&  DRM_MODE_PROP_RANGE) {
+		printf("\t\tvalues:");
+		for (i = 0; i<  prop->count_values; i++)
+			printf(" %"PRIu64, prop->values[i]);
+		printf("\n");
+	}
+
+	if (prop->flags&  DRM_MODE_PROP_ENUM) {
+		printf("\t\tenums:");

tests/proptest/proptest.c line 152

Quoted 10 lines
tests/proptest/proptest.c new file +10 -0
+		for (i = 0; i<  prop->count_enums; i++)
+			printf(" %s=%llu", prop->enums[i].name,
+			       prop->enums[i].value);
+		printf("\n");
+	} else {
+		assert(prop->count_enums == 0);
+	}
+
+	if (prop->flags&  DRM_MODE_PROP_BLOB) {
+		printf("\t\tblobs:\n");

"\n" seems to be unnecessary.

tests/proptest/proptest.c line 162

Quoted 10 lines
tests/proptest/proptest.c new file +10 -0
+		for (i = 0; i<  prop->count_blobs; i++)
+			dump_blob(prop->blob_ids[i]);
+		printf("\n");
+	} else {
+		assert(prop->count_blobs == 0);
+	}
+
+	printf("\t\tvalue:");
+	if (prop->flags&  DRM_MODE_PROP_BLOB)
+		dump_blob(value);

Here needs printf("\n");

Quoted 108 lines
tests/proptest/proptest.c new file +108 -0
+	else
+		printf(" %"PRIu64"\n", value);
+
+	drmModeFreeProperty(prop);
+}
+
+static void listObjectProperties(uint32_t id, uint32_t type)
+{
+	unsigned int i;
+	drmModeObjectPropertiesPtr props;
+
+	props = drmModeObjectGetProperties(fd, id, type);
+
+	if (!props) {
+		printf("\tNo properties: %s.\n", strerror(errno));
+		return;
+	}
+
+	for (i = 0; i<  props->count_props; i++)
+		dump_prop(props->props[i], props->prop_values[i]);
+
+	drmModeFreeObjectProperties(props);
+}
+
+static void listConnectorProperties(void)
+{
+	int i;
+	drmModeConnectorPtr c;
+
+	for (i = 0; i<  res->count_connectors; i++) {
+		c = drmModeGetConnector(fd, res->connectors[i]);
+
+		if (!c) {
+			fprintf(stderr, "Could not get connector %u: %s\n",
+				res->connectors[i], strerror(errno));
+			continue;
+		}
+
+		printf("Connector %u (%s-%u)\n", c->connector_id,
+		       connector_type_str(c->connector_type),
+		       c->connector_type_id);
+
+		listObjectProperties(c->connector_id,
+				     DRM_MODE_OBJECT_CONNECTOR);
+
+		drmModeFreeConnector(c);
+	}
+}
+
+static void listCrtcProperties(void)
+{
+	int i;
+	drmModeCrtcPtr c;
+
+	for (i = 0; i<  res->count_crtcs; i++) {
+		c = drmModeGetCrtc(fd, res->crtcs[i]);
+
+		if (!c) {
+			fprintf(stderr, "Could not get crtc %u: %s\n",
+				res->crtcs[i], strerror(errno));
+			continue;
+		}
+
+		printf("CRTC %u\n", c->crtc_id);
+
+		listObjectProperties(c->crtc_id, DRM_MODE_OBJECT_CRTC);
+
+		drmModeFreeCrtc(c);
+	}
+}
+
+static void listAllProperties(void)
+{
+	listConnectorProperties();
+	listCrtcProperties();
+}
+
+static int setProperty(char *argv[])
+{
+	uint32_t obj_id, obj_type, prop_id;
+	uint64_t value;
+
+	obj_id = atoi(argv[1]);
+
+	if (!strcmp(argv[2], "connector")) {
+		obj_type = DRM_MODE_OBJECT_CONNECTOR;
+	} else if (!strcmp(argv[2], "crtc")) {
+		obj_type = DRM_MODE_OBJECT_CRTC;
+	} else {
+		fprintf(stderr, "Invalid object type.\n");
+		return 1;
+	}
+
+	prop_id = atoi(argv[3]);
+	value = atoll(argv[4]);
+
+	return drmModeObjectSetProperty(fd, obj_id, obj_type, prop_id, value);
+}
+
+static void printUsage(void)
+{
+	printf("Usage:\n"
+"  proptest\n"
+"  proptest [obj id] [obj type] [prop id] [value]\n"
+"\n"
+"The first form just prints all the existing properties. The second one is\n"
+"used to set the value of a specified property. The object type can be one of\n"
+"the following strings:\n"

tests/proptest/proptest.c line 280

Quoted 10 lines
tests/proptest/proptest.c new file +10 -0
+"  connector crtc\n"
+"\n"
+"Example:\n"
+"  proptest 7 connector 2 1\n"
+"will set property 2 of connector 7 to 1\n");
+}
+
+int main(int argc, char *argv[])
+{
+	char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm" };

Please add "exynos"

Quoted 27 lines
tests/proptest/proptest.c new file +27 -0
+	unsigned int i, ret = 0;
+
+	for (i = 0; i<  ARRAY_SIZE(modules); i++){
+		fd = drmOpen(modules[i], NULL);
+		if (fd>= 0) {
+			printf("Module %s loaded.\n", modules[i]);
+			break;
+		}
+	}
+
+	if (i == ARRAY_SIZE(modules)) {
+		fprintf(stderr, "Failed to load drm modules.\n");
+		return 1;
+	}
+
+	res = drmModeGetResources(fd);
+	if (!res) {
+		fprintf(stderr, "Failed to get resources: %s\n",
+			strerror(errno));
+		ret = 1;
+		goto done;
+	}
+
+	if (argc<  2) {
+		listAllProperties();
+	} else if (argc == 5) {
+		ret = setProperty(argv);

tests/proptest/proptest.c line 317

Quoted 10 lines
tests/proptest/proptest.c new file +10 -0
+	} else {
+		printUsage();
+		ret = 1;
+	}
+
+	drmModeFreeResources(res);
+done:
+	drmClose(fd);
+	return ret;
+}

Thanks.

author
#5 lore raw

PATCH 4/8 Add support for bitmask properties

In reply to Rob Clark

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
#6 lore raw

PATCH 5/8 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
#7 lore raw

PATCH 6/8 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
author
#8 lore raw

PATCH 7/8 proptest: support bitmask properties

In reply to Rob Clark

From: Rob Clark <[email protected]>

Add support to display bitmask properties.

---
 tests/proptest/proptest.c |    8 ++++++++
 1 file changed, 8 insertions(+)
tests/proptest/proptest.c +8 -0
index 52896fe..fa34a48 100644
@@ -127,6 +127,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");
@@ -144,6 +146,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
#9 lore raw

PATCH 8/8 proptest: support plane properties

In reply to Rob Clark

From: Rob Clark <[email protected]>

Add support to display plane properties.

---
 tests/proptest/proptest.c |   32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
tests/proptest/proptest.c +32 -0
index fa34a48..aac6b8f 100644
@@ -39,6 +39,7 @@
 
 int fd;
 drmModeResPtr res = NULL;
+drmModePlaneResPtr plane_res = NULL;
 
 const char *connector_type_str(uint32_t type)
 {
@@ -239,10 +240,33 @@ static void listCrtcProperties(void)
 	}
 }
 
+static void listPlaneProperties(void)
+{
+	int i;
+	drmModePlanePtr p;
+
+	for (i = 0; i < plane_res->count_planes; i++) {
+		p = drmModeGetPlane(fd, plane_res->planes[i]);
+
+		if (!p) {
+			fprintf(stderr, "Could not get plane %u: %s\n",
+				plane_res->planes[i], strerror(errno));
+			continue;
+		}
+
+		printf("Plane %u\n", p->plane_id);
+
+		listObjectProperties(p->plane_id, DRM_MODE_OBJECT_PLANE);
+
+		drmModeFreePlane(p);
+	}
+}
+
 static void listAllProperties(void)
 {
 	listConnectorProperties();
 	listCrtcProperties();
+	listPlaneProperties();
 }
 
 static int setProperty(char *argv[])
@@ -309,6 +333,14 @@ int main(int argc, char *argv[])
 		goto done;
 	}
 
+	plane_res = drmModeGetPlaneResources(fd);
+	if (!plane_res) {
+		fprintf(stderr, "Failed to get plane resources: %s\n",
+			strerror(errno));
+		ret = 1;
+		goto done;
+	}
+
 	if (argc < 2) {
 		listAllProperties();
 	} else if (argc == 5) {
Signature · 1 line
1.7.9.5
#10 lore raw

Re: [PATCH libdrm 8/8] proptest: support plane properties

Hi, Rob.

Quoted 3 lines · Rob Clark

From: Rob Clark<[email protected]>

Add support to display plane properties.

Do you not support to set property for plane?

Quoted 67 lines
---
  tests/proptest/proptest.c |   32 ++++++++++++++++++++++++++++++++
  1 file changed, 32 insertions(+)
tests/proptest/proptest.c +32 -0
index fa34a48..aac6b8f 100644
@@ -39,6 +39,7 @@
 
  int fd;
  drmModeResPtr res = NULL;
+drmModePlaneResPtr plane_res = NULL;
 
  const char *connector_type_str(uint32_t type)
  {
@@ -239,10 +240,33 @@ static void listCrtcProperties(void)
  	}
  }
 
+static void listPlaneProperties(void)
+{
+	int i;
+	drmModePlanePtr p;
+
+	for (i = 0; i<  plane_res->count_planes; i++) {
+		p = drmModeGetPlane(fd, plane_res->planes[i]);
+
+		if (!p) {
+			fprintf(stderr, "Could not get plane %u: %s\n",
+				plane_res->planes[i], strerror(errno));
+			continue;
+		}
+
+		printf("Plane %u\n", p->plane_id);
+
+		listObjectProperties(p->plane_id, DRM_MODE_OBJECT_PLANE);
+
+		drmModeFreePlane(p);
+	}
+}
+
  static void listAllProperties(void)
  {
  	listConnectorProperties();
  	listCrtcProperties();
+	listPlaneProperties();
  }
 
  static int setProperty(char *argv[])
@@ -309,6 +333,14 @@ int main(int argc, char *argv[])
  		goto done;
  	}
 
+	plane_res = drmModeGetPlaneResources(fd);
+	if (!plane_res) {
+		fprintf(stderr, "Failed to get plane resources: %s\n",
+			strerror(errno));
+		ret = 1;
+		goto done;
+	}
+
  	if (argc<  2) {
  		listAllProperties();
  	} else if (argc == 5) {
author
#11 lore raw

Re: [PATCH libdrm 8/8] proptest: support plane properties

Quoted 11 lines · Joonyoung Shim

Hi, Rob.

Quoted 4 lines · Rob Clark

From: Rob Clark<[email protected]>

Add support to display plane properties.

Do you not support to set property for plane?

oh, heh, I missed the fact that proptest actually lets you *set* properties.. I won't push this particular patch until I update it to set properties too

BR,
-R

Quoted 74 lines
Quoted 58 lines

---
 tests/proptest/proptest.c |   32 ++++++++++++++++++++++++++++++++

 1 file changed, 32 insertions(+)
tests/proptest/proptest.c +25 -0
index fa34a48..aac6b8f 100644
@@ -39,6 +39,7 @@
 
  int fd;
  drmModeResPtr res = NULL;
+drmModePlaneResPtr plane_res = NULL;
 
  const char *connector_type_str(uint32_t type)
  {
@@ -239,10 +240,33 @@ static void listCrtcProperties(void)
        }
  }
 
+static void listPlaneProperties(void)
+{
+       int i;
+       drmModePlanePtr p;
+
+       for (i = 0; i<  plane_res->count_planes; i++) {
+               p = drmModeGetPlane(fd, plane_res->planes[i]);
+
+               if (!p) {
+                       fprintf(stderr, "Could not get plane %u: %s\n",
+                               plane_res->planes[i], strerror(errno));
+                       continue;
+               }
+
+               printf("Plane %u\n", p->plane_id);
+
+               listObjectProperties(p->plane_id, DRM_MODE_OBJECT_PLANE);
+
+               drmModeFreePlane(p);
+       }
+}
+
  static void listAllProperties(void)
  {
        listConnectorProperties();
        listCrtcProperties();
+       listPlaneProperties();
  }
 
  static int setProperty(char *argv[])
@@ -309,6 +333,14 @@ int main(int argc, char *argv[])
                goto done;
        }
 
+       plane_res = drmModeGetPlaneResources(fd);

tests/proptest/proptest.c int main(int argc, char *argv[]) · line 346

Quoted 10 lines
tests/proptest/proptest.c +7 -0
+       if (!plane_res) {
+               fprintf(stderr, "Failed to get plane resources: %s\n",
+                       strerror(errno));
+               ret = 1;
+               goto done;
+       }
+
        if (argc<  2) {
                listAllProperties();
        } else if (argc == 5) {

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