All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH v2 2/2] tests/fbdev: Add tests for display panning
Date: Wed, 20 Oct 2021 17:17:06 +0300	[thread overview]
Message-ID: <YXAk4jM0IRXWxIam@intel.com> (raw)
In-Reply-To: <20211014134517.26473-3-tzimmermann@suse.de>

On Thu, Oct 14, 2021 at 03:45:17PM +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.
> 
> v2:
> 	* set offset to respect panning offsets (Ville)
> 	* respect FB_VMODE_YWRAP (Ville)
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  tests/fbdev.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 135 insertions(+)
> 
> diff --git a/tests/fbdev.c b/tests/fbdev.c
> index 2cf137d2..e1f18718 100644
> --- a/tests/fbdev.c
> +++ b/tests/fbdev.c
> @@ -39,6 +39,20 @@
>  
>  #include "igt.h"
>  
> +#define PANSTEP(panstep_) \
> +	((panstep_) ? (panstep_) : 1)
> +
> +static unsigned int __panoffset(unsigned int offset, unsigned int panstep)
> +{
> +	return offset - (offset % PANSTEP(panstep));
> +}
> +
> +#define XOFFSET(offset_) \
> +	__panoffset(offset_, fix_info.xpanstep)
> +
> +#define YOFFSET(offset_) \
> +	__panoffset(offset_, fix_info.ypanstep)
> +
>  static void mode_tests(int fd)
>  {
>  	struct fb_var_screeninfo var_info;
> @@ -92,6 +106,127 @@ static void mode_tests(int fd)
>  			     "vertical virtual resolution (%u) with line length %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 = XOFFSET(var_info.xres_virtual - var_info.xres - var_info.xoffset);
> +		pan_var.yoffset = YOFFSET(var_info.yres_virtual - var_info.yres - var_info.yoffset);
> +		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 = XOFFSET(0);
> +		pan_var.yoffset = 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);

A bit repetivive this stuff. Could put that block of code
into a helper maybe?

Otherwise looks sensible enough to me. For the series:
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> +
> +		/* jump to maximum extend */
> +		pan_var.xoffset = XOFFSET(var_info.xres_virtual - var_info.xres);
> +		pan_var.yoffset = 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 = XOFFSET(var_info.xres_virtual - var_info.xres + PANSTEP(fix_info.xpanstep));
> +		pan_var.yoffset = 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 horizontal virtual resolution */
> +		pan_var.xoffset = XOFFSET(var_info.xres_virtual);
> +		pan_var.yoffset = 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);
> +
> +		/*
> +		 * With FB_MODE_YWRAP set, the display is expected to wrap around when reaching
> +		 * the limits of the vertical resolution. Otherwise, this should fail.
> +		 */
> +
> +		if (var_info.vmode & FB_VMODE_YWRAP) {
> +			/* jump beyond maximum vertical extend */
> +			pan_var.xoffset = XOFFSET(0);
> +			pan_var.yoffset = YOFFSET(var_info.yres_virtual - var_info.yres + PANSTEP(fix_info.ypanstep));
> +			ret = ioctl(fd, FBIOPAN_DISPLAY, &pan_var);
> +			igt_assert_f(ret == 0, "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(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 beyond vertical virtual resolution */
> +			pan_var.xoffset = XOFFSET(0);
> +			pan_var.yoffset = YOFFSET(var_info.yres_virtual);
> +			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);
> +		} else {
> +			/* jump beyond maximum vertical extend */
> +			pan_var.xoffset = XOFFSET(0);
> +			pan_var.yoffset = YOFFSET(var_info.yres_virtual - var_info.yres + PANSTEP(fix_info.ypanstep));
> +			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 = XOFFSET(0);
> +			pan_var.yoffset = 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);
> +			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

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2021-10-20 14:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14 13:45 [igt-dev] [PATCH v2 0/2] tests/fbdev: Additional tests for resolution and panning Thomas Zimmermann
2021-10-14 13:45 ` [igt-dev] [PATCH v2 1/2] tests/fbdev: Test for validity of video mode settings Thomas Zimmermann
2021-10-14 13:45 ` [igt-dev] [PATCH v2 2/2] tests/fbdev: Add tests for display panning Thomas Zimmermann
2021-10-20 14:17   ` Ville Syrjälä [this message]
2021-10-22  7:55     ` Thomas Zimmermann
2021-10-14 18:21 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/fbdev: Additional tests for resolution and panning (rev2) Patchwork
2021-10-14 22:02 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-10-20 14:08 ` [igt-dev] [PATCH v2 0/2] tests/fbdev: Additional tests for resolution and panning Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YXAk4jM0IRXWxIam@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.