Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v3)

2015-11-02 Thread Thomas Wood
On 27 October 2015 at 10:37, Tvrtko Ursulin
 wrote:
>
> On 23/10/15 12:35, Daniel Vetter wrote:
>>
>> On Fri, Oct 23, 2015 at 09:51:06AM +0100, Tvrtko Ursulin wrote:
>>>
>>>
>>> Hi,
>>>
>>> On 23/10/15 02:34, Vivek Kasireddy wrote:

 The main goal of this subtest is to trigger the following warning in
 the function i915_gem_object_get_fence():
 if (WARN_ON(!obj->map_and_fenceable))

 To trigger this warning, the subtest first creates a Y-tiled object and
 an associated framebuffer with the Y-fb modifier. Furthermore, to
 prevent the map_and_fenceable from being set, we make sure that
 the object does not have a normal VMA by refraining from rendering to
 the
 object and by setting the rotation property upfront before calling
 commit.

 v2: Do not call paint_squares and just use one output.

 v3: Convert an if condition to igt_require and move the plane rotation
 requirement further up before the fb allocation.

 Cc: Tvrtko Ursulin 
 Signed-off-by: Vivek Kasireddy 
 ---
   tests/kms_rotation_crc.c | 68
 
   1 file changed, 68 insertions(+)

 diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
 index cc9847e..b25a949 100644
 --- a/tests/kms_rotation_crc.c
 +++ b/tests/kms_rotation_crc.c
 @@ -264,6 +264,68 @@ 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_obj(data_t *data, enum igt_plane
 plane_type)
 +{
 +   igt_display_t *display = &data->display;
 +   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
 +   uint32_t format = DRM_FORMAT_XRGB;
 +   int bpp = igt_drm_format_to_bpp(format);
 +   enum igt_commit_style commit = COMMIT_LEGACY;
 +   int fd = data->gfx_fd;
 +   igt_output_t *output = &display->outputs[0];
 +   igt_plane_t *plane;
 +   drmModeModeInfo *mode;
 +   unsigned int stride, size, w, h;
 +   uint32_t gem_handle;
 +   int ret;
 +
 +   igt_require(output != NULL && output->valid == true);
 +
 +   plane = igt_output_get_plane(output, plane_type);
 +   igt_require(igt_plane_supports_rotation(plane));
 +
 +   if (plane_type == IGT_PLANE_PRIMARY || plane_type ==
 IGT_PLANE_CURSOR) {
 +   igt_require(data->display.has_universal_planes);
 +   commit = COMMIT_UNIVERSAL;
 +   }
 +
 +   mode = igt_output_get_mode(output);
 +   w = mode->hdisplay;
 +   h = mode->vdisplay;
 +
 +   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
 +   ;
 +   for (size = 1024*1024; size < stride * h; size *= 2)
 +   ;
 +
 +   gem_handle = gem_create(fd, size);
 +   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
 +   igt_assert(ret == 0);
 +
 +   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
 + format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
 + &data->fb.fb_id));
 +   data->fb.width = w;
 +   data->fb.height = h;
 +   data->fb.gem_handle = gem_handle;
 +
 +   igt_plane_set_fb(plane, NULL);
 +   igt_display_commit(display);
 +
 +   igt_plane_set_rotation(plane, data->rotation);
 +   igt_plane_set_fb(plane, &data->fb);
 +
 +   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
 +DRM_MODE_OBJECT_PLANE,
 +plane->rotation_property,
 +plane->rotation);
 +   ret = igt_display_try_commit2(display, commit);
 +
 +   kmstest_restore_vt_mode();
 +   igt_remove_fb(fd, &data->fb);
 +   igt_assert(ret == 0);
 +}
 +
   igt_main
   {
 data_t data = {};
 @@ -345,6 +407,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_obj(&data,
 IGT_PLANE_PRIMARY);
 +   }
 +
 igt_fixture {
 igt_display_fini(&data.display);
 }

>>>
>>> Reviewed-by: Tvrtko Ursulin 
>>
>>
>> Applied, thanks.
>
>
> Hasn't hit the repo yet.

Daniel has now pushed this patch (v3), so the further changes that
have been made will need to be split into new patches.


>
> Regards,
>
> Tvrtko
>
> ___
> Intel-gfx mailing list
> Intel-

Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v5)

2015-11-02 Thread Tvrtko Ursulin


On 31/10/15 01:45, Vivek Kasireddy wrote:

Hi Tvrtko,

On Fri, 30 Oct 2015 10:22:08 +
Tvrtko Ursulin  wrote:



On 30/10/15 01:44, Vivek Kasireddy wrote:

The main goal of this subtest is to trigger the following warning in
the function i915_gem_object_get_fence():
if (WARN_ON(!obj->map_and_fenceable))

To trigger this warning, the subtest first creates a Y-tiled object
and an associated framebuffer with the Y-fb modifier. Furthermore,
to prevent the map_and_fenceable from being set, we make sure that
the object does not have a normal VMA by refraining from rendering
to the object and by setting the rotation property upfront before
calling commit.

v2: Do not call paint_squares and just use one output.

v3: Convert an if condition to igt_require and move the plane
rotation requirement further up before the fb allocation.

v4: After setting rotation to 90 and committing, change the
rotation to 0 and commit once more. This is to test if the i915
driver hits any warnings while pinning and unpinning an object that
has both normal and rotated views.

v5:
- Add another subtest to toggle the order of rotation
- Exhaustively test the i915 driver's pinning and unpinning code
paths for any fence leaks by iterating until MAX available fences.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
   tests/kms_rotation_crc.c | 84
 1 file changed, 84
insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..34f8150 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,80 @@ 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_obj(data_t *data, enum
igt_plane plane_type,
+  int toggle)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   igt_output_t *output = &display->outputs[0];
+   igt_plane_t *plane;
+   drmModeModeInfo *mode;
+   unsigned int stride, size, w, h;
+   uint32_t gem_handle;
+   int num_fences = gem_available_fences(fd);
+   int i, ret;
+
+   igt_require(output != NULL && output->valid == true);
+
+   plane = igt_output_get_plane(output, plane_type);
+   igt_require(igt_plane_supports_rotation(plane));
+
+   if (plane_type == IGT_PLANE_PRIMARY || plane_type ==
IGT_PLANE_CURSOR) {
+   igt_require(data->display.has_universal_planes);
+   commit = COMMIT_UNIVERSAL;
+   }
+
+   mode = igt_output_get_mode(output);
+   w = mode->hdisplay;
+   h = mode->vdisplay;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y,
stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+
+   igt_plane_set_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_fb(plane, &data->fb);
+
+   for (i = 0; i < num_fences + 1; i++) {
+   igt_plane_set_rotation(plane, toggle ?
IGT_ROTATION_0 : IGT_ROTATION_90);
+   drmModeObjectSetProperty(fd,
plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+   igt_assert(ret == 0);
+
+   igt_plane_set_rotation(plane, toggle ?
IGT_ROTATION_90 : IGT_ROTATION_0);
+   drmModeObjectSetProperty(fd,
plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+   igt_assert(ret == 0);
+   }


It manages to exhaust the fences with only one object? I was
expecting that multiple objects will be required since if it is only
one how come it allocates more than one fence register?


Before I sent out this version, I did try with two objects to see if it
triggers any WARNs but it didn't. I am not sure if I did it right
though, I'll take a look at it again. However, when I tried this
versi

Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v5)

2015-10-30 Thread Vivek Kasireddy
Hi Tvrtko,

On Fri, 30 Oct 2015 10:22:08 +
Tvrtko Ursulin  wrote:

> 
> On 30/10/15 01:44, Vivek Kasireddy wrote:
> > The main goal of this subtest is to trigger the following warning in
> > the function i915_gem_object_get_fence():
> > if (WARN_ON(!obj->map_and_fenceable))
> >
> > To trigger this warning, the subtest first creates a Y-tiled object
> > and an associated framebuffer with the Y-fb modifier. Furthermore,
> > to prevent the map_and_fenceable from being set, we make sure that
> > the object does not have a normal VMA by refraining from rendering
> > to the object and by setting the rotation property upfront before
> > calling commit.
> >
> > v2: Do not call paint_squares and just use one output.
> >
> > v3: Convert an if condition to igt_require and move the plane
> > rotation requirement further up before the fb allocation.
> >
> > v4: After setting rotation to 90 and committing, change the
> > rotation to 0 and commit once more. This is to test if the i915
> > driver hits any warnings while pinning and unpinning an object that
> > has both normal and rotated views.
> >
> > v5:
> > - Add another subtest to toggle the order of rotation
> > - Exhaustively test the i915 driver's pinning and unpinning code
> > paths for any fence leaks by iterating until MAX available fences.
> >
> > Cc: Tvrtko Ursulin 
> > Signed-off-by: Vivek Kasireddy 
> > ---
> >   tests/kms_rotation_crc.c | 84
> >  1 file changed, 84
> > insertions(+)
> >
> > diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> > index cc9847e..34f8150 100644
> > --- a/tests/kms_rotation_crc.c
> > +++ b/tests/kms_rotation_crc.c
> > @@ -264,6 +264,80 @@ 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_obj(data_t *data, enum
> > igt_plane plane_type,
> > +  int toggle)
> > +{
> > +   igt_display_t *display = &data->display;
> > +   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> > +   uint32_t format = DRM_FORMAT_XRGB;
> > +   int bpp = igt_drm_format_to_bpp(format);
> > +   enum igt_commit_style commit = COMMIT_LEGACY;
> > +   int fd = data->gfx_fd;
> > +   igt_output_t *output = &display->outputs[0];
> > +   igt_plane_t *plane;
> > +   drmModeModeInfo *mode;
> > +   unsigned int stride, size, w, h;
> > +   uint32_t gem_handle;
> > +   int num_fences = gem_available_fences(fd);
> > +   int i, ret;
> > +
> > +   igt_require(output != NULL && output->valid == true);
> > +
> > +   plane = igt_output_get_plane(output, plane_type);
> > +   igt_require(igt_plane_supports_rotation(plane));
> > +
> > +   if (plane_type == IGT_PLANE_PRIMARY || plane_type ==
> > IGT_PLANE_CURSOR) {
> > +   igt_require(data->display.has_universal_planes);
> > +   commit = COMMIT_UNIVERSAL;
> > +   }
> > +
> > +   mode = igt_output_get_mode(output);
> > +   w = mode->hdisplay;
> > +   h = mode->vdisplay;
> > +
> > +   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
> > +   ;
> > +   for (size = 1024*1024; size < stride * h; size *= 2)
> > +   ;
> > +
> > +   gem_handle = gem_create(fd, size);
> > +   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y,
> > stride);
> > +   igt_assert(ret == 0);
> > +
> > +   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
> > + format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
> > + &data->fb.fb_id));
> > +   data->fb.width = w;
> > +   data->fb.height = h;
> > +   data->fb.gem_handle = gem_handle;
> > +
> > +   igt_plane_set_fb(plane, NULL);
> > +   igt_display_commit(display);
> > +
> > +   igt_plane_set_fb(plane, &data->fb);
> > +
> > +   for (i = 0; i < num_fences + 1; i++) {
> > +   igt_plane_set_rotation(plane, toggle ?
> > IGT_ROTATION_0 : IGT_ROTATION_90);
> > +   drmModeObjectSetProperty(fd,
> > plane->drm_plane->plane_id,
> > +DRM_MODE_OBJECT_PLANE,
> > +plane->rotation_property,
> > +plane->rotation);
> > +   ret = igt_display_try_commit2(display, commit);
> > +   igt_assert(ret == 0);
> > +
> > +   igt_plane_set_rotation(plane, toggle ?
> > IGT_ROTATION_90 : IGT_ROTATION_0);
> > +   drmModeObjectSetProperty(fd,
> > plane->drm_plane->plane_id,
> > +DRM_MODE_OBJECT_PLANE,
> > +plane->rotation_property,
> > +plane->rotation);
> > +   ret = igt_display_try_commit2(display, commit);
> > +   igt_assert(ret == 0);
> > +   }
> 
> It manages to exhaust the fences with only one object? I was
> expecting that multiple objects will be required since if it is only
> one how come it allocates more than one fence register?

Before I sent 

Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v5)

2015-10-30 Thread Tvrtko Ursulin


On 30/10/15 01:44, Vivek Kasireddy wrote:

The main goal of this subtest is to trigger the following warning in
the function i915_gem_object_get_fence():
if (WARN_ON(!obj->map_and_fenceable))

To trigger this warning, the subtest first creates a Y-tiled object and
an associated framebuffer with the Y-fb modifier. Furthermore, to
prevent the map_and_fenceable from being set, we make sure that
the object does not have a normal VMA by refraining from rendering to the
object and by setting the rotation property upfront before calling commit.

v2: Do not call paint_squares and just use one output.

v3: Convert an if condition to igt_require and move the plane rotation
requirement further up before the fb allocation.

v4: After setting rotation to 90 and committing, change the rotation to
0 and commit once more. This is to test if the i915 driver hits any
warnings while pinning and unpinning an object that has both normal
and rotated views.

v5:
- Add another subtest to toggle the order of rotation
- Exhaustively test the i915 driver's pinning and unpinning code paths
   for any fence leaks by iterating until MAX available fences.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
  tests/kms_rotation_crc.c | 84 
  1 file changed, 84 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..34f8150 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,80 @@ 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_obj(data_t *data, enum igt_plane 
plane_type,
+  int toggle)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   igt_output_t *output = &display->outputs[0];
+   igt_plane_t *plane;
+   drmModeModeInfo *mode;
+   unsigned int stride, size, w, h;
+   uint32_t gem_handle;
+   int num_fences = gem_available_fences(fd);
+   int i, ret;
+
+   igt_require(output != NULL && output->valid == true);
+
+   plane = igt_output_get_plane(output, plane_type);
+   igt_require(igt_plane_supports_rotation(plane));
+
+   if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+   igt_require(data->display.has_universal_planes);
+   commit = COMMIT_UNIVERSAL;
+   }
+
+   mode = igt_output_get_mode(output);
+   w = mode->hdisplay;
+   h = mode->vdisplay;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+
+   igt_plane_set_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_fb(plane, &data->fb);
+
+   for (i = 0; i < num_fences + 1; i++) {
+   igt_plane_set_rotation(plane, toggle ? IGT_ROTATION_0 : 
IGT_ROTATION_90);
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+   igt_assert(ret == 0);
+
+   igt_plane_set_rotation(plane, toggle ? IGT_ROTATION_90 : 
IGT_ROTATION_0);
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+   igt_assert(ret == 0);
+   }


It manages to exhaust the fences with only one object? I was expecting 
that multiple objects will be required since if it is only one how come 
it allocates more than one fence register?


Regards,

Tvrtko
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v5)

2015-10-29 Thread Vivek Kasireddy
The main goal of this subtest is to trigger the following warning in
the function i915_gem_object_get_fence():
if (WARN_ON(!obj->map_and_fenceable))

To trigger this warning, the subtest first creates a Y-tiled object and
an associated framebuffer with the Y-fb modifier. Furthermore, to
prevent the map_and_fenceable from being set, we make sure that
the object does not have a normal VMA by refraining from rendering to the
object and by setting the rotation property upfront before calling commit.

v2: Do not call paint_squares and just use one output.

v3: Convert an if condition to igt_require and move the plane rotation
requirement further up before the fb allocation.

v4: After setting rotation to 90 and committing, change the rotation to
0 and commit once more. This is to test if the i915 driver hits any
warnings while pinning and unpinning an object that has both normal
and rotated views.

v5:
- Add another subtest to toggle the order of rotation
- Exhaustively test the i915 driver's pinning and unpinning code paths
  for any fence leaks by iterating until MAX available fences.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
 tests/kms_rotation_crc.c | 84 
 1 file changed, 84 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..34f8150 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,80 @@ 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_obj(data_t *data, enum igt_plane 
plane_type,
+  int toggle)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   igt_output_t *output = &display->outputs[0];
+   igt_plane_t *plane;
+   drmModeModeInfo *mode;
+   unsigned int stride, size, w, h;
+   uint32_t gem_handle;
+   int num_fences = gem_available_fences(fd);
+   int i, ret;
+
+   igt_require(output != NULL && output->valid == true);
+
+   plane = igt_output_get_plane(output, plane_type);
+   igt_require(igt_plane_supports_rotation(plane));
+
+   if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+   igt_require(data->display.has_universal_planes);
+   commit = COMMIT_UNIVERSAL;
+   }
+
+   mode = igt_output_get_mode(output);
+   w = mode->hdisplay;
+   h = mode->vdisplay;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+
+   igt_plane_set_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_fb(plane, &data->fb);
+
+   for (i = 0; i < num_fences + 1; i++) {
+   igt_plane_set_rotation(plane, toggle ? IGT_ROTATION_0 : 
IGT_ROTATION_90);
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+   igt_assert(ret == 0);
+
+   igt_plane_set_rotation(plane, toggle ? IGT_ROTATION_90 : 
IGT_ROTATION_0);
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+   igt_assert(ret == 0);
+   }
+
+   kmstest_restore_vt_mode();
+   igt_remove_fb(fd, &data->fb);
+}
+
 igt_main
 {
data_t data = {};
@@ -345,6 +419,16 @@ igt_main
test_plane_rotation(&data, IGT_PLANE_PRIMARY);
}
 
+   igt_subtest_f("primary-rotation-90-to-0-Y-tiled") {
+   igt_require(gen >= 9);
+   test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY, 0);
+   }
+
+   igt_subtest_f("primary-rotation-0-to-90-Y-tiled") {
+   igt_require(gen >= 9);
+   test_plane_rotat

Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v4)

2015-10-29 Thread Tvrtko Ursulin


On 29/10/15 01:48, Vivek Kasireddy wrote:

The main goal of this subtest is to trigger the following warning in
the function i915_gem_object_get_fence():
if (WARN_ON(!obj->map_and_fenceable))

To trigger this warning, the subtest first creates a Y-tiled object and
an associated framebuffer with the Y-fb modifier. Furthermore, to
prevent the map_and_fenceable from being set, we make sure that
the object does not have a normal VMA by refraining from rendering to the
object and by setting the rotation property upfront before calling commit.

v2: Do not call paint_squares and just use one output.

v3: Convert an if condition to igt_require and move the plane rotation
requirement further up before the fb allocation.

v4: After setting rotation to 90 and committing, change the rotation to
0 and commit once more. This is to test if the i915 driver hits any
warnings while pinning and unpinning an object that has both normal
and rotated views.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
  tests/kms_rotation_crc.c | 84 
  1 file changed, 84 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..31cece2 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,84 @@ 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_obj(data_t *data, enum igt_plane 
plane_type)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   igt_output_t *output = &display->outputs[0];
+   igt_plane_t *plane;
+   drmModeModeInfo *mode;
+   unsigned int stride, size, w, h;
+   uint32_t gem_handle;
+   int ret;
+
+   igt_require(output != NULL && output->valid == true);
+
+   plane = igt_output_get_plane(output, plane_type);
+   igt_require(igt_plane_supports_rotation(plane));
+
+   if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+   igt_require(data->display.has_universal_planes);
+   commit = COMMIT_UNIVERSAL;
+   }
+
+   mode = igt_output_get_mode(output);
+   w = mode->hdisplay;
+   h = mode->vdisplay;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+
+   igt_plane_set_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_rotation(plane, data->rotation);
+   igt_plane_set_fb(plane, &data->fb);
+
+   /*
+* Set the rotation property before commit to make sure the object
+* only has a rotated view.
+*/
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+
+
+   /*
+* We set the rotation to 0 so that the underlying object will now
+* have a normal view.
+*/
+   igt_plane_set_rotation(plane, IGT_ROTATION_0);
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+
+   kmstest_restore_vt_mode();
+   igt_remove_fb(fd, &data->fb);
+   igt_assert(ret == 0);
+}
+
  igt_main
  {
data_t data = {};
@@ -345,6 +423,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_obj(&data, IGT_PLANE_PRIMARY);
+   }
+
igt_fixture {
igt_display_fini(&data.display);
}



Reviewed-by: Tvrtko Ursulin 

Regards,

Tvrtko
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v4)

2015-10-28 Thread Vivek Kasireddy
The main goal of this subtest is to trigger the following warning in
the function i915_gem_object_get_fence():
if (WARN_ON(!obj->map_and_fenceable))

To trigger this warning, the subtest first creates a Y-tiled object and
an associated framebuffer with the Y-fb modifier. Furthermore, to
prevent the map_and_fenceable from being set, we make sure that
the object does not have a normal VMA by refraining from rendering to the
object and by setting the rotation property upfront before calling commit.

v2: Do not call paint_squares and just use one output.

v3: Convert an if condition to igt_require and move the plane rotation
requirement further up before the fb allocation.

v4: After setting rotation to 90 and committing, change the rotation to
0 and commit once more. This is to test if the i915 driver hits any
warnings while pinning and unpinning an object that has both normal
and rotated views.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
 tests/kms_rotation_crc.c | 84 
 1 file changed, 84 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..31cece2 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,84 @@ 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_obj(data_t *data, enum igt_plane 
plane_type)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   igt_output_t *output = &display->outputs[0];
+   igt_plane_t *plane;
+   drmModeModeInfo *mode;
+   unsigned int stride, size, w, h;
+   uint32_t gem_handle;
+   int ret;
+
+   igt_require(output != NULL && output->valid == true);
+
+   plane = igt_output_get_plane(output, plane_type);
+   igt_require(igt_plane_supports_rotation(plane));
+
+   if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+   igt_require(data->display.has_universal_planes);
+   commit = COMMIT_UNIVERSAL;
+   }
+
+   mode = igt_output_get_mode(output);
+   w = mode->hdisplay;
+   h = mode->vdisplay;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+
+   igt_plane_set_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_rotation(plane, data->rotation);
+   igt_plane_set_fb(plane, &data->fb);
+
+   /*
+* Set the rotation property before commit to make sure the object
+* only has a rotated view.
+*/
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+
+
+   /*
+* We set the rotation to 0 so that the underlying object will now
+* have a normal view.
+*/
+   igt_plane_set_rotation(plane, IGT_ROTATION_0);
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+
+   kmstest_restore_vt_mode();
+   igt_remove_fb(fd, &data->fb);
+   igt_assert(ret == 0);
+}
+
 igt_main
 {
data_t data = {};
@@ -345,6 +423,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_obj(&data, IGT_PLANE_PRIMARY);
+   }
+
igt_fixture {
igt_display_fini(&data.display);
}
-- 
2.4.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v3)

2015-10-27 Thread Tvrtko Ursulin


On 23/10/15 12:35, Daniel Vetter wrote:

On Fri, Oct 23, 2015 at 09:51:06AM +0100, Tvrtko Ursulin wrote:


Hi,

On 23/10/15 02:34, Vivek Kasireddy wrote:

The main goal of this subtest is to trigger the following warning in
the function i915_gem_object_get_fence():
if (WARN_ON(!obj->map_and_fenceable))

To trigger this warning, the subtest first creates a Y-tiled object and
an associated framebuffer with the Y-fb modifier. Furthermore, to
prevent the map_and_fenceable from being set, we make sure that
the object does not have a normal VMA by refraining from rendering to the
object and by setting the rotation property upfront before calling commit.

v2: Do not call paint_squares and just use one output.

v3: Convert an if condition to igt_require and move the plane rotation
requirement further up before the fb allocation.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
  tests/kms_rotation_crc.c | 68 
  1 file changed, 68 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..b25a949 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,68 @@ 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_obj(data_t *data, enum igt_plane 
plane_type)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   igt_output_t *output = &display->outputs[0];
+   igt_plane_t *plane;
+   drmModeModeInfo *mode;
+   unsigned int stride, size, w, h;
+   uint32_t gem_handle;
+   int ret;
+
+   igt_require(output != NULL && output->valid == true);
+
+   plane = igt_output_get_plane(output, plane_type);
+   igt_require(igt_plane_supports_rotation(plane));
+
+   if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+   igt_require(data->display.has_universal_planes);
+   commit = COMMIT_UNIVERSAL;
+   }
+
+   mode = igt_output_get_mode(output);
+   w = mode->hdisplay;
+   h = mode->vdisplay;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+
+   igt_plane_set_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_rotation(plane, data->rotation);
+   igt_plane_set_fb(plane, &data->fb);
+
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+
+   kmstest_restore_vt_mode();
+   igt_remove_fb(fd, &data->fb);
+   igt_assert(ret == 0);
+}
+
  igt_main
  {
data_t data = {};
@@ -345,6 +407,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_obj(&data, IGT_PLANE_PRIMARY);
+   }
+
igt_fixture {
igt_display_fini(&data.display);
}



Reviewed-by: Tvrtko Ursulin 


Applied, thanks.


Hasn't hit the repo yet.

Regards,

Tvrtko
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v3)

2015-10-23 Thread Vivek Kasireddy
On Fri, 23 Oct 2015 13:35:21 +0200
Daniel Vetter  wrote:

> On Fri, Oct 23, 2015 at 09:51:06AM +0100, Tvrtko Ursulin wrote:
> > 
> > Hi,
> > 
> > On 23/10/15 02:34, Vivek Kasireddy wrote:
> > >The main goal of this subtest is to trigger the following warning
> > >in the function i915_gem_object_get_fence():
> > >   if (WARN_ON(!obj->map_and_fenceable))
> > >
> > >To trigger this warning, the subtest first creates a Y-tiled
> > >object and an associated framebuffer with the Y-fb modifier.
> > >Furthermore, to prevent the map_and_fenceable from being set, we
> > >make sure that the object does not have a normal VMA by refraining
> > >from rendering to the object and by setting the rotation property
> > >upfront before calling commit.
> > >
> > >v2: Do not call paint_squares and just use one output.
> > >
> > >v3: Convert an if condition to igt_require and move the plane
> > >rotation requirement further up before the fb allocation.
> > >
> > >Cc: Tvrtko Ursulin 
> > >Signed-off-by: Vivek Kasireddy 
> > >---
> > >  tests/kms_rotation_crc.c | 68
> > >  1 file changed,
> > > 68 insertions(+)
> > >
> > >diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> > >index cc9847e..b25a949 100644
> > >--- a/tests/kms_rotation_crc.c
> > >+++ b/tests/kms_rotation_crc.c
> > >@@ -264,6 +264,68 @@ 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_obj(data_t *data, enum
> > >igt_plane plane_type) +{
> > >+  igt_display_t *display = &data->display;
> > >+  uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> > >+  uint32_t format = DRM_FORMAT_XRGB;
> > >+  int bpp = igt_drm_format_to_bpp(format);
> > >+  enum igt_commit_style commit = COMMIT_LEGACY;
> > >+  int fd = data->gfx_fd;
> > >+  igt_output_t *output = &display->outputs[0];
> > >+  igt_plane_t *plane;
> > >+  drmModeModeInfo *mode;
> > >+  unsigned int stride, size, w, h;
> > >+  uint32_t gem_handle;
> > >+  int ret;
> > >+
> > >+  igt_require(output != NULL && output->valid == true);
> > >+
> > >+  plane = igt_output_get_plane(output, plane_type);
> > >+  igt_require(igt_plane_supports_rotation(plane));
> > >+
> > >+  if (plane_type == IGT_PLANE_PRIMARY || plane_type ==
> > >IGT_PLANE_CURSOR) {
> > >+  igt_require(data->display.has_universal_planes);
> > >+  commit = COMMIT_UNIVERSAL;
> > >+  }
> > >+
> > >+  mode = igt_output_get_mode(output);
> > >+  w = mode->hdisplay;
> > >+  h = mode->vdisplay;
> > >+
> > >+  for (stride = 512; stride < (w * bpp / 8); stride *= 2)
> > >+  ;
> > >+  for (size = 1024*1024; size < stride * h; size *= 2)
> > >+  ;
> > >+
> > >+  gem_handle = gem_create(fd, size);
> > >+  ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y,
> > >stride);
> > >+  igt_assert(ret == 0);
> > >+
> > >+  do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
> > >+format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
> > >+&data->fb.fb_id));
> > >+  data->fb.width = w;
> > >+  data->fb.height = h;
> > >+  data->fb.gem_handle = gem_handle;
> > >+
> > >+  igt_plane_set_fb(plane, NULL);
> > >+  igt_display_commit(display);
> > >+
> > >+  igt_plane_set_rotation(plane, data->rotation);
> > >+  igt_plane_set_fb(plane, &data->fb);
> > >+
> > >+  drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
> > >+   DRM_MODE_OBJECT_PLANE,
> > >+   plane->rotation_property,
> > >+   plane->rotation);
> > >+  ret = igt_display_try_commit2(display, commit);
> > >+
> > >+  kmstest_restore_vt_mode();
> > >+  igt_remove_fb(fd, &data->fb);
> > >+  igt_assert(ret == 0);
> > >+}
> > >+
> > >  igt_main
> > >  {
> > >   data_t data = {};
> > >@@ -345,6 +407,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_obj(&data,
> > >IGT_PLANE_PRIMARY);
> > >+  }
> > >+
> > >   igt_fixture {
> > >   igt_display_fini(&data.display);
> > >   }
> > >
> > 
> > Reviewed-by: Tvrtko Ursulin 
> 
> Applied, thanks.
> -Daniel
Hi Daniel,
Not sure whether Tvrtko or Chris have any futher comments on the fix
for this bug but do you have any comments?

This was the fix:
http://lists.freedesktop.org/archives/intel-gfx/2015-September/076183.html

Thanks and Regards,
Vivek

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v3)

2015-10-23 Thread Daniel Vetter
On Fri, Oct 23, 2015 at 09:51:06AM +0100, Tvrtko Ursulin wrote:
> 
> Hi,
> 
> On 23/10/15 02:34, Vivek Kasireddy wrote:
> >The main goal of this subtest is to trigger the following warning in
> >the function i915_gem_object_get_fence():
> > if (WARN_ON(!obj->map_and_fenceable))
> >
> >To trigger this warning, the subtest first creates a Y-tiled object and
> >an associated framebuffer with the Y-fb modifier. Furthermore, to
> >prevent the map_and_fenceable from being set, we make sure that
> >the object does not have a normal VMA by refraining from rendering to the
> >object and by setting the rotation property upfront before calling commit.
> >
> >v2: Do not call paint_squares and just use one output.
> >
> >v3: Convert an if condition to igt_require and move the plane rotation
> >requirement further up before the fb allocation.
> >
> >Cc: Tvrtko Ursulin 
> >Signed-off-by: Vivek Kasireddy 
> >---
> >  tests/kms_rotation_crc.c | 68 
> > 
> >  1 file changed, 68 insertions(+)
> >
> >diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> >index cc9847e..b25a949 100644
> >--- a/tests/kms_rotation_crc.c
> >+++ b/tests/kms_rotation_crc.c
> >@@ -264,6 +264,68 @@ 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_obj(data_t *data, enum igt_plane 
> >plane_type)
> >+{
> >+igt_display_t *display = &data->display;
> >+uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> >+uint32_t format = DRM_FORMAT_XRGB;
> >+int bpp = igt_drm_format_to_bpp(format);
> >+enum igt_commit_style commit = COMMIT_LEGACY;
> >+int fd = data->gfx_fd;
> >+igt_output_t *output = &display->outputs[0];
> >+igt_plane_t *plane;
> >+drmModeModeInfo *mode;
> >+unsigned int stride, size, w, h;
> >+uint32_t gem_handle;
> >+int ret;
> >+
> >+igt_require(output != NULL && output->valid == true);
> >+
> >+plane = igt_output_get_plane(output, plane_type);
> >+igt_require(igt_plane_supports_rotation(plane));
> >+
> >+if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
> >+igt_require(data->display.has_universal_planes);
> >+commit = COMMIT_UNIVERSAL;
> >+}
> >+
> >+mode = igt_output_get_mode(output);
> >+w = mode->hdisplay;
> >+h = mode->vdisplay;
> >+
> >+for (stride = 512; stride < (w * bpp / 8); stride *= 2)
> >+;
> >+for (size = 1024*1024; size < stride * h; size *= 2)
> >+;
> >+
> >+gem_handle = gem_create(fd, size);
> >+ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
> >+igt_assert(ret == 0);
> >+
> >+do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
> >+  format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
> >+  &data->fb.fb_id));
> >+data->fb.width = w;
> >+data->fb.height = h;
> >+data->fb.gem_handle = gem_handle;
> >+
> >+igt_plane_set_fb(plane, NULL);
> >+igt_display_commit(display);
> >+
> >+igt_plane_set_rotation(plane, data->rotation);
> >+igt_plane_set_fb(plane, &data->fb);
> >+
> >+drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
> >+ DRM_MODE_OBJECT_PLANE,
> >+ plane->rotation_property,
> >+ plane->rotation);
> >+ret = igt_display_try_commit2(display, commit);
> >+
> >+kmstest_restore_vt_mode();
> >+igt_remove_fb(fd, &data->fb);
> >+igt_assert(ret == 0);
> >+}
> >+
> >  igt_main
> >  {
> > data_t data = {};
> >@@ -345,6 +407,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_obj(&data, IGT_PLANE_PRIMARY);
> >+}
> >+
> > igt_fixture {
> > igt_display_fini(&data.display);
> > }
> >
> 
> Reviewed-by: Tvrtko Ursulin 

Applied, thanks.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v3)

2015-10-23 Thread Tvrtko Ursulin


Hi,

On 23/10/15 02:34, Vivek Kasireddy wrote:

The main goal of this subtest is to trigger the following warning in
the function i915_gem_object_get_fence():
if (WARN_ON(!obj->map_and_fenceable))

To trigger this warning, the subtest first creates a Y-tiled object and
an associated framebuffer with the Y-fb modifier. Furthermore, to
prevent the map_and_fenceable from being set, we make sure that
the object does not have a normal VMA by refraining from rendering to the
object and by setting the rotation property upfront before calling commit.

v2: Do not call paint_squares and just use one output.

v3: Convert an if condition to igt_require and move the plane rotation
requirement further up before the fb allocation.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
  tests/kms_rotation_crc.c | 68 
  1 file changed, 68 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..b25a949 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,68 @@ 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_obj(data_t *data, enum igt_plane 
plane_type)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   igt_output_t *output = &display->outputs[0];
+   igt_plane_t *plane;
+   drmModeModeInfo *mode;
+   unsigned int stride, size, w, h;
+   uint32_t gem_handle;
+   int ret;
+
+   igt_require(output != NULL && output->valid == true);
+
+   plane = igt_output_get_plane(output, plane_type);
+   igt_require(igt_plane_supports_rotation(plane));
+
+   if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+   igt_require(data->display.has_universal_planes);
+   commit = COMMIT_UNIVERSAL;
+   }
+
+   mode = igt_output_get_mode(output);
+   w = mode->hdisplay;
+   h = mode->vdisplay;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+
+   igt_plane_set_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_rotation(plane, data->rotation);
+   igt_plane_set_fb(plane, &data->fb);
+
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+
+   kmstest_restore_vt_mode();
+   igt_remove_fb(fd, &data->fb);
+   igt_assert(ret == 0);
+}
+
  igt_main
  {
data_t data = {};
@@ -345,6 +407,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_obj(&data, IGT_PLANE_PRIMARY);
+   }
+
igt_fixture {
igt_display_fini(&data.display);
}



Reviewed-by: Tvrtko Ursulin 

Regards,

Tvrtko
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v3)

2015-10-22 Thread Vivek Kasireddy
The main goal of this subtest is to trigger the following warning in
the function i915_gem_object_get_fence():
if (WARN_ON(!obj->map_and_fenceable))

To trigger this warning, the subtest first creates a Y-tiled object and
an associated framebuffer with the Y-fb modifier. Furthermore, to
prevent the map_and_fenceable from being set, we make sure that
the object does not have a normal VMA by refraining from rendering to the
object and by setting the rotation property upfront before calling commit.

v2: Do not call paint_squares and just use one output.

v3: Convert an if condition to igt_require and move the plane rotation
requirement further up before the fb allocation.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
 tests/kms_rotation_crc.c | 68 
 1 file changed, 68 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..b25a949 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,68 @@ 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_obj(data_t *data, enum igt_plane 
plane_type)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   igt_output_t *output = &display->outputs[0];
+   igt_plane_t *plane;
+   drmModeModeInfo *mode;
+   unsigned int stride, size, w, h;
+   uint32_t gem_handle;
+   int ret;
+
+   igt_require(output != NULL && output->valid == true);
+
+   plane = igt_output_get_plane(output, plane_type);
+   igt_require(igt_plane_supports_rotation(plane));
+
+   if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+   igt_require(data->display.has_universal_planes);
+   commit = COMMIT_UNIVERSAL;
+   }
+
+   mode = igt_output_get_mode(output);
+   w = mode->hdisplay;
+   h = mode->vdisplay;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+
+   igt_plane_set_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_rotation(plane, data->rotation);
+   igt_plane_set_fb(plane, &data->fb);
+
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+
+   kmstest_restore_vt_mode();
+   igt_remove_fb(fd, &data->fb);
+   igt_assert(ret == 0);
+}
+
 igt_main
 {
data_t data = {};
@@ -345,6 +407,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_obj(&data, IGT_PLANE_PRIMARY);
+   }
+
igt_fixture {
igt_display_fini(&data.display);
}
-- 
2.4.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v2)

2015-10-22 Thread Tvrtko Ursulin


Hi,

On 22/10/15 02:24, Vivek Kasireddy wrote:

The main goal of this subtest is to verify whether flipping a


Need to change to commit message since there is no flipping involved.


framebuffer with a Y fb modifier (90/270 degree rotation) and
with an associated Y-tiled object works or not.


And also explain in more detail the requirement to not have a normal VMA 
before the rotated one is displayed.



v2: Do not call paint_squares and just use one output.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
  tests/kms_rotation_crc.c | 73 
  1 file changed, 73 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..63f27f8 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,73 @@ 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_obj(data_t *data, enum igt_plane 
plane_type)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   int valid_tests = 0;
+   igt_output_t *output = &display->outputs[0];
+   int ret;
+
+   if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+   igt_require(data->display.has_universal_planes);
+   commit = COMMIT_UNIVERSAL;
+   }
+
+   if (output && output->valid) {


How about getting rid of this indentation level and valid_tests by just 
doing igt_require on the condition above?



+   igt_plane_t *plane;
+   drmModeModeInfo *mode = igt_output_get_mode(output);
+   unsigned int w = mode->hdisplay;
+   unsigned int h = mode->vdisplay;
+   unsigned int stride, size;
+   uint32_t gem_handle;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+
+   plane = igt_output_get_plane(output, plane_type);
+   igt_require(igt_plane_supports_rotation(plane));


This would maybe be cleaner above the fb allocation, to group all the 
asserts together.


Otherwise looks fine to me.

Regards,

Tvrtko
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v2)

2015-10-21 Thread Vivek Kasireddy
The main goal of this subtest is to verify whether flipping a
framebuffer with a Y fb modifier (90/270 degree rotation) and
with an associated Y-tiled object works or not.

v2: Do not call paint_squares and just use one output.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
 tests/kms_rotation_crc.c | 73 
 1 file changed, 73 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..63f27f8 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,73 @@ 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_obj(data_t *data, enum igt_plane 
plane_type)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   int valid_tests = 0;
+   igt_output_t *output = &display->outputs[0];
+   int ret;
+
+   if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+   igt_require(data->display.has_universal_planes);
+   commit = COMMIT_UNIVERSAL;
+   }
+
+   if (output && output->valid) {
+   igt_plane_t *plane;
+   drmModeModeInfo *mode = igt_output_get_mode(output);
+   unsigned int w = mode->hdisplay;
+   unsigned int h = mode->vdisplay;
+   unsigned int stride, size;
+   uint32_t gem_handle;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+
+   plane = igt_output_get_plane(output, plane_type);
+   igt_require(igt_plane_supports_rotation(plane));
+
+   igt_plane_set_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_rotation(plane, data->rotation);
+   igt_plane_set_fb(plane, &data->fb);
+
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+
+   kmstest_restore_vt_mode();
+   kmstest_set_vt_graphics_mode();
+
+   igt_remove_fb(fd, &data->fb);
+   igt_assert(ret == 0);
+
+   valid_tests++;
+   }
+   igt_require_f(valid_tests, "no valid output found\n");
+}
+
 igt_main
 {
data_t data = {};
@@ -345,6 +412,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_obj(&data, IGT_PLANE_PRIMARY);
+   }
+
igt_fixture {
igt_display_fini(&data.display);
}
-- 
2.4.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier

2015-10-20 Thread Vivek Kasireddy
On Tue, 20 Oct 2015 10:10:20 +0100
Tvrtko Ursulin  wrote:

> 
> On 20/10/15 02:14, Vivek Kasireddy wrote:
> > Hi Tvrtko,
> >
> > On Mon, 19 Oct 2015 11:20:05 +0100
> > Tvrtko Ursulin  wrote:
> >
> >>
> >> Hi,
> >>
> >> On 17/10/15 03:47, Vivek Kasireddy wrote:
> >>> The main goal of this subtest is to verify whether flipping a
> >>> framebuffer with a Y fb modifier (90/270 degree rotation) and
> >>> an associated Y-tiled object works or not.
> >>>
> >>> Cc: Tvrtko Ursulin 
> >>> Signed-off-by: Vivek Kasireddy 
> >>> ---
> >>>tests/kms_rotation_crc.c | 83
> >>>  1 file changed,
> >>> 83 insertions(+)
> >>>
> >>> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> >>> index cc9847e..bb9aecb 100644
> >>> --- a/tests/kms_rotation_crc.c
> >>> +++ b/tests/kms_rotation_crc.c
> >>> @@ -264,6 +264,83 @@ 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_obj(data_t *data, enum
> >>> igt_plane plane_type) +{
> >>> + igt_display_t *display = &data->display;
> >>> + uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> >>> + uint32_t format = DRM_FORMAT_XRGB;
> >>> + int bpp = igt_drm_format_to_bpp(format);
> >>> + enum igt_commit_style commit = COMMIT_LEGACY;
> >>> + int fd = data->gfx_fd;
> >>> + int valid_tests = 0;
> >>> + igt_output_t *output;
> >>> + int ret;
> >>> +
> >>> + 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) {
> >>> + igt_plane_t *plane;
> >>> + drmModeModeInfo *mode =
> >>> igt_output_get_mode(output);
> >>> + unsigned int w = mode->hdisplay;
> >>> + unsigned int h = mode->vdisplay;
> >>> + unsigned int stride, size;
> >>> + uint32_t gem_handle;
> >>> +
> >>> + for (stride = 512; stride < (w * bpp / 8); stride
> >>> *= 2)
> >>> + ;
> >>> + for (size = 1024*1024; size < stride * h; size *=
> >>> 2)
> >>> + ;
> >>> +
> >>> + gem_handle = gem_create(fd, size);
> >>> + ret = __gem_set_tiling(fd, gem_handle,
> >>> I915_TILING_Y, stride);
> >>> + igt_assert(ret == 0);
> >>> +
> >>> + do_or_die(__kms_addfb(fd, gem_handle, w, h,
> >>> stride,
> >>> +   format, tiling,
> >>> LOCAL_DRM_MODE_FB_MODIFIERS,
> >>> +   &data->fb.fb_id));
> >>> +
> >>> + data->fb.width = w;
> >>> + data->fb.height = h;
> >>> + data->fb.gem_handle = gem_handle;
> >>> + data->fb.stride = stride;
> >>> + data->fb.size = size;
> >>> + 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_fb(plane, NULL);
> >>> + igt_display_commit(display);
> >>> +
> >>> + igt_plane_set_rotation(plane, data->rotation);
> >>> + paint_squares(data, mode, IGT_ROTATION_0, plane);
> >>> + igt_plane_set_fb(plane, &data->fb);
> >>> +
> >>> + drmModeObjectSetProperty(fd,
> >>> plane->drm_plane->plane_id,
> >>> +  DRM_MODE_OBJECT_PLANE,
> >>> +
> >>> plane->rotation_property,
> >>> +  plane->rotation);
> >>> + ret = igt_display_try_commit2(display, commit);
> >>> + igt_assert(ret == 0);
> >>
> >> This manages to trigger the WARN? How come since paint_squares
> >> above will have created the normal VMA?
> >
> > Yes, this does trigger the WARN regardless of whether paint_squares
> > is called or not. I am going to have to find out why the normal VMA
> > was not created when paint_squares was called. And, this subtest
> > does not restore the console cleanly which is something I also have
> > to fix.
> 
> Could be that normal VMA is not created in the Cairo rendering path
> for Y tiled buffers. Since the final rendering is done via a blit and
> if you have PPGTT that would do it I think.
> 
> If PPGTT is always true for gen9 then this could work.

Hi Tvrtko,
Yes, I see that PPGTT is always true for gen9 and perhaps the reason
why the normal VMA is not created. Do you suggest that I get rid of the
call to paint_squares and further simplify the test by just flipping the
fb to only one output?

Thanks and Regards,
Vivek

> 
> Regards,
> 
> Tvrtko

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier

2015-10-20 Thread Tvrtko Ursulin


On 20/10/15 02:14, Vivek Kasireddy wrote:

Hi Tvrtko,

On Mon, 19 Oct 2015 11:20:05 +0100
Tvrtko Ursulin  wrote:



Hi,

On 17/10/15 03:47, Vivek Kasireddy wrote:

The main goal of this subtest is to verify whether flipping a
framebuffer with a Y fb modifier (90/270 degree rotation) and
an associated Y-tiled object works or not.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
   tests/kms_rotation_crc.c | 83
 1 file changed, 83
insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..bb9aecb 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,83 @@ 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_obj(data_t *data, enum
igt_plane plane_type) +{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   int valid_tests = 0;
+   igt_output_t *output;
+   int ret;
+
+   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) {
+   igt_plane_t *plane;
+   drmModeModeInfo *mode =
igt_output_get_mode(output);
+   unsigned int w = mode->hdisplay;
+   unsigned int h = mode->vdisplay;
+   unsigned int stride, size;
+   uint32_t gem_handle;
+
+   for (stride = 512; stride < (w * bpp / 8); stride
*= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *=
2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle,
I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling,
LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+   data->fb.stride = stride;
+   data->fb.size = size;
+   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_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_rotation(plane, data->rotation);
+   paint_squares(data, mode, IGT_ROTATION_0, plane);
+   igt_plane_set_fb(plane, &data->fb);
+
+   drmModeObjectSetProperty(fd,
plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+   igt_assert(ret == 0);


This manages to trigger the WARN? How come since paint_squares above
will have created the normal VMA?


Yes, this does trigger the WARN regardless of whether paint_squares is
called or not. I am going to have to find out why the normal VMA was
not created when paint_squares was called. And, this subtest does not
restore the console cleanly which is something I also have to fix.


Could be that normal VMA is not created in the Cairo rendering path for 
Y tiled buffers. Since the final rendering is done via a blit and if you 
have PPGTT that would do it I think.


If PPGTT is always true for gen9 then this could work.

Regards,

Tvrtko
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier

2015-10-19 Thread Vivek Kasireddy
Hi Tvrtko,

On Mon, 19 Oct 2015 11:20:05 +0100
Tvrtko Ursulin  wrote:

> 
> Hi,
> 
> On 17/10/15 03:47, Vivek Kasireddy wrote:
> > The main goal of this subtest is to verify whether flipping a
> > framebuffer with a Y fb modifier (90/270 degree rotation) and
> > an associated Y-tiled object works or not.
> >
> > Cc: Tvrtko Ursulin 
> > Signed-off-by: Vivek Kasireddy 
> > ---
> >   tests/kms_rotation_crc.c | 83
> >  1 file changed, 83
> > insertions(+)
> >
> > diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> > index cc9847e..bb9aecb 100644
> > --- a/tests/kms_rotation_crc.c
> > +++ b/tests/kms_rotation_crc.c
> > @@ -264,6 +264,83 @@ 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_obj(data_t *data, enum
> > igt_plane plane_type) +{
> > +   igt_display_t *display = &data->display;
> > +   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> > +   uint32_t format = DRM_FORMAT_XRGB;
> > +   int bpp = igt_drm_format_to_bpp(format);
> > +   enum igt_commit_style commit = COMMIT_LEGACY;
> > +   int fd = data->gfx_fd;
> > +   int valid_tests = 0;
> > +   igt_output_t *output;
> > +   int ret;
> > +
> > +   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) {
> > +   igt_plane_t *plane;
> > +   drmModeModeInfo *mode =
> > igt_output_get_mode(output);
> > +   unsigned int w = mode->hdisplay;
> > +   unsigned int h = mode->vdisplay;
> > +   unsigned int stride, size;
> > +   uint32_t gem_handle;
> > +
> > +   for (stride = 512; stride < (w * bpp / 8); stride
> > *= 2)
> > +   ;
> > +   for (size = 1024*1024; size < stride * h; size *=
> > 2)
> > +   ;
> > +
> > +   gem_handle = gem_create(fd, size);
> > +   ret = __gem_set_tiling(fd, gem_handle,
> > I915_TILING_Y, stride);
> > +   igt_assert(ret == 0);
> > +
> > +   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
> > + format, tiling,
> > LOCAL_DRM_MODE_FB_MODIFIERS,
> > + &data->fb.fb_id));
> > +
> > +   data->fb.width = w;
> > +   data->fb.height = h;
> > +   data->fb.gem_handle = gem_handle;
> > +   data->fb.stride = stride;
> > +   data->fb.size = size;
> > +   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_fb(plane, NULL);
> > +   igt_display_commit(display);
> > +
> > +   igt_plane_set_rotation(plane, data->rotation);
> > +   paint_squares(data, mode, IGT_ROTATION_0, plane);
> > +   igt_plane_set_fb(plane, &data->fb);
> > +
> > +   drmModeObjectSetProperty(fd,
> > plane->drm_plane->plane_id,
> > +DRM_MODE_OBJECT_PLANE,
> > +plane->rotation_property,
> > +plane->rotation);
> > +   ret = igt_display_try_commit2(display, commit);
> > +   igt_assert(ret == 0);
> 
> This manages to trigger the WARN? How come since paint_squares above 
> will have created the normal VMA?

Yes, this does trigger the WARN regardless of whether paint_squares is
called or not. I am going to have to find out why the normal VMA was
not created when paint_squares was called. And, this subtest does not
restore the console cleanly which is something I also have to fix.


Thanks,
Vivek

> 
> Regards,
> 
> Tvrtko

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier

2015-10-19 Thread Tvrtko Ursulin


Hi,

On 17/10/15 03:47, Vivek Kasireddy wrote:

The main goal of this subtest is to verify whether flipping a
framebuffer with a Y fb modifier (90/270 degree rotation) and
an associated Y-tiled object works or not.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
  tests/kms_rotation_crc.c | 83 
  1 file changed, 83 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..bb9aecb 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,83 @@ 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_obj(data_t *data, enum igt_plane 
plane_type)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   int valid_tests = 0;
+   igt_output_t *output;
+   int ret;
+
+   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) {
+   igt_plane_t *plane;
+   drmModeModeInfo *mode = igt_output_get_mode(output);
+   unsigned int w = mode->hdisplay;
+   unsigned int h = mode->vdisplay;
+   unsigned int stride, size;
+   uint32_t gem_handle;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+   data->fb.stride = stride;
+   data->fb.size = size;
+   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_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_rotation(plane, data->rotation);
+   paint_squares(data, mode, IGT_ROTATION_0, plane);
+   igt_plane_set_fb(plane, &data->fb);
+
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+   igt_assert(ret == 0);


This manages to trigger the WARN? How come since paint_squares above 
will have created the normal VMA?


Regards,

Tvrtko
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier

2015-10-16 Thread Vivek Kasireddy
The main goal of this subtest is to verify whether flipping a
framebuffer with a Y fb modifier (90/270 degree rotation) and
an associated Y-tiled object works or not.

Cc: Tvrtko Ursulin 
Signed-off-by: Vivek Kasireddy 
---
 tests/kms_rotation_crc.c | 83 
 1 file changed, 83 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847e..bb9aecb 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -264,6 +264,83 @@ 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_obj(data_t *data, enum igt_plane 
plane_type)
+{
+   igt_display_t *display = &data->display;
+   uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+   uint32_t format = DRM_FORMAT_XRGB;
+   int bpp = igt_drm_format_to_bpp(format);
+   enum igt_commit_style commit = COMMIT_LEGACY;
+   int fd = data->gfx_fd;
+   int valid_tests = 0;
+   igt_output_t *output;
+   int ret;
+
+   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) {
+   igt_plane_t *plane;
+   drmModeModeInfo *mode = igt_output_get_mode(output);
+   unsigned int w = mode->hdisplay;
+   unsigned int h = mode->vdisplay;
+   unsigned int stride, size;
+   uint32_t gem_handle;
+
+   for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+   ;
+   for (size = 1024*1024; size < stride * h; size *= 2)
+   ;
+
+   gem_handle = gem_create(fd, size);
+   ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+   igt_assert(ret == 0);
+
+   do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+ format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+ &data->fb.fb_id));
+
+   data->fb.width = w;
+   data->fb.height = h;
+   data->fb.gem_handle = gem_handle;
+   data->fb.stride = stride;
+   data->fb.size = size;
+   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_fb(plane, NULL);
+   igt_display_commit(display);
+
+   igt_plane_set_rotation(plane, data->rotation);
+   paint_squares(data, mode, IGT_ROTATION_0, plane);
+   igt_plane_set_fb(plane, &data->fb);
+
+   drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE,
+plane->rotation_property,
+plane->rotation);
+   ret = igt_display_try_commit2(display, commit);
+   igt_assert(ret == 0);
+
+   kmstest_restore_vt_mode();
+   kmstest_set_vt_graphics_mode();
+   igt_display_commit2(display, commit);
+
+   valid_tests++;
+   igt_remove_fb(fd, &data->fb);
+   igt_output_set_pipe(output, PIPE_ANY);
+
+   igt_plane_set_fb(plane, NULL);
+   igt_display_commit(display);
+   }
+   igt_require_f(valid_tests, "no valid crtc/connector combinations 
found\n");
+}
+
 igt_main
 {
data_t data = {};
@@ -345,6 +422,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_obj(&data, IGT_PLANE_PRIMARY);
+   }
+
igt_fixture {
igt_display_fini(&data.display);
}
-- 
2.4.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx