[igt-dev] [PATCH 1/2] tests/fbdev: Test for validity of video mode settings

Thomas Zimmermann tzimmermann at suse.de
Tue Oct 12 14:23:43 UTC 2021


Hi

Am 11.10.21 um 16:20 schrieb Ville Syrjälä:
> On Mon, Oct 11, 2021 at 04:07:18PM +0200, Thomas Zimmermann wrote:
>> Add basic tests for video mode resolution and color on fbdev
>> devices.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
>> ---
>>   tests/fbdev.c | 43 +++++++++++++++++++++++++++++++++++--------
>>   1 file changed, 35 insertions(+), 8 deletions(-)
>>
>> diff --git a/tests/fbdev.c b/tests/fbdev.c
>> index 443a43dc..c9903f8b 100644
>> --- a/tests/fbdev.c
>> +++ b/tests/fbdev.c
>> @@ -50,14 +50,41 @@ static void mode_tests(int fd)
>>   
>>   	igt_describe("Check if screeninfo is valid");
>>   	igt_subtest("info") {
>> -		unsigned long size;
>> -
>> -		size = var_info.yres * fix_info.line_length;
>> -		igt_assert_f(size <= fix_info.smem_len,
>> -			     "screen size (%d x %d) of pitch %d does not fit within mappable area of size %u\n",
>> -			     var_info.xres, var_info.yres,
>> -			     fix_info.line_length,
>> -			     fix_info.smem_len);
>> +		unsigned long nlines;
>> +
>> +		/* video memory configuration */
>> +		igt_assert_f(fix_info.line_length, "line pitch not set\n");
>> +		igt_assert_f(fix_info.smem_len, "size of video memory not set\n");
>> +		igt_assert_f(fix_info.line_length <= fix_info.smem_len,
>> +			     "line length (%u) exceeds available video memory (%u)\n",
>> +			     fix_info.line_length, fix_info.smem_len);
>> +
>> +		/* color format */
>> +		igt_assert_f(var_info.bits_per_pixel, "bits-per-pixel not set\n");
>> +
>> +		/* horizontal resolution */
>> +		igt_assert_f(var_info.xres, "horizontal resolution not set\n");
>> +		igt_assert_f(var_info.xres_virtual, "horizontal virtual resolution not set\n");
>> +		igt_assert_f(var_info.xres <= var_info.xres_virtual,
>> +			     "horizontal virtual resolution (%u) less than horizontal resolution (%u)\n",
>> +			     var_info.xres_virtual, var_info.xres);
>> +		igt_assert_f(var_info.xoffset <= (var_info.xres_virtual - var_info.xres),
>> +			     "screen horizontal offset (%u) overflow\n",
>> +			     var_info.xoffset);
>> +
>> +		/* vertical resolution */
>> +		igt_assert_f(var_info.yres, "vertical resolution not set\n");
>> +		igt_assert_f(var_info.yres_virtual, "vertical virtual resolution not set\n");
>> +		igt_assert_f(var_info.yres <= var_info.yres_virtual,
>> +			     "vertical virtual resolution (%u) less than vertical resolution (%u)\n",
>> +			     var_info.yres_virtual, var_info.yres);
>> +		igt_assert_f(var_info.yoffset <= (var_info.yres_virtual - var_info.yres),
>> +			     "screen vertical offset (%u) overflow\n",
>> +			     var_info.yoffset);
> 
> YWRAP does allow for that IIRC. So maybe should check that, or maybe we
> don't care about drivers that support it?

Some fbdev drivers and omap_drm seem to support it. I'll add a test for it.

> 
>> +		nlines = fix_info.smem_len / fix_info.line_length;
>> +		igt_assert_f(var_info.yres_virtual <= nlines,
>> +			     "vertical virtual resolution (%u) with pitch %u exceeds available video memory\n",
>> +			     var_info.yres_virtual, fix_info.line_length);
> 
> Maybe add the counterpart for the horizontal direction?

I thought about this, but found that maybe some awkward color format 
might not have a clear relation between resolution and linelength. But 
I'll add a test to check against the bit per line. Hopefully this will work.

Best regards
Thomas

> 
>>   	}
>>   }
>>   
>> -- 
>> 2.33.0
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20211012/96d48e9a/attachment-0001.sig>


More information about the igt-dev mailing list