Mesa (master): glthread: use uint64_t to declare the batch buffer instead of align(8)

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 8 18:06:43 UTC 2020


Module: Mesa
Branch: master
Commit: 6fe524d0f8cbab3d1e5ce32ef694b17dcd31db1d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6fe524d0f8cbab3d1e5ce32ef694b17dcd31db1d

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Oct  9 22:37:28 2020 -0400

glthread: use uint64_t to declare the batch buffer instead of align(8)

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7719>

---

 src/mesa/main/glthread.c         | 4 ++--
 src/mesa/main/glthread.h         | 7 +------
 src/mesa/main/glthread_marshal.h | 2 +-
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c
index 68bf9427260..c1cd08d7c72 100644
--- a/src/mesa/main/glthread.c
+++ b/src/mesa/main/glthread.c
@@ -48,7 +48,7 @@ glthread_unmarshal_batch(void *job, int thread_index)
    struct gl_context *ctx = batch->ctx;
    int pos = 0;
    int used = batch->used;
-   uint8_t *buffer = batch->buffer;
+   uint64_t *buffer = batch->buffer;
 
    _glapi_set_dispatch(ctx->CurrentServerDispatch);
 
@@ -59,7 +59,7 @@ glthread_unmarshal_batch(void *job, int thread_index)
 
    while (pos < used) {
       const struct marshal_cmd_base *cmd =
-         (const struct marshal_cmd_base *)&buffer[pos];
+         (const struct marshal_cmd_base *)&buffer[pos / 8];
 
       _mesa_unmarshal_dispatch[cmd->cmd_id](ctx, cmd);
       pos += cmd->cmd_size;
diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h
index 73d1b22c02a..1a952155042 100644
--- a/src/mesa/main/glthread.h
+++ b/src/mesa/main/glthread.h
@@ -109,12 +109,7 @@ struct glthread_batch
    int used;
 
    /** Data contained in the command buffer. */
-#ifdef _MSC_VER
-   __declspec(align(8))
-#else
-   __attribute__((aligned(8)))
-#endif
-   uint8_t buffer[MARSHAL_MAX_CMD_SIZE];
+   uint64_t buffer[MARSHAL_MAX_CMD_SIZE / 8];
 };
 
 struct glthread_client_attrib {
diff --git a/src/mesa/main/glthread_marshal.h b/src/mesa/main/glthread_marshal.h
index 1ffb4df2e53..d24b85eee76 100644
--- a/src/mesa/main/glthread_marshal.h
+++ b/src/mesa/main/glthread_marshal.h
@@ -64,7 +64,7 @@ _mesa_glthread_allocate_command(struct gl_context *ctx,
    struct glthread_batch *next = glthread->next_batch;
    const int aligned_size = align(size, 8);
    struct marshal_cmd_base *cmd_base =
-      (struct marshal_cmd_base *)&next->buffer[glthread->used];
+      (struct marshal_cmd_base *)&next->buffer[glthread->used / 8];
    glthread->used += aligned_size;
    cmd_base->cmd_id = cmd_id;
    cmd_base->cmd_size = aligned_size;



More information about the mesa-commit mailing list