diff mbox

igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier

Message ID 1445050059-3298-1-git-send-email-vivek.kasireddy@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kasireddy, Vivek Oct. 17, 2015, 2:47 a.m. UTC
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 <tvrtko.ursulin@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
 tests/kms_rotation_crc.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

Comments

Tvrtko Ursulin Oct. 19, 2015, 10:20 a.m. UTC | #1
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 <tvrtko.ursulin@intel.com>
> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> ---
>   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_XRGB8888;
> +	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
Kasireddy, Vivek Oct. 20, 2015, 1:14 a.m. UTC | #2
Hi Tvrtko,

On Mon, 19 Oct 2015 11:20:05 +0100
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> 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 <tvrtko.ursulin@intel.com>
> > Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> > ---
> >   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_XRGB8888;
> > +	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
Tvrtko Ursulin Oct. 20, 2015, 9:10 a.m. UTC | #3
On 20/10/15 02:14, Vivek Kasireddy wrote:
> Hi Tvrtko,
>
> On Mon, 19 Oct 2015 11:20:05 +0100
> Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> 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 <tvrtko.ursulin@intel.com>
>>> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
>>> ---
>>>    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_XRGB8888;
>>> +	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
Kasireddy, Vivek Oct. 21, 2015, 1:41 a.m. UTC | #4
On Tue, 20 Oct 2015 10:10:20 +0100
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:

> 
> On 20/10/15 02:14, Vivek Kasireddy wrote:
> > Hi Tvrtko,
> >
> > On Mon, 19 Oct 2015 11:20:05 +0100
> > Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> 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 <tvrtko.ursulin@intel.com>
> >>> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> >>> ---
> >>>    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_XRGB8888;
> >>> +	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
diff mbox

Patch

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_XRGB8888;
+	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);
 	}