[igt-dev] [PATCH 2/2] tests/fbdev: Add tests for display panning

Thomas Zimmermann tzimmermann at suse.de
Tue Oct 12 14:26:08 UTC 2021


Hi

Am 11.10.21 um 16:24 schrieb Ville Syrjälä:
> On Mon, Oct 11, 2021 at 04:07:19PM +0200, Thomas Zimmermann wrote:
>> Add tests that perform panning / page flip operations on an fbdev
>> device. Panning should work when the viewport wi within the virtual
>> screen and fail otherwise.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
>> ---
>>   tests/fbdev.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 92 insertions(+)
>>
>> diff --git a/tests/fbdev.c b/tests/fbdev.c
>> index c9903f8b..17727cd0 100644
>> --- a/tests/fbdev.c
>> +++ b/tests/fbdev.c
>> @@ -86,6 +86,98 @@ static void mode_tests(int fd)
>>   			     "vertical virtual resolution (%u) with pitch %u exceeds available video memory\n",
>>   			     var_info.yres_virtual, fix_info.line_length);
>>   	}
>> +
>> +	igt_describe("Check panning / page flipping");
>> +	igt_subtest("pan") {
>> +		struct fb_var_screeninfo pan_var, new_var;
>> +		int ret;
>> +
>> +		/* jump to opposite end of virtual screen */
>> +		pan_var.xoffset = var_info.xres_virtual - var_info.xres - var_info.xoffset;
>> +		pan_var.yoffset = var_info.yres_virtual - var_info.yres - var_info.yoffset;
> 
> Should look at {x,y}panstep probably before assuming this stuff will do exactly
> what you ask it.

Good point. Aligning the offsets should do the job.

> 
>> +		ret = ioctl(fd, FBIOPAN_DISPLAY, &pan_var);
>> +		igt_assert_f(ret == 0, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +		ret = ioctl(fd, FBIOGET_VSCREENINFO, &new_var);
>> +		igt_assert_f(ret == 0, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +		igt_assert_f(pan_var.xoffset == new_var.xoffset && pan_var.yoffset == new_var.yoffset,
>> +			     "panning to (%u, %u) moved to (%u, %u)\n",
>> +			     pan_var.xoffset, pan_var.yoffset, new_var.xoffset, new_var.yoffset);
>> +
>> +		/* jump to (0, 0) */
>> +		pan_var.xoffset = 0;
>> +		pan_var.yoffset = 0;
>> +		ret = ioctl(fd, FBIOPAN_DISPLAY, &pan_var);
>> +		igt_assert_f(ret == 0, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +		ret = ioctl(fd, FBIOGET_VSCREENINFO, &new_var);
>> +		igt_assert_f(ret == 0, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +		igt_assert_f(pan_var.xoffset == new_var.xoffset && pan_var.yoffset == new_var.yoffset,
>> +			     "panning to (%u, %u) moved to (%u, %u)\n",
>> +			     pan_var.xoffset, pan_var.yoffset, new_var.xoffset, new_var.yoffset);
>> +
>> +		/* jump to maximum extend */
>> +		pan_var.xoffset = var_info.xres_virtual - var_info.xres;
>> +		pan_var.yoffset = var_info.yres_virtual - var_info.yres;
>> +		ret = ioctl(fd, FBIOPAN_DISPLAY, &pan_var);
>> +		igt_assert_f(ret == 0, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +		ret = ioctl(fd, FBIOGET_VSCREENINFO, &new_var);
>> +		igt_assert_f(ret == 0, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +		igt_assert_f(pan_var.xoffset == new_var.xoffset && pan_var.yoffset == new_var.yoffset,
>> +			     "panning to (%u, %u) moved to (%u, %u)\n",
>> +			     pan_var.xoffset, pan_var.yoffset, new_var.xoffset, new_var.yoffset);
>> +
>> +		/* return to original offsets for next tests */
>> +		ret = ioctl(fd, FBIOPAN_DISPLAY, &var_info);
>> +		igt_assert_f(ret == 0, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +
>> +		/* jump beyond maximum horizontal extend */
>> +		pan_var.xoffset = var_info.xres_virtual - var_info.xres + 1;
>> +		pan_var.yoffset = 0;
>> +		ret = ioctl(fd, FBIOPAN_DISPLAY, &pan_var);
>> +		igt_assert_f(ret == -1, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +		ret = ioctl(fd, FBIOGET_VSCREENINFO, &new_var);
>> +		igt_assert_f(ret == 0, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +		igt_assert_f(var_info.xoffset == new_var.xoffset && var_info.yoffset == new_var.yoffset,
>> +			     "panning to (%u, %u) moved to (%u, %u)\n",
>> +			     pan_var.xoffset, pan_var.yoffset, new_var.xoffset, new_var.yoffset);
>> +
>> +		/* jump beyond maximum vertical extend */
>> +		pan_var.xoffset = 0;
>> +		pan_var.yoffset = var_info.yres_virtual - var_info.yres + 1;
>> +		ret = ioctl(fd, FBIOPAN_DISPLAY, &pan_var);
>> +		igt_assert_f(ret == -1, "ioctl(FBIOPAN_DISPLAY), ret=%d\n", ret);
>> +		ret = ioctl(fd, FBIOGET_VSCREENINFO, &new_var);
>> +		igt_assert_f(ret == 0, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +		igt_assert_f(var_info.xoffset == new_var.xoffset && var_info.yoffset == new_var.yoffset,
>> +			     "panning to (%u, %u) moved to (%u, %u)\n",
>> +			     pan_var.xoffset, pan_var.yoffset, new_var.xoffset, new_var.yoffset);
>> +
>> +		/* jump beyond horizontal virtual resolution */
>> +		pan_var.xoffset = var_info.xres_virtual;
>> +		pan_var.yoffset = 0;
>> +		ret = ioctl(fd, FBIOPAN_DISPLAY, &pan_var);
>> +		igt_assert_f(ret == -1, "ioctl(FBIOPAN_DISPLAY), ret=%d\n", ret);
>> +		ret = ioctl(fd, FBIOGET_VSCREENINFO, &new_var);
>> +		igt_assert_f(ret == 0, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +		igt_assert_f(var_info.xoffset == new_var.xoffset && var_info.yoffset == new_var.yoffset,
>> +			     "panning to (%u, %u) moved to (%u, %u)\n",
>> +			     pan_var.xoffset, pan_var.yoffset, new_var.xoffset, new_var.yoffset);
>> +
>> +		/* jump beyond vertical virtual resolution */
>> +		pan_var.xoffset = 0;
>> +		pan_var.yoffset = var_info.yres_virtual;
>> +		ret = ioctl(fd, FBIOPAN_DISPLAY, &pan_var);
>> +		igt_assert_f(ret == -1, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
> 
> Another YWRAP issue here.

Really? It's a flag in var.vmode. I'd expect that we can leave it out 
for the tests to disable the wrap-around.

Best regards
Thomas

> 
>> +		ret = ioctl(fd, FBIOGET_VSCREENINFO, &new_var);
>> +		igt_assert_f(ret == 0, "ioctl(FBIOPAN_DISPLAY) failed, ret=%d\n", ret);
>> +		igt_assert_f(var_info.xoffset == new_var.xoffset && var_info.yoffset == new_var.yoffset,
>> +			     "panning to (%u, %u) moved to (%u, %u)\n",
>> +			     pan_var.xoffset, pan_var.yoffset, new_var.xoffset, new_var.yoffset);
>> +	}
>> +
>> +	igt_fixture {
>> +		/* restore original panning offsets */
>> +		ioctl(fd, FBIOPAN_DISPLAY, &var_info);
>> +	}
>>   }
>>   
>>   static void framebuffer_tests(int fd)
>> -- 
>> 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/38b94b00/attachment.sig>


More information about the igt-dev mailing list