Skip to contentSkip to conversation

modetest: consider supported formats before selecting a DRM plane

PATCH In review Fabien DESSENNE 4 participants 5 messages Mar 28, 2014 – Apr 20, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modetest: consider supported formats before selecting a DRM plane

This fixes an issue where the DRM planes do not support the same pixel formats.
The current implementation selects a DRM plane without checking whether the pixel format is supported or not. As a consequence modetest may try to set up a plane not supporting the user request-format, which fails. Modetest has to check the supported formats accross the plane list before selecting a candidate.

---
 tests/modetest/modetest.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tests/modetest/modetest.c +6 -3
index 4761c60..866ea82 100644
@@ -951,7 +951,7 @@ static int set_plane(struct device *dev, struct plane_arg *p)
 	int crtc_x, crtc_y, crtc_w, crtc_h;
 	struct crtc *crtc = NULL;
 	unsigned int pipe;
-	unsigned int i;
+	unsigned int i, j;
 
 	/* Find an unused plane which can be connected to our CRTC. Find the
 	 * CRTC index first, then iterate over available planes.
@@ -974,8 +974,11 @@ static int set_plane(struct device *dev, struct plane_arg *p)
 		if (!ovr)
 			continue;
 
-		if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id)
-			plane_id = ovr->plane_id;
+		if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id) {
+			for (j = 0; j < ovr->count_formats; j++)
+				if (!strncmp(p->format_str, (char *) &ovr->formats[j], 4))
+					plane_id = ovr->plane_id;
+		}
 	}
 
 	if (!plane_id) {
Signature · 1 line
1.9.0
#1 lore raw

Can anyone review this patch ?
Thanks for your time.
Fabien

Quoted 54 lines

-----Original Message-----
From: Fabien DESSENNE [mailto:[email protected]]
Sent: vendredi 28 mars 2014 11:16
To: [email protected]
Cc: Benjamin Gaignard; Vincent Abriou; Fabien DESSENNE
Subject: [PATCH] modetest: consider supported formats before selecting a DRM plane

This fixes an issue where the DRM planes do not support the same pixel formats.
The current implementation selects a DRM plane without checking whether the pixel format is supported or not. As a consequence modetest may try to set up a plane not supporting the user request-format, which fails. Modetest has to check the supported formats accross the plane list before selecting a candidate.

---
 tests/modetest/modetest.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tests/modetest/modetest.c index renamed from tests/modetest/modetest.c +0 -0

4761c60..866ea82 100644

tests/modetest/modetest.c +1 -1
@@ -951,7 +951,7 @@ static int set_plane(struct device *dev, struct
 plane_arg *p)
 	int crtc_x, crtc_y, crtc_w, crtc_h;
 	struct crtc *crtc = NULL;
 	unsigned int pipe;
-	unsigned int i;
+	unsigned int i, j;
 
 	/* Find an unused plane which can be connected to our CRTC. Find

the

tests/modetest/modetest.c +5 -2
 	 * CRTC index first, then iterate over available planes.
@@ -974,8 +974,11 @@ static int set_plane(struct device *dev, struct
 plane_arg *p)
 		if (!ovr)
 			continue;
 
-		if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id)
-			plane_id = ovr->plane_id;
+		if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id) {
+			for (j = 0; j < ovr->count_formats; j++)
+				if (!strncmp(p->format_str, (char *) &ovr-
 >formats[j], 4))
+					plane_id = ovr->plane_id;
+		}
 	}

if (!plane_id) {
--
1.9.0

#2 lore raw
In reply to Fabien DESSENNE
Quoted 9 lines · Fabien DESSENNE

This fixes an issue where the DRM planes do not support the same pixel formats.
The current implementation selects a DRM plane without checking whether the pixel format is supported or not. As a consequence modetest may try to set up a plane not supporting the user request-format, which fails. Modetest has to check the supported formats accross the plane list before selecting a candidate.

Looks reasonable. I suppose one drawback is that you could previously use modetest to test an error condition. I'm not sure if anyone cares about that.. having a proper collection of tests for generic KMS APIs would of course be a better solution to that problem ;-)

It could be a useful thing for linaro to look into intel-gpu-tools and see if it could be possible to refactor some of that into some cross-driver tests ;-)

BR,
-R

Quoted 38 lines
---
 tests/modetest/modetest.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tests/modetest/modetest.c +6 -4
index 4761c60..866ea82 100644
@@ -951,7 +951,7 @@ static int set_plane(struct device *dev, struct plane_arg *p)
        int crtc_x, crtc_y, crtc_w, crtc_h;
        struct crtc *crtc = NULL;
        unsigned int pipe;
-       unsigned int i;
+       unsigned int i, j;
 
        /* Find an unused plane which can be connected to our CRTC. Find the
         * CRTC index first, then iterate over available planes.
@@ -974,8 +974,11 @@ static int set_plane(struct device *dev, struct plane_arg *p)
                if (!ovr)
                        continue;
 
-               if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id)
-                       plane_id = ovr->plane_id;
+               if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id) {
+                       for (j = 0; j < ovr->count_formats; j++)
+                               if (!strncmp(p->format_str, (char *) &ovr->formats[j], 4))
+                                       plane_id = ovr->plane_id;
+               }
        }
 
        if (!plane_id) {
--

1.9.0

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

#3 lore raw

Hi,

Do we have something more to do get this patch merge ? Or do you see issue ?

Regards,
Benjamin

2014-04-04 16:36 GMT+02:00 Rob Clark <[email protected]>:

Quoted 61 lines · Fabien DESSENNE
Quoted 9 lines

This fixes an issue where the DRM planes do not support the same pixel formats.
The current implementation selects a DRM plane without checking whether the pixel format is supported or not. As a consequence modetest may try to set up a plane not supporting the user request-format, which fails. Modetest has to check the supported formats accross the plane list before selecting a candidate.

Looks reasonable. I suppose one drawback is that you could previously use modetest to test an error condition. I'm not sure if anyone cares about that.. having a proper collection of tests for generic KMS APIs would of course be a better solution to that problem ;-)

It could be a useful thing for linaro to look into intel-gpu-tools and see if it could be possible to refactor some of that into some cross-driver tests ;-)

BR,
-R

Quoted 38 lines
---
 tests/modetest/modetest.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tests/modetest/modetest.c +6 -4
index 4761c60..866ea82 100644
@@ -951,7 +951,7 @@ static int set_plane(struct device *dev, struct plane_arg *p)
        int crtc_x, crtc_y, crtc_w, crtc_h;
        struct crtc *crtc = NULL;
        unsigned int pipe;
-       unsigned int i;
+       unsigned int i, j;
 
        /* Find an unused plane which can be connected to our CRTC. Find the
         * CRTC index first, then iterate over available planes.
@@ -974,8 +974,11 @@ static int set_plane(struct device *dev, struct plane_arg *p)
                if (!ovr)
                        continue;
 
-               if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id)
-                       plane_id = ovr->plane_id;
+               if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id) {
+                       for (j = 0; j < ovr->count_formats; j++)
+                               if (!strncmp(p->format_str, (char *) &ovr->formats[j], 4))
+                                       plane_id = ovr->plane_id;
+               }
        }
 
        if (!plane_id) {
--

1.9.0

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

Signature · 11 lines
Benjamin Gaignard

Graphic Working Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#4 lore raw
In reply to Fabien DESSENNE
Quoted 32 lines · Fabien DESSENNE

This fixes an issue where the DRM planes do not support the same pixel formats.
The current implementation selects a DRM plane without checking whether the pixel format is supported or not. As a consequence modetest may try to set up a plane not supporting the user request-format, which fails. Modetest has to check the supported formats accross the plane list before selecting a candidate.

---
 tests/modetest/modetest.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tests/modetest/modetest.c +1 -1
index 4761c60..866ea82 100644
@@ -951,7 +951,7 @@ static int set_plane(struct device *dev, struct
 plane_arg *p)
        int crtc_x, crtc_y, crtc_w, crtc_h;
        struct crtc *crtc = NULL;
        unsigned int pipe;
-       unsigned int i;
+       unsigned int i, j;
 
        /* Find an unused plane which can be connected to our CRTC. Find

the
* CRTC index first, then iterate over available planes.

tests/modetest/modetest.c +0 -0
@@ -974,8 +974,11 @@ static int set_plane(struct device *dev, struct
 plane_arg *p)
                if (!ovr)
                        continue;

tests/modetest/modetest.c static int set_plane(struct device *dev, struct · line 984

Quoted 10 lines
tests/modetest/modetest.c +5 -2
 
-               if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id)
-                       plane_id = ovr->plane_id;
+               if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id) {
+                       for (j = 0; j < ovr->count_formats; j++)
+                               if (!strncmp(p->format_str, (char *)
 &ovr->formats[j], 4))
+                                       plane_id = ovr->plane_id;
+               }
 

This loop continues to cycle through the list even after a positive match. A micro-optimization would be to add a "break;" after setting plane_id. Either way, this patch is:

But, I can't help you get the patch actually committed to the DRM repository...
I'm still trying to get someone to help me get my own patches in.

Best Regards,
-djk

        }
Quoted 10 lines
        if (!plane_id) {

--
1.9.0

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

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