[igt-dev] [PATCH i-g-t 1/2] lib/kms: Add for_each_pipe_clamped
Patnana, Venkata Sai
venkata.sai.patnana at intel.com
Mon Mar 29 08:19:49 UTC 2021
> -----Original Message-----
> From: Latvala, Petri <petri.latvala at intel.com>
> Sent: Tuesday, March 23, 2021 5:19 PM
> To: Modem, Bhanuprakash <bhanuprakash.modem at intel.com>
> Cc: Patnana, Venkata Sai <venkata.sai.patnana at intel.com>; igt-
> dev at lists.freedesktop.org; B S, Karthik <karthik.b.s at intel.com>; Heikkila, Juha-
> pekka <juha-pekka.heikkila at intel.com>; Shankar, Uma
> <uma.shankar at intel.com>
> Subject: Re: [PATCH i-g-t 1/2] lib/kms: Add for_each_pipe_clamped
>
> On Tue, Mar 23, 2021 at 01:32:20PM +0200, Modem, Bhanuprakash wrote:
> > > From: Patnana, Venkata Sai <venkata.sai.patnana at intel.com>
> > > Sent: Tuesday, March 23, 2021 4:23 PM
> > > To: igt-dev at lists.freedesktop.org
> > > Cc: B S, Karthik <karthik.b.s at intel.com>; Heikkila, Juha-pekka
> > > <juha- pekka.heikkila at intel.com>; Shankar, Uma
> > > <uma.shankar at intel.com>; Patnana, Venkata Sai
> > > <venkata.sai.patnana at intel.com>; Modem, Bhanuprakash
> > > <bhanuprakash.modem at intel.com>; Latvala, Petri
> > > <petri.latvala at intel.com>
> > > Subject: [PATCH i-g-t 1/2] lib/kms: Add for_each_pipe_clamped
> > >
> > > From: Patnana Venkata Sai <venkata.sai.patnana at intel.com>
> > >
> > > for_each_pipe and for_each_pipe_static cannot be used for limiting
> > > pipe iteration.
> > > This api will provide limits the pipe iteration
> > >
> > > v2: Handle fused pipes (Petri)
> > > Add a variable pipe count (Bhanu)
> > > v3: change api name as suggested (Petri)
> > >
> > > Cc: Uma Shankar <uma.shankar at intel.com>
> > > Cc: Juha-Pekka Heikkilä <juha-pekka.heikkila at intel.com>
> > > Cc: Modem Bhanuprakash <bhanuprakash.modem at intel.com>
> > > Cc: Karthik B S <karthik.b.s at intel.com>
> > > Cc: Petri Latvala <petri.latvala at intel.com>
> > > Signed-off-by: Patnana Venkata Sai <venkata.sai.patnana at intel.com>
> > > ---
> > > lib/igt_kms.h | 12 ++++++++++++
> > > 1 file changed, 12 insertions(+)
> > >
> > > diff --git a/lib/igt_kms.h b/lib/igt_kms.h index
> > > 09b10b3e04..7dbf14483c 100644
> > > --- a/lib/igt_kms.h
> > > +++ b/lib/igt_kms.h
> > > @@ -534,6 +534,18 @@ static inline bool
> > > igt_output_is_connected(igt_output_t *output)
> > > for_each_pipe_static(pipe) \
> > > for_each_if((display)->pipes[(pipe)].enabled)
> > >
> > > +/**
> > > + * for_each_pipe_clamped:
> > > + * @display: a pointer to an #igt_display_t structure
> > > + * @pipe: The pipe to iterate.
> > > + * @pipe_count: Number of pipes to be iterate
> > > + *
> > > + * This for loop iterates based on pipe_count and supported by IGT
> > > libraries,
> > > + */
> > > +#define for_each_pipe_clamped(display, pipe, pipe_count) \
> >
> > What about other APIs like "for_each_pipe_with_valid_output" those
> > iterates over all enabled pipes? Are we planning to implement similar
> > APIs to limit the execution to few pipes?
>
> A good point here. At this point I suppose it might be cleaner to leave the
> for_each loops alone and implement clamping in the tests directly with an open-
> coded counting.
>
> igt_subtest_with_dynamic(....) {
> int count = 0;
> for_each_pipe(no magickry here) {
> igt_dynamic_f(pipe-%s)
> ....
> if (++count > limit)
> break;
> }
> }
>
Here our basic idea is to implement a cleaner code, to make lib for generic approach,
Because in multiple tests we are doing this same approach for all tests. That is why we had decided to create a new api.
>
> --
> Petri Latvala
>
>
> >
> > > +for_each_pipe_static(pipe) \
> > > + for_each_if((display)->pipes[(pipe)].enabled) \
> > > +for_each_if(pipe_count-- > 0)
> > > /**
> > > * for_each_pipe_with_valid_output:
> > > * @display: a pointer to an #igt_display_t structure
> > > --
> > > 2.25.1
> >
More information about the igt-dev
mailing list