dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libdrm] modetest: set_gamma only if CRTC supports gamma property
@ 2020-03-17 12:11 Rohit Visavalia
  2020-03-23  5:39 ` Ilia Mirkin
  0 siblings, 1 reply; 3+ messages in thread
From: Rohit Visavalia @ 2020-03-17 12:11 UTC (permalink / raw)
  To: dri-devel, imirkin, emil.velikov, Hyun Kwon
  Cc: Dhaval Rajeshbhai Shah, Rohit Visavalia, Varunkumar Allagadapa,
	Devarsh Thakkar, Ranganathan Sk

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

Signed-off-by: Rohit Visavalia <rohit.visavalia@xilinx.com>
---
 tests/modetest/modetest.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index b907ab3..23ee73d 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH libdrm] modetest: set_gamma only if CRTC supports gamma property
  2020-03-17 12:11 [PATCH libdrm] modetest: set_gamma only if CRTC supports gamma property Rohit Visavalia
@ 2020-03-23  5:39 ` Ilia Mirkin
  2020-08-25  7:43   ` Rohit Visavalia
  0 siblings, 1 reply; 3+ messages in thread
From: Ilia Mirkin @ 2020-03-23  5:39 UTC (permalink / raw)
  To: Rohit Visavalia
  Cc: Ranganathan Sk, Dhaval Rajeshbhai Shah, dri-devel,
	Varunkumar Allagadapa, Devarsh Thakkar, Emil Velikov

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.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>

On Tue, Mar 17, 2020 at 8:11 AM Rohit Visavalia
<rohit.visavalia@xilinx.com> wrote:
>
> Current implementation shows error as "failed to set gamma: Function
> no implemented" if platform specific drm has no gamma property implemented
>
> Signed-off-by: Rohit Visavalia <rohit.visavalia@xilinx.com>
> ---
>  tests/modetest/modetest.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
> index b907ab3..23ee73d 100644
> --- a/tests/modetest/modetest.c
> +++ b/tests/modetest/modetest.c
> @@ -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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH libdrm] modetest: set_gamma only if CRTC supports gamma property
  2020-03-23  5:39 ` Ilia Mirkin
@ 2020-08-25  7:43   ` Rohit Visavalia
  0 siblings, 0 replies; 3+ messages in thread
From: Rohit Visavalia @ 2020-08-25  7:43 UTC (permalink / raw)
  To: Ilia Mirkin, Ville Syrjälä
  Cc: Ranganathan Sk, Dhaval Rajeshbhai Shah, dri-devel,
	Varunkumar Allagadapa, Devarsh Thakkar, Emil Velikov

Hi Ville,

This patch is already reviewed by Ilia Mirkin <imirkin@alum.mit.edu> and I have unit tested it, if it looks good to you could you please merge it?

Thanks
Rohit

> -----Original Message-----
> From: Ilia Mirkin [mailto:imirkin@alum.mit.edu]
> Sent: Monday, March 23, 2020 11:10 AM
> To: Rohit Visavalia <RVISAVAL@xilinx.com>
> Cc: dri-devel <dri-devel@lists.freedesktop.org>; Emil Velikov
> <emil.velikov@collabora.com>; Hyun Kwon <hyunk@xilinx.com>; Devarsh
> Thakkar <DEVARSHT@xilinx.com>; Dhaval Rajeshbhai Shah
> <dshah@xilinx.com>; Ranganathan Sk <rsk@xilinx.com>; Varunkumar
> Allagadapa <VARUNKUM@xilinx.com>
> 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.
> 
> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
> 
> On Tue, Mar 17, 2020 at 8:11 AM Rohit Visavalia <rohit.visavalia@xilinx.com>
> wrote:
> >
> > Current implementation shows error as "failed to set gamma: Function
> > no implemented" if platform specific drm has no gamma property
> > implemented
> >
> > Signed-off-by: Rohit Visavalia <rohit.visavalia@xilinx.com>
> > ---
> >  tests/modetest/modetest.c | 21 ++++++++++++++++-----
> >  1 file changed, 16 insertions(+), 5 deletions(-)
> >
> > diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
> > index b907ab3..23ee73d 100644
> > --- a/tests/modetest/modetest.c
> > +++ b/tests/modetest/modetest.c
> > @@ -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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-26  8:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 12:11 [PATCH libdrm] modetest: set_gamma only if CRTC supports gamma property Rohit Visavalia
2020-03-23  5:39 ` Ilia Mirkin
2020-08-25  7:43   ` Rohit Visavalia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).