diff mbox

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

Message ID 1338919594-25392-9-git-send-email-rob.clark@linaro.org
State New
Headers show

Commit Message

Rob Clark June 5, 2012, 6:06 p.m. UTC
From: Rob Clark <rob@ti.com>

Add support to display plane properties.

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

Comments

Joonyoung Shim June 7, 2012, 5:09 a.m. UTC | #1
Hi, Rob.

On 06/06/2012 03:06 AM, Rob Clark wrote:
> From: Rob Clark<rob@ti.com>
>
> Add support to display plane properties.

Do you not support to set property for plane?

>
> Signed-off-by: Rob Clark<rob@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) {
Rob Clark June 7, 2012, 2:45 p.m. UTC | #2
On Thu, Jun 7, 2012 at 1:09 PM, Joonyoung Shim <jy0922.shim@samsung.com> wrote:
> Hi, Rob.
>
>
> On 06/06/2012 03:06 AM, Rob Clark wrote:
>>
>> From: Rob Clark<rob@ti.com>
>>
>> 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

>
>>
>> Signed-off-by: Rob Clark<rob@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) {
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

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) {