Mesa (staging/21.1): Revert "gallium/u_threaded: align batches and call slots to 16 bytes"

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 10 19:24:06 UTC 2021


Module: Mesa
Branch: staging/21.1
Commit: 4682a269c30d71dc7c985f8babd2616c3c2537a5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4682a269c30d71dc7c985f8babd2616c3c2537a5

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Wed Apr 28 17:19:43 2021 -0400

Revert "gallium/u_threaded: align batches and call slots to 16 bytes"

This reverts commit 3b1ce49bc1e5aff87805b0bab255885c84bf5052.

It will be completely rewritten, but let's revert this first.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.eric.pelloux-prayer at amd.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10606>
(cherry picked from commit 954f59f2af4a135f2af2d2b6e341b4332ad3cccd)

---

 .pick_status.json                               |  2 +-
 src/gallium/auxiliary/util/u_threaded_context.c | 12 ++----------
 src/gallium/auxiliary/util/u_threaded_context.h |  3 +--
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index ad01bda5c2c..d95881f34b5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -364,7 +364,7 @@
         "description": "Revert \"gallium/u_threaded: align batches and call slots to 16 bytes\"",
         "nominated": true,
         "nomination_type": 2,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "3b1ce49bc1e5aff87805b0bab255885c84bf5052"
     },
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index d8d671b69ee..965321651f9 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -3170,7 +3170,7 @@ tc_destroy(struct pipe_context *_pipe)
    slab_destroy_child(&tc->pool_transfers);
    assert(tc->batch_slots[tc->next].num_total_call_slots == 0);
    pipe->destroy(pipe);
-   os_free_aligned(tc);
+   FREE(tc);
 }
 
 static const tc_execute execute_func[TC_NUM_CALLS] = {
@@ -3211,19 +3211,11 @@ threaded_context_create(struct pipe_context *pipe,
    if (!debug_get_bool_option("GALLIUM_THREAD", util_get_cpu_caps()->nr_cpus > 1))
       return pipe;
 
-   tc = os_malloc_aligned(sizeof(struct threaded_context), 16);
+   tc = CALLOC_STRUCT(threaded_context);
    if (!tc) {
       pipe->destroy(pipe);
       return NULL;
    }
-   memset(tc, 0, sizeof(*tc));
-
-   assert((uintptr_t)tc % 16 == 0);
-   /* These should be static asserts, but they don't work with MSVC */
-   assert(offsetof(struct threaded_context, batch_slots) % 16 == 0);
-   assert(offsetof(struct threaded_context, batch_slots[0].call) % 16 == 0);
-   assert(offsetof(struct threaded_context, batch_slots[0].call[1]) % 16 == 0);
-   assert(offsetof(struct threaded_context, batch_slots[1].call) % 16 == 0);
 
    /* The driver context isn't wrapped, so set its "priv" to NULL. */
    pipe->priv = NULL;
diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h
index 468221be030..8356b24012f 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.h
+++ b/src/gallium/auxiliary/util/u_threaded_context.h
@@ -325,8 +325,7 @@ union tc_payload {
    bool boolean;
 };
 
-/* Each call slot should be aligned to its own size for optimal cache usage. */
-struct ALIGN16 tc_call {
+struct tc_call {
    unsigned sentinel;
    ushort num_call_slots;
    ushort call_id;



More information about the mesa-commit mailing list