[Mesa-dev] [PATCH 1/3] i965: Fix HW blitter pitch limits

Kenneth Graunke kenneth at whitecape.org
Sun Jun 7 01:01:48 PDT 2015


On Friday, June 05, 2015 03:14:29 PM Chris Wilson wrote:
> The BLT pitch is specified in bytes for linear surfaces and in dwords
> for tiled surfaces. In both cases the programmable limit is 32,767, so
> adjust the check to compensate for the effect of tiling.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Kristian Høgsberg <krh at bitplanet.net>
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/intel_blit.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
> index 7680a40..360bfe8 100644
> --- a/src/mesa/drivers/dri/i965/intel_blit.c
> +++ b/src/mesa/drivers/dri/i965/intel_blit.c
> @@ -130,6 +130,14 @@ set_blitter_tiling(struct brw_context *brw,
>        ADVANCE_BATCH();                                                  \
>     } while (0)
>  
> +static int blt_pitch(struct intel_mipmap_tree *mt)

static int
blt_pitch(struct intel_mipmap_tree *mt)

> +{
> +   int pitch = mt->pitch;
> +   if (mt->tiling)
> +      pitch /= 4;
> +   return pitch;
> +}

Wow, the docs are really confusing.  They sure make it sound like the
XY_SRC_COPY_BLT pitch is *always* specified in DWords, even for linear
buffers.

But, our existing code is definitely only dividing by 4 for tiled surfaces,
and has been doing that for years...

> +
>  /**
>   * Implements a rectangular block transfer (blit) of pixels between two
>   * miptrees.
> @@ -197,14 +205,14 @@ intel_miptree_blit(struct brw_context *brw,
>      *
>      * Furthermore, intelEmitCopyBlit (which is called below) uses a signed
>      * 16-bit integer to represent buffer pitch, so it can only handle buffer
> -    * pitches < 32k.
> +    * pitches < 32k. However, the pitch is measured in bytes for linear buffers
> +    * and dwords for tiled buffers.
>      *
>      * As a result of these two limitations, we can only use the blitter to do
> -    * this copy when the miptree's pitch is less than 32k.
> +    * this copy when the miptree's pitch is less than 32k linear or 128k tiled.
>      */
> -   if (src_mt->pitch >= 32768 ||
> -       dst_mt->pitch >= 32768) {
> -      perf_debug("Falling back due to >=32k pitch\n");
> +   if (blt_pitch(src_mt) >= 32768 || blt_pitch(dst_mt) >= 32768) {
> +      perf_debug("Falling back due to >= 32k/128k pitch\n");
>        return false;
>     }
>  
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150607/9b0762f0/attachment.sig>


More information about the mesa-dev mailing list