Mesa (staging/21.2): svga: fix bitwise/logical and mixup

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 24 22:54:06 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: 2af2178e20d1c2fbf505e12079a1b187f4c1aa35
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2af2178e20d1c2fbf505e12079a1b187f4c1aa35

Author: Thomas H.P. Andersen <phomes at gmail.com>
Date:   Sun Aug  1 12:52:56 2021 +0200

svga: fix bitwise/logical and mixup

The function need_temp_reg_initialization looks suspecious.

It will only ever return true if we get past this if:
if (!(emit->info.indirect_files && (1u << TGSI_FILE_TEMPORARY)) ...

Using the logical && means the intended initialization done
based on the result of this check is not performed.

This code was both introduced and altered in MR 5317.
ccb4ea5a introduces the function.
ba37d408 is a collection of performance improvements and misc
fixes. This altered the if from using bitwise to logical and.

This commit changes it back to bitwise.

Spotted from a compile warning.

Fixes: ba37d408da3 ("svga: Performance fixes")

Reviewed-by: Zoltán Böszörményi <zboszor at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12157>
(cherry picked from commit 64292c0f05ba891d9c7319e1a1cea98eb0630af4)

---

 .pick_status.json                           | 2 +-
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 265f31539cd..d3d68393c09 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -247,7 +247,7 @@
         "description": "svga: fix bitwise/logical and mixup",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "ba37d408da30d87b6848d76242d9d797dbef80a0"
     },
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 8989a57d2ba..a9435a09838 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -1450,7 +1450,7 @@ static boolean
 need_temp_reg_initialization(struct svga_shader_emitter_v10 *emit,
                              unsigned index)
 {
-   if (!(emit->info.indirect_files && (1u << TGSI_FILE_TEMPORARY))
+   if (!(emit->info.indirect_files & (1u << TGSI_FILE_TEMPORARY))
        && emit->current_loop_depth == 0) {
       if (!emit->temp_map[index].initialized &&
           emit->temp_map[index].index < emit->num_shader_temps) {



More information about the mesa-commit mailing list