Mesa (main): pvr: Allow signal_sync pointer to be NULL in job submission.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 7 14:02:37 UTC 2022


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

Author: Rajnesh Kanwal <rajnesh.kanwal at imgtec.com>
Date:   Mon May 16 14:28:43 2022 +0100

pvr: Allow signal_sync pointer to be NULL in job submission.

This allows the common driver to pass NULL signal_sync for cases
where there are multiple jobs (of the same type) to be processed.
In that case, it's useless to maintain the signal_syncs other than
the one returned by the last submission.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal at imgtec.com>
Reviewed-by: Frank Binns <frank.binns at imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16897>

---

 .../vulkan/winsys/pvrsrvkm/pvr_srv_job_compute.c        |  8 ++++++--
 .../vulkan/winsys/pvrsrvkm/pvr_srv_job_render.c         | 17 +++++++++++++----
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_compute.c b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_compute.c
index f76a807be15..92debd910f9 100644
--- a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_compute.c
+++ b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_compute.c
@@ -222,8 +222,12 @@ VkResult pvr_srv_winsys_compute_submit(
    if (result != VK_SUCCESS)
       goto err_close_in_fd;
 
-   srv_signal_sync = to_srv_sync(signal_sync);
-   pvr_srv_set_sync_payload(srv_signal_sync, fence);
+   if (signal_sync) {
+      srv_signal_sync = to_srv_sync(signal_sync);
+      pvr_srv_set_sync_payload(srv_signal_sync, fence);
+   } else if (fence != -1) {
+      close(fence);
+   }
 
    return VK_SUCCESS;
 
diff --git a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_render.c b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_render.c
index b940627c677..a1b41fa1190 100644
--- a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_render.c
+++ b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_render.c
@@ -680,10 +680,19 @@ VkResult pvr_srv_winsys_render_submit(
    if (result != VK_SUCCESS)
       goto err_close_in_fds;
 
-   srv_signal_sync_geom = to_srv_sync(signal_sync_geom);
-   srv_signal_sync_frag = to_srv_sync(signal_sync_frag);
-   pvr_srv_set_sync_payload(srv_signal_sync_geom, fence_geom);
-   pvr_srv_set_sync_payload(srv_signal_sync_frag, fence_frag);
+   if (signal_sync_geom) {
+      srv_signal_sync_geom = to_srv_sync(signal_sync_geom);
+      pvr_srv_set_sync_payload(srv_signal_sync_geom, fence_geom);
+   } else if (fence_geom != -1) {
+      close(fence_geom);
+   }
+
+   if (signal_sync_frag) {
+      srv_signal_sync_frag = to_srv_sync(signal_sync_frag);
+      pvr_srv_set_sync_payload(srv_signal_sync_frag, fence_frag);
+   } else if (fence_frag != -1) {
+      close(fence_frag);
+   }
 
    return VK_SUCCESS;
 



More information about the mesa-commit mailing list