[Mesa-dev] [PATCH] i965: Make intelEmitCopyBlit not truncate large strides.

Jason Ekstrand jason at jlekstrand.net
Sun Jan 22 21:59:10 UTC 2017


On Sun, Jan 22, 2017 at 1:50 AM, Kenneth Graunke <kenneth at whitecape.org>
wrote:

> When trying to blit larger tiled surfaces, the pitch can be larger than
> 32768 bytes, which means it won't fit in a GLshort.  Passing it in will
> truncate the stride to 0, which has...surprising results.
>
> For Y-tiled surfaces, pitches can be up to 128KB, as we divide by 4 and
> program the pitch as a number of tiles.


I thought it was dwords, not tiles?


>   So, this is actually legal and
> works out if we don't botch things here.
>
> Fixes GL45-CTS.gtf30.GL3Tests.depth_texture.depth_texture_copyteximage
> at widths greater than 8192.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/intel_blit.c | 4 ++--
>  src/mesa/drivers/dri/i965/intel_blit.h | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> XXX: This patch needs proper testing.  The test lab is having issues
>      this weekend, so I'll plan to test it more thoroughly on Monday.
>
> diff --git a/src/mesa/drivers/dri/i965/intel_blit.c
> b/src/mesa/drivers/dri/i965/intel_blit.c
> index 21a16e18c38..6ab06b10fd9 100644
> --- a/src/mesa/drivers/dri/i965/intel_blit.c
> +++ b/src/mesa/drivers/dri/i965/intel_blit.c
> @@ -577,12 +577,12 @@ xy_blit_cmd(uint32_t src_tiling, uint32_t
> src_tr_mode,
>  bool
>  intelEmitCopyBlit(struct brw_context *brw,
>                   GLuint cpp,
> -                 GLshort src_pitch,
> +                 uint32_t src_pitch,
>

These should be int32_t because the pitch can be negative.  We should also
update the comment at the top of intel_miptree_blit to be more correct.

While we're dealing with these issues, there's a check in
can_fast_copy_blit that's supposed to effectively be pitch >= 0 but I'm
pretty sure it's wrong in the face of tiled surfaces.


>                   drm_intel_bo *src_buffer,
>                   GLuint src_offset,
>                   uint32_t src_tiling,
>                   uint32_t src_tr_mode,
> -                 GLshort dst_pitch,
> +                 uint32_t dst_pitch,
>                   drm_intel_bo *dst_buffer,
>                   GLuint dst_offset,
>                   uint32_t dst_tiling,
> diff --git a/src/mesa/drivers/dri/i965/intel_blit.h
> b/src/mesa/drivers/dri/i965/intel_blit.h
> index 6925795656a..ae78dfe56dc 100644
> --- a/src/mesa/drivers/dri/i965/intel_blit.h
> +++ b/src/mesa/drivers/dri/i965/intel_blit.h
> @@ -31,12 +31,12 @@
>  bool
>  intelEmitCopyBlit(struct brw_context *brw,
>                    GLuint cpp,
> -                  GLshort src_pitch,
> +                  uint32_t src_pitch,
>                    drm_intel_bo *src_buffer,
>                    GLuint src_offset,
>                    uint32_t src_tiling,
>                    uint32_t src_tr_mode,
> -                  GLshort dst_pitch,
> +                  uint32_t dst_pitch,
>                    drm_intel_bo *dst_buffer,
>                    GLuint dst_offset,
>                    uint32_t dst_tiling,
> --
> 2.11.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170122/47e69864/attachment.html>


More information about the mesa-dev mailing list