History

vulkan: add support for encode feedback queries

Lynne committed 2 years ago

Commit 83cd7751 parent 2ce0e511 file · +16 −10Browse files

Unified · Split

libavutil/vulkan.c+16−10
@@ -281,6 +281,15 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf, · 280 unmodified lines
281281 VkCommandPoolCreateInfo cqueue_create;
282282 VkCommandBufferAllocateInfo cbuf_create;
283283
284+ const VkQueryPoolVideoEncodeFeedbackCreateInfoKHR *ef = NULL;
285+
286+ if (query_type == VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR) {
287+ ef = ff_vk_find_struct(query_create_pnext,
288+ VK_STRUCTURE_TYPE_QUERY_POOL_VIDEO_ENCODE_FEEDBACK_CREATE_INFO_KHR);
289+ if (!ef)
290+ return AVERROR(EINVAL);
291+ }
292+
284293 /* Create command pool */
285294 cqueue_create = (VkCommandPoolCreateInfo) {
286295 .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
@@ -338,21 +347,18 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf, · 51 unmodified lines
338347 }
339348
340349 pool->nb_queries = nb_queries;
341− pool->query_status_stride = 2;
350+ pool->query_status_stride = 1 + 1; /* One result, one status by default */
342351 pool->query_results = nb_queries;
343− pool->query_statuses = 0; /* if radv supports it, nb_queries; */
352+ pool->query_statuses = nb_queries;
344353
345−#if 0 /* CONFIG_VULKAN_ENCODE */
346354 /* Video encode quieries produce two results per query */
347355 if (query_type == VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR) {
348− pool->query_status_stride = 3; /* skip,skip,result,skip,skip,result */
349− pool->query_results *= 2;
350− } else
351−#endif
352− if (query_type == VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR) {
356+ int nb_results = av_popcount(ef->encodeFeedbackFlags);
357+ pool->query_status_stride = nb_results + 1;
358+ pool->query_results *= nb_results;
359+ } else if (query_type == VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR) {
353360 pool->query_status_stride = 1;
354361 pool->query_results = 0;
355− pool->query_statuses = nb_queries;
356362 }
357363
358364 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, · 85 unmodified lines
444450 e->query_idx,
445451 pool->nb_queries,
446452 pool->qd_size, e->query_data,
447− pool->query_64bit ? 8 : 4, qf);
453+ pool->qd_size, qf);
448454 if (ret != VK_SUCCESS)
449455 return ret;
450456

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t