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

Author: Marek Olšák <marek.ol...@amd.com>
Date:   Thu Feb 22 00:28:39 2018 +0100

radeonsi: properly extract a buffer address from a descriptor

---

 src/gallium/drivers/radeonsi/si_descriptors.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index e6c58ffca7..b6e767c254 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -96,7 +96,13 @@ static uint32_t null_image_descriptor[8] = {
 
 static uint64_t si_desc_extract_buffer_address(uint32_t *desc)
 {
-       return desc[0] | ((uint64_t)G_008F04_BASE_ADDRESS_HI(desc[1]) << 32);
+       uint64_t va = desc[0] |
+                     ((uint64_t)G_008F04_BASE_ADDRESS_HI(desc[1]) << 32);
+
+       /* Sign-extend the 48-bit address. */
+       if (va & (1ull << 47))
+               va |= 0xffffull << 48;
+       return va;
 }
 
 static void si_init_descriptor_list(uint32_t *desc_list,

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to