igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	igt-dev@lists.freedesktop.org
Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Subject: Re: [igt-dev] [PATCH i-g-t 04/25] tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats
Date: Thu, 20 Sep 2018 16:36:13 -0700	[thread overview]
Message-ID: <1537486573.2746.30.camel@intel.com> (raw)
In-Reply-To: <20180719150415.935-4-ville.syrjala@linux.intel.com>

Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Try to create a bunch of fbs with different formats/modfifiers and
> make sure sure addfb2 accepts/rejects them in accordance with what
> the plane IN_FORMATS blobifiers are advertizing.
> 
> We only check "easy" formats (ie. RGB/C8, no YUV/planar etc.). We
> also assume that one can always create a 64x64 fb with stride of
> 64*8 bytes.
> 
> v2: Skip when blobifiers aren't supported

Some trivial rebasing required.

More below.

> 
> Cc: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  tests/kms_addfb_basic.c | 107
> ++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 104 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> index 7d8852f02003..9e33d00346e0 100644
> --- a/tests/kms_addfb_basic.c
> +++ b/tests/kms_addfb_basic.c
> @@ -41,6 +41,97 @@
>  uint32_t gem_bo;
>  uint32_t gem_bo_small;
>  
> +static const uint64_t modifiers[] = {
> +	DRM_FORMAT_MOD_LINEAR,
> +	I915_FORMAT_MOD_X_TILED,
> +	I915_FORMAT_MOD_Y_TILED,
> +	I915_FORMAT_MOD_Yf_TILED,
> +	I915_FORMAT_MOD_Y_TILED_CCS,
> +	I915_FORMAT_MOD_Yf_TILED_CCS,

For the buffers that support CCS, I see the test failing with the
Kernel complaining that we're not passing 2 planes (since .num_planes=2
in ccs_formats from intel_display.c). It looks like igt needs to craft
the aux buffer too.

More below.

> +};
> +
> +static const uint32_t formats[] = {
> +	DRM_FORMAT_C8,
> +
> +	DRM_FORMAT_RGB565,
> +	DRM_FORMAT_BGR565,
> +
> +	DRM_FORMAT_RGB888,
> +	DRM_FORMAT_BGR888,
> +
> +	DRM_FORMAT_XRGB8888,
> +	DRM_FORMAT_XBGR8888,
> +	DRM_FORMAT_RGBX8888,
> +	DRM_FORMAT_BGRX8888,
> +	DRM_FORMAT_ARGB8888,
> +	DRM_FORMAT_ABGR8888,
> +	DRM_FORMAT_RGBA8888,
> +	DRM_FORMAT_BGRA8888,
> +
> +	DRM_FORMAT_XRGB2101010,
> +	DRM_FORMAT_XBGR2101010,
> +	DRM_FORMAT_RGBX1010102,
> +	DRM_FORMAT_BGRX1010102,
> +	DRM_FORMAT_ARGB2101010,
> +	DRM_FORMAT_ABGR2101010,
> +	DRM_FORMAT_RGBA1010102,
> +	DRM_FORMAT_BGRA1010102,
> +};
> +
> +#define IGT_FORMAT_FMT "%c%c%c%c (0x%08x)"
> +#define IGT_FORMAT_ARGS(f) ((f) >> 0) & 0xff, ((f) >> 8) & 0xff, \
> +		((f) >> 16) & 0xff, ((f) >> 24) & 0xff, (f)
> +
> +/*
> + * make sure addfb2 accepts/rejects every format/modifier
> + * in accordance with the plane IN_FORMATS properties.
> + */
> +static void expected_formats(igt_display_t *display)
> +{
> +	int fd = display->drm_fd;
> +	uint32_t handle;
> +
> +	igt_require(display->format_mod_count);

After patch 01, this is really not skipping a lot.

Perhaps it would be better to igt_require(plane->modifiers) if you
implement my suggestion from patch 01? :)

> +
> +	handle = gem_create(fd, 64*8*64);

I'm assuming you have checked that this is sane.


> +	igt_assert(handle);
> +
> +	for (int i = 0; i < ARRAY_SIZE(formats); i++) {
> +		uint32_t format = formats[i];
> +
> +		for (int j = 0; j < ARRAY_SIZE(modifiers); j++) {
> +			uint64_t modifier = modifiers[j];
> +			struct drm_mode_fb_cmd2 f = {
> +				.width = 64,
> +				.height = 64,
> +				.pixel_format = format,
> +				.handles[0] = handle,
> +				.pitches[0] = 64 * 8,
> +				.modifier[0] = modifier,
> +				.flags = DRM_MODE_FB_MODIFIERS,
> +			};
> +			int ret;
> +
> +			igt_info("Testing format " IGT_FORMAT_FMT "
> / modifier 0x%" PRIx64 "\n",
> +				 IGT_FORMAT_ARGS(format), modifier);
> +
> +			ret = drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2,
> &f);
> +
> +			if (igt_display_has_format_mod(display,
> format, modifier)) {
> +				igt_assert_eq(ret, 0);
> +				igt_assert_neq(f.fb_id, 0);
> +			} else {
> +				igt_assert_neq(ret, 0);
> +				igt_assert_eq(f.fb_id, 0);
> +			}
> +

I was fine with this until I ran the test and it failed. My problem
with this style is that once you hit one of these assertions you stop
the test, so you don't get an idea of how bad your Kernel is. You could
simply igt_info() the failures, failures++ (or false_positives++ and
false_negatives++) and then igt_assert(failures == 0) outside the loop.
This way we can see all the bad combinations in one run, without having
to fix the first problem in order to uncover the next.

Everything else looks good.

> +			drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id);
> +		}
> +	}
> +
> +	gem_close(fd, handle);
> +}
> +
>  static void invalid_tests(int fd)
>  {
>  	struct local_drm_mode_fb_cmd2 f = {};
> @@ -539,13 +630,17 @@ static void prop_tests(int fd)
>  
>  }
>  
> -int fd;
> +static igt_display_t display;
> +static int fd;
>  
>  igt_main
>  {
> -	igt_fixture
> +	igt_fixture {
>  		fd = drm_open_driver_master(DRIVER_ANY);
>  
> +		igt_display_init(&display, fd);
> +	}
> +
>  	invalid_tests(fd);
>  
>  	pitch_tests(fd);
> @@ -560,6 +655,12 @@ igt_main
>  
>  	prop_tests(fd);
>  
> -	igt_fixture
> +	igt_subtest("expected-formats")
> +		expected_formats(&display);
> +
> +	igt_fixture {
> +		igt_display_fini(&display);
> +
>  		close(fd);
> +	}
>  }
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-09-20 23:36 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19 15:03 [igt-dev] [PATCH i-g-t 01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Ville Syrjala
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 02/25] tests/kms_ccs: Use igt_plane_has_format_mod() Ville Syrjala
2018-09-20 20:56   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 03/25] tests/kms_plane: Add validate-in-formats subtest Ville Syrjala
2018-09-20 21:10   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 04/25] tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats Ville Syrjala
2018-09-20 23:36   ` Paulo Zanoni [this message]
2018-09-21 13:37     ` Ville Syrjälä
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 05/25] tests/gem_render_copy: Fix clipped height Ville Syrjala
2018-08-24  3:17   ` Dhinakaran Pandiyan
2018-08-28 14:21     ` Ville Syrjälä
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 06/25] lib/igt_fb: Respect the users choice of stride Ville Syrjala
2018-09-21  0:04   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 07/25] lib: Add DIV_ROUND_UP() Ville Syrjala
2018-09-18 21:17   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 08/25] lib/igt_fb: Use fb_blit_upload as the base class for fb_convert_blit_upload Ville Syrjala
2018-09-21  0:15   ` Paulo Zanoni
2018-07-19 15:03 ` [igt-dev] [PATCH i-g-t 09/25] lib/igt_fb: Pass fb_blit_upload to free_linear_mapping() Ville Syrjala
2018-09-21  0:20   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 10/25] lib/igt_fb: s/planar_foo/fb_plane_foo/ Ville Syrjala
2018-09-21 21:58   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 11/25] lib/igt_fb: Add fb_plane_bpp() Ville Syrjala
2018-09-21 22:02   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 12/25] lib/igt_fb: Add fb_num_planes() Ville Syrjala
2018-09-21 22:05   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 13/25] lib/igt_fb: Extract calc_plane_stride() Ville Syrjala
2018-09-21 22:33   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 14/25] lib/igt_fb: Consolidate fb size calculation to one function Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 15/25] lib/kms: Pass strides[] to __kms_addfb Ville Syrjala
2018-09-21 22:45   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 16/25] lib/kms: Pass the number of planes explicitly to __kms_addfb() Ville Syrjala
2018-09-21 22:54   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 17/25] lib/igt_fb: Remove the hand rolled addfb2 Ville Syrjala
2018-09-21 23:15   ` Paulo Zanoni
2018-10-03 10:56     ` Petri Latvala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 18/25] lib/igt_fb: Constify format_desc_struct Ville Syrjala
2018-09-21 23:20   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 19/25] lib/igt_fb: Pass around igt_fb internally Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 20/25] lib/igt_fb: Refactor blitter usage Ville Syrjala
2018-09-21 23:48   ` Paulo Zanoni
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 21/25] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 22/25] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 23/25] tests/gem_render_copy: Test Yf tiling Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 24/25] lib/igt_fb: Use rendercopy for rendering into compressed buffers Ville Syrjala
2018-07-19 15:04 ` [igt-dev] [PATCH i-g-t 25/25] tests/kms_plane: Test all modifiers as well Ville Syrjala
2018-07-19 15:26 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/25] lib/igt_kms: Fill the plane format/mod information for pre-blobifier drivers Patchwork
2018-07-19 17:40 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-09-20 20:26 ` [igt-dev] [PATCH i-g-t 01/25] " Paulo Zanoni
2018-09-21 13:26   ` Ville Syrjälä
2018-09-21 21:39     ` Paulo Zanoni
2018-11-27 20:30       ` Kazlauskas, Nicholas
2018-11-27 21:20         ` Ville Syrjälä

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=1537486573.2746.30.camel@intel.com \
    --to=paulo.r.zanoni@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=ulrich.hecht+renesas@gmail.com \
    --cc=ville.syrjala@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).