--- orig/mesa-10.3.2/src/gallium/drivers/radeonsi/si_dma.c 2014-10-25 03:20:20.000000000 +0300 +++ need_dma/mesa-10.3.2/src/gallium/drivers/radeonsi/si_dma.c 2014-11-18 13:15:13.484935674 +0200 @@ -111,7 +111,7 @@ static void si_dma_copy_buffer(struct si } } -static void si_dma_copy_tile(struct si_context *ctx, +static int si_dma_copy_tile(struct si_context *ctx, struct pipe_resource *dst, unsigned dst_level, unsigned dst_x, @@ -211,6 +211,9 @@ static void si_dma_copy_tile(struct si_c size = (copy_height * pitch) / 4; ncopy = (size / SI_DMA_COPY_MAX_SIZE_DW) + !!(size % SI_DMA_COPY_MAX_SIZE_DW); r600_need_dma_space(&ctx->b, ncopy * 9); + if (((ncopy * 9) + cs->cdw) > RADEON_MAX_CMDBUF_DWORDS) { + return 0; + } r600_context_bo_reloc(&ctx->b, &ctx->b.rings.dma, &rsrc->resource, RADEON_USAGE_READ, RADEON_PRIO_MIN); @@ -238,6 +241,7 @@ static void si_dma_copy_tile(struct si_c addr += cheight * pitch; y += cheight; } + return 1; } void si_dma_copy(struct pipe_context *ctx, @@ -324,9 +328,12 @@ void si_dma_copy(struct pipe_context *ct si_dma_copy_buffer(sctx, dst, src, dst_offset, src_offset, src_box->height * src_pitch); } else { - si_dma_copy_tile(sctx, dst, dst_level, dst_x, dst_y, dst_z, + if (!si_dma_copy_tile(sctx, dst, dst_level, dst_x, dst_y, dst_z, src, src_level, src_x, src_y, src_box->z, - copy_height, dst_pitch, bpp); + copy_height, dst_pitch, bpp)) + { + goto fallback; + } } return;