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

Rob Clark rob.clark at linaro.org
Tue Jun 5 11:06:34 PDT 2012


From: Rob Clark <rob at ti.com>

Add support to display plane properties.

Signed-off-by: Rob Clark <rob at ti.com>
---
 tests/proptest/proptest.c |   32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/proptest/proptest.c b/tests/proptest/proptest.c
index fa34a48..aac6b8f 100644
--- a/tests/proptest/proptest.c
+++ b/tests/proptest/proptest.c
@@ -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) {
-- 
1.7.9.5



More information about the dri-devel mailing list