diff mbox

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

Message ID 20151015181046.719adb12@vkasired-desk2.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kasireddy, Vivek Oct. 16, 2015, 1:10 a.m. UTC
Hi Tvrtko,

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

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

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

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

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

Comments

Tvrtko Ursulin Oct. 16, 2015, 11:06 a.m. UTC | #1
Hi,

On 16/10/15 02:10, Vivek Kasireddy wrote:
>>>>> On 07/10/15 03:35, Vivek Kasireddy wrote:
>>>>>> This new subtest will validate a Y-tiled object's tiling mode
>>>>>> against its associated fb modifier.
>>>>>>
>>>>>> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>>>> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
>>>>>> ---
>>>>>>     tests/kms_addfb_basic.c | 9 +++++++++
>>>>>>     1 file changed, 9 insertions(+)
>>>>>>
>>>>>> diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
>>>>>> index d466e4d..7ca1add 100644
>>>>>> --- a/tests/kms_addfb_basic.c
>>>>>> +++ b/tests/kms_addfb_basic.c
>>>>>> @@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int gen)
>>>>>>             f.handles[0] = gem_bo;
>>>>>>         }
>>>>>>
>>>>>> +    igt_subtest("addfb25-Y-tiled-X-modifier-mismatch") {
>>>>>> +        igt_require(gen >= 9);
>>>>>> +        igt_require_fb_modifiers(fd);
>>>>>> +        gem_set_tiling(fd, gem_bo, I915_TILING_Y, 1024*4);
>>>>>> +
>>>>>> +        f.modifier[0] = LOCAL_I915_FORMAT_MOD_X_TILED;
>>>>>> +        igt_assert(drmIoctl(fd,
>>>>>> LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) < 0 && errno == EINVAL);
>>>>>> +    }
>>>>>> +
>>>>>>         igt_subtest("addfb25-Y-tiled") {
>>>>>>             igt_require_fb_modifiers(fd);
>>>>>>
>>>>>
>>>>> Wasn't the original WARN triggered by Y tiled object and Y fb
>>>>> modifier?
>>>>
>>>> Creating a new fb using a Y-tiled object and Y/X fb modifier will
>>>> not trigger the original WARN. It'll be triggered only if the fb
>>>> is going to be pinned -- and flipped. I am not sure how to get
>>>> that WARN to be triggered with the existing suite of igt tests.
>>>
>>> Ah yes, you would need to attempt display it, not even necessarily
>>> flip it. I am sure there are tests which do that. :) I know from
>>> recent activity kms_rotation_crc for example creates a Y tiled FB
>>> and displays it. So maybe borrow some code to start with from there.
>>
>> Even better, kms_flip_tiling does the majority of what is needed here
>> already. Just drop in a subtest which will do set_tiling and that
>> should be good.
>
> I have realized that I cannot get the the map_and_fenceable WARN to be
> triggered with any of the IGT tests. This is because the WARN is
> triggered only when pinning/fencing a Y-tiled fb that has a rotated
> view (90/270 degree rotation) that none of the IGT tests can do. I
> looked at and wrote a subtest in kms_rotation_crc but the WARN was not
> triggered because IGT does not support atomic flip/commit yet.
> Currently, since it does a SetPlane first, the object has a normal view
> and its map_and-fenceable bit is set, however, when the rotation
> property is applied, the object though has a rotated view, its
> map_and-fenceable bit never gets updated and stays 1 and hence the
> warning doesn't get triggered. I am copying the subtest code below for
> reference.

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
Daniel Vetter Oct. 19, 2015, 9:50 a.m. UTC | #2
On Thu, Oct 15, 2015 at 06:10:46PM -0700, Vivek Kasireddy wrote:
> Hi Tvrtko,
> 
> On Fri, 9 Oct 2015 09:34:25 +0100
> Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
> 
> > 
> > 
> > On 08/10/15 09:55, Tvrtko Ursulin wrote:
> > > On 07/10/15 22:07, Vivek Kasireddy wrote:
> > >>
> > >> Hi Tvrtko,
> > >>
> > >> On Wed, 7 Oct 2015 15:07:30 +0100
> > >> Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
> > >>
> > >>>
> > >>> Hi,
> > >>>
> > >>> On 07/10/15 03:35, Vivek Kasireddy wrote:
> > >>>> This new subtest will validate a Y-tiled object's tiling mode
> > >>>> against its associated fb modifier.
> > >>>>
> > >>>> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > >>>> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> > >>>> ---
> > >>>>    tests/kms_addfb_basic.c | 9 +++++++++
> > >>>>    1 file changed, 9 insertions(+)
> > >>>>
> > >>>> diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> > >>>> index d466e4d..7ca1add 100644
> > >>>> --- a/tests/kms_addfb_basic.c
> > >>>> +++ b/tests/kms_addfb_basic.c
> > >>>> @@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int gen)
> > >>>>            f.handles[0] = gem_bo;
> > >>>>        }
> > >>>>
> > >>>> +    igt_subtest("addfb25-Y-tiled-X-modifier-mismatch") {
> > >>>> +        igt_require(gen >= 9);
> > >>>> +        igt_require_fb_modifiers(fd);
> > >>>> +        gem_set_tiling(fd, gem_bo, I915_TILING_Y, 1024*4);
> > >>>> +
> > >>>> +        f.modifier[0] = LOCAL_I915_FORMAT_MOD_X_TILED;
> > >>>> +        igt_assert(drmIoctl(fd,
> > >>>> LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) < 0 && errno == EINVAL);
> > >>>> +    }
> > >>>> +
> > >>>>        igt_subtest("addfb25-Y-tiled") {
> > >>>>            igt_require_fb_modifiers(fd);
> > >>>>
> > >>>
> > >>> Wasn't the original WARN triggered by Y tiled object and Y fb
> > >>> modifier?
> > >>
> > >> Creating a new fb using a Y-tiled object and Y/X fb modifier will
> > >> not trigger the original WARN. It'll be triggered only if the fb
> > >> is going to be pinned -- and flipped. I am not sure how to get
> > >> that WARN to be triggered with the existing suite of igt tests.
> > >
> > > Ah yes, you would need to attempt display it, not even necessarily
> > > flip it. I am sure there are tests which do that. :) I know from
> > > recent activity kms_rotation_crc for example creates a Y tiled FB
> > > and displays it. So maybe borrow some code to start with from there.
> > 
> > Even better, kms_flip_tiling does the majority of what is needed here 
> > already. Just drop in a subtest which will do set_tiling and that
> > should be good.
> 
> I have realized that I cannot get the the map_and_fenceable WARN to be
> triggered with any of the IGT tests. This is because the WARN is
> triggered only when pinning/fencing a Y-tiled fb that has a rotated
> view (90/270 degree rotation) that none of the IGT tests can do. I
> looked at and wrote a subtest in kms_rotation_crc but the WARN was not
> triggered because IGT does not support atomic flip/commit yet.
> Currently, since it does a SetPlane first, the object has a normal view
> and its map_and-fenceable bit is set, however, when the rotation
> property is applied, the object though has a rotated view, its
> map_and-fenceable bit never gets updated and stays 1 and hence the
> warning doesn't get triggered. I am copying the subtest code below for
> reference.

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

> 
> From 5d7f6920663b2fd264aca6085170811276948a5b Mon Sep 17 00:00:00 2001
> From: Vivek Kasireddy <vivek.kasireddy@intel.com>
> Date: Thu, 15 Oct 2015 17:48:50 -0700
> Subject: [PATCH] igt/kms_rotation_crc: Add a new subtest to flip Y-tiled
>  rotated fb
> 
> ---
>  tests/kms_rotation_crc.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 70 insertions(+)
> 
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index cc9847e..f10a770 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -264,6 +264,70 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
>  	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
>  }
>  
> +static void test_plane_rotation_ytiled(data_t *data, enum igt_plane plane_type)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_output_t *output;
> +	enum igt_commit_style commit = COMMIT_LEGACY;
> +	drmModeModeInfo *mode;
> +	unsigned int w, h;
> +	igt_plane_t *plane;
> +	int ret;
> +	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> +	uint32_t format = DRM_FORMAT_XRGB8888;
> +	int bpp = igt_drm_format_to_bpp(format);
> +
> +	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
> +		igt_require(data->display.has_universal_planes);
> +		commit = COMMIT_UNIVERSAL;
> +	}
> +
> +	for_each_connected_output(display, output) {
> +		mode = igt_output_get_mode(output);
> +
> +		w = mode->hdisplay;
> +		h = mode->vdisplay;
> +
> +		for (data->fb.stride = 512; data->fb.stride < (w * bpp / 8); data->fb.stride *= 2);
> +
> +		for (data->fb.size = 1024*1024; data->fb.size < data->fb.stride * h; data->fb.size *= 2);
> +
> +		data->fb.gem_handle = gem_create(data->gfx_fd, data->fb.size);
> +		ret = __gem_set_tiling(data->gfx_fd, data->fb.gem_handle, I915_TILING_Y, data->fb.stride);
> +		igt_assert(ret == 0);
> +
> +		do_or_die(__kms_addfb(data->gfx_fd, data->fb.gem_handle, w, h,
> +			  data->fb.stride, format, tiling,
> +			  LOCAL_DRM_MODE_FB_MODIFIERS, &data->fb.fb_id));
> +
> +		data->fb.width = w;
> +		data->fb.height = h;
> +		data->fb.tiling = tiling;
> +		data->fb.drm_format = format;
> +
> +		plane = igt_output_get_plane(output, plane_type);
> +		igt_require(igt_plane_supports_rotation(plane));
> +
> +		igt_plane_set_rotation(plane, data->rotation);
> +		paint_squares(data, mode, IGT_ROTATION_0, plane);
> +		igt_plane_set_fb(plane, &data->fb);
> +
> +		drmModeObjectSetProperty(data->gfx_fd, plane->drm_plane->plane_id,
> +			DRM_MODE_OBJECT_PLANE, plane->rotation_property, plane->rotation);
> +		igt_display_commit2(display, commit);
> +
> +		kmstest_restore_vt_mode();
> +		kmstest_set_vt_graphics_mode();
> +		commit_crtc(data, output, plane);
> +
> +		igt_remove_fb(data->gfx_fd, &data->fb);
> +		igt_plane_set_fb(plane, NULL);
> +		igt_output_set_pipe(output, PIPE_ANY);
> +
> +		igt_display_commit(display);
> +	}
> +}
> +
>  igt_main
>  {
>  	data_t data = {};
> @@ -345,6 +409,12 @@ igt_main
>  		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
>  	}
>  
> +	igt_subtest_f("primary-rotation-90-Y-tiled") {
> +		igt_require(gen >= 9);
> +		data.rotation = IGT_ROTATION_90;
> +		test_plane_rotation_ytiled(&data, IGT_PLANE_PRIMARY);
> +	}
> +
>  	igt_fixture {
>  		igt_display_fini(&data.display);
>  	}
> -- 
> 2.4.3
> 
> Thanks and Regards,
> Vivek
> 
> > 
> > Regards,
> > 
> > Tvrtko
> > 
> > 
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Kasireddy, Vivek Oct. 20, 2015, 1:19 a.m. UTC | #3
On Mon, 19 Oct 2015 11:50:25 +0200
Daniel Vetter <daniel@ffwll.ch> wrote:

> On Thu, Oct 15, 2015 at 06:10:46PM -0700, Vivek Kasireddy wrote:
> > Hi Tvrtko,
> > 
> > On Fri, 9 Oct 2015 09:34:25 +0100
> > Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
> > 
> > > 
> > > 
> > > On 08/10/15 09:55, Tvrtko Ursulin wrote:
> > > > On 07/10/15 22:07, Vivek Kasireddy wrote:
> > > >>
> > > >> Hi Tvrtko,
> > > >>
> > > >> On Wed, 7 Oct 2015 15:07:30 +0100
> > > >> Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
> > > >>
> > > >>>
> > > >>> Hi,
> > > >>>
> > > >>> On 07/10/15 03:35, Vivek Kasireddy wrote:
> > > >>>> This new subtest will validate a Y-tiled object's tiling mode
> > > >>>> against its associated fb modifier.
> > > >>>>
> > > >>>> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > > >>>> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> > > >>>> ---
> > > >>>>    tests/kms_addfb_basic.c | 9 +++++++++
> > > >>>>    1 file changed, 9 insertions(+)
> > > >>>>
> > > >>>> diff --git a/tests/kms_addfb_basic.c
> > > >>>> b/tests/kms_addfb_basic.c index d466e4d..7ca1add 100644
> > > >>>> --- a/tests/kms_addfb_basic.c
> > > >>>> +++ b/tests/kms_addfb_basic.c
> > > >>>> @@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int
> > > >>>> gen) f.handles[0] = gem_bo;
> > > >>>>        }
> > > >>>>
> > > >>>> +    igt_subtest("addfb25-Y-tiled-X-modifier-mismatch") {
> > > >>>> +        igt_require(gen >= 9);
> > > >>>> +        igt_require_fb_modifiers(fd);
> > > >>>> +        gem_set_tiling(fd, gem_bo, I915_TILING_Y, 1024*4);
> > > >>>> +
> > > >>>> +        f.modifier[0] = LOCAL_I915_FORMAT_MOD_X_TILED;
> > > >>>> +        igt_assert(drmIoctl(fd,
> > > >>>> LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) < 0 && errno == EINVAL);
> > > >>>> +    }
> > > >>>> +
> > > >>>>        igt_subtest("addfb25-Y-tiled") {
> > > >>>>            igt_require_fb_modifiers(fd);
> > > >>>>
> > > >>>
> > > >>> Wasn't the original WARN triggered by Y tiled object and Y fb
> > > >>> modifier?
> > > >>
> > > >> Creating a new fb using a Y-tiled object and Y/X fb modifier
> > > >> will not trigger the original WARN. It'll be triggered only if
> > > >> the fb is going to be pinned -- and flipped. I am not sure how
> > > >> to get that WARN to be triggered with the existing suite of
> > > >> igt tests.
> > > >
> > > > Ah yes, you would need to attempt display it, not even
> > > > necessarily flip it. I am sure there are tests which do
> > > > that. :) I know from recent activity kms_rotation_crc for
> > > > example creates a Y tiled FB and displays it. So maybe borrow
> > > > some code to start with from there.
> > > 
> > > Even better, kms_flip_tiling does the majority of what is needed
> > > here already. Just drop in a subtest which will do set_tiling and
> > > that should be good.
> > 
> > I have realized that I cannot get the the map_and_fenceable WARN to
> > be triggered with any of the IGT tests. This is because the WARN is
> > triggered only when pinning/fencing a Y-tiled fb that has a rotated
> > view (90/270 degree rotation) that none of the IGT tests can do. I
> > looked at and wrote a subtest in kms_rotation_crc but the WARN was
> > not triggered because IGT does not support atomic flip/commit yet.
> > Currently, since it does a SetPlane first, the object has a normal
> > view and its map_and-fenceable bit is set, however, when the
> > rotation property is applied, the object though has a rotated view,
> > its map_and-fenceable bit never gets updated and stays 1 and hence
> > the warning doesn't get triggered. I am copying the subtest code
> > below for reference.
> 
> 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

> 
> > 
> > From 5d7f6920663b2fd264aca6085170811276948a5b Mon Sep 17 00:00:00
> > 2001 From: Vivek Kasireddy <vivek.kasireddy@intel.com>
> > Date: Thu, 15 Oct 2015 17:48:50 -0700
> > Subject: [PATCH] igt/kms_rotation_crc: Add a new subtest to flip
> > Y-tiled rotated fb
> > 
> > ---
> >  tests/kms_rotation_crc.c | 70
> > ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70
> > insertions(+)
> > 
> > diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> > index cc9847e..f10a770 100644
> > --- a/tests/kms_rotation_crc.c
> > +++ b/tests/kms_rotation_crc.c
> > @@ -264,6 +264,70 @@ static void test_plane_rotation(data_t *data,
> > enum igt_plane plane_type) igt_require_f(valid_tests, "no valid
> > crtc/connector combinations found\n"); }
> >  
> > +static void test_plane_rotation_ytiled(data_t *data, enum
> > igt_plane plane_type) +{
> > +	igt_display_t *display = &data->display;
> > +	igt_output_t *output;
> > +	enum igt_commit_style commit = COMMIT_LEGACY;
> > +	drmModeModeInfo *mode;
> > +	unsigned int w, h;
> > +	igt_plane_t *plane;
> > +	int ret;
> > +	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> > +	uint32_t format = DRM_FORMAT_XRGB8888;
> > +	int bpp = igt_drm_format_to_bpp(format);
> > +
> > +	if (plane_type == IGT_PLANE_PRIMARY || plane_type ==
> > IGT_PLANE_CURSOR) {
> > +		igt_require(data->display.has_universal_planes);
> > +		commit = COMMIT_UNIVERSAL;
> > +	}
> > +
> > +	for_each_connected_output(display, output) {
> > +		mode = igt_output_get_mode(output);
> > +
> > +		w = mode->hdisplay;
> > +		h = mode->vdisplay;
> > +
> > +		for (data->fb.stride = 512; data->fb.stride < (w *
> > bpp / 8); data->fb.stride *= 2); +
> > +		for (data->fb.size = 1024*1024; data->fb.size <
> > data->fb.stride * h; data->fb.size *= 2); +
> > +		data->fb.gem_handle = gem_create(data->gfx_fd,
> > data->fb.size);
> > +		ret = __gem_set_tiling(data->gfx_fd,
> > data->fb.gem_handle, I915_TILING_Y, data->fb.stride);
> > +		igt_assert(ret == 0);
> > +
> > +		do_or_die(__kms_addfb(data->gfx_fd,
> > data->fb.gem_handle, w, h,
> > +			  data->fb.stride, format, tiling,
> > +			  LOCAL_DRM_MODE_FB_MODIFIERS,
> > &data->fb.fb_id)); +
> > +		data->fb.width = w;
> > +		data->fb.height = h;
> > +		data->fb.tiling = tiling;
> > +		data->fb.drm_format = format;
> > +
> > +		plane = igt_output_get_plane(output, plane_type);
> > +		igt_require(igt_plane_supports_rotation(plane));
> > +
> > +		igt_plane_set_rotation(plane, data->rotation);
> > +		paint_squares(data, mode, IGT_ROTATION_0, plane);
> > +		igt_plane_set_fb(plane, &data->fb);
> > +
> > +		drmModeObjectSetProperty(data->gfx_fd,
> > plane->drm_plane->plane_id,
> > +			DRM_MODE_OBJECT_PLANE,
> > plane->rotation_property, plane->rotation);
> > +		igt_display_commit2(display, commit);
> > +
> > +		kmstest_restore_vt_mode();
> > +		kmstest_set_vt_graphics_mode();
> > +		commit_crtc(data, output, plane);
> > +
> > +		igt_remove_fb(data->gfx_fd, &data->fb);
> > +		igt_plane_set_fb(plane, NULL);
> > +		igt_output_set_pipe(output, PIPE_ANY);
> > +
> > +		igt_display_commit(display);
> > +	}
> > +}
> > +
> >  igt_main
> >  {
> >  	data_t data = {};
> > @@ -345,6 +409,12 @@ igt_main
> >  		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
> >  	}
> >  
> > +	igt_subtest_f("primary-rotation-90-Y-tiled") {
> > +		igt_require(gen >= 9);
> > +		data.rotation = IGT_ROTATION_90;
> > +		test_plane_rotation_ytiled(&data,
> > IGT_PLANE_PRIMARY);
> > +	}
> > +
> >  	igt_fixture {
> >  		igt_display_fini(&data.display);
> >  	}
> > -- 
> > 2.4.3
> > 
> > Thanks and Regards,
> > Vivek
> > 
> > > 
> > > Regards,
> > > 
> > > Tvrtko
> > > 
> > > 
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
diff mbox

Patch

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