[igt-dev] [PATCH v4 08/13] chamelium: Use preferred mode when testing a single mode

Maxime Ripard maxime.ripard at bootlin.com
Thu Aug 23 11:46:52 UTC 2018


Hi Eric,

On Thu, Aug 09, 2018 at 02:28:12PM -0700, Eric Anholt wrote:
> Maxime Ripard <maxime.ripard at bootlin.com> writes:
> 
> > The current code is testing the first mode in the connector list when it's
> > testing a single mode. While this is arbitrarily chosen, it makes more
> > sense to use the preferred mode reported by the display.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
> > ---
> >  tests/kms_chamelium.c | 19 ++++++++++++++++++-
> >  1 file changed, 18 insertions(+), 1 deletion(-)
> >
> > diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
> > index 490bacc6f5fe..5d7fb83fb74f 100644
> > --- a/tests/kms_chamelium.c
> > +++ b/tests/kms_chamelium.c
> > @@ -534,6 +534,20 @@ static void do_test_display_crc(data_t *data, struct chamelium_port *port,
> >  	igt_remove_fb(data->drm_fd, &fb);
> >  }
> >  
> > +static drmModeModeInfo *find_preferred_mode(drmModeConnector *connector)
> > +{
> > +	int i;
> > +
> > +	for (i = 0; i < connector->count_modes; i++) {
> > +		drmModeModeInfo *mode = &connector->modes[i];
> > +
> > +		if (mode->type & DRM_MODE_TYPE_PREFERRED)
> > +			return mode;
> > +	}
> > +
> > +	return NULL;
> > +}
> > +
> >  static void test_display_crc_one_mode(data_t *data, struct chamelium_port *port,
> >  				      int count)
> >  {
> > @@ -549,7 +563,10 @@ static void test_display_crc_one_mode(data_t *data, struct chamelium_port *port,
> >  	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> >  	igt_assert(primary);
> >  
> > -	do_test_display_crc(data, port, output, &connector->modes[0], count);
> > +	mode = find_preferred_mode(connector);
> > +	igt_assert(mode);
> > +
> > +	do_test_display_crc(data, port, output, mode, count);
> 
> Instead of asserting, should we pick the first if there was no
> preferred?  I don't really know, so I'd ack the patch either way.

I've changed the return NULL above to return &connector->modes[0]
instead.

Thanks!
Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20180823/9e8bbd2c/attachment.sig>


More information about the igt-dev mailing list