Mesa (master): iris: make BATCH_SZ smaller by BATCH_RESERVED bytes
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 15 21:49:14 UTC 2020
Module: Mesa
Branch: master
Commit: 2c82b13c8ff63cc296215b6b5991ac00e6f3d495
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c82b13c8ff63cc296215b6b5991ac00e6f3d495
Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date: Thu Apr 2 16:03:41 2020 -0700
iris: make BATCH_SZ smaller by BATCH_RESERVED bytes
Iris allocates gem buffers using buckets of allocation sizes that are
page aligned. We always ask for batch buffers of size BATCH_SZ +
BATCH_RESERVED, which is not page aligned: we ask for 65552 bytes,
which ends up in the bucket of size 81920, resulting in 20% unused
space. Adjust things so there is no waste of space: BATCH_SZ +
BATCH_RESERVED is now 65536.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4561>
---
src/gallium/drivers/iris/iris_batch.c | 6 ------
src/gallium/drivers/iris/iris_batch.h | 8 +++++++-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index b0341513f2b..ff0dfd053f4 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -63,12 +63,6 @@
#define FILE_DEBUG_FLAG DEBUG_BUFMGR
-/* Terminating the batch takes either 4 bytes for MI_BATCH_BUFFER_END
- * or 12 bytes for MI_BATCH_BUFFER_START (when chaining). Plus, we may
- * need an extra 4 bytes to pad out to the nearest QWord. So reserve 16.
- */
-#define BATCH_RESERVED 16
-
static void
iris_batch_reset(struct iris_batch *batch);
diff --git a/src/gallium/drivers/iris/iris_batch.h b/src/gallium/drivers/iris/iris_batch.h
index d8399d3cd34..056a2469191 100644
--- a/src/gallium/drivers/iris/iris_batch.h
+++ b/src/gallium/drivers/iris/iris_batch.h
@@ -38,8 +38,14 @@
/* The kernel assumes batchbuffers are smaller than 256kB. */
#define MAX_BATCH_SIZE (256 * 1024)
+/* Terminating the batch takes either 4 bytes for MI_BATCH_BUFFER_END
+ * or 12 bytes for MI_BATCH_BUFFER_START (when chaining). Plus, we may
+ * need an extra 4 bytes to pad out to the nearest QWord. So reserve 16.
+ */
+#define BATCH_RESERVED 16
+
/* Our target batch size - flush approximately at this point. */
-#define BATCH_SZ (64 * 1024)
+#define BATCH_SZ (64 * 1024 - BATCH_RESERVED)
enum iris_batch_name {
IRIS_BATCH_RENDER,
More information about the mesa-commit
mailing list