Mesa (main): pvr: Add pvrsrvkm visibility test heap.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 13 18:04:42 UTC 2022


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

Author: Karmjit Mahil <Karmjit.Mahil at imgtec.com>
Date:   Wed Feb 23 15:43:54 2022 +0000

pvr: Add pvrsrvkm visibility test heap.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil at imgtec.com>
Reviewed-by: Frank Binns <frank.binns at imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15880>

---

 src/imagination/vulkan/winsys/pvr_winsys.h       |  1 +
 src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c | 35 ++++++++++++++++++++----
 src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.h |  2 ++
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/src/imagination/vulkan/winsys/pvr_winsys.h b/src/imagination/vulkan/winsys/pvr_winsys.h
index 19e9a010978..a45fe6064a7 100644
--- a/src/imagination/vulkan/winsys/pvr_winsys.h
+++ b/src/imagination/vulkan/winsys/pvr_winsys.h
@@ -56,6 +56,7 @@ struct pvr_winsys_heaps {
    struct pvr_winsys_heap *pds_heap;
    struct pvr_winsys_heap *rgn_hdr_heap;
    struct pvr_winsys_heap *usc_heap;
+   struct pvr_winsys_heap *vis_test_heap;
 };
 
 struct pvr_winsys_static_data_offsets {
diff --git a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c
index 646ffc67d66..8c8ba7c16bc 100644
--- a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c
+++ b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c
@@ -123,10 +123,10 @@ static VkResult pvr_srv_memctx_init(struct pvr_srv_winsys *srv_ws)
    const struct pvr_winsys_static_data_offsets usc_heap_static_data_offsets = {
       .vdm_sync = FWIF_USC_HEAP_VDM_SYNC_OFFSET_BYTES,
    };
-   const struct pvr_winsys_static_data_offsets
-      rgn_hdr_heap_static_data_offsets = { 0 };
+   const struct pvr_winsys_static_data_offsets no_static_data_offsets = { 0 };
 
    char heap_name[PVR_SRV_DEVMEM_HEAPNAME_MAXLENGTH];
+   int vis_test_heap_idx = -1;
    int general_heap_idx = -1;
    int rgn_hdr_heap_idx = -1;
    int pds_heap_idx = -1;
@@ -181,11 +181,17 @@ static VkResult pvr_srv_memctx_init(struct pvr_srv_winsys *srv_ws)
                          PVR_SRV_USCCODE_HEAP_IDENT,
                          sizeof(PVR_SRV_USCCODE_HEAP_IDENT)) == 0) {
          usc_heap_idx = i;
+      } else if (vis_test_heap_idx == -1 &&
+                 strncmp(heap_name,
+                         PVR_SRV_VISIBILITY_TEST_HEAP_IDENT,
+                         sizeof(PVR_SRV_VISIBILITY_TEST_HEAP_IDENT)) == 0) {
+         vis_test_heap_idx = i;
       }
    }
 
-   /* Check for and initialize required heaps. */
-   if (general_heap_idx == -1 || pds_heap_idx == -1 || usc_heap_idx == -1) {
+   /* Check for and initialise required heaps. */
+   if (general_heap_idx == -1 || pds_heap_idx == -1 || usc_heap_idx == -1 ||
+       vis_test_heap_idx == -1) {
       result = vk_error(NULL, VK_ERROR_INITIALIZATION_FAILED);
       goto err_pvr_srv_int_ctx_destroy;
    }
@@ -211,14 +217,21 @@ static VkResult pvr_srv_memctx_init(struct pvr_srv_winsys *srv_ws)
    if (result != VK_SUCCESS)
       goto err_pvr_srv_heap_finish_pds;
 
+   result = pvr_srv_heap_init(srv_ws,
+                              &srv_ws->vis_test_heap,
+                              vis_test_heap_idx,
+                              &no_static_data_offsets);
+   if (result != VK_SUCCESS)
+      goto err_pvr_srv_heap_finish_usc;
+
    /* Check for and set up optional heaps. */
    if (rgn_hdr_heap_idx != -1) {
       result = pvr_srv_heap_init(srv_ws,
                                  &srv_ws->rgn_hdr_heap,
                                  rgn_hdr_heap_idx,
-                                 &rgn_hdr_heap_static_data_offsets);
+                                 &no_static_data_offsets);
       if (result != VK_SUCCESS)
-         goto err_pvr_srv_heap_finish_usc;
+         goto err_pvr_srv_heap_finish_vis_test;
       srv_ws->rgn_hdr_heap_present = true;
    } else {
       srv_ws->rgn_hdr_heap_present = false;
@@ -254,6 +267,9 @@ err_pvr_srv_heap_finish_rgn_hdr:
    if (srv_ws->rgn_hdr_heap_present)
       pvr_srv_heap_finish(srv_ws, &srv_ws->rgn_hdr_heap);
 
+err_pvr_srv_heap_finish_vis_test:
+   pvr_srv_heap_finish(srv_ws, &srv_ws->vis_test_heap);
+
 err_pvr_srv_heap_finish_usc:
    pvr_srv_heap_finish(srv_ws, &srv_ws->usc_heap);
 
@@ -283,6 +299,12 @@ static void pvr_srv_memctx_finish(struct pvr_srv_winsys *srv_ws)
       }
    }
 
+   if (!pvr_srv_heap_finish(srv_ws, &srv_ws->vis_test_heap)) {
+      vk_errorf(NULL,
+                VK_ERROR_UNKNOWN,
+                "Visibility test heap in use, can not deinit");
+   }
+
    if (!pvr_srv_heap_finish(srv_ws, &srv_ws->usc_heap))
       vk_errorf(NULL, VK_ERROR_UNKNOWN, "USC heap in use, can not deinit");
 
@@ -369,6 +391,7 @@ static void pvr_srv_winsys_get_heaps_info(struct pvr_winsys *ws,
    heaps->general_heap = &srv_ws->general_heap.base;
    heaps->pds_heap = &srv_ws->pds_heap.base;
    heaps->usc_heap = &srv_ws->usc_heap.base;
+   heaps->vis_test_heap = &srv_ws->vis_test_heap.base;
 
    if (srv_ws->rgn_hdr_heap_present)
       heaps->rgn_hdr_heap = &srv_ws->rgn_hdr_heap.base;
diff --git a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.h b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.h
index 6dd9dcc4f8f..2f5475c2493 100644
--- a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.h
+++ b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.h
@@ -45,6 +45,7 @@
 #define PVR_SRV_RGNHDR_BRN_63142_HEAP_IDENT "RgnHdr BRN63142"
 #define PVR_SRV_PDSCODEDATA_HEAP_IDENT "PDS Code and Data"
 #define PVR_SRV_USCCODE_HEAP_IDENT "USC Code"
+#define PVR_SRV_VISIBILITY_TEST_HEAP_IDENT "Visibility Test"
 
 #define FWIF_PDS_HEAP_TOTAL_BYTES 4096
 #define FWIF_PDS_HEAP_VDM_SYNC_OFFSET_BYTES 0
@@ -81,6 +82,7 @@ struct pvr_srv_winsys {
    struct pvr_srv_winsys_heap general_heap;
    struct pvr_srv_winsys_heap pds_heap;
    struct pvr_srv_winsys_heap usc_heap;
+   struct pvr_srv_winsys_heap vis_test_heap;
 
    /* Optional heaps */
    bool rgn_hdr_heap_present;



More information about the mesa-commit mailing list