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

Author: Eric Anholt <[email protected]>
Date:   Thu Sep 17 09:13:10 2020 -0700

turnip/kgsl: Associate fences with submits.

This fixes all the I was seeing in the multiview tests.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4479>

---

 src/freedreno/vulkan/tu_kgsl.c | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/src/freedreno/vulkan/tu_kgsl.c b/src/freedreno/vulkan/tu_kgsl.c
index d017cebbb8b..f31a33a7cca 100644
--- a/src/freedreno/vulkan/tu_kgsl.c
+++ b/src/freedreno/vulkan/tu_kgsl.c
@@ -221,6 +221,7 @@ tu_QueueSubmit(VkQueue _queue,
                VkFence _fence)
 {
    TU_FROM_HANDLE(tu_queue, queue, _queue);
+   VkResult result = VK_SUCCESS;
 
    uint32_t max_entry_count = 0;
    for (uint32_t i = 0; i < submitCount; ++i) {
@@ -271,18 +272,35 @@ tu_QueueSubmit(VkQueue _queue,
       int ret = safe_ioctl(queue->device->physical_device->local_fd,
                            IOCTL_KGSL_GPU_COMMAND, &req);
       if (ret) {
-         fprintf(stderr, "submit failed: %s\n", strerror(errno));
-         abort();
+         result = tu_device_set_lost(queue->device,
+                                     "submit failed: %s\n", strerror(errno));
+         goto fail;
       }
 
-#if 0
+      /* no need to merge fences as queue execution is serialized */
       if (i == submitCount - 1) {
-         /* no need to merge fences as queue execution is serialized */
-         tu_fence_update_fd(&queue->submit_fence, req.fence_fd);
+         int fd;
+         struct kgsl_timestamp_event event = {
+            .type = KGSL_TIMESTAMP_EVENT_FENCE,
+            .context_id = queue->msm_queue_id,
+            .timestamp = req.timestamp,
+            .priv = &fd,
+            .len = sizeof(fd),
+         };
+
+         int ret = safe_ioctl(queue->device->physical_device->local_fd,
+                              IOCTL_KGSL_TIMESTAMP_EVENT, &event);
+         if (ret != 0) {
+            result = tu_device_set_lost(queue->device,
+                                        "Failed to create sync file for 
timestamp: %s\n",
+                                        strerror(errno));
+            goto fail;
+         }
+
+         tu_fence_update_fd(&queue->submit_fence, fd);
       }
-#endif
    }
-
+fail:
    vk_free(&queue->device->vk.alloc, cmds);
 
    if (_fence != VK_NULL_HANDLE) {
@@ -290,7 +308,7 @@ tu_QueueSubmit(VkQueue _queue,
       tu_fence_copy(fence, &queue->submit_fence);
    }
 
-   return VK_SUCCESS;
+   return result;
 }
 
 VkResult

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to