Re: [igt-dev] [PATCH i-g-t 3/3] tests/kms_plane_scaling: Don't test every pixel format

Ville Syrjälä
2020-01-30T15:57:22Z

On Thu, Jan 30, 2020 at 03:40:58PM +0000, Chris Wilson wrote:
> Quoting Ville Syrjala (2020-01-30 15:12:29)
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > We probably don't need to test every pixel format, so let's just
> > test one format for each format "class" (as defined by
> > igt_reduce_format()).
> >
> > Speeds up the test considerably (on KBL):
> > $ time ./build/tests/kms_plane_scaling --r pipe-A-scaler-with-clipping-clamping
> > - real 0m25,186s
> > + real 0m3,440s
> >
> > As with kms_plane we'll add a new command line argument (--extended)
> > which can be used to test all formats.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> > tests/kms_plane_scaling.c | 80 ++++++++++++++++++++++++++++++++++++---
> > 1 file changed, 74 insertions(+), 6 deletions(-)
> >
> > diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> > index 35aac8dad078..19087286a0f9 100644
> > --- a/tests/kms_plane_scaling.c
> > +++ b/tests/kms_plane_scaling.c
> > @@ -23,6 +23,7 @@
> > */
> >
> > #include "igt.h"
> > +#include "igt_vec.h"
> > #include <math.h>
> >
> >
> > @@ -43,6 +44,7 @@ typedef struct {
> > igt_plane_t *plane2;
> > igt_plane_t *plane3;
> > igt_plane_t *plane4;
> > + bool extended;
> > } data_t;
> >
> > static int get_num_scalers(data_t* d, enum pipe pipe)
> > @@ -221,6 +223,28 @@ static bool can_scale(data_t *d, unsigned format)
> > }
> > }
> >
> > +static bool test_format(data_t *data,
> > + struct igt_vec *tested_formats,
> > + uint32_t format)
> > +{
> > + if (!igt_fb_supported_format(format))
> > + return false;
> > +
> > + if (!is_i915_device(data->drm_fd) ||
> > + data->extended)
> > + return true;
> > +
> > + format = igt_reduce_format(format);
> > +
> > + /* only test each format "class" once */
> > + if (igt_vec_index(tested_formats, &format) >= 0)
> > + return false;
> > +
> > + igt_vec_push(tested_formats, &format);
>
> Ok, that does exactly what you describe.
>
> However, that lookup is giving me the shivers, but it does the job so
> long as we don't have too many formats.

Yeah, this being the reduced format we should only have a handful of
these. But I'd be totally fine using a better data structure if
someone wants to write me one ;)

>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Thanks.

--
Ville Syrjälä
Intel