Mesa (main): ir3: Create at least one thread for async shader compile

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 21 07:46:05 UTC 2022


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

Author: Christian Gmeiner <christian.gmeiner at gmail.com>
Date:   Sun Jun 19 14:44:37 2022 +0200

ir3: Create at least one thread for async shader compile

On a single core CPU system we end with num_threads being 0 and we do
_NOT_ create any async compile threads in util_queue_init(..).

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Reviewed-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17124>

---

 src/gallium/drivers/freedreno/ir3/ir3_gallium.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
index 2f40df26c81..4e089b0b209 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
@@ -558,6 +558,9 @@ ir3_screen_init(struct pipe_screen *pscreen)
     */
    unsigned num_threads = sysconf(_SC_NPROCESSORS_ONLN) - 1;
 
+   /* Create at least one thread - even on single core CPU systems. */
+   num_threads = MAX2(1, num_threads);
+
    util_queue_init(&screen->compile_queue, "ir3q", 64, num_threads,
                    UTIL_QUEUE_INIT_RESIZE_IF_FULL |
                       UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY, NULL);



More information about the mesa-commit mailing list