From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 3/5] lib/intel_batchbuffer: Make blitter asserts more useful
Date: Thu, 18 Apr 2019 14:52:28 +0300 [thread overview]
Message-ID: <20190418115228.GJ1747@intel.com> (raw)
In-Reply-To: <155553396437.25904.18248707527239086873@skylake-alporthouse-com>
On Wed, Apr 17, 2019 at 09:46:04PM +0100, Chris Wilson wrote:
> Quoting Ville Syrjala (2019-04-17 21:35:42)
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Use igt_assert_lt/lte for the blitter coord/stride asserts
> > so that we can see what the offending value was. gcc likes
> > to optimize the values away so gdb often doesn't help as
> > much as one would like.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> > lib/intel_batchbuffer.c | 54 +++++++++++++++++++++++------------------
> > 1 file changed, 30 insertions(+), 24 deletions(-)
> >
> > diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
> > index 712ce1a32da6..422f3b6186aa 100644
> > --- a/lib/intel_batchbuffer.c
> > +++ b/lib/intel_batchbuffer.c
> > @@ -417,16 +417,16 @@ intel_blt_copy(struct intel_batchbuffer *batch,
> > cmd_bits |= XY_SRC_COPY_BLT_DST_TILED;
> > }
> >
> > -#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15))
> > - igt_assert(CHECK_RANGE(src_x1) && CHECK_RANGE(src_y1) &&
> > - CHECK_RANGE(dst_x1) && CHECK_RANGE(dst_y1) &&
> > - CHECK_RANGE(width) && CHECK_RANGE(height) &&
> > - CHECK_RANGE(src_x1 + width) &&
> > - CHECK_RANGE(src_y1 + height) &&
> > - CHECK_RANGE(dst_x1 + width) &&
> > - CHECK_RANGE(dst_y1 + height) &&
> > - CHECK_RANGE(src_pitch) &&
> > - CHECK_RANGE(dst_pitch));
> > +#define CHECK_RANGE(x) do { \
> > + igt_assert_lte(0, (x)); \
> > + igt_assert_lt((x), (1 << 15)); \
> > +} while (0)
> > + CHECK_RANGE(src_x1); CHECK_RANGE(src_y1);
> > + CHECK_RANGE(dst_x1); CHECK_RANGE(dst_y1);
> > + CHECK_RANGE(width); CHECK_RANGE(height);
> > + CHECK_RANGE(src_x1 + width); CHECK_RANGE(src_y1 + height);
> > + CHECK_RANGE(dst_x1 + width); CHECK_RANGE(dst_y1 + height);
> > + CHECK_RANGE(src_pitch); CHECK_RANGE(dst_pitch);
> > #undef CHECK_RANGE
>
> Ok.
>
> > br13_bits = 0;
> > @@ -715,13 +715,16 @@ void igt_blitter_fast_copy__raw(int fd,
> > dword0 = fast_copy_dword0(src_tiling, dst_tiling);
> > dword1 = fast_copy_dword1(src_tiling, dst_tiling, bpp);
> >
> > -#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15))
> > - assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) &&
> > - CHECK_RANGE(dst_x) && CHECK_RANGE(dst_y) &&
> > - CHECK_RANGE(width) && CHECK_RANGE(height) &&
> > - CHECK_RANGE(src_x + width) && CHECK_RANGE(src_y + height) &&
> > - CHECK_RANGE(dst_x + width) && CHECK_RANGE(dst_y + height) &&
> > - CHECK_RANGE(src_pitch) && CHECK_RANGE(dst_pitch));
>
> Plain assert!
>
> > +#define CHECK_RANGE(x) do { \
> > + igt_assert_lte(0, (x)); \
> > + igt_assert_lt((x), (1 << 15)); \
> > +} while (0)
>
> This looks like a redefinition? Oh, undef.
>
> Maybe call it CHECK_BLT_RANGE()? CHECK_XY_RANGE()?
>
> > + CHECK_RANGE(src_x); CHECK_RANGE(src_y);
> > + CHECK_RANGE(dst_x); CHECK_RANGE(dst_y);
> > + CHECK_RANGE(width); CHECK_RANGE(height);
> > + CHECK_RANGE(src_x + width); CHECK_RANGE(src_y + height);
> > + CHECK_RANGE(dst_x + width); CHECK_RANGE(dst_y + height);
> > + CHECK_RANGE(src_pitch); CHECK_RANGE(dst_pitch);
> > #undef CHECK_RANGE
>
> Ok.
>
> > batch[i++] = dword0;
> > @@ -791,13 +794,16 @@ void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
> > dword0 = fast_copy_dword0(src->tiling, dst->tiling);
> > dword1 = fast_copy_dword1(src->tiling, dst->tiling, dst->bpp);
> >
> > -#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15))
> > - assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) &&
> > - CHECK_RANGE(dst_x) && CHECK_RANGE(dst_y) &&
> > - CHECK_RANGE(width) && CHECK_RANGE(height) &&
> > - CHECK_RANGE(src_x + width) && CHECK_RANGE(src_y + height) &&
> > - CHECK_RANGE(dst_x + width) && CHECK_RANGE(dst_y + height) &&
> > - CHECK_RANGE(src_pitch) && CHECK_RANGE(dst_pitch));
> > +#define CHECK_RANGE(x) do { \
> > + igt_assert_lte(0, (x)); \
> > + igt_assert_lt((x), (1 << 15)); \
> > +} while (0)
>
> Third time's a winner!
>
> > + CHECK_RANGE(src_x); CHECK_RANGE(src_y);
> > + CHECK_RANGE(dst_x); CHECK_RANGE(dst_y);
> > + CHECK_RANGE(width); CHECK_RANGE(height);
> > + CHECK_RANGE(src_x + width); CHECK_RANGE(src_y + height);
> > + CHECK_RANGE(dst_x + width); CHECK_RANGE(dst_y + height);
> > + CHECK_RANGE(src_pitch); CHECK_RANGE(dst_pitch);
> > #undef CHECK_RANGE
>
> Ok.
>
> Kill the repeated CHECK_RANGE() definitions.
Sure. Can do.
>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris
--
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-04-18 11:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-17 20:35 [igt-dev] [PATCH i-g-t 1/5] lib/igt_fb: Unref the renderecopy scratch bos Ville Syrjala
2019-04-17 20:35 ` [igt-dev] [PATCH i-g-t 2/5] tests/i915/gem_render_copy: Don't leak bos between subtests Ville Syrjala
2019-04-17 20:41 ` Chris Wilson
2019-04-18 12:11 ` [igt-dev] [PATCH i-g-t v2 " Ville Syrjala
2019-04-17 20:35 ` [igt-dev] [PATCH i-g-t 3/5] lib/intel_batchbuffer: Make blitter asserts more useful Ville Syrjala
2019-04-17 20:46 ` Chris Wilson
2019-04-18 11:52 ` Ville Syrjälä [this message]
2019-04-18 12:11 ` [igt-dev] [PATCH i-g-t v2 " Ville Syrjala
2019-04-17 20:35 ` [igt-dev] [PATCH i-g-t 4/5] lib/igt_fb: Nuke redundant rendercopy cairo surface variant Ville Syrjala
2019-04-17 20:47 ` Chris Wilson
2019-04-18 11:53 ` Ville Syrjälä
2019-04-18 12:12 ` [igt-dev] [PATCH i-g-t v2 " Ville Syrjala
2019-04-17 20:35 ` [igt-dev] [PATCH i-g-t 5/5] lib/igt_fb: Fix blitter limit checks Ville Syrjala
2019-04-17 20:52 ` Chris Wilson
2019-04-18 12:07 ` Ville Syrjälä
2019-04-18 12:12 ` [igt-dev] [PATCH i-g-t v2 " Ville Syrjala
2019-04-17 20:38 ` [igt-dev] [PATCH i-g-t 1/5] lib/igt_fb: Unref the renderecopy scratch bos Chris Wilson
2019-04-18 11:51 ` Ville Syrjälä
2019-04-17 22:55 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/5] " Patchwork
2019-04-18 12:09 ` [igt-dev] [PATCH i-g-t v2 1/5] " Ville Syrjala
2019-04-18 12:50 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/5] lib/igt_fb: Unref the renderecopy scratch bos (rev6) Patchwork
2019-04-18 15:20 ` [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=20190418115228.GJ1747@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
/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