Unified · Split
| @@ -281,6 +281,15 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf, · 280 unmodified lines | |||
| 281 | VkCommandPoolCreateInfo cqueue_create; | 281 | VkCommandPoolCreateInfo cqueue_create; |
| 282 | VkCommandBufferAllocateInfo cbuf_create; | 282 | VkCommandBufferAllocateInfo cbuf_create; |
| 283 | 283 | ||
| 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 | |||
| 284 | /* Create command pool */ | 293 | /* Create command pool */ |
| 285 | cqueue_create = (VkCommandPoolCreateInfo) { | 294 | cqueue_create = (VkCommandPoolCreateInfo) { |
| 286 | .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, | 295 | .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 | |||
| 338 | } | 347 | } |
| 339 | 348 | ||
| 340 | pool->nb_queries = nb_queries; | 349 | pool->nb_queries = nb_queries; |
| 341 | pool->query_status_stride = 2; | 350 | pool->query_status_stride = 1 + 1; /* One result, one status by default */ |
| 342 | pool->query_results = nb_queries; | 351 | pool->query_results = nb_queries; |
| 343 | pool->query_statuses = 0; /* if radv supports it, nb_queries; */ | 352 | pool->query_statuses = nb_queries; |
| 344 | 353 | ||
| 345 | #if 0 /* CONFIG_VULKAN_ENCODE */ | ||
| 346 | /* Video encode quieries produce two results per query */ | 354 | /* Video encode quieries produce two results per query */ |
| 347 | if (query_type == VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR) { | 355 | if (query_type == VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR) { |
| 348 | pool->query_status_stride = 3; /* skip,skip,result,skip,skip,result */ | 356 | int nb_results = av_popcount(ef->encodeFeedbackFlags); |
| 349 | pool->query_results *= 2; | 357 | pool->query_status_stride = nb_results + 1; |
| 350 | } else | 358 | pool->query_results *= nb_results; |
| 351 | #endif | 359 | } else if (query_type == VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR) { |
| 352 | if (query_type == VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR) { | ||
| 353 | pool->query_status_stride = 1; | 360 | pool->query_status_stride = 1; |
| 354 | pool->query_results = 0; | 361 | pool->query_results = 0; |
| 355 | pool->query_statuses = nb_queries; | ||
| 356 | } | 362 | } |
| 357 | 363 | ||
| 358 | pool->qd_size = (pool->query_results + pool->query_statuses)*(query_64bit ? 8 : 4); | 364 | 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 | |||
| 444 | e->query_idx, | 450 | e->query_idx, |
| 445 | pool->nb_queries, | 451 | pool->nb_queries, |
| 446 | pool->qd_size, e->query_data, | 452 | pool->qd_size, e->query_data, |
| 447 | pool->query_64bit ? 8 : 4, qf); | 453 | pool->qd_size, qf); |
| 448 | if (ret != VK_SUCCESS) | 454 | if (ret != VK_SUCCESS) |
| 449 | return ret; | 455 | return ret; |
| 450 | 456 | ||