* [FFmpeg-devel] [PATCH] vulkan: add support for encode feedback queries
@ 2024-08-09 14:46 Lynne via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Lynne via ffmpeg-devel @ 2024-08-09 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Lynne
---
libavutil/vulkan.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 7b45e43a89..13344b7aed 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -281,6 +281,15 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf,
VkCommandPoolCreateInfo cqueue_create;
VkCommandBufferAllocateInfo cbuf_create;
+ const VkQueryPoolVideoEncodeFeedbackCreateInfoKHR *ef = NULL;
+
+ if (query_type == VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR) {
+ ef = ff_vk_find_struct(query_create_pnext,
+ VK_STRUCTURE_TYPE_QUERY_POOL_VIDEO_ENCODE_FEEDBACK_CREATE_INFO_KHR);
+ if (!ef)
+ return AVERROR(EINVAL);
+ }
+
/* Create command pool */
cqueue_create = (VkCommandPoolCreateInfo) {
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
@@ -338,21 +347,18 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf,
}
pool->nb_queries = nb_queries;
- pool->query_status_stride = 2;
+ pool->query_status_stride = 1 + 1; /* One result, one status by default */
pool->query_results = nb_queries;
- pool->query_statuses = 0; /* if radv supports it, nb_queries; */
+ pool->query_statuses = nb_queries;
-#if 0 /* CONFIG_VULKAN_ENCODE */
/* Video encode quieries produce two results per query */
if (query_type == VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR) {
- pool->query_status_stride = 3; /* skip,skip,result,skip,skip,result */
- pool->query_results *= 2;
- } else
-#endif
- if (query_type == VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR) {
+ int nb_results = av_popcount(ef->encodeFeedbackFlags);
+ pool->query_status_stride = nb_results + 1;
+ pool->query_results *= nb_results;
+ } else if (query_type == VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR) {
pool->query_status_stride = 1;
pool->query_results = 0;
- pool->query_statuses = nb_queries;
}
pool->qd_size = (pool->query_results + pool->query_statuses)*(query_64bit ? 8 : 4);
@@ -444,7 +450,7 @@ VkResult ff_vk_exec_get_query(FFVulkanContext *s, FFVkExecContext *e,
e->query_idx,
pool->nb_queries,
pool->qd_size, e->query_data,
- pool->query_64bit ? 8 : 4, qf);
+ pool->qd_size, qf);
if (ret != VK_SUCCESS)
return ret;
--
2.45.2.753.g447d99e1c3b
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-08-09 14:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-09 14:46 [FFmpeg-devel] [PATCH] vulkan: add support for encode feedback queries Lynne via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git