[Mesa-dev] [PATCH 1/3] r600g, radeonsi: use a fallback in dma_copy instead of failing

2014-03-11 Thread Marek Olšák
From: Marek Olšák marek.ol...@amd.com

v2: - allow byte-aligned DMA buffer copies on Evergreen
- fix piglit/texsubimage regression
- use the fallback for 3D copies (depth  1) as well
---
 src/gallium/drivers/r600/evergreen_state.c  | 40 +
 src/gallium/drivers/r600/r600_state.c   | 44 +++
 src/gallium/drivers/radeon/r600_buffer_common.c | 58 +++--
 src/gallium/drivers/radeon/r600_pipe_common.h   | 17 
 src/gallium/drivers/radeon/r600_texture.c   | 18 +++-
 src/gallium/drivers/radeonsi/si_state.c | 19 
 6 files changed, 99 insertions(+), 97 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index dca7c58..1e14b01 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -3329,13 +3329,13 @@ static void evergreen_dma_copy_tile(struct r600_context 
*rctx,
}
 }
 
-static boolean evergreen_dma_blit(struct pipe_context *ctx,
- struct pipe_resource *dst,
- unsigned dst_level,
- unsigned dst_x, unsigned dst_y, unsigned 
dst_z,
- struct pipe_resource *src,
- unsigned src_level,
- const struct pipe_box *src_box)
+static void evergreen_dma_blit(struct pipe_context *ctx,
+  struct pipe_resource *dst,
+  unsigned dst_level,
+  unsigned dstx, unsigned dsty, unsigned dstz,
+  struct pipe_resource *src,
+  unsigned src_level,
+  const struct pipe_box *src_box)
 {
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_texture *rsrc = (struct r600_texture*)src;
@@ -3343,22 +3343,22 @@ static boolean evergreen_dma_blit(struct pipe_context 
*ctx,
unsigned dst_pitch, src_pitch, bpp, dst_mode, src_mode, copy_height;
unsigned src_w, dst_w;
unsigned src_x, src_y;
+   unsigned dst_x = dstx, dst_y = dsty, dst_z = dstz;
 
if (rctx-b.rings.dma.cs == NULL) {
-   return FALSE;
+   goto fallback;
}
 
if (dst-target == PIPE_BUFFER  src-target == PIPE_BUFFER) {
evergreen_dma_copy(rctx, dst, src, dst_x, src_box-x, 
src_box-width);
-   return TRUE;
+   return;
}
 
-   if (src-format != dst-format) {
-   return FALSE;
-   }
-   if (rdst-dirty_level_mask != 0) {
-   return FALSE;
+   if (src-format != dst-format || src_box-depth  1 ||
+   rdst-dirty_level_mask != 0) {
+   goto fallback;
}
+
if (rsrc-dirty_level_mask) {
ctx-flush_resource(ctx, src);
}
@@ -3383,13 +3383,13 @@ static boolean evergreen_dma_blit(struct pipe_context 
*ctx,
 
if (src_pitch != dst_pitch || src_box-x || dst_x || src_w != dst_w) {
/* FIXME evergreen can do partial blit */
-   return FALSE;
+   goto fallback;
}
/* the x test here are currently useless (because we don't support 
partial blit)
 * but keep them around so we don't forget about those
 */
if ((src_pitch  0x7) || (src_box-x  0x7) || (dst_x  0x7) || 
(src_box-y  0x7) || (dst_y  0x7)) {
-   return FALSE;
+   goto fallback;
}
 
/* 128 bpp surfaces require non_disp_tiling for both
@@ -3400,7 +3400,7 @@ static boolean evergreen_dma_blit(struct pipe_context 
*ctx,
if ((rctx-b.chip_class == CAYMAN) 
(src_mode != dst_mode) 
(util_format_get_blocksize(src-format) = 16)) {
-   return FALSE;
+   goto fallback;
}
 
if (src_mode == dst_mode) {
@@ -3423,7 +3423,11 @@ static boolean evergreen_dma_blit(struct pipe_context 
*ctx,
src, src_level, src_x, src_y, 
src_box-z,
copy_height, dst_pitch, bpp);
}
-   return TRUE;
+   return;
+
+fallback:
+   ctx-resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
+ src, src_level, src_box);
 }
 
 void evergreen_init_state_functions(struct r600_context *rctx)
diff --git a/src/gallium/drivers/r600/r600_state.c 
b/src/gallium/drivers/r600/r600_state.c
index 6d89e6c..2a4813b 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -2883,13 +2883,13 @@ static boolean r600_dma_copy_tile(struct r600_context 
*rctx,
return TRUE;
 }
 
-static boolean r600_dma_blit(struct pipe_context *ctx,
-struct pipe_resource *dst,
-unsigned 

Re: [Mesa-dev] [PATCH 1/3] r600g, radeonsi: use a fallback in dma_copy instead of failing

2014-03-11 Thread Jan Vesely
On Tue, 2014-03-11 at 15:09 +0100, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 v2: - allow byte-aligned DMA buffer copies on Evergreen
 - fix piglit/texsubimage regression
 - use the fallback for 3D copies (depth  1) as well
 ---
  src/gallium/drivers/r600/evergreen_state.c  | 40 +
  src/gallium/drivers/r600/r600_state.c   | 44 +++
  src/gallium/drivers/radeon/r600_buffer_common.c | 58 
 +++--
  src/gallium/drivers/radeon/r600_pipe_common.h   | 17 
  src/gallium/drivers/radeon/r600_texture.c   | 18 +++-
  src/gallium/drivers/radeonsi/si_state.c | 19 
  6 files changed, 99 insertions(+), 97 deletions(-)
 
 diff --git a/src/gallium/drivers/r600/evergreen_state.c 
 b/src/gallium/drivers/r600/evergreen_state.c
 index dca7c58..1e14b01 100644
 --- a/src/gallium/drivers/r600/evergreen_state.c
 +++ b/src/gallium/drivers/r600/evergreen_state.c
 @@ -3329,13 +3329,13 @@ static void evergreen_dma_copy_tile(struct 
 r600_context *rctx,
   }
  }
  
 -static boolean evergreen_dma_blit(struct pipe_context *ctx,
 -   struct pipe_resource *dst,
 -   unsigned dst_level,
 -   unsigned dst_x, unsigned dst_y, unsigned 
 dst_z,
 -   struct pipe_resource *src,
 -   unsigned src_level,
 -   const struct pipe_box *src_box)
 +static void evergreen_dma_blit(struct pipe_context *ctx,
 +struct pipe_resource *dst,
 +unsigned dst_level,
 +unsigned dstx, unsigned dsty, unsigned dstz,
 +struct pipe_resource *src,
 +unsigned src_level,
 +const struct pipe_box *src_box)
  {
   struct r600_context *rctx = (struct r600_context *)ctx;
   struct r600_texture *rsrc = (struct r600_texture*)src;
 @@ -3343,22 +3343,22 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,
   unsigned dst_pitch, src_pitch, bpp, dst_mode, src_mode, copy_height;
   unsigned src_w, dst_w;
   unsigned src_x, src_y;
 + unsigned dst_x = dstx, dst_y = dsty, dst_z = dstz;
  
   if (rctx-b.rings.dma.cs == NULL) {
 - return FALSE;
 + goto fallback;
   }
  
   if (dst-target == PIPE_BUFFER  src-target == PIPE_BUFFER) {
   evergreen_dma_copy(rctx, dst, src, dst_x, src_box-x, 
 src_box-width);
 - return TRUE;
 + return;
   }
  
 - if (src-format != dst-format) {
 - return FALSE;
 - }
 - if (rdst-dirty_level_mask != 0) {
 - return FALSE;
 + if (src-format != dst-format || src_box-depth  1 ||
 + rdst-dirty_level_mask != 0) {
 + goto fallback;
   }
 +
   if (rsrc-dirty_level_mask) {
   ctx-flush_resource(ctx, src);
   }
 @@ -3383,13 +3383,13 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,
  
   if (src_pitch != dst_pitch || src_box-x || dst_x || src_w != dst_w) {
   /* FIXME evergreen can do partial blit */
 - return FALSE;
 + goto fallback;
   }
   /* the x test here are currently useless (because we don't support 
 partial blit)
* but keep them around so we don't forget about those
*/
   if ((src_pitch  0x7) || (src_box-x  0x7) || (dst_x  0x7) || 
 (src_box-y  0x7) || (dst_y  0x7)) {
 - return FALSE;
 + goto fallback;
   }
  
   /* 128 bpp surfaces require non_disp_tiling for both
 @@ -3400,7 +3400,7 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,
   if ((rctx-b.chip_class == CAYMAN) 
   (src_mode != dst_mode) 
   (util_format_get_blocksize(src-format) = 16)) {
 - return FALSE;
 + goto fallback;
   }
  
   if (src_mode == dst_mode) {
 @@ -3423,7 +3423,11 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,
   src, src_level, src_x, src_y, 
 src_box-z,
   copy_height, dst_pitch, bpp);
   }
 - return TRUE;
 + return;
 +
 +fallback:
 + ctx-resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
 +   src, src_level, src_box);
  }
  
  void evergreen_init_state_functions(struct r600_context *rctx)
 diff --git a/src/gallium/drivers/r600/r600_state.c 
 b/src/gallium/drivers/r600/r600_state.c
 index 6d89e6c..2a4813b 100644
 --- a/src/gallium/drivers/r600/r600_state.c
 +++ b/src/gallium/drivers/r600/r600_state.c
 @@ -2883,13 +2883,13 @@ static boolean r600_dma_copy_tile(struct r600_context 
 *rctx,
   return TRUE;
  }
  
 -static boolean r600_dma_blit(struct pipe_context *ctx,
 -  struct pipe_resource *dst,

Re: [Mesa-dev] [PATCH 1/3] r600g, radeonsi: use a fallback in dma_copy instead of failing

2014-03-11 Thread Jan Vesely
On Tue, 2014-03-11 at 11:37 -0400, Jan Vesely wrote:
 On Tue, 2014-03-11 at 15:09 +0100, Marek Olšák wrote:
  From: Marek Olšák marek.ol...@amd.com
  
  v2: - allow byte-aligned DMA buffer copies on Evergreen
  - fix piglit/texsubimage regression
  - use the fallback for 3D copies (depth  1) as well
  ---
   src/gallium/drivers/r600/evergreen_state.c  | 40 +
   src/gallium/drivers/r600/r600_state.c   | 44 +++
   src/gallium/drivers/radeon/r600_buffer_common.c | 58 
  +++--
   src/gallium/drivers/radeon/r600_pipe_common.h   | 17 
   src/gallium/drivers/radeon/r600_texture.c   | 18 +++-
   src/gallium/drivers/radeonsi/si_state.c | 19 
   6 files changed, 99 insertions(+), 97 deletions(-)
  
  diff --git a/src/gallium/drivers/r600/evergreen_state.c 
  b/src/gallium/drivers/r600/evergreen_state.c
  index dca7c58..1e14b01 100644
  --- a/src/gallium/drivers/r600/evergreen_state.c
  +++ b/src/gallium/drivers/r600/evergreen_state.c
  @@ -3329,13 +3329,13 @@ static void evergreen_dma_copy_tile(struct 
  r600_context *rctx,
  }
   }
   
  -static boolean evergreen_dma_blit(struct pipe_context *ctx,
  - struct pipe_resource *dst,
  - unsigned dst_level,
  - unsigned dst_x, unsigned dst_y, unsigned 
  dst_z,
  - struct pipe_resource *src,
  - unsigned src_level,
  - const struct pipe_box *src_box)
  +static void evergreen_dma_blit(struct pipe_context *ctx,
  +  struct pipe_resource *dst,
  +  unsigned dst_level,
  +  unsigned dstx, unsigned dsty, unsigned dstz,
  +  struct pipe_resource *src,
  +  unsigned src_level,
  +  const struct pipe_box *src_box)
   {
  struct r600_context *rctx = (struct r600_context *)ctx;
  struct r600_texture *rsrc = (struct r600_texture*)src;
  @@ -3343,22 +3343,22 @@ static boolean evergreen_dma_blit(struct 
  pipe_context *ctx,
  unsigned dst_pitch, src_pitch, bpp, dst_mode, src_mode, copy_height;
  unsigned src_w, dst_w;
  unsigned src_x, src_y;
  +   unsigned dst_x = dstx, dst_y = dsty, dst_z = dstz;
   
  if (rctx-b.rings.dma.cs == NULL) {
  -   return FALSE;
  +   goto fallback;
  }
   
  if (dst-target == PIPE_BUFFER  src-target == PIPE_BUFFER) {
  evergreen_dma_copy(rctx, dst, src, dst_x, src_box-x, 
  src_box-width);
  -   return TRUE;
  +   return;
  }
   
  -   if (src-format != dst-format) {
  -   return FALSE;
  -   }
  -   if (rdst-dirty_level_mask != 0) {
  -   return FALSE;
  +   if (src-format != dst-format || src_box-depth  1 ||
  +   rdst-dirty_level_mask != 0) {
  +   goto fallback;
  }
  +
  if (rsrc-dirty_level_mask) {
  ctx-flush_resource(ctx, src);
  }
  @@ -3383,13 +3383,13 @@ static boolean evergreen_dma_blit(struct 
  pipe_context *ctx,
   
  if (src_pitch != dst_pitch || src_box-x || dst_x || src_w != dst_w) {
  /* FIXME evergreen can do partial blit */
  -   return FALSE;
  +   goto fallback;
  }
  /* the x test here are currently useless (because we don't support 
  partial blit)
   * but keep them around so we don't forget about those
   */
  if ((src_pitch  0x7) || (src_box-x  0x7) || (dst_x  0x7) || 
  (src_box-y  0x7) || (dst_y  0x7)) {
  -   return FALSE;
  +   goto fallback;
  }
   
  /* 128 bpp surfaces require non_disp_tiling for both
  @@ -3400,7 +3400,7 @@ static boolean evergreen_dma_blit(struct pipe_context 
  *ctx,
  if ((rctx-b.chip_class == CAYMAN) 
  (src_mode != dst_mode) 
  (util_format_get_blocksize(src-format) = 16)) {
  -   return FALSE;
  +   goto fallback;
  }
   
  if (src_mode == dst_mode) {
  @@ -3423,7 +3423,11 @@ static boolean evergreen_dma_blit(struct 
  pipe_context *ctx,
  src, src_level, src_x, src_y, 
  src_box-z,
  copy_height, dst_pitch, bpp);
  }
  -   return TRUE;
  +   return;
  +
  +fallback:
  +   ctx-resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
  + src, src_level, src_box);
   }
   
   void evergreen_init_state_functions(struct r600_context *rctx)
  diff --git a/src/gallium/drivers/r600/r600_state.c 
  b/src/gallium/drivers/r600/r600_state.c
  index 6d89e6c..2a4813b 100644
  --- a/src/gallium/drivers/r600/r600_state.c
  +++ b/src/gallium/drivers/r600/r600_state.c
  @@ -2883,13 +2883,13 @@ static boolean r600_dma_copy_tile(struct 
  r600_context *rctx,
  return TRUE;
   }
   
  -static boolean r600_dma_blit(struct pipe_context *ctx,
  -

Re: [Mesa-dev] [PATCH 1/3] r600g, radeonsi: use a fallback in dma_copy instead of failing

2014-03-11 Thread Tom Stellard
On Tue, Mar 11, 2014 at 12:37:15PM -0400, Jan Vesely wrote:
 On Tue, 2014-03-11 at 11:37 -0400, Jan Vesely wrote:
  On Tue, 2014-03-11 at 15:09 +0100, Marek Olšák wrote:
   From: Marek Olšák marek.ol...@amd.com
   
   v2: - allow byte-aligned DMA buffer copies on Evergreen
   - fix piglit/texsubimage regression
   - use the fallback for 3D copies (depth  1) as well
   ---
src/gallium/drivers/r600/evergreen_state.c  | 40 +
src/gallium/drivers/r600/r600_state.c   | 44 +++
src/gallium/drivers/radeon/r600_buffer_common.c | 58 
   +++--
src/gallium/drivers/radeon/r600_pipe_common.h   | 17 
src/gallium/drivers/radeon/r600_texture.c   | 18 +++-
src/gallium/drivers/radeonsi/si_state.c | 19 
6 files changed, 99 insertions(+), 97 deletions(-)
   
   diff --git a/src/gallium/drivers/r600/evergreen_state.c 
   b/src/gallium/drivers/r600/evergreen_state.c
   index dca7c58..1e14b01 100644
   --- a/src/gallium/drivers/r600/evergreen_state.c
   +++ b/src/gallium/drivers/r600/evergreen_state.c
   @@ -3329,13 +3329,13 @@ static void evergreen_dma_copy_tile(struct 
   r600_context *rctx,
 }
}

   -static boolean evergreen_dma_blit(struct pipe_context *ctx,
   -   struct pipe_resource *dst,
   -   unsigned dst_level,
   -   unsigned dst_x, unsigned dst_y, unsigned 
   dst_z,
   -   struct pipe_resource *src,
   -   unsigned src_level,
   -   const struct pipe_box *src_box)
   +static void evergreen_dma_blit(struct pipe_context *ctx,
   +struct pipe_resource *dst,
   +unsigned dst_level,
   +unsigned dstx, unsigned dsty, unsigned dstz,
   +struct pipe_resource *src,
   +unsigned src_level,
   +const struct pipe_box *src_box)
{
 struct r600_context *rctx = (struct r600_context *)ctx;
 struct r600_texture *rsrc = (struct r600_texture*)src;
   @@ -3343,22 +3343,22 @@ static boolean evergreen_dma_blit(struct 
   pipe_context *ctx,
 unsigned dst_pitch, src_pitch, bpp, dst_mode, src_mode, copy_height;
 unsigned src_w, dst_w;
 unsigned src_x, src_y;
   + unsigned dst_x = dstx, dst_y = dsty, dst_z = dstz;

 if (rctx-b.rings.dma.cs == NULL) {
   - return FALSE;
   + goto fallback;
 }

 if (dst-target == PIPE_BUFFER  src-target == PIPE_BUFFER) {
 evergreen_dma_copy(rctx, dst, src, dst_x, src_box-x, 
   src_box-width);
   - return TRUE;
   + return;
 }

   - if (src-format != dst-format) {
   - return FALSE;
   - }
   - if (rdst-dirty_level_mask != 0) {
   - return FALSE;
   + if (src-format != dst-format || src_box-depth  1 ||
   + rdst-dirty_level_mask != 0) {
   + goto fallback;
 }
   +
 if (rsrc-dirty_level_mask) {
 ctx-flush_resource(ctx, src);
 }
   @@ -3383,13 +3383,13 @@ static boolean evergreen_dma_blit(struct 
   pipe_context *ctx,

 if (src_pitch != dst_pitch || src_box-x || dst_x || src_w != dst_w) {
 /* FIXME evergreen can do partial blit */
   - return FALSE;
   + goto fallback;
 }
 /* the x test here are currently useless (because we don't support 
   partial blit)
  * but keep them around so we don't forget about those
  */
 if ((src_pitch  0x7) || (src_box-x  0x7) || (dst_x  0x7) || 
   (src_box-y  0x7) || (dst_y  0x7)) {
   - return FALSE;
   + goto fallback;
 }

 /* 128 bpp surfaces require non_disp_tiling for both
   @@ -3400,7 +3400,7 @@ static boolean evergreen_dma_blit(struct 
   pipe_context *ctx,
 if ((rctx-b.chip_class == CAYMAN) 
 (src_mode != dst_mode) 
 (util_format_get_blocksize(src-format) = 16)) {
   - return FALSE;
   + goto fallback;
 }

 if (src_mode == dst_mode) {
   @@ -3423,7 +3423,11 @@ static boolean evergreen_dma_blit(struct 
   pipe_context *ctx,
 src, src_level, src_x, src_y, 
   src_box-z,
 copy_height, dst_pitch, bpp);
 }
   - return TRUE;
   + return;
   +
   +fallback:
   + ctx-resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
   +   src, src_level, src_box);
}

void evergreen_init_state_functions(struct r600_context *rctx)
   diff --git a/src/gallium/drivers/r600/r600_state.c 
   b/src/gallium/drivers/r600/r600_state.c
   index 6d89e6c..2a4813b 100644
   --- a/src/gallium/drivers/r600/r600_state.c
   +++ b/src/gallium/drivers/r600/r600_state.c
   @@ -2883,13 +2883,13 @@ static boolean r600_dma_copy_tile(struct 
   r600_context *rctx,
 return TRUE;
}

   

Re: [Mesa-dev] [PATCH 1/3] r600g, radeonsi: use a fallback in dma_copy instead of failing

2014-03-11 Thread Jan Vesely
On Tue, 2014-03-11 at 12:49 -0400, Tom Stellard wrote:
 On Tue, Mar 11, 2014 at 12:37:15PM -0400, Jan Vesely wrote:
  On Tue, 2014-03-11 at 11:37 -0400, Jan Vesely wrote:
   On Tue, 2014-03-11 at 15:09 +0100, Marek Olšák wrote:
From: Marek Olšák marek.ol...@amd.com

v2: - allow byte-aligned DMA buffer copies on Evergreen
- fix piglit/texsubimage regression
- use the fallback for 3D copies (depth  1) as well
---
 src/gallium/drivers/r600/evergreen_state.c  | 40 +
 src/gallium/drivers/r600/r600_state.c   | 44 
+++
 src/gallium/drivers/radeon/r600_buffer_common.c | 58 
+++--
 src/gallium/drivers/radeon/r600_pipe_common.h   | 17 
 src/gallium/drivers/radeon/r600_texture.c   | 18 +++-
 src/gallium/drivers/radeonsi/si_state.c | 19 
 6 files changed, 99 insertions(+), 97 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index dca7c58..1e14b01 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -3329,13 +3329,13 @@ static void evergreen_dma_copy_tile(struct 
r600_context *rctx,
}
 }
 
-static boolean evergreen_dma_blit(struct pipe_context *ctx,
- struct pipe_resource *dst,
- unsigned dst_level,
- unsigned dst_x, unsigned dst_y, 
unsigned dst_z,
- struct pipe_resource *src,
- unsigned src_level,
- const struct pipe_box *src_box)
+static void evergreen_dma_blit(struct pipe_context *ctx,
+  struct pipe_resource *dst,
+  unsigned dst_level,
+  unsigned dstx, unsigned dsty, unsigned 
dstz,
+  struct pipe_resource *src,
+  unsigned src_level,
+  const struct pipe_box *src_box)
 {
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_texture *rsrc = (struct r600_texture*)src;
@@ -3343,22 +3343,22 @@ static boolean evergreen_dma_blit(struct 
pipe_context *ctx,
unsigned dst_pitch, src_pitch, bpp, dst_mode, src_mode, 
copy_height;
unsigned src_w, dst_w;
unsigned src_x, src_y;
+   unsigned dst_x = dstx, dst_y = dsty, dst_z = dstz;
 
if (rctx-b.rings.dma.cs == NULL) {
-   return FALSE;
+   goto fallback;
}
 
if (dst-target == PIPE_BUFFER  src-target == PIPE_BUFFER) {
evergreen_dma_copy(rctx, dst, src, dst_x, src_box-x, 
src_box-width);
-   return TRUE;
+   return;
}
 
-   if (src-format != dst-format) {
-   return FALSE;
-   }
-   if (rdst-dirty_level_mask != 0) {
-   return FALSE;
+   if (src-format != dst-format || src_box-depth  1 ||
+   rdst-dirty_level_mask != 0) {
+   goto fallback;
}
+
if (rsrc-dirty_level_mask) {
ctx-flush_resource(ctx, src);
}
@@ -3383,13 +3383,13 @@ static boolean evergreen_dma_blit(struct 
pipe_context *ctx,
 
if (src_pitch != dst_pitch || src_box-x || dst_x || src_w != 
dst_w) {
/* FIXME evergreen can do partial blit */
-   return FALSE;
+   goto fallback;
}
/* the x test here are currently useless (because we don't 
support partial blit)
 * but keep them around so we don't forget about those
 */
if ((src_pitch  0x7) || (src_box-x  0x7) || (dst_x  0x7) || 
(src_box-y  0x7) || (dst_y  0x7)) {
-   return FALSE;
+   goto fallback;
}
 
/* 128 bpp surfaces require non_disp_tiling for both
@@ -3400,7 +3400,7 @@ static boolean evergreen_dma_blit(struct 
pipe_context *ctx,
if ((rctx-b.chip_class == CAYMAN) 
(src_mode != dst_mode) 
(util_format_get_blocksize(src-format) = 16)) {
-   return FALSE;
+   goto fallback;
}
 
if (src_mode == dst_mode) {
@@ -3423,7 +3423,11 @@ static boolean evergreen_dma_blit(struct 
pipe_context *ctx,
src, src_level, src_x, src_y, 
src_box-z,
copy_height, dst_pitch, bpp);
}
-   return TRUE;
+   

Re: [Mesa-dev] [PATCH 1/3] r600g, radeonsi: use a fallback in dma_copy instead of failing

2014-03-11 Thread Marek Olšák
I pushed this patch without a review because of bugs that needed to be fixed.

Marek

On Tue, Mar 11, 2014 at 3:09 PM, Marek Olšák mar...@gmail.com wrote:
 From: Marek Olšák marek.ol...@amd.com

 v2: - allow byte-aligned DMA buffer copies on Evergreen
 - fix piglit/texsubimage regression
 - use the fallback for 3D copies (depth  1) as well
 ---
  src/gallium/drivers/r600/evergreen_state.c  | 40 +
  src/gallium/drivers/r600/r600_state.c   | 44 +++
  src/gallium/drivers/radeon/r600_buffer_common.c | 58 
 +++--
  src/gallium/drivers/radeon/r600_pipe_common.h   | 17 
  src/gallium/drivers/radeon/r600_texture.c   | 18 +++-
  src/gallium/drivers/radeonsi/si_state.c | 19 
  6 files changed, 99 insertions(+), 97 deletions(-)

 diff --git a/src/gallium/drivers/r600/evergreen_state.c 
 b/src/gallium/drivers/r600/evergreen_state.c
 index dca7c58..1e14b01 100644
 --- a/src/gallium/drivers/r600/evergreen_state.c
 +++ b/src/gallium/drivers/r600/evergreen_state.c
 @@ -3329,13 +3329,13 @@ static void evergreen_dma_copy_tile(struct 
 r600_context *rctx,
 }
  }

 -static boolean evergreen_dma_blit(struct pipe_context *ctx,
 - struct pipe_resource *dst,
 - unsigned dst_level,
 - unsigned dst_x, unsigned dst_y, unsigned 
 dst_z,
 - struct pipe_resource *src,
 - unsigned src_level,
 - const struct pipe_box *src_box)
 +static void evergreen_dma_blit(struct pipe_context *ctx,
 +  struct pipe_resource *dst,
 +  unsigned dst_level,
 +  unsigned dstx, unsigned dsty, unsigned dstz,
 +  struct pipe_resource *src,
 +  unsigned src_level,
 +  const struct pipe_box *src_box)
  {
 struct r600_context *rctx = (struct r600_context *)ctx;
 struct r600_texture *rsrc = (struct r600_texture*)src;
 @@ -3343,22 +3343,22 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,
 unsigned dst_pitch, src_pitch, bpp, dst_mode, src_mode, copy_height;
 unsigned src_w, dst_w;
 unsigned src_x, src_y;
 +   unsigned dst_x = dstx, dst_y = dsty, dst_z = dstz;

 if (rctx-b.rings.dma.cs == NULL) {
 -   return FALSE;
 +   goto fallback;
 }

 if (dst-target == PIPE_BUFFER  src-target == PIPE_BUFFER) {
 evergreen_dma_copy(rctx, dst, src, dst_x, src_box-x, 
 src_box-width);
 -   return TRUE;
 +   return;
 }

 -   if (src-format != dst-format) {
 -   return FALSE;
 -   }
 -   if (rdst-dirty_level_mask != 0) {
 -   return FALSE;
 +   if (src-format != dst-format || src_box-depth  1 ||
 +   rdst-dirty_level_mask != 0) {
 +   goto fallback;
 }
 +
 if (rsrc-dirty_level_mask) {
 ctx-flush_resource(ctx, src);
 }
 @@ -3383,13 +3383,13 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,

 if (src_pitch != dst_pitch || src_box-x || dst_x || src_w != dst_w) {
 /* FIXME evergreen can do partial blit */
 -   return FALSE;
 +   goto fallback;
 }
 /* the x test here are currently useless (because we don't support 
 partial blit)
  * but keep them around so we don't forget about those
  */
 if ((src_pitch  0x7) || (src_box-x  0x7) || (dst_x  0x7) || 
 (src_box-y  0x7) || (dst_y  0x7)) {
 -   return FALSE;
 +   goto fallback;
 }

 /* 128 bpp surfaces require non_disp_tiling for both
 @@ -3400,7 +3400,7 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,
 if ((rctx-b.chip_class == CAYMAN) 
 (src_mode != dst_mode) 
 (util_format_get_blocksize(src-format) = 16)) {
 -   return FALSE;
 +   goto fallback;
 }

 if (src_mode == dst_mode) {
 @@ -3423,7 +3423,11 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,
 src, src_level, src_x, src_y, 
 src_box-z,
 copy_height, dst_pitch, bpp);
 }
 -   return TRUE;
 +   return;
 +
 +fallback:
 +   ctx-resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
 + src, src_level, src_box);
  }

  void evergreen_init_state_functions(struct r600_context *rctx)
 diff --git a/src/gallium/drivers/r600/r600_state.c 
 b/src/gallium/drivers/r600/r600_state.c
 index 6d89e6c..2a4813b 100644
 --- a/src/gallium/drivers/r600/r600_state.c
 +++ b/src/gallium/drivers/r600/r600_state.c
 @@ 

Re: [Mesa-dev] [PATCH 1/3] r600g, radeonsi: use a fallback in dma_copy instead of failing

2014-03-09 Thread Niels Ole Salscheider
On Sunday 09 March 2014, 02:24:51, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/gallium/drivers/r600/evergreen_state.c  | 37 +---
  src/gallium/drivers/r600/r600_state.c   | 41 ++---
  src/gallium/drivers/radeon/r600_buffer_common.c | 58
 +++-- src/gallium/drivers/radeon/r600_pipe_common.h   |
 17 
  src/gallium/drivers/radeon/r600_texture.c   | 18 +++-
  src/gallium/drivers/radeonsi/si_state.c | 19 
  6 files changed, 97 insertions(+), 93 deletions(-)
 
 diff --git a/src/gallium/drivers/r600/evergreen_state.c
 b/src/gallium/drivers/r600/evergreen_state.c index dca7c58..5e57f8d 100644
 --- a/src/gallium/drivers/r600/evergreen_state.c
 +++ b/src/gallium/drivers/r600/evergreen_state.c
 @@ -3329,13 +3329,13 @@ static void evergreen_dma_copy_tile(struct
 r600_context *rctx, }
  }
 
 -static boolean evergreen_dma_blit(struct pipe_context *ctx,
 -   struct pipe_resource *dst,
 -   unsigned dst_level,
 -   unsigned dst_x, unsigned dst_y, unsigned 
 dst_z,
 -   struct pipe_resource *src,
 -   unsigned src_level,
 -   const struct pipe_box *src_box)
 +static void evergreen_dma_blit(struct pipe_context *ctx,
 +struct pipe_resource *dst,
 +unsigned dst_level,
 +unsigned dst_x, unsigned dst_y, unsigned dst_z,
 +struct pipe_resource *src,
 +unsigned src_level,
 +const struct pipe_box *src_box)
  {
   struct r600_context *rctx = (struct r600_context *)ctx;
   struct r600_texture *rsrc = (struct r600_texture*)src;
 @@ -3345,19 +3345,22 @@ static boolean evergreen_dma_blit(struct
 pipe_context *ctx, unsigned src_x, src_y;
 
   if (rctx-b.rings.dma.cs == NULL) {
 - return FALSE;
 + goto fallback;
   }
 
   if (dst-target == PIPE_BUFFER  src-target == PIPE_BUFFER) {
 + if (dst_x % 4 || src_box-x % 4 || src_box-width % 4)
 + goto fallback;

Why do we need this? I think that the async DMA engine can handle byte aligned 
copies. It is streamout that needs x and width to be dw aligned, isn't it?

 +
   evergreen_dma_copy(rctx, dst, src, dst_x, src_box-x, src_box-
width);
 - return TRUE;
 + return;
   }
 
   if (src-format != dst-format) {
 - return FALSE;
 + goto fallback;
   }
   if (rdst-dirty_level_mask != 0) {
 - return FALSE;
 + goto fallback;
   }
   if (rsrc-dirty_level_mask) {
   ctx-flush_resource(ctx, src);
 @@ -3383,13 +3386,13 @@ static boolean evergreen_dma_blit(struct
 pipe_context *ctx,
 
   if (src_pitch != dst_pitch || src_box-x || dst_x || src_w != dst_w) {
   /* FIXME evergreen can do partial blit */
 - return FALSE;
 + goto fallback;
   }
   /* the x test here are currently useless (because we don't support 
partial
 blit) * but keep them around so we don't forget about those
*/
   if ((src_pitch  0x7) || (src_box-x  0x7) || (dst_x  0x7) ||
 (src_box-y  0x7) || (dst_y  0x7)) { -  return FALSE;
 + goto fallback;
   }
 
   /* 128 bpp surfaces require non_disp_tiling for both
 @@ -3400,7 +3403,7 @@ static boolean evergreen_dma_blit(struct pipe_context
 *ctx, if ((rctx-b.chip_class == CAYMAN) 
   (src_mode != dst_mode) 
   (util_format_get_blocksize(src-format) = 16)) {
 - return FALSE;
 + goto fallback;
   }
 
   if (src_mode == dst_mode) {
 @@ -3423,7 +3426,11 @@ static boolean evergreen_dma_blit(struct pipe_context
 *ctx, src, src_level, src_x, src_y, src_box-z,
   copy_height, dst_pitch, bpp);
   }
 - return TRUE;
 + return;
 +
 +fallback:
 + ctx-resource_copy_region(ctx, dst, dst_level, dst_x, dst_y, dst_z,
 +   src, src_level, src_box);
  }
 
  void evergreen_init_state_functions(struct r600_context *rctx)
 diff --git a/src/gallium/drivers/r600/r600_state.c
 b/src/gallium/drivers/r600/r600_state.c index 6d89e6c..a0e6d2d 100644
 --- a/src/gallium/drivers/r600/r600_state.c
 +++ b/src/gallium/drivers/r600/r600_state.c
 @@ -2883,13 +2883,13 @@ static boolean r600_dma_copy_tile(struct
 r600_context *rctx, return TRUE;
  }
 
 -static boolean r600_dma_blit(struct pipe_context *ctx,
 -  struct pipe_resource *dst,
 -  unsigned dst_level,
 -  unsigned dst_x, unsigned dst_y, unsigned dst_z,
 -  struct pipe_resource *src,
 -  unsigned src_level,
 -   

Re: [Mesa-dev] [PATCH 1/3] r600g, radeonsi: use a fallback in dma_copy instead of failing

2014-03-09 Thread Marek Olšák
The buffer upload code required dword alignment. I don't know why. It
might have been for R600-R700.

Marek

On Sun, Mar 9, 2014 at 11:59 AM, Niels Ole Salscheider
niels_...@salscheider-online.de wrote:
 On Sunday 09 March 2014, 02:24:51, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com

 ---
  src/gallium/drivers/r600/evergreen_state.c  | 37 +---
  src/gallium/drivers/r600/r600_state.c   | 41 ++---
  src/gallium/drivers/radeon/r600_buffer_common.c | 58
 +++-- src/gallium/drivers/radeon/r600_pipe_common.h   |
 17 
  src/gallium/drivers/radeon/r600_texture.c   | 18 +++-
  src/gallium/drivers/radeonsi/si_state.c | 19 
  6 files changed, 97 insertions(+), 93 deletions(-)

 diff --git a/src/gallium/drivers/r600/evergreen_state.c
 b/src/gallium/drivers/r600/evergreen_state.c index dca7c58..5e57f8d 100644
 --- a/src/gallium/drivers/r600/evergreen_state.c
 +++ b/src/gallium/drivers/r600/evergreen_state.c
 @@ -3329,13 +3329,13 @@ static void evergreen_dma_copy_tile(struct
 r600_context *rctx, }
  }

 -static boolean evergreen_dma_blit(struct pipe_context *ctx,
 -   struct pipe_resource *dst,
 -   unsigned dst_level,
 -   unsigned dst_x, unsigned dst_y, unsigned 
 dst_z,
 -   struct pipe_resource *src,
 -   unsigned src_level,
 -   const struct pipe_box *src_box)
 +static void evergreen_dma_blit(struct pipe_context *ctx,
 +struct pipe_resource *dst,
 +unsigned dst_level,
 +unsigned dst_x, unsigned dst_y, unsigned dst_z,
 +struct pipe_resource *src,
 +unsigned src_level,
 +const struct pipe_box *src_box)
  {
   struct r600_context *rctx = (struct r600_context *)ctx;
   struct r600_texture *rsrc = (struct r600_texture*)src;
 @@ -3345,19 +3345,22 @@ static boolean evergreen_dma_blit(struct
 pipe_context *ctx, unsigned src_x, src_y;

   if (rctx-b.rings.dma.cs == NULL) {
 - return FALSE;
 + goto fallback;
   }

   if (dst-target == PIPE_BUFFER  src-target == PIPE_BUFFER) {
 + if (dst_x % 4 || src_box-x % 4 || src_box-width % 4)
 + goto fallback;

 Why do we need this? I think that the async DMA engine can handle byte aligned
 copies. It is streamout that needs x and width to be dw aligned, isn't it?

 +
   evergreen_dma_copy(rctx, dst, src, dst_x, src_box-x, src_box-
width);
 - return TRUE;
 + return;
   }

   if (src-format != dst-format) {
 - return FALSE;
 + goto fallback;
   }
   if (rdst-dirty_level_mask != 0) {
 - return FALSE;
 + goto fallback;
   }
   if (rsrc-dirty_level_mask) {
   ctx-flush_resource(ctx, src);
 @@ -3383,13 +3386,13 @@ static boolean evergreen_dma_blit(struct
 pipe_context *ctx,

   if (src_pitch != dst_pitch || src_box-x || dst_x || src_w != dst_w) {
   /* FIXME evergreen can do partial blit */
 - return FALSE;
 + goto fallback;
   }
   /* the x test here are currently useless (because we don't support
 partial
 blit) * but keep them around so we don't forget about those
*/
   if ((src_pitch  0x7) || (src_box-x  0x7) || (dst_x  0x7) ||
 (src_box-y  0x7) || (dst_y  0x7)) { -  return FALSE;
 + goto fallback;
   }

   /* 128 bpp surfaces require non_disp_tiling for both
 @@ -3400,7 +3403,7 @@ static boolean evergreen_dma_blit(struct pipe_context
 *ctx, if ((rctx-b.chip_class == CAYMAN) 
   (src_mode != dst_mode) 
   (util_format_get_blocksize(src-format) = 16)) {
 - return FALSE;
 + goto fallback;
   }

   if (src_mode == dst_mode) {
 @@ -3423,7 +3426,11 @@ static boolean evergreen_dma_blit(struct pipe_context
 *ctx, src, src_level, src_x, src_y, src_box-z,
   copy_height, dst_pitch, bpp);
   }
 - return TRUE;
 + return;
 +
 +fallback:
 + ctx-resource_copy_region(ctx, dst, dst_level, dst_x, dst_y, dst_z,
 +   src, src_level, src_box);
  }

  void evergreen_init_state_functions(struct r600_context *rctx)
 diff --git a/src/gallium/drivers/r600/r600_state.c
 b/src/gallium/drivers/r600/r600_state.c index 6d89e6c..a0e6d2d 100644
 --- a/src/gallium/drivers/r600/r600_state.c
 +++ b/src/gallium/drivers/r600/r600_state.c
 @@ -2883,13 +2883,13 @@ static boolean r600_dma_copy_tile(struct
 r600_context *rctx, return TRUE;
  }

 -static boolean r600_dma_blit(struct pipe_context *ctx,
 -  struct pipe_resource *dst,
 -  unsigned 

Re: [Mesa-dev] [PATCH 1/3] r600g, radeonsi: use a fallback in dma_copy instead of failing

2014-03-09 Thread Bruno Jimenez
This series fixes some of the opencv opencl-related tests for me.

Thanks!

On Sun, 2014-03-09 at 02:24 +0100, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/gallium/drivers/r600/evergreen_state.c  | 37 +---
  src/gallium/drivers/r600/r600_state.c   | 41 ++---
  src/gallium/drivers/radeon/r600_buffer_common.c | 58 
 +++--
  src/gallium/drivers/radeon/r600_pipe_common.h   | 17 
  src/gallium/drivers/radeon/r600_texture.c   | 18 +++-
  src/gallium/drivers/radeonsi/si_state.c | 19 
  6 files changed, 97 insertions(+), 93 deletions(-)
 
 diff --git a/src/gallium/drivers/r600/evergreen_state.c 
 b/src/gallium/drivers/r600/evergreen_state.c
 index dca7c58..5e57f8d 100644
 --- a/src/gallium/drivers/r600/evergreen_state.c
 +++ b/src/gallium/drivers/r600/evergreen_state.c
 @@ -3329,13 +3329,13 @@ static void evergreen_dma_copy_tile(struct 
 r600_context *rctx,
   }
  }
  
 -static boolean evergreen_dma_blit(struct pipe_context *ctx,
 -   struct pipe_resource *dst,
 -   unsigned dst_level,
 -   unsigned dst_x, unsigned dst_y, unsigned 
 dst_z,
 -   struct pipe_resource *src,
 -   unsigned src_level,
 -   const struct pipe_box *src_box)
 +static void evergreen_dma_blit(struct pipe_context *ctx,
 +struct pipe_resource *dst,
 +unsigned dst_level,
 +unsigned dst_x, unsigned dst_y, unsigned dst_z,
 +struct pipe_resource *src,
 +unsigned src_level,
 +const struct pipe_box *src_box)
  {
   struct r600_context *rctx = (struct r600_context *)ctx;
   struct r600_texture *rsrc = (struct r600_texture*)src;
 @@ -3345,19 +3345,22 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,
   unsigned src_x, src_y;
  
   if (rctx-b.rings.dma.cs == NULL) {
 - return FALSE;
 + goto fallback;
   }
  
   if (dst-target == PIPE_BUFFER  src-target == PIPE_BUFFER) {
 + if (dst_x % 4 || src_box-x % 4 || src_box-width % 4)
 + goto fallback;
 +
   evergreen_dma_copy(rctx, dst, src, dst_x, src_box-x, 
 src_box-width);
 - return TRUE;
 + return;
   }
  
   if (src-format != dst-format) {
 - return FALSE;
 + goto fallback;
   }
   if (rdst-dirty_level_mask != 0) {
 - return FALSE;
 + goto fallback;
   }
   if (rsrc-dirty_level_mask) {
   ctx-flush_resource(ctx, src);
 @@ -3383,13 +3386,13 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,
  
   if (src_pitch != dst_pitch || src_box-x || dst_x || src_w != dst_w) {
   /* FIXME evergreen can do partial blit */
 - return FALSE;
 + goto fallback;
   }
   /* the x test here are currently useless (because we don't support 
 partial blit)
* but keep them around so we don't forget about those
*/
   if ((src_pitch  0x7) || (src_box-x  0x7) || (dst_x  0x7) || 
 (src_box-y  0x7) || (dst_y  0x7)) {
 - return FALSE;
 + goto fallback;
   }
  
   /* 128 bpp surfaces require non_disp_tiling for both
 @@ -3400,7 +3403,7 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,
   if ((rctx-b.chip_class == CAYMAN) 
   (src_mode != dst_mode) 
   (util_format_get_blocksize(src-format) = 16)) {
 - return FALSE;
 + goto fallback;
   }
  
   if (src_mode == dst_mode) {
 @@ -3423,7 +3426,11 @@ static boolean evergreen_dma_blit(struct pipe_context 
 *ctx,
   src, src_level, src_x, src_y, 
 src_box-z,
   copy_height, dst_pitch, bpp);
   }
 - return TRUE;
 + return;
 +
 +fallback:
 + ctx-resource_copy_region(ctx, dst, dst_level, dst_x, dst_y, dst_z,
 +   src, src_level, src_box);
  }
  
  void evergreen_init_state_functions(struct r600_context *rctx)
 diff --git a/src/gallium/drivers/r600/r600_state.c 
 b/src/gallium/drivers/r600/r600_state.c
 index 6d89e6c..a0e6d2d 100644
 --- a/src/gallium/drivers/r600/r600_state.c
 +++ b/src/gallium/drivers/r600/r600_state.c
 @@ -2883,13 +2883,13 @@ static boolean r600_dma_copy_tile(struct r600_context 
 *rctx,
   return TRUE;
  }
  
 -static boolean r600_dma_blit(struct pipe_context *ctx,
 -  struct pipe_resource *dst,
 -  unsigned dst_level,
 -  unsigned dst_x, unsigned dst_y, unsigned dst_z,
 -  struct pipe_resource *src,
 -  

Re: [Mesa-dev] [PATCH 1/3] r600g, radeonsi: use a fallback in dma_copy instead of failing

2014-03-09 Thread Niels Ole Salscheider
You are right, r600-r700 require dword alignment while linear copies can be 
byte aligned on EG+.
Apart from that, patch 1 and 2 look good to me...

Ole
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] r600g, radeonsi: use a fallback in dma_copy instead of failing

2014-03-08 Thread Marek Olšák
From: Marek Olšák marek.ol...@amd.com

---
 src/gallium/drivers/r600/evergreen_state.c  | 37 +---
 src/gallium/drivers/r600/r600_state.c   | 41 ++---
 src/gallium/drivers/radeon/r600_buffer_common.c | 58 +++--
 src/gallium/drivers/radeon/r600_pipe_common.h   | 17 
 src/gallium/drivers/radeon/r600_texture.c   | 18 +++-
 src/gallium/drivers/radeonsi/si_state.c | 19 
 6 files changed, 97 insertions(+), 93 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index dca7c58..5e57f8d 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -3329,13 +3329,13 @@ static void evergreen_dma_copy_tile(struct r600_context 
*rctx,
}
 }
 
-static boolean evergreen_dma_blit(struct pipe_context *ctx,
- struct pipe_resource *dst,
- unsigned dst_level,
- unsigned dst_x, unsigned dst_y, unsigned 
dst_z,
- struct pipe_resource *src,
- unsigned src_level,
- const struct pipe_box *src_box)
+static void evergreen_dma_blit(struct pipe_context *ctx,
+  struct pipe_resource *dst,
+  unsigned dst_level,
+  unsigned dst_x, unsigned dst_y, unsigned dst_z,
+  struct pipe_resource *src,
+  unsigned src_level,
+  const struct pipe_box *src_box)
 {
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_texture *rsrc = (struct r600_texture*)src;
@@ -3345,19 +3345,22 @@ static boolean evergreen_dma_blit(struct pipe_context 
*ctx,
unsigned src_x, src_y;
 
if (rctx-b.rings.dma.cs == NULL) {
-   return FALSE;
+   goto fallback;
}
 
if (dst-target == PIPE_BUFFER  src-target == PIPE_BUFFER) {
+   if (dst_x % 4 || src_box-x % 4 || src_box-width % 4)
+   goto fallback;
+
evergreen_dma_copy(rctx, dst, src, dst_x, src_box-x, 
src_box-width);
-   return TRUE;
+   return;
}
 
if (src-format != dst-format) {
-   return FALSE;
+   goto fallback;
}
if (rdst-dirty_level_mask != 0) {
-   return FALSE;
+   goto fallback;
}
if (rsrc-dirty_level_mask) {
ctx-flush_resource(ctx, src);
@@ -3383,13 +3386,13 @@ static boolean evergreen_dma_blit(struct pipe_context 
*ctx,
 
if (src_pitch != dst_pitch || src_box-x || dst_x || src_w != dst_w) {
/* FIXME evergreen can do partial blit */
-   return FALSE;
+   goto fallback;
}
/* the x test here are currently useless (because we don't support 
partial blit)
 * but keep them around so we don't forget about those
 */
if ((src_pitch  0x7) || (src_box-x  0x7) || (dst_x  0x7) || 
(src_box-y  0x7) || (dst_y  0x7)) {
-   return FALSE;
+   goto fallback;
}
 
/* 128 bpp surfaces require non_disp_tiling for both
@@ -3400,7 +3403,7 @@ static boolean evergreen_dma_blit(struct pipe_context 
*ctx,
if ((rctx-b.chip_class == CAYMAN) 
(src_mode != dst_mode) 
(util_format_get_blocksize(src-format) = 16)) {
-   return FALSE;
+   goto fallback;
}
 
if (src_mode == dst_mode) {
@@ -3423,7 +3426,11 @@ static boolean evergreen_dma_blit(struct pipe_context 
*ctx,
src, src_level, src_x, src_y, 
src_box-z,
copy_height, dst_pitch, bpp);
}
-   return TRUE;
+   return;
+
+fallback:
+   ctx-resource_copy_region(ctx, dst, dst_level, dst_x, dst_y, dst_z,
+ src, src_level, src_box);
 }
 
 void evergreen_init_state_functions(struct r600_context *rctx)
diff --git a/src/gallium/drivers/r600/r600_state.c 
b/src/gallium/drivers/r600/r600_state.c
index 6d89e6c..a0e6d2d 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -2883,13 +2883,13 @@ static boolean r600_dma_copy_tile(struct r600_context 
*rctx,
return TRUE;
 }
 
-static boolean r600_dma_blit(struct pipe_context *ctx,
-struct pipe_resource *dst,
-unsigned dst_level,
-unsigned dst_x, unsigned dst_y, unsigned dst_z,
-struct pipe_resource *src,
-unsigned src_level,
-const struct pipe_box *src_box)
+static void r600_dma_blit(struct