Skip to contentSkip to conversation

tests/fbdev: Additional tests for resolution and panning

PATCH Superseded Thomas Zimmermann 3 participants 8 messages Oct 11, 2021 – Oct 12, 2021

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover tests/fbdev: Additional tests for resolution and panning

Add addtional tests for resolution and panning operations on fbdev devices. Succeed on successful operations. Fail on invalid operations or state.

DRM's simpledrm driver exposed a bug in DRM's fbdev overallocation code,
[1] which is required for fbdev pageflipping. The new test cases intent to test panning and page flipping, and detect such issues early.

Tested with the current simpledrm and a hacked version that supports fbdev overallocation. This will also help to implement the panning functionality for real in simpledrm and other drivers.

[1] https://lore.kernel.org/dri-devel/[email protected]/

Thomas Zimmermann (2):
tests/fbdev: Test for validity of video mode settings tests/fbdev: Add tests for display panning

 tests/fbdev.c | 135 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 127 insertions(+), 8 deletions(-)

--
2.33.0

#1 lore raw

PATCH 1/2 tests/fbdev: Test for validity of video mode settings

Add basic tests for video mode resolution and color on fbdev devices.

---
 tests/fbdev.c | 43 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 8 deletions(-)
tests/fbdev.c +35 -8
index 443a43dc..c9903f8b 100644
@@ -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);
+		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);
 	}
 }
 
Signature · 1 line
2.33.0
#2 lore raw

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

Quoted 45 lines · Thomas Zimmermann

Add basic tests for video mode resolution and color on fbdev devices.

---
 tests/fbdev.c | 43 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 8 deletions(-)
tests/fbdev.c +21 -8
index 443a43dc..c9903f8b 100644
@@ -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);

tests/fbdev.c static void mode_tests(int fd) · line 83

Quoted 10 lines
tests/fbdev.c +10 -0
+
+		/* 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?

tests/fbdev.c static void mode_tests(int fd) · line 87

Quoted 4 lines
tests/fbdev.c +4 -0
+		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?

Quoted 5 lines
tests/fbdev.c +0 -0
 	}
 }
 
Signature · 1 line
2.33.0
Signature · 2 lines
Ville Syrjälä
Intel
#3 lore raw

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

Hi

Am 11.10.21 um 16:20 schrieb Ville Syrjälä:

Quoted 51 lines · Thomas Zimmermann
Quoted 50 lines

Add basic tests for video mode resolution and color on fbdev devices.

---
  tests/fbdev.c | 43 +++++++++++++++++++++++++++++++++++--------
  1 file changed, 35 insertions(+), 8 deletions(-)
tests/fbdev.c +26 -8
index 443a43dc..c9903f8b 100644
@@ -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,
Quoted 8 lines

tests/fbdev.c static void mode_tests(int fd) · line 83

Quoted 5 lines
tests/fbdev.c +5 -0
+			     "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.

Quoted 7 lines

tests/fbdev.c static void mode_tests(int fd) · line 87

Quoted 5 lines
tests/fbdev.c +4 -0
+		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

Quoted 7 lines
Quoted 6 lines
tests/fbdev.c +0 -0
  	}
  }
 
Signature · 1 line
2.33.0
Signature · 6 lines
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
#4 lore raw

PATCH 2/2 tests/fbdev: Add tests for display panning

In reply to Thomas Zimmermann

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.

---
 tests/fbdev.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)
tests/fbdev.c +92 -0
index c9903f8b..17727cd0 100644
@@ -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;
+		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);
+		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)
Signature · 1 line
2.33.0
#5 lore raw

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

Quoted 16 lines · Thomas Zimmermann

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.

---
 tests/fbdev.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)
tests/fbdev.c +0 -0
index c9903f8b..17727cd0 100644
@@ -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);

tests/fbdev.c static void mode_tests(int fd) · line 97

Quoted 10 lines
tests/fbdev.c +9 -0
 	}
+
+	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.

Quoted 62 lines
tests/fbdev.c +62 -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 (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);

tests/fbdev.c static void mode_tests(int fd) · line 169

Quoted 10 lines
tests/fbdev.c +10 -0
+		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.

Quoted 16 lines
tests/fbdev.c +11 -0
+		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)
Signature · 1 line
2.33.0
Signature · 2 lines
Ville Syrjälä
Intel
#6 lore raw

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

Hi

Am 11.10.21 um 16:24 schrieb Ville Syrjälä:

Quoted 22 lines · Thomas Zimmermann
Quoted 21 lines

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.

---
  tests/fbdev.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 92 insertions(+)
tests/fbdev.c +4 -0
index c9903f8b..17727cd0 100644
@@ -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;
Quoted 8 lines

tests/fbdev.c static void mode_tests(int fd) · line 97

Quoted 5 lines
tests/fbdev.c +5 -0
+		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.

Quoted 67 lines
Quoted 67 lines
tests/fbdev.c +66 -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 (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);
Quoted 8 lines

tests/fbdev.c static void mode_tests(int fd) · line 169

Quoted 6 lines
tests/fbdev.c +6 -0
+
+		/* 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

Quoted 18 lines
Quoted 17 lines
tests/fbdev.c +11 -0
+		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)
Signature · 1 line
2.33.0
Signature · 6 lines
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
#7 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for tests/fbdev: Additional tests for resolution and panning

In reply to Thomas Zimmermann
== Series Details ==

== Series Details ==

Series: tests/fbdev: Additional tests for resolution and panning
URL : https://patchwork.freedesktop.org/series/95676/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10715 -> IGTPW_6307
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6307/index.html

Known issues
------------

Here are the changes found in IGTPW_6307 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_cs_nop@sync-fork-compute0:
- fi-snb-2600: NOTRUN -> [SKIP][1] ([fdo#109271]) +17 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6307/fi-snb-2600/igt@amdgpu/[email protected]

* igt@gem_exec_suspend@basic-s3:
- fi-tgl-1115g4: [PASS][2] -> [FAIL][3] ([i915#1888])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10715/fi-tgl-1115g4/igt@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6307/fi-tgl-1115g4/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-cml-u2: [PASS][4] -> [DMESG-WARN][5] ([i915#4269])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10715/fi-cml-u2/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6307/fi-cml-u2/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@hangcheck:
- fi-snb-2600: [INCOMPLETE][6] ([i915#3921]) -> [PASS][7]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10715/fi-snb-2600/igt@i915_selftest@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6307/fi-snb-2600/igt@i915_selftest@[email protected]

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
[i915#3921]: https://gitlab.freedesktop.org/drm/intel/issues/3921
[i915#4269]: https://gitlab.freedesktop.org/drm/intel/issues/4269

Participating hosts (40 -> 35)
------------------------------

Missing (5): fi-kbl-soraka fi-tgl-dsi fi-bsw-cyan fi-kbl-guc fi-ctg-p8600

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_6242 -> IGTPW_6307

CI-20190529: 20190529
CI_DRM_10715: 74b6fd5b34d5fbe3672e864d279654d079e88073 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_6307: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6307/index.html
IGT_6242: 721fd85ee95225ed5df322f7182bdfa9b86a3e68 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Testlist changes ==

+igt@fbdev@pan

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6307/index.html