[Intel-gfx] [PATCH] igt/kms_addfb_basic: New subtest to check for fb modifier and tiling mode mismatch

Vivek Kasireddy vivek.kasireddy at intel.com
Thu Oct 15 18:10:46 PDT 2015


Hi Tvrtko,

On Fri, 9 Oct 2015 09:34:25 +0100
Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com> wrote:

> 
> 
> On 08/10/15 09:55, Tvrtko Ursulin wrote:
> > On 07/10/15 22:07, Vivek Kasireddy wrote:
> >>
> >> Hi Tvrtko,
> >>
> >> On Wed, 7 Oct 2015 15:07:30 +0100
> >> Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com> wrote:
> >>
> >>>
> >>> Hi,
> >>>
> >>> On 07/10/15 03:35, Vivek Kasireddy wrote:
> >>>> This new subtest will validate a Y-tiled object's tiling mode
> >>>> against its associated fb modifier.
> >>>>
> >>>> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> >>>> Signed-off-by: Vivek Kasireddy <vivek.kasireddy at intel.com>
> >>>> ---
> >>>>    tests/kms_addfb_basic.c | 9 +++++++++
> >>>>    1 file changed, 9 insertions(+)
> >>>>
> >>>> diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> >>>> index d466e4d..7ca1add 100644
> >>>> --- a/tests/kms_addfb_basic.c
> >>>> +++ b/tests/kms_addfb_basic.c
> >>>> @@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int gen)
> >>>>            f.handles[0] = gem_bo;
> >>>>        }
> >>>>
> >>>> +    igt_subtest("addfb25-Y-tiled-X-modifier-mismatch") {
> >>>> +        igt_require(gen >= 9);
> >>>> +        igt_require_fb_modifiers(fd);
> >>>> +        gem_set_tiling(fd, gem_bo, I915_TILING_Y, 1024*4);
> >>>> +
> >>>> +        f.modifier[0] = LOCAL_I915_FORMAT_MOD_X_TILED;
> >>>> +        igt_assert(drmIoctl(fd,
> >>>> LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) < 0 && errno == EINVAL);
> >>>> +    }
> >>>> +
> >>>>        igt_subtest("addfb25-Y-tiled") {
> >>>>            igt_require_fb_modifiers(fd);
> >>>>
> >>>
> >>> Wasn't the original WARN triggered by Y tiled object and Y fb
> >>> modifier?
> >>
> >> Creating a new fb using a Y-tiled object and Y/X fb modifier will
> >> not trigger the original WARN. It'll be triggered only if the fb
> >> is going to be pinned -- and flipped. I am not sure how to get
> >> that WARN to be triggered with the existing suite of igt tests.
> >
> > Ah yes, you would need to attempt display it, not even necessarily
> > flip it. I am sure there are tests which do that. :) I know from
> > recent activity kms_rotation_crc for example creates a Y tiled FB
> > and displays it. So maybe borrow some code to start with from there.
> 
> Even better, kms_flip_tiling does the majority of what is needed here 
> already. Just drop in a subtest which will do set_tiling and that
> should be good.

I have realized that I cannot get the the map_and_fenceable WARN to be
triggered with any of the IGT tests. This is because the WARN is
triggered only when pinning/fencing a Y-tiled fb that has a rotated
view (90/270 degree rotation) that none of the IGT tests can do. I
looked at and wrote a subtest in kms_rotation_crc but the WARN was not
triggered because IGT does not support atomic flip/commit yet.
Currently, since it does a SetPlane first, the object has a normal view
and its map_and-fenceable bit is set, however, when the rotation
property is applied, the object though has a rotated view, its
map_and-fenceable bit never gets updated and stays 1 and hence the
warning doesn't get triggered. I am copying the subtest code below for
reference.

From 5d7f6920663b2fd264aca6085170811276948a5b Mon Sep 17 00:00:00 2001
From: Vivek Kasireddy <vivek.kasireddy at intel.com>
Date: Thu, 15 Oct 2015 17:48:50 -0700
Subject: [PATCH] igt/kms_rotation_crc: Add a new subtest to flip Y-tiled
 rotated fb

---
 tests/kms_rotation_crc.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..f10a770 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,70 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 }
 
+static void test_plane_rotation_ytiled(data_t *data, enum igt_plane plane_type)
+{
+	igt_display_t *display = &data->display;
+	igt_output_t *output;
+	enum igt_commit_style commit = COMMIT_LEGACY;
+	drmModeModeInfo *mode;
+	unsigned int w, h;
+	igt_plane_t *plane;
+	int ret;
+	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+	uint32_t format = DRM_FORMAT_XRGB8888;
+	int bpp = igt_drm_format_to_bpp(format);
+
+	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+		igt_require(data->display.has_universal_planes);
+		commit = COMMIT_UNIVERSAL;
+	}
+
+	for_each_connected_output(display, output) {
+		mode = igt_output_get_mode(output);
+
+		w = mode->hdisplay;
+		h = mode->vdisplay;
+
+		for (data->fb.stride = 512; data->fb.stride < (w * bpp / 8); data->fb.stride *= 2);
+
+		for (data->fb.size = 1024*1024; data->fb.size < data->fb.stride * h; data->fb.size *= 2);
+
+		data->fb.gem_handle = gem_create(data->gfx_fd, data->fb.size);
+		ret = __gem_set_tiling(data->gfx_fd, data->fb.gem_handle, I915_TILING_Y, data->fb.stride);
+		igt_assert(ret == 0);
+
+		do_or_die(__kms_addfb(data->gfx_fd, data->fb.gem_handle, w, h,
+			  data->fb.stride, format, tiling,
+			  LOCAL_DRM_MODE_FB_MODIFIERS, &data->fb.fb_id));
+
+		data->fb.width = w;
+		data->fb.height = h;
+		data->fb.tiling = tiling;
+		data->fb.drm_format = format;
+
+		plane = igt_output_get_plane(output, plane_type);
+		igt_require(igt_plane_supports_rotation(plane));
+
+		igt_plane_set_rotation(plane, data->rotation);
+		paint_squares(data, mode, IGT_ROTATION_0, plane);
+		igt_plane_set_fb(plane, &data->fb);
+
+		drmModeObjectSetProperty(data->gfx_fd, plane->drm_plane->plane_id,
+			DRM_MODE_OBJECT_PLANE, plane->rotation_property, plane->rotation);
+		igt_display_commit2(display, commit);
+
+		kmstest_restore_vt_mode();
+		kmstest_set_vt_graphics_mode();
+		commit_crtc(data, output, plane);
+
+		igt_remove_fb(data->gfx_fd, &data->fb);
+		igt_plane_set_fb(plane, NULL);
+		igt_output_set_pipe(output, PIPE_ANY);
+
+		igt_display_commit(display);
+	}
+}
+
 igt_main
 {
 	data_t data = {};
@@ -345,6 +409,12 @@ igt_main
 		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
 	}
 
+	igt_subtest_f("primary-rotation-90-Y-tiled") {
+		igt_require(gen >= 9);
+		data.rotation = IGT_ROTATION_90;
+		test_plane_rotation_ytiled(&data, IGT_PLANE_PRIMARY);
+	}
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 	}
-- 
2.4.3

Thanks and Regards,
Vivek

> 
> Regards,
> 
> Tvrtko
> 
> 



More information about the Intel-gfx mailing list