All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Vivek Kasireddy <vivek.kasireddy@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] igt/kms_rotation_crc: Add a new subtest to exhaustively test for fence leaks (v2)
Date: Wed, 4 Nov 2015 10:07:47 +0000	[thread overview]
Message-ID: <5639D8F3.40401@linux.intel.com> (raw)
In-Reply-To: <1446603926-22117-1-git-send-email-vivek.kasireddy@intel.com>


On 04/11/15 02:25, Vivek Kasireddy wrote:
> In this subtest, as a first step, MAX_FENCES+1 number of framebuffers are
> created backed up by objects that have multiple GGTT views (normal and
> rotated). Next, we have the i915 driver instantiate a normal view followed
> by a rotated view. We continue doing the above MAX_FENCES + 1 times.
>
> v2:
> - Add a igt_require() to check if there is enough GTT space left for
>    MAX_FENCES+1 framebuffers. (Tvrtko)
> - Make data2 local to test_plane_rotation_exhaust_fences(). (Tvrtko)
> - If there is a failure, deallocate all the previously allocated
>    framebuffers before asserting.
>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> ---
>   tests/kms_rotation_crc.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 106 insertions(+)
>
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index ed6eeef..154c6a1 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -25,6 +25,7 @@
>   #include "igt.h"
>   #include <math.h>
>
> +#define MAX_FENCES 32
>
>   typedef struct {
>   	int gfx_fd;
> @@ -376,6 +377,106 @@ static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_ty
>   	igt_assert(ret == 0);
>   }
>
> +static void test_plane_rotation_exhaust_fences(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;
> +	data_t data2[MAX_FENCES+1] = {};
> +	unsigned int stride, size, w, h;
> +	uint32_t gem_handle;
> +	uint64_t total_aperture_size, total_fbs_size;
> +	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)
> +		;
> +
> +	/*
> +	 * Make sure there is atleast 90% of the available GTT space left
> +	 * for creating (MAX_FENCES+1) framebuffers.
> +	 */
> +	total_fbs_size = size * (MAX_FENCES + 1);
> +	total_aperture_size = gem_available_aperture_size(fd);
> +	igt_require(total_fbs_size < total_aperture_size * 0.9);
> +
> +	igt_plane_set_fb(plane, NULL);
> +	igt_display_commit(display);
> +
> +	for (i = 0; i < MAX_FENCES + 1; i++) {
> +		gem_handle = gem_create(fd, size);
> +		ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
> +		if (ret) {
> +			igt_warn("failed to set tiling\n");
> +			goto err_alloc;

If it hits this path it leaks the gem_handle I think.

> +		}
> +
> +		ret = (__kms_addfb(fd, gem_handle, w, h, stride,
> +		       format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
> +		       &data2[i].fb.fb_id));
> +		if (ret) {
> +			igt_warn("failed to create framebuffer\n");
> +			goto err_alloc;

And here.

> +		}
> +
> +		data2[i].fb.width = w;
> +		data2[i].fb.height = h;
> +		data2[i].fb.gem_handle = gem_handle;
> +
> +		igt_plane_set_fb(plane, &data2[i].fb);
> +		igt_plane_set_rotation(plane, IGT_ROTATION_0);
> +
> +		ret = igt_display_try_commit2(display, commit);
> +		if (ret) {
> +			igt_warn("failed to commit unrotated fb\n");
> +			goto err_commit;
> +		}
> +
> +		igt_plane_set_rotation(plane, 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);
> +		if (ret) {
> +			igt_warn("failed to commit hardware rotated fb\n");
> +			goto err_commit;
> +		}
> +	}
> +
> +err_alloc:
> +	i--;
> +err_commit:
> +	kmstest_restore_vt_mode();
> +
> +	for (; i >= 0; i--)
> +		igt_remove_fb(fd, &data2[i].fb);
> +
> +	igt_assert(ret == 0);
> +}
> +
>   igt_main
>   {
>   	data_t data = {};
> @@ -471,6 +572,11 @@ igt_main
>   		test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY);
>   	}
>
> +	igt_subtest_f("exhaust-fences") {
> +		igt_require(gen >= 9);
> +		test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY);
> +	}
> +
>   	igt_fixture {
>   		igt_display_fini(&data.display);
>   	}
>

Regards,

Tvrtko

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

  reply	other threads:[~2015-11-04 10:07 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16 10:59 [PATCH i-g-t 1/3] lib/igt_fb: Allow specifiying object tiling when creating frame buffers Tvrtko Ursulin
2015-10-16 10:59 ` [PATCH i-g-t 2/3] lib/igt_kms: Set new rotation property before displaying Tvrtko Ursulin
2015-10-16 10:59 ` [PATCH i-g-t 3/3] kms_rotation_crc: Test case for rotated VMA first with legacy tiling Tvrtko Ursulin
2015-10-16 12:03 ` [PATCH i-g-t 1/3] lib/igt_fb: Allow specifiying object tiling when creating frame buffers Ville Syrjälä
2015-10-16 12:19   ` Tvrtko Ursulin
2015-10-16 12:29     ` Ville Syrjälä
2015-10-16 12:54       ` Tvrtko Ursulin
2015-10-16 13:01         ` Ville Syrjälä
2015-10-16 13:06           ` Tvrtko Ursulin
2015-10-17  2:47     ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier Vivek Kasireddy
2015-10-19 10:20       ` Tvrtko Ursulin
2015-10-20  1:14         ` Vivek Kasireddy
2015-10-20  9:10           ` Tvrtko Ursulin
2015-10-21  1:41             ` Vivek Kasireddy
2015-10-22  1:24             ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v2) Vivek Kasireddy
2015-10-22  9:56               ` Tvrtko Ursulin
2015-10-23  1:34                 ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v3) Vivek Kasireddy
2015-10-23  8:51                   ` Tvrtko Ursulin
2015-10-23 11:35                     ` Daniel Vetter
2015-10-24  1:03                       ` Vivek Kasireddy
2015-10-27 10:37                       ` Tvrtko Ursulin
2015-10-29  1:48                         ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v4) Vivek Kasireddy
2015-10-29 10:33                           ` Tvrtko Ursulin
2015-10-30  1:44                             ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v5) Vivek Kasireddy
2015-10-30 10:22                               ` Tvrtko Ursulin
2015-10-31  1:45                                 ` Vivek Kasireddy
2015-11-02  9:41                                   ` Tvrtko Ursulin
2015-11-02 13:36                         ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v3) Thomas Wood
2015-11-03  1:25                           ` [PATCH] igt/kms_rotation_crc: Add a new subtest to exhaustively test for fence leaks Vivek Kasireddy
2015-11-03 10:02                             ` Tvrtko Ursulin
2015-11-04  2:25                               ` [PATCH] igt/kms_rotation_crc: Add a new subtest to exhaustively test for fence leaks (v2) Vivek Kasireddy
2015-11-04 10:07                                 ` Tvrtko Ursulin [this message]
2015-11-05  0:10                                   ` [PATCH] igt/kms_rotation_crc: Add a new subtest to exhaustively test for fence leaks (v3) Vivek Kasireddy
2015-11-05  9:46                                     ` Tvrtko Ursulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5639D8F3.40401@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=vivek.kasireddy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.