From: Lynne via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Lynne <dev@lynne.ee>
Subject: [FFmpeg-devel] [PATCH] vulkan: add support for encode feedback queries
Date: Fri, 9 Aug 2024 16:46:45 +0200
Message-ID: <20240809144703.1278661-1-dev@lynne.ee> (raw)
---
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".
reply other threads:[~2024-08-09 14:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240809144703.1278661-1-dev@lynne.ee \
--to=ffmpeg-devel@ffmpeg.org \
--cc=dev@lynne.ee \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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