aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2023-10-25 22:58:20 +0000
committerLynne <dev@lynne.ee>2023-10-28 21:16:15 +0200
commit1a8e76698478006d97432f1eb972d37ef3549dbc (patch)
treecd28fe1b8b0d35766baaeb23d8944e2d03ca10b2
parent1ad7bd0fe5f9eaaf8eb9d8ab99f19a2457e3aefe (diff)
downloadffmpeg-1a8e76698478006d97432f1eb972d37ef3549dbc.tar.gz
vulkan: return VK_NOT_READY when no queries are available
Fixes a validation issue. The issue is that the function gets called before we've sumitted a frame for decoding to that context. However, we cannot run queries before they've been reset, which happens at submission time. As we'd need to otherwise run a command queue at init-time, just check if submissions have happened.
-rw-r--r--libavutil/vulkan.c5
-rw-r--r--libavutil/vulkan.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index dec8ccad64..bf8456b06d 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -456,6 +456,9 @@ VkResult ff_vk_exec_get_query(FFVulkanContext *s, FFVkExecContext *e,
int64_t res = 0;
VkQueryResultFlags qf = 0;
+ if (!e->had_submission)
+ return VK_NOT_READY;
+
qf |= pool->query_64bit ?
VK_QUERY_RESULT_64_BIT : 0x0;
qf |= pool->query_statuses ?
@@ -779,6 +782,8 @@ int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e)
}
}
+ e->had_submission = 1;
+
return 0;
}
diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h
index 25c5ad4b74..b666841836 100644
--- a/libavutil/vulkan.h
+++ b/libavutil/vulkan.h
@@ -154,6 +154,7 @@ typedef struct FFVkExecContext {
uint32_t idx;
const struct FFVkExecPool *parent;
pthread_mutex_t lock;
+ int had_submission;
/* Queue for the execution context */
VkQueue queue;