Skip to contentSkip to conversation

igt/kms_addfb_basic: New subtest to check for fb modifier and tiling mode mismatch

PATCH In review Vivek Kasireddy 3 participants 10 messages Oct 7, 2015 – Oct 20, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igt/kms_addfb_basic: New subtest to check for fb modifier and tiling mode mismatch

This new subtest will validate a Y-tiled object's tiling mode against its associated fb modifier.

---
 tests/kms_addfb_basic.c | 9 +++++++++
 1 file changed, 9 insertions(+)
tests/kms_addfb_basic.c +9 -0
index d466e4d..7ca1add 100644
@@ -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);
 
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Hi,

Quoted 19 lines · Vivek Kasireddy

This new subtest will validate a Y-tiled object's tiling mode against its associated fb modifier.

---
  tests/kms_addfb_basic.c | 9 +++++++++
  1 file changed, 9 insertions(+)
tests/kms_addfb_basic.c +2 -0
index d466e4d..7ca1add 100644
@@ -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);

tests/kms_addfb_basic.c static void addfb25_ytile(int fd, int gen) · line 387

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

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

Hi Tvrtko,

Quoted 21 lines · On Wed, 7 Oct 2015 15:07:30 +0100 Tvrtko Ursulin…

Hi,

Quoted 17 lines · Vivek Kasireddy

This new subtest will validate a Y-tiled object's tiling mode against its associated fb modifier.

---
  tests/kms_addfb_basic.c | 9 +++++++++
  1 file changed, 9 insertions(+)
tests/kms_addfb_basic.c +0 -0
index d466e4d..7ca1add 100644
@@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int gen)
  		f.handles[0] = gem_bo;
  	}
 
Quoted 16 lines

tests/kms_addfb_basic.c static void addfb25_ytile(int fd, int gen) · line 386

Quoted 13 lines
tests/kms_addfb_basic.c +9 -0
+	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.

Thanks and Regards,
Vivek

Quoted 6 lines

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 44 lines · Vivek Kasireddy

Hi Tvrtko,

Quoted 21 lines · On Wed, 7 Oct 2015 15:07:30 +0100 Tvrtko Ursulin…

Hi,

Quoted 17 lines · Vivek Kasireddy

This new subtest will validate a Y-tiled object's tiling mode against its associated fb modifier.

---
   tests/kms_addfb_basic.c | 9 +++++++++
   1 file changed, 9 insertions(+)
tests/kms_addfb_basic.c +0 -0
index d466e4d..7ca1add 100644
@@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int gen)
   		f.handles[0] = gem_bo;
   	}
 
Quoted 16 lines

tests/kms_addfb_basic.c static void addfb25_ytile(int fd, int gen) · line 386

Quoted 13 lines
tests/kms_addfb_basic.c +9 -0
+	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?

Quoted 4 lines

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.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 50 lines · Tvrtko Ursulin
Quoted 44 lines · Vivek Kasireddy

Hi Tvrtko,

Quoted 21 lines · On Wed, 7 Oct 2015 15:07:30 +0100 Tvrtko Ursulin…

Hi,

Quoted 17 lines · Vivek Kasireddy

This new subtest will validate a Y-tiled object's tiling mode against its associated fb modifier.

---
   tests/kms_addfb_basic.c | 9 +++++++++
   1 file changed, 9 insertions(+)
tests/kms_addfb_basic.c +0 -0
index d466e4d..7ca1add 100644
@@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int gen)
           f.handles[0] = gem_bo;
       }
 
Quoted 16 lines

tests/kms_addfb_basic.c static void addfb25_ytile(int fd, int gen) · line 386

Quoted 13 lines
tests/kms_addfb_basic.c +9 -0
+    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?

Quoted 4 lines

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.

Quoted 4 lines

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.

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Hi Tvrtko,

Quoted 53 lines · On Fri, 9 Oct 2015 09:34:25 +0100 Tvrtko Ursulin…
Quoted 50 lines · Tvrtko Ursulin
Quoted 48 lines · Vivek Kasireddy

Hi Tvrtko,

Quoted 21 lines · On Wed, 7 Oct 2015 15:07:30 +0100 Tvrtko Ursulin…

Hi,

Quoted 17 lines · Vivek Kasireddy

This new subtest will validate a Y-tiled object's tiling mode against its associated fb modifier.

---
   tests/kms_addfb_basic.c | 9 +++++++++
   1 file changed, 9 insertions(+)
tests/kms_addfb_basic.c +0 -0
index d466e4d..7ca1add 100644
@@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int gen)
           f.handles[0] = gem_bo;
       }
 
Quoted 16 lines

tests/kms_addfb_basic.c static void addfb25_ytile(int fd, int gen) · line 386

Quoted 13 lines
tests/kms_addfb_basic.c +9 -0
+    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.

Quoted 8 lines
Quoted 4 lines

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.

Thank you for your suggestion. I am currently having problems with my hardware. After resolving these, I'll look into kms_flip_tiling and send out a patch soon.

Thanks and Regards,
Vivek

Quoted 6 lines

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
In reply to Tvrtko Ursulin

Hi Tvrtko,

Quoted 53 lines · On Fri, 9 Oct 2015 09:34:25 +0100 Tvrtko Ursulin…
Quoted 50 lines · Tvrtko Ursulin
Quoted 48 lines · Vivek Kasireddy

Hi Tvrtko,

Quoted 21 lines · On Wed, 7 Oct 2015 15:07:30 +0100 Tvrtko Ursulin…

Hi,

Quoted 17 lines · Vivek Kasireddy

This new subtest will validate a Y-tiled object's tiling mode against its associated fb modifier.

---
   tests/kms_addfb_basic.c | 9 +++++++++
   1 file changed, 9 insertions(+)
tests/kms_addfb_basic.c +0 -0
index d466e4d..7ca1add 100644
@@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int gen)
           f.handles[0] = gem_bo;
       }
 
Quoted 16 lines

tests/kms_addfb_basic.c static void addfb25_ytile(int fd, int gen) · line 387

Quoted 13 lines
tests/kms_addfb_basic.c +9 -0
+    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.

Quoted 8 lines
Quoted 4 lines

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 <[email protected]>
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(+)
tests/kms_rotation_crc.c +70 -0
index cc9847e..f10a770 100644
@@ -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);
 	}
Signature · 4 lines
2.4.3

Thanks and Regards,
Vivek
Quoted 6 lines

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Hi,

Quoted 49 lines · Vivek Kasireddy
Quoted 40 lines
Quoted 40 lines
Quoted 39 lines
Quoted 18 lines · Vivek Kasireddy
Quoted 17 lines

This new subtest will validate a Y-tiled object's tiling mode against its associated fb modifier.

---
    tests/kms_addfb_basic.c | 9 +++++++++
    1 file changed, 9 insertions(+)
tests/kms_addfb_basic.c +0 -0
index d466e4d..7ca1add 100644
@@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int gen)
            f.handles[0] = gem_bo;
        }
 
Quoted 16 lines

tests/kms_addfb_basic.c static void addfb25_ytile(int fd, int gen) · line 387

Quoted 13 lines
tests/kms_addfb_basic.c +9 -0
+    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.

Quoted 8 lines
Quoted 4 lines

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.

Quoted 12 lines

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.

It is possible and it looks like you have been on the right track. If you just avoided rendering to the fb (paint_squares) I think it might have worked.

Unfortunately before reading your e-mail thoroughly I rushed and developed my own POC so you will now see a patch series I copied you on.

That triggers the WARN nicely.

But your approach, localized changes to kms_rotation_crc, is probably better. So feel free to refine your test case and we can drop my patch series.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw
In reply to Vivek Kasireddy
Quoted 67 lines · Vivek Kasireddy

Hi Tvrtko,

Quoted 53 lines · On Fri, 9 Oct 2015 09:34:25 +0100 Tvrtko Ursulin…
Quoted 50 lines · Tvrtko Ursulin
Quoted 48 lines · Vivek Kasireddy

Hi Tvrtko,

Quoted 21 lines · On Wed, 7 Oct 2015 15:07:30 +0100 Tvrtko Ursulin…

Hi,

Quoted 17 lines · Vivek Kasireddy

This new subtest will validate a Y-tiled object's tiling mode against its associated fb modifier.

---
   tests/kms_addfb_basic.c | 9 +++++++++
   1 file changed, 9 insertions(+)
tests/kms_addfb_basic.c +0 -0
index d466e4d..7ca1add 100644
@@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int gen)
           f.handles[0] = gem_bo;
       }
 
Quoted 16 lines

tests/kms_addfb_basic.c static void addfb25_ytile(int fd, int gen) · line 387

Quoted 13 lines
tests/kms_addfb_basic.c +9 -0
+    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.

Quoted 8 lines
Quoted 4 lines

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.

Quoted 12 lines

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.

Just do another setplane with a new Y-tiled buffer after you've set up the rotation. That should do the trick.
-Daniel

Quoted 116 lines

From 5d7f6920663b2fd264aca6085170811276948a5b Mon Sep 17 00:00:00 2001
From: Vivek Kasireddy <[email protected]>
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(+)
tests/kms_rotation_crc.c +70 -0
index cc9847e..f10a770 100644
@@ -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);
 	}
Signature · 4 lines
2.4.3

Thanks and Regards,
Vivek
Quoted 6 lines

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw
Quoted 83 lines · On Mon, 19 Oct 2015 11:50:25 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 69 lines · Vivek Kasireddy

Hi Tvrtko,

Quoted 60 lines · On Fri, 9 Oct 2015 09:34:25 +0100 Tvrtko Ursulin…
Quoted 51 lines · Tvrtko Ursulin
Quoted 44 lines · Vivek Kasireddy

Hi Tvrtko,

Quoted 21 lines · On Wed, 7 Oct 2015 15:07:30 +0100 Tvrtko Ursulin…

Hi,

Quoted 17 lines · Vivek Kasireddy

This new subtest will validate a Y-tiled object's tiling mode against its associated fb modifier.

---
   tests/kms_addfb_basic.c | 9 +++++++++
   1 file changed, 9 insertions(+)
(quoted diff) +0 -0

b/tests/kms_addfb_basic.c index d466e4d..7ca1add 100644

tests/kms_addfb_basic.c +0 -0
@@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int
 gen) f.handles[0] = gem_bo;
       }
 
Quoted 16 lines

tests/kms_addfb_basic.c static void addfb25_ytile(int fd, int · line 387

Quoted 13 lines
tests/kms_addfb_basic.c +9 -0
+    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?

Quoted 5 lines

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.

Quoted 5 lines

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.

Quoted 3 lines

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.

Quoted 12 lines

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.

Quoted 3 lines

Just do another setplane with a new Y-tiled buffer after you've set up the rotation. That should do the trick.
-Daniel

Hi Daniel,
I did manage to get the WARN to be triggered with this sub-test:
http://lists.freedesktop.org/archives/intel-gfx/2015-October/078220.html
by doing something similar.

Thanks,
Vivek

Quoted 117 lines
Quoted 117 lines

From 5d7f6920663b2fd264aca6085170811276948a5b Mon Sep 17 00:00:00 2001 From: Vivek Kasireddy <[email protected]>
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(+)

tests/kms_rotation_crc.c +0 -0
index cc9847e..f10a770 100644
@@ -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) +{

tests/kms_rotation_crc.c +12 -0
+	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) {

tests/kms_rotation_crc.c +11 -0
+		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); +

tests/kms_rotation_crc.c +1 -0
+		for (data->fb.size = 1024*1024; data->fb.size <

data->fb.stride * h; data->fb.size *= 2); +

tests/kms_rotation_crc.c +1 -0
+		data->fb.gem_handle = gem_create(data->gfx_fd,

data->fb.size);

tests/kms_rotation_crc.c +1 -0
+		ret = __gem_set_tiling(data->gfx_fd,

data->fb.gem_handle, I915_TILING_Y, data->fb.stride);

tests/kms_rotation_crc.c +3 -0
+		igt_assert(ret == 0);
+
+		do_or_die(__kms_addfb(data->gfx_fd,

data->fb.gem_handle, w, h,

tests/kms_rotation_crc.c +2 -0
+			  data->fb.stride, format, tiling,
+			  LOCAL_DRM_MODE_FB_MODIFIERS,

&data->fb.fb_id)); +

tests/kms_rotation_crc.c +13 -0
+		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,

tests/kms_rotation_crc.c +1 -0
+			DRM_MODE_OBJECT_PLANE,

plane->rotation_property, plane->rotation);

tests/kms_rotation_crc.c +20 -0
+		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);

}

Signature · 4 lines
2.4.3

Thanks and Regards,
Vivek
Quoted 3 lines

Regards,

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx