freedreno/a3xx: only emit dirty consts
[mesa.git] / src / gallium / drivers / radeonsi / si_dma.c
index ff647228f50dd803799d6c0cac8fb4cd600da47a..b1bd5e706c2656f4705c76ed653c9ddf840c9736 100644 (file)
@@ -231,7 +231,7 @@ void si_dma_copy(struct pipe_context *ctx,
        struct si_context *sctx = (struct si_context *)ctx;
        struct r600_texture *rsrc = (struct r600_texture*)src;
        struct r600_texture *rdst = (struct r600_texture*)dst;
-       unsigned dst_pitch, src_pitch, bpp, dst_mode, src_mode, copy_height;
+       unsigned dst_pitch, src_pitch, bpp, dst_mode, src_mode;
        unsigned src_w, dst_w;
        unsigned src_x, src_y;
        unsigned dst_x = dstx, dst_y = dsty, dst_z = dstz;
@@ -251,7 +251,9 @@ void si_dma_copy(struct pipe_context *ctx,
        }
 
        if (src->format != dst->format || src_box->depth > 1 ||
-           rdst->dirty_level_mask != 0) {
+           rdst->dirty_level_mask != 0 ||
+           rdst->cmask.size || rdst->fmask.size ||
+           rsrc->cmask.size || rsrc->fmask.size) {
                goto fallback;
        }
 
@@ -269,7 +271,6 @@ void si_dma_copy(struct pipe_context *ctx,
        src_pitch = rsrc->surface.level[src_level].pitch_bytes;
        src_w = rsrc->surface.level[src_level].npix_x;
        dst_w = rdst->surface.level[dst_level].npix_x;
-       copy_height = src_box->height / rsrc->surface.blk_h;
 
        dst_mode = rdst->surface.level[dst_level].mode;
        src_mode = rsrc->surface.level[src_level].mode;
@@ -277,14 +278,20 @@ void si_dma_copy(struct pipe_context *ctx,
        src_mode = src_mode == RADEON_SURF_MODE_LINEAR_ALIGNED ? RADEON_SURF_MODE_LINEAR : src_mode;
        dst_mode = dst_mode == RADEON_SURF_MODE_LINEAR_ALIGNED ? RADEON_SURF_MODE_LINEAR : dst_mode;
 
-       if (src_pitch != dst_pitch || src_box->x || dst_x || src_w != dst_w) {
+       if (src_pitch != dst_pitch || src_box->x || dst_x || src_w != dst_w ||
+           src_box->width != src_w ||
+           src_box->height != rsrc->surface.level[src_level].npix_y ||
+           src_box->height != rdst->surface.level[dst_level].npix_y ||
+           rsrc->surface.level[src_level].nblk_y !=
+           rdst->surface.level[dst_level].nblk_y) {
                /* FIXME si can do partial blit */
                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 % 8) || (src_box->x % 8) || (dst_x % 8) || (src_box->y % 8) || (dst_y % 8)) {
+       if ((src_pitch % 8) || (src_box->x % 8) || (dst_x % 8) ||
+           (src_box->y % 8) || (dst_y % 8) || (src_box->height % 8)) {
                goto fallback;
        }
 
@@ -302,11 +309,12 @@ void si_dma_copy(struct pipe_context *ctx,
                dst_offset += rdst->surface.level[dst_level].slice_size * dst_z;
                dst_offset += dst_y * dst_pitch + dst_x * bpp;
                si_dma_copy_buffer(sctx, dst, src, dst_offset, src_offset,
-                                  copy_height * src_pitch);
+                                  rsrc->surface.level[src_level].slice_size);
        } else {
                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);
+                                src_box->height / rsrc->surface.blk_h,
+                                dst_pitch, bpp);
        }
        return;