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

Author: Karmjit Mahil <[email protected]>
Date:   Mon Aug  8 16:24:41 2022 +0100

pvr: Fix bo mapping on alloc with PVR_BO_ALLOC_FLAG_CPU_ACCESS.

If PVR_BO_ALLOC_FLAG_CPU_ACCESS was specified when calling
pvr_bo_alloc() the new bo was also being cpu mapped while this
was not the intention as the PVR_BO_ALLOC_FLAG_CPU_MAPPED is meant
to be used for that purpose. Fixed in this commit.

Signed-off-by: Karmjit Mahil <[email protected]>
Reviewed-by: Frank Binns <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17984>

---

 src/imagination/vulkan/pvr_bo.c | 2 +-
 src/imagination/vulkan/pvr_bo.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/imagination/vulkan/pvr_bo.c b/src/imagination/vulkan/pvr_bo.c
index e24a285ff7f..315c2a36d46 100644
--- a/src/imagination/vulkan/pvr_bo.c
+++ b/src/imagination/vulkan/pvr_bo.c
@@ -37,7 +37,7 @@ static uint32_t pvr_bo_alloc_to_winsys_flags(uint64_t flags)
 {
    uint32_t ws_flags = 0;
 
-   if (flags & PVR_BO_ALLOC_FLAG_CPU_ACCESS)
+   if (flags & (PVR_BO_ALLOC_FLAG_CPU_ACCESS | PVR_BO_ALLOC_FLAG_CPU_MAPPED))
       ws_flags |= PVR_WINSYS_BO_FLAG_CPU_ACCESS;
 
    if (flags & PVR_BO_ALLOC_FLAG_GPU_UNCACHED)
diff --git a/src/imagination/vulkan/pvr_bo.h b/src/imagination/vulkan/pvr_bo.h
index 2a00c24e369..4f3565bf6eb 100644
--- a/src/imagination/vulkan/pvr_bo.h
+++ b/src/imagination/vulkan/pvr_bo.h
@@ -59,8 +59,7 @@ struct pvr_bo {
  * \brief Flag passed to #pvr_bo_alloc() to indicate that the buffer should
  * be mapped to the CPU. Implies #PVR_BO_ALLOC_FLAG_CPU_ACCESS.
  */
-#define PVR_BO_ALLOC_FLAG_CPU_MAPPED \
-   (BITFIELD_BIT(1U) | PVR_BO_ALLOC_FLAG_CPU_ACCESS)
+#define PVR_BO_ALLOC_FLAG_CPU_MAPPED BITFIELD_BIT(1U)
 /**
  * \brief Flag passed to #pvr_bo_alloc() to indicate that the buffer should be
  * mapped to the GPU as uncached.

Reply via email to