Mesa (main): iris: Delete the MI_COPY_MEM_MEM resource_copy_region implementation.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Oct 2 09:06:20 UTC 2021


Module: Mesa
Branch: main
Commit: 0a9e46e535842af61910924b5f30086b6981e3b9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a9e46e535842af61910924b5f30086b6981e3b9

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Sep  7 13:48:58 2021 -0700

iris: Delete the MI_COPY_MEM_MEM resource_copy_region implementation.

The MI_COPY_MEM_MEM version of resource_copy_region has known bugs:

- It's failing to set valid_buffer_range correctly
- It's missing iris_emit_buffer_barrier_for() for the
  source/destination, so there may be missing flushes.
- There are some bad interactions with the tile cache and VF using L3.

Even with those fixed, if you expand the "no more than 16 bytes"
restriction to allow copies up to 1024 bytes, then it starts failing
Piglit tests on Icelake.

We could probably fix this.  However, I had originally only measured a
0.689096% +/- 0.473968% (n=4) speedup in Shadow of Mordor's OpenGL
port, which is already fairly small, especially before adding missing
flushes.  Further, some of that likely came from not switching between
render and compute...which we'll soon be able to avoid thanks to BLOCS.

Folks were also worried that MI_COPY_MEM_MEM can't be pipelined, and
that stalling the command streamer may actually slow things down,
especially as the GPUs become more powerful.  We aren't really sure
about this, but it's another concern.

So, let's just get rid of this optimization.  It seemed like a good
idea at the time, but it's just causing issues for very little gain.

Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
Acked-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12863>

---

 src/gallium/drivers/iris/iris_blit.c | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c
index 461da6cb947..2c8f93048c1 100644
--- a/src/gallium/drivers/iris/iris_blit.c
+++ b/src/gallium/drivers/iris/iris_blit.c
@@ -702,20 +702,6 @@ iris_copy_region(struct blorp_context *blorp,
    tex_cache_flush_hack(batch, ISL_FORMAT_UNSUPPORTED, src_res->surf.format);
 }
 
-static struct iris_batch *
-get_preferred_batch(struct iris_context *ice, struct iris_bo *bo)
-{
-   /* If the compute batch is already using this buffer, we'd prefer to
-    * continue queueing in the compute batch.
-    */
-   if (iris_batch_references(&ice->batches[IRIS_BATCH_COMPUTE], bo))
-      return &ice->batches[IRIS_BATCH_COMPUTE];
-
-   /* Otherwise default to the render batch. */
-   return &ice->batches[IRIS_BATCH_RENDER];
-}
-
-
 /**
  * The pipe->resource_copy_region() driver hook.
  *
@@ -732,24 +718,8 @@ iris_resource_copy_region(struct pipe_context *ctx,
                           const struct pipe_box *src_box)
 {
    struct iris_context *ice = (void *) ctx;
-   struct iris_screen *screen = (void *) ctx->screen;
    struct iris_batch *batch = &ice->batches[IRIS_BATCH_RENDER];
 
-   /* Use MI_COPY_MEM_MEM for tiny (<= 16 byte, % 4) buffer copies. */
-   if (p_src->target == PIPE_BUFFER && p_dst->target == PIPE_BUFFER &&
-       dstx % 4 == 0 && src_box->x % 4 == 0 &&
-       src_box->width % 4 == 0 && src_box->width <= 16) {
-      struct iris_bo *dst_bo = iris_resource_bo(p_dst);
-      batch = get_preferred_batch(ice, dst_bo);
-      iris_batch_maybe_flush(batch, 24 + 5 * (src_box->width / 4));
-      iris_emit_pipe_control_flush(batch,
-                                   "stall for MI_COPY_MEM_MEM copy_region",
-                                   PIPE_CONTROL_CS_STALL);
-      screen->vtbl.copy_mem_mem(batch, dst_bo, dstx, iris_resource_bo(p_src),
-                                src_box->x, src_box->width);
-      return;
-   }
-
    iris_copy_region(&ice->blorp, batch, p_dst, dst_level, dstx, dsty, dstz,
                     p_src, src_level, src_box);
 



More information about the mesa-commit mailing list