[Mesa-dev] [PATCH] r600g: x/y coordinates must be divided by block dim in dma blit

Marek Olšák maraeo at gmail.com
Mon Jul 8 11:26:40 PDT 2013


Reviewed-by: Marek Olšák <maraeo at gmail.com>

Marek

On Fri, Jul 5, 2013 at 8:55 PM, Christoph Bumiller
<e0425955 at student.tuwien.ac.at> wrote:
> From: Christoph Bumiller <christoph.bumiller at speed.at>
>
> ---
>  src/gallium/drivers/r600/evergreen_state.c | 10 ++++++++--
>  src/gallium/drivers/r600/r600_state.c      | 10 ++++++++--
>  2 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
> index 0dc4f15..0267d28 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -3740,6 +3740,7 @@ boolean evergreen_dma_blit(struct pipe_context *ctx,
>         struct r600_texture *rdst = (struct r600_texture*)dst;
>         unsigned dst_pitch, src_pitch, bpp, dst_mode, src_mode, copy_height;
>         unsigned src_w, dst_w;
> +       unsigned src_x, src_y;
>
>         if (rctx->rings.dma.cs == NULL) {
>                 return FALSE;
> @@ -3748,6 +3749,11 @@ boolean evergreen_dma_blit(struct pipe_context *ctx,
>                 return FALSE;
>         }
>
> +       src_x = util_format_get_nblocksx(src->format, src_box->x);
> +       dst_x = util_format_get_nblocksx(src->format, dst_x);
> +       src_y = util_format_get_nblocksy(src->format, src_box->y);
> +       dst_y = util_format_get_nblocksy(src->format, dst_y);
> +
>         bpp = rdst->surface.bpe;
>         dst_pitch = rdst->surface.level[dst_level].pitch_bytes;
>         src_pitch = rsrc->surface.level[src_level].pitch_bytes;
> @@ -3792,7 +3798,7 @@ boolean evergreen_dma_blit(struct pipe_context *ctx,
>                  */
>                 src_offset= rsrc->surface.level[src_level].offset;
>                 src_offset += rsrc->surface.level[src_level].slice_size * src_box->z;
> -               src_offset += src_box->y * src_pitch + src_box->x * bpp;
> +               src_offset += src_y * src_pitch + src_x * bpp;
>                 dst_offset = rdst->surface.level[dst_level].offset;
>                 dst_offset += rdst->surface.level[dst_level].slice_size * dst_z;
>                 dst_offset += dst_y * dst_pitch + dst_x * bpp;
> @@ -3800,7 +3806,7 @@ boolean evergreen_dma_blit(struct pipe_context *ctx,
>                                         src_box->height * src_pitch);
>         } else {
>                 evergreen_dma_copy_tile(rctx, dst, dst_level, dst_x, dst_y, dst_z,
> -                                       src, src_level, src_box->x, src_box->y, src_box->z,
> +                                       src, src_level, src_x, src_y, src_box->z,
>                                         copy_height, dst_pitch, bpp);
>         }
>         return TRUE;
> diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
> index 301ca88..ac0e0ce 100644
> --- a/src/gallium/drivers/r600/r600_state.c
> +++ b/src/gallium/drivers/r600/r600_state.c
> @@ -3139,6 +3139,7 @@ boolean r600_dma_blit(struct pipe_context *ctx,
>         struct r600_texture *rdst = (struct r600_texture*)dst;
>         unsigned dst_pitch, src_pitch, bpp, dst_mode, src_mode, copy_height;
>         unsigned src_w, dst_w;
> +       unsigned src_x, src_y;
>
>         if (rctx->rings.dma.cs == NULL) {
>                 return FALSE;
> @@ -3147,6 +3148,11 @@ boolean r600_dma_blit(struct pipe_context *ctx,
>                 return FALSE;
>         }
>
> +       src_x = util_format_get_nblocksx(src->format, src_box->x);
> +       dst_x = util_format_get_nblocksx(src->format, dst_x);
> +       src_y = util_format_get_nblocksy(src->format, src_box->y);
> +       dst_y = util_format_get_nblocksy(src->format, dst_y);
> +
>         bpp = rdst->surface.bpe;
>         dst_pitch = rdst->surface.level[dst_level].pitch_bytes;
>         src_pitch = rsrc->surface.level[src_level].pitch_bytes;
> @@ -3179,7 +3185,7 @@ boolean r600_dma_blit(struct pipe_context *ctx,
>                  */
>                 src_offset= rsrc->surface.level[src_level].offset;
>                 src_offset += rsrc->surface.level[src_level].slice_size * src_box->z;
> -               src_offset += src_box->y * src_pitch + src_box->x * bpp;
> +               src_offset += src_y * src_pitch + src_x * bpp;
>                 dst_offset = rdst->surface.level[dst_level].offset;
>                 dst_offset += rdst->surface.level[dst_level].slice_size * dst_z;
>                 dst_offset += dst_y * dst_pitch + dst_x * bpp;
> @@ -3191,7 +3197,7 @@ boolean r600_dma_blit(struct pipe_context *ctx,
>                 r600_dma_copy(rctx, dst, src, dst_offset, src_offset, size);
>         } else {
>                 return r600_dma_copy_tile(rctx, dst, dst_level, dst_x, dst_y, dst_z,
> -                                       src, src_level, src_box->x, src_box->y, src_box->z,
> +                                       src, src_level, src_x, src_y, src_box->z,
>                                         copy_height, dst_pitch, bpp);
>         }
>         return TRUE;
> --
> 1.8.1.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list