Skip to contentSkip to conversation

modetest: set_gamma only if CRTC supports gamma property

PATCH In review Rohit Visavalia 3 participants 3 messages Mar 17, 2020 – Aug 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modetest: set_gamma only if CRTC supports gamma property

Current implementation shows error as "failed to set gamma: Function no implemented" if platform specific drm has no gamma property implemented

---
 tests/modetest/modetest.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
tests/modetest/modetest.c +16 -5
index b907ab3..23ee73d 100644
@@ -1328,14 +1328,24 @@ static int set_plane(struct device *dev, struct plane_arg *p)
 static void atomic_set_planes(struct device *dev, struct plane_arg *p,
                              unsigned int count, bool update)
 {
-       unsigned int i, pattern = primary_fill;
+       unsigned int i, j, pattern = primary_fill;
+       struct crtc *crtc = NULL;
 
        /* set up planes */
        for (i = 0; i < count; i++) {
-               if (i > 0)
+               if (i > 0) {
                        pattern = secondary_fill;
-               else
-                       set_gamma(dev, p[i].crtc_id, p[i].fourcc);
+               } else {
+                       for (j = 0; j < dev->resources->res->count_crtcs; j++) {
+                               if (p[i].crtc_id ==
+                                   dev->resources->res->crtcs[j]) {
+                                       crtc = &dev->resources->crtcs[j];
+                                       break;
+                               }
+                       }
+                       if (crtc->crtc->gamma_size)
+                               set_gamma(dev, p[i].crtc_id, p[i].fourcc);
+               }
 
                if (atomic_set_plane(dev, &p[i], pattern, update))
                        return;
@@ -1522,7 +1532,8 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
                        return;
                }
 
-               set_gamma(dev, pipe->crtc->crtc->crtc_id, pipe->fourcc);
+               if (pipe->crtc->crtc->gamma_size)
+                       set_gamma(dev, pipe->crtc->crtc->crtc_id, pipe->fourcc);
        }
 }
 

--
2.7.4

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/1
#1 lore raw

Not an enormous fan of what you had to do in atomic_set_planes, but OTOH I don't see a much better way to do it either.

Quoted 55 lines · Rohit Visavalia

Current implementation shows error as "failed to set gamma: Function no implemented" if platform specific drm has no gamma property implemented

---
 tests/modetest/modetest.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
tests/modetest/modetest.c +16 -6
index b907ab3..23ee73d 100644
@@ -1328,14 +1328,24 @@ static int set_plane(struct device *dev, struct plane_arg *p)
 static void atomic_set_planes(struct device *dev, struct plane_arg *p,
                              unsigned int count, bool update)
 {
-       unsigned int i, pattern = primary_fill;
+       unsigned int i, j, pattern = primary_fill;
+       struct crtc *crtc = NULL;
 
        /* set up planes */
        for (i = 0; i < count; i++) {
-               if (i > 0)
+               if (i > 0) {
                        pattern = secondary_fill;
-               else
-                       set_gamma(dev, p[i].crtc_id, p[i].fourcc);
+               } else {
+                       for (j = 0; j < dev->resources->res->count_crtcs; j++) {
+                               if (p[i].crtc_id ==
+                                   dev->resources->res->crtcs[j]) {
+                                       crtc = &dev->resources->crtcs[j];
+                                       break;
+                               }
+                       }
+                       if (crtc->crtc->gamma_size)
+                               set_gamma(dev, p[i].crtc_id, p[i].fourcc);
+               }
 
                if (atomic_set_plane(dev, &p[i], pattern, update))
                        return;
@@ -1522,7 +1532,8 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
                        return;
                }
 
-               set_gamma(dev, pipe->crtc->crtc->crtc_id, pipe->fourcc);
+               if (pipe->crtc->crtc->gamma_size)
+                       set_gamma(dev, pipe->crtc->crtc->crtc_id, pipe->fourcc);
        }
 }
 
--

2.7.4

Quoted 1 line

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

#2 lore raw

Hi Ville,

This patch is already reviewed by Ilia Mirkin <[email protected]> and I have unit tested it, if it looks good to you could you please merge it?

Thanks
Rohit

Quoted 79 lines

-----Original Message-----
From: Ilia Mirkin [mailto:[email protected]]
Sent: Monday, March 23, 2020 11:10 AM
To: Rohit Visavalia <[email protected]>
Cc: dri-devel <[email protected]>; Emil Velikov <[email protected]>; Hyun Kwon <[email protected]>; Devarsh Thakkar <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Ranganathan Sk <[email protected]>; Varunkumar Allagadapa <[email protected]>
Subject: Re: [PATCH libdrm] modetest: set_gamma only if CRTC supports gamma property

CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.

Not an enormous fan of what you had to do in atomic_set_planes, but OTOH I don't see a much better way to do it either.

Quoted 15 lines · Rohit Visavalia

Current implementation shows error as "failed to set gamma: Function no implemented" if platform specific drm has no gamma property implemented

---
 tests/modetest/modetest.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
tests/modetest/modetest.c +0 -0
index b907ab3..23ee73d 100644
@@ -1328,14 +1328,24 @@ static int set_plane(struct device *dev,
Quoted 1 line

struct plane_arg *p) static void atomic_set_planes(struct device *dev, struct

plane_arg *p,

tests/modetest/modetest.c static void set_mode(struct device *dev, struct

Quoted 27 lines
                              unsigned int count, bool update)  {
tests/modetest/modetest.c +14 -4
-       unsigned int i, pattern = primary_fill;
+       unsigned int i, j, pattern = primary_fill;
+       struct crtc *crtc = NULL;
 
        /* set up planes */
        for (i = 0; i < count; i++) {
-               if (i > 0)
+               if (i > 0) {
                        pattern = secondary_fill;
-               else
-                       set_gamma(dev, p[i].crtc_id, p[i].fourcc);
+               } else {
+                       for (j = 0; j < dev->resources->res->count_crtcs; j++) {
+                               if (p[i].crtc_id ==
+                                   dev->resources->res->crtcs[j]) {
+                                       crtc = &dev->resources->crtcs[j];
+                                       break;
+                               }
+                       }
+                       if (crtc->crtc->gamma_size)
+                               set_gamma(dev, p[i].crtc_id, p[i].fourcc);
+               }
 
                if (atomic_set_plane(dev, &p[i], pattern, update))
                        return;
@@ -1522,7 +1532,8 @@ static void set_mode(struct device *dev, struct

pipe_arg *pipes, unsigned int co

Quoted 10 lines
tests/modetest/modetest.c +3 -1
                        return;
                }
 
-               set_gamma(dev, pipe->crtc->crtc->crtc_id, pipe->fourcc);
+               if (pipe->crtc->crtc->gamma_size)
+                       set_gamma(dev, pipe->crtc->crtc->crtc_id,
+ pipe->fourcc);
        }
 }
Quoted 8 lines
Quoted 4 lines
tests/modetest/modetest.c +0 -1
--

2.7.4

This email and any attachments are intended for the sole use of the named

recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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