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

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Thu Oct 29 03:33:06 PDT 2015


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 <tvrtko.ursulin at intel.com>
> Signed-off-by: Vivek Kasireddy <vivek.kasireddy at intel.com>
> ---
>   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_XRGB8888;
> +	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 <tvrtko.ursulin at intel.com>

Regards,

Tvrtko


More information about the Intel-gfx mailing list