freedreno/a6xx: fix hangs with newer sqe fw
[mesa.git] / src / gallium / drivers / v3d / v3d_blit.c
index d6d09570014ec6f597cd473b714d7811ed51cfb4..d42e8fd0e6979f2345e41f5df93c190eaaf74b0c 100644 (file)
@@ -386,8 +386,8 @@ v3d_tfu(struct pipe_context *pctx,
         struct drm_v3d_submit_tfu tfu = {
                 .ios = (height << 16) | width,
                 .bo_handles = {
-                        src->bo->handle,
-                        src != dst ? dst->bo->handle : 0
+                        dst->bo->handle,
+                        src != dst ? src->bo->handle : 0
                 },
                 .in_sync = v3d->out_sync,
                 .out_sync = v3d->out_sync,
@@ -491,7 +491,8 @@ v3d_tfu_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
         if ((info->mask & PIPE_MASK_RGBA) == 0)
                 return false;
 
-        if (info->dst.box.x != 0 ||
+        if (info->scissor_enable ||
+            info->dst.box.x != 0 ||
             info->dst.box.y != 0 ||
             info->dst.box.width != dst_width ||
             info->dst.box.height != dst_height ||
@@ -517,6 +518,7 @@ v3d_tfu_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
 void
 v3d_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info)
 {
+        struct v3d_context *v3d = v3d_context(pctx);
         struct pipe_blit_info info = *blit_info;
 
         if (info.mask & PIPE_MASK_S) {
@@ -529,4 +531,11 @@ v3d_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info)
 
         if (info.mask)
                 v3d_render_blit(pctx, &info);
+
+        /* Flush our blit jobs immediately.  They're unlikely to get reused by
+         * normal drawing or other blits, and without flushing we can easily
+         * run into unexpected OOMs when blits are used for a large series of
+         * texture uploads before using the textures.
+         */
+        v3d_flush_jobs_writing_resource(v3d, info.dst.resource);
 }