All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shankar, Uma" <uma.shankar@intel.com>
To: "Patnana, Venkata Sai" <venkata.sai.patnana@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "Heikkila, Juha-pekka" <juha-pekka.heikkila@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 09/17] tests/kms_big_fb: Add max HW stride length tests
Date: Tue, 15 Jun 2021 06:00:58 +0000	[thread overview]
Message-ID: <1d7b8e818fae4f14adfeb9048c3a27e3@intel.com> (raw)
In-Reply-To: <20210611052005.303-9-venkata.sai.patnana@intel.com>



> -----Original Message-----
> From: Patnana, Venkata Sai <venkata.sai.patnana@intel.com>
> Sent: Friday, June 11, 2021 10:50 AM
> To: igt-dev@lists.freedesktop.org
> Cc: Patnana, Venkata Sai <venkata.sai.patnana@intel.com>; Heikkila, Juha-pekka
> <juha-pekka.heikkila@intel.com>; Shankar, Uma <uma.shankar@intel.com>
> Subject: [PATCH i-g-t 09/17] tests/kms_big_fb: Add max HW stride length tests
> 
> From: Juha-Pekka Heikkilä <juha-pekka.heikkila@intel.com>
> 
> Test maximum HW stride lengths. On Intel HW from gen5 up to
> Gen10 maximum HW stride length is 32K. On Gen11 when using 64bpp formats
> strides can reach up to 64k. These test try exact maximum HW strides so gtt
> remapping will not come in play.

Looks Good to me.
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
> 
> Cc: Uma Shankar <uma.shankar@intel.com>
> Signed-off-by: Juha-Pekka Heikkilä <juha-pekka.heikkila@intel.com>
> ---
>  tests/kms_big_fb.c | 154 ++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 146 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/kms_big_fb.c b/tests/kms_big_fb.c index 0ea076706f..65565127fd
> 100644
> --- a/tests/kms_big_fb.c
> +++ b/tests/kms_big_fb.c
> @@ -50,6 +50,11 @@ typedef struct {
>  	igt_render_copyfunc_t render_copy;
>  	struct buf_ops *bops;
>  	struct intel_bb *ibb;
> +	bool max_hw_stride_test;
> +	int hw_stride;
> +	int max_hw_fb_width;
> +	uint32_t format_override;
> +	uint32_t stride_override;
>  } data_t;
> 
>  static struct intel_buf *init_buf(data_t *data, @@ -83,6 +88,38 @@ static void
> fini_buf(struct intel_buf *buf)
>  	intel_buf_destroy(buf);
>  }
> 
> +static void setup_fb(data_t *data, struct igt_fb *newfb, uint32_t width,
> +		     uint32_t height, uint64_t format, uint64_t modifier, uint64_t
> +stride) {
> +	struct drm_mode_fb_cmd2 f = {0};
> +	cairo_t *cr;
> +
> +	newfb->strides[0] = stride;
> +	igt_create_bo_for_fb(data->drm_fd, width, height, format, modifier,
> +			     newfb);
> +
> +	igt_assert(newfb->gem_handle > 0);
> +
> +	f.width = newfb->width;
> +	f.height = newfb->height;
> +	f.pixel_format = newfb->drm_format;
> +	f.flags = LOCAL_DRM_MODE_FB_MODIFIERS;
> +
> +	for (int n = 0; n < newfb->num_planes; n++) {
> +		f.handles[n] = newfb->gem_handle;
> +		f.modifier[n] = newfb->modifier;
> +		f.pitches[n] = newfb->strides[n];
> +		f.offsets[n] = newfb->offsets[n];
> +	}
> +
> +	cr = igt_get_cairo_ctx(data->drm_fd, newfb);
> +	igt_paint_color(cr, 0, 0, newfb->width, newfb->height, 0, 0, 0);
> +	igt_put_cairo_ctx(cr);
> +
> +	igt_assert(drmIoctl(data->drm_fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f)
> == 0);
> +	newfb->fb_id = f.fb_id;
> +}
> +
>  static void copy_pattern(data_t *data,
>  			 struct igt_fb *dst_fb, int dx, int dy,
>  			 struct igt_fb *src_fb, int sx, int sy, @@ -178,9 +215,6 @@
> static void max_fb_size(data_t *data, int *width, int *height,
>  	uint64_t size;
>  	int i = 0;
> 
> -	*width = data->max_fb_width;
> -	*height = data->max_fb_height;
> -
>  	/* max fence stride is only 8k bytes on gen3 */
>  	if (intel_display_ver(data->devid) < 4 &&
>  	    format == DRM_FORMAT_XRGB8888)
> @@ -209,10 +243,17 @@ static void prep_fb(data_t *data)
>  	if (data->big_fb.fb_id)
>  		return;
> 
> -	igt_create_fb(data->drm_fd,
> -		      data->big_fb_width, data->big_fb_height,
> -		      data->format, data->modifier,
> -		      &data->big_fb);
> +	if (data->hw_stride == 0) {
> +		igt_create_fb(data->drm_fd,
> +			data->big_fb_width, data->big_fb_height,
> +			data->format, data->modifier,
> +			&data->big_fb);
> +	} else {
> +		setup_fb(data, &data->big_fb, data->big_fb_width,
> +			 data->big_fb_height, data->format, data->modifier,
> +			 data->hw_stride);
> +		igt_info("using stride length %d\n", data->hw_stride);
> +	}
> 
>  	generate_pattern(data, &data->big_fb, 640, 480);  } @@ -435,6 +476,14
> @@ static bool test_pipe(data_t *data)
> 
>  static void test_scanout(data_t *data)
>  {
> +	if (data->max_hw_stride_test) {
> +		data->big_fb_width = data->max_hw_fb_width;
> +		data->big_fb_height = data->max_hw_fb_width;
> +	} else {
> +		data->big_fb_width = data->max_fb_width;
> +		data->big_fb_height = data->max_fb_height;
> +	}
> +
>  	max_fb_size(data, &data->big_fb_width, &data->big_fb_height,
>  		    data->format, data->modifier);
> 
> @@ -587,7 +636,27 @@ test_addfb(data_t *data)
>  	gem_close(data->drm_fd, bo);
>  }
> 
> -static data_t data;
> +/*
> + * TODO: adapt i9xx_plane_max_stride(..) here from intel_display.c
> + * in kernel sources to support older gen for max hw stride length
> + * testing.
> + */
> +static void
> +set_max_hw_stride(data_t *data)
> +{
> +	if (intel_display_ver(data->devid) >= 13) {
> +		/*
> +		 * The stride in bytes must not exceed of the size
> +		 * of 128K bytes. For pixel formats of 64bpp will allow
> +		 * for a 16K pixel surface.
> +		 */
> +		data->hw_stride = 131072;
> +	} else {
> +		data->hw_stride = 32768;
> +	}
> +}
> +
> +static data_t data = {};
> 
>  static const struct {
>  	uint64_t modifier;
> @@ -619,6 +688,13 @@ static const struct {
>  	{ IGT_ROTATION_270, 270, },
>  };
> 
> +static const struct {
> +	igt_rotation_t flip;
> +	const char *flipname;
> +} fliptab[] = {
> +	{ 0, "" },
> +	{ IGT_REFLECT_X, "-hflip" },
> +};
>  igt_main
>  {
>  	igt_fixture {
> @@ -665,6 +741,9 @@ igt_main
>  			data.render_copy = igt_get_render_copyfunc(data.devid);
> 
>  		data.bops = buf_ops_create(data.drm_fd);
> +		data.ibb = intel_bb_create(data.drm_fd, 4096);
> +
> +		data.max_hw_stride_test = false;
>  	}
> 
>  	/*
> @@ -732,6 +811,65 @@ igt_main
>  		}
>  	}
> 
> +	data.max_hw_stride_test = true;
> +	// Run max hw stride length tests on gen5 and later.
> +	for (int i = 0; i < ARRAY_SIZE(modifiers); i++) {
> +		data.modifier = modifiers[i].modifier;
> +
> +		set_max_hw_stride(&data);
> +
> +		for (int l = 0; l < ARRAY_SIZE(fliptab); l++) {
> +			for (int j = 0; j < ARRAY_SIZE(formats); j++) {
> +				/*
> +				* try only those formats which can show full length.
> +				* Here 32K is used to have CI test results consistent
> +				* for all platforms, 32K is smallest number possbily
> +				* coming to data.hw_stride from above
> set_max_hw_stride()
> +				*/
> +				if (32768 / (formats[j].bpp >> 3) > 8192)
> +					continue;
> +
> +				data.format = formats[j].format;
> +
> +				for (int k = 0; k < ARRAY_SIZE(rotations); k++) {
> +					data.rotation = rotations[k].rotation |
> fliptab[l].flip;
> +
> +					// this combination will never happen.
> +					if ((data.rotation & (IGT_ROTATION_90 |
> IGT_ROTATION_270)) ||
> +						(fliptab[l].flip == IGT_REFLECT_X
> && modifiers[i].modifier == DRM_FORMAT_MOD_LINEAR))
> +						continue;
> +
> +					igt_describe("test maximum hardware
> supported stride length for given bpp and modifiers.");
> +					igt_subtest_f("%s-max-hw-stride-%dbpp-
> rotate-%d%s", modifiers[i].name,
> +						formats[j].bpp, rotations[k].angle,
> fliptab[l].flipname) {
> +
> 	igt_require(intel_display_ver(intel_get_drm_devid(data.drm_fd)) >= 5);
> +						if (data.format_override != 0) {
> +							igt_info("using format
> override fourcc %.4s\n", (char *)&data.format_override);
> +							data.format =
> data.format_override;
> +						}
> +						if (data.stride_override != 0) {
> +							igt_info("using FB width
> override %.d\n", data.stride_override);
> +							data.hw_stride =
> data.stride_override;
> +							data.max_hw_fb_width =
> data.stride_override;
> +
> +						} else {
> +							data.max_hw_fb_width =
> min(data.hw_stride / (formats[j].bpp >> 3), data.max_fb_width);
> +						}
> +
> +						igt_require(data.format ==
> DRM_FORMAT_C8 ||
> +
> 	igt_fb_supported_format(data.format));
> +
> 	igt_require(igt_display_has_format_mod(&data.display, data.format,
> data.modifier));
> +						test_scanout(&data);
> +					}
> +				}
> +
> +				igt_fixture
> +					cleanup_fb(&data);
> +			}
> +		}
> +	}
> +	data.max_hw_stride_test = false;
> +
>  	igt_fixture {
>  		igt_display_fini(&data.display);
>  		buf_ops_destroy(data.bops);
> --
> 2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2021-06-15  6:01 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11  5:19 [igt-dev] [PATCH i-g-t 01/17] tests/kms_dither: New IGT to validate crtc Dithering venkata.sai.patnana
2021-06-11  5:19 ` [igt-dev] [PATCH i-g-t 02/17] tests/kms_dither: Validate dither after CC blocks venkata.sai.patnana
2021-06-11  5:19 ` [igt-dev] [PATCH i-g-t 03/17] tests/device_reset: Unload snd driver before i915 unbind venkata.sai.patnana
2021-06-11 15:49   ` Kai Vehmanen
2021-06-11  5:19 ` [igt-dev] [PATCH i-g-t 04/17] tests/core_hotunplug: " venkata.sai.patnana
2021-06-11 15:50   ` Kai Vehmanen
2021-06-11  5:19 ` [igt-dev] [PATCH i-g-t 05/17] tests/kms_force_connector_basic: Skip prune stale mode venkata.sai.patnana
2021-06-11  5:19 ` [igt-dev] [PATCH i-g-t 06/17] tests/kms: Create buffer object from LMEM for discrete venkata.sai.patnana
2021-06-11  5:19 ` [igt-dev] [PATCH i-g-t 07/17] tests/kms_addfb_basic: Add invalid buffer object test " venkata.sai.patnana
2021-06-11 11:40   ` Petri Latvala
2021-06-11 11:49   ` [igt-dev] [PATCH i-g-t v2 " venkata.sai.patnana
2021-06-11 12:09     ` Petri Latvala
2021-06-11  5:19 ` [igt-dev] [PATCH i-g-t 08/17] tests/kms_dp_dsc: Read the debugfs only once venkata.sai.patnana
2021-06-11  5:19 ` [igt-dev] [PATCH i-g-t 09/17] tests/kms_big_fb: Add max HW stride length tests venkata.sai.patnana
2021-06-15  6:00   ` Shankar, Uma [this message]
2021-06-11  5:19 ` [igt-dev] [PATCH i-g-t 10/17] tests/kms_big_fb: Add max hw stride lenght async flip test venkata.sai.patnana
2021-06-11  5:19 ` [igt-dev] [PATCH i-g-t 11/17] tests/kms_big_fb: Optimize setup_fb function venkata.sai.patnana
2021-06-11  9:59   ` [igt-dev] [PATCH i-g-t v2 " venkata.sai.patnana
2021-06-11 11:32     ` Karthik B S
2021-06-11  5:20 ` [igt-dev] [PATCH i-g-t 12/17] tests/kms_dp_dsc: Add a subtest to force DSC output BPP venkata.sai.patnana
2021-06-15 15:25   ` [igt-dev] [PATCH i-g-t v2 " venkata.sai.patnana
2021-06-11  5:20 ` [igt-dev] [PATCH i-g-t 13/17] lib: Add helper functions to read/write dsc debugfs venkata.sai.patnana
2021-06-15  9:13   ` Petri Latvala
2021-06-11  5:20 ` [igt-dev] [PATCH i-g-t 14/17] tests/kms_dp_dsc: Assign all related data members together venkata.sai.patnana
2021-06-11  5:20 ` [igt-dev] [PATCH i-g-t 15/17] tests/kms_dp_dsc: Use helper functions to read/write dsc debugfs venkata.sai.patnana
2021-06-15  9:15   ` Petri Latvala
2021-06-15 15:25   ` [igt-dev] [PATCH i-g-t v2 " venkata.sai.patnana
2021-06-11  5:20 ` [igt-dev] [PATCH i-g-t 16/17] tests/kms_invalid_dotclock: Modify the test for bigjoiner venkata.sai.patnana
2021-06-11  5:20 ` [igt-dev] [PATCH i-g-t 17/17] tests/kms_cdclk : Add test to validate cdclk crawling venkata.sai.patnana
2021-06-11  9:59   ` venkata.sai.patnana
2021-06-11 11:49     ` [igt-dev] [PATCH i-g-t v2 " venkata.sai.patnana
2021-06-11 14:11       ` [igt-dev] [PATCH i-g-t v3 " venkata.sai.patnana
2021-06-11  6:15 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/17] tests/kms_dither: New IGT to validate crtc Dithering Patchwork
2021-06-11  9:15 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-06-11 12:17   ` Petri Latvala
2021-06-11 10:56 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/17] tests/kms_dither: New IGT to validate crtc Dithering (rev3) Patchwork
2021-06-11 12:14 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-06-11 13:01 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/17] tests/kms_dither: New IGT to validate crtc Dithering (rev5) Patchwork
2021-06-11 15:05 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-06-11 15:23 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,01/17] tests/kms_dither: New IGT to validate crtc Dithering (rev6) Patchwork
2021-06-15  5:54 ` [igt-dev] [PATCH i-g-t 01/17] tests/kms_dither: New IGT to validate crtc Dithering Shankar, Uma
2021-06-15  5:58   ` Modem, Bhanuprakash
2021-06-15  6:11     ` Shankar, Uma
2021-06-15  9:04       ` Jani Nikula
2021-06-15 16:18 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/17] tests/kms_dither: New IGT to validate crtc Dithering (rev8) Patchwork
2021-06-16  0:10 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=1d7b8e818fae4f14adfeb9048c3a27e3@intel.com \
    --to=uma.shankar@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=juha-pekka.heikkila@intel.com \
    --cc=venkata.sai.patnana@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.