We recently introduced a public field which was a superset of the queue context we used to have. Switch to using it entirely. This also allows us to get rid of the NIH function which was valid only for video queues.
Showing the changes to libavfilter (12 of 22 files). Show all
Unified · Split
| @@ -31,7 +31,7 @@ typedef struct AvgBlurVulkanContext { · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | int initialized; |
| 33 | 33 | FFVkExecPool e; |
| 34 | − FFVkQueueFamilyCtx qf; | |
| 34 | + AVVulkanDeviceQueueFamily *qf; | |
| 35 | 35 | VkSampler sampler; |
| 36 | 36 | FFVulkanShader shd; |
| 37 | 37 | |
| @@ -77,8 +77,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 39 unmodified lines | ||
| 77 | 77 | return AVERROR_EXTERNAL; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 81 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); | |
| 80 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 81 | + if (!s->qf) { | |
| 82 | + av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 83 | + err = AVERROR(ENOTSUP); | |
| 84 | + goto fail; | |
| 85 | + } | |
| 86 | + | |
| 87 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | |
| 82 | 88 | RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR)); |
| 83 | 89 | RET(ff_vk_shader_init(vkctx, &s->shd, "avgblur", |
| 84 | 90 | VK_SHADER_STAGE_COMPUTE_BIT, |
| @@ -47,7 +47,7 @@ typedef struct BlendVulkanContext { · 46 unmodified lines | ||
| 47 | 47 | |
| 48 | 48 | int initialized; |
| 49 | 49 | FFVkExecPool e; |
| 50 | − FFVkQueueFamilyCtx qf; | |
| 50 | + AVVulkanDeviceQueueFamily *qf; | |
| 51 | 51 | FFVulkanShader shd; |
| 52 | 52 | VkSampler sampler; |
| 53 | 53 | |
| @@ -141,8 +141,14 @@ static av_cold int init_filter(AVFilterContext *avctx) · 87 unmodified lines | ||
| 141 | 141 | return AVERROR_EXTERNAL; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 145 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); | |
| 144 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 145 | + if (!s->qf) { | |
| 146 | + av_log(avctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 147 | + err = AVERROR(ENOTSUP); | |
| 148 | + goto fail; | |
| 149 | + } | |
| 150 | + | |
| 151 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | |
| 146 | 152 | RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST)); |
| 147 | 153 | RET(ff_vk_shader_init(vkctx, &s->shd, "blend", |
| 148 | 154 | VK_SHADER_STAGE_COMPUTE_BIT, |
| @@ -33,7 +33,7 @@ typedef struct BWDIFVulkanContext { · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | int initialized; |
| 35 | 35 | FFVkExecPool e; |
| 36 | − FFVkQueueFamilyCtx qf; | |
| 36 | + AVVulkanDeviceQueueFamily *qf; | |
| 37 | 37 | VkSampler sampler; |
| 38 | 38 | FFVulkanShader shd; |
| 39 | 39 | } BWDIFVulkanContext; |
| @@ -65,8 +65,14 @@ static av_cold int init_filter(AVFilterContext *ctx) · 25 unmodified lines | ||
| 65 | 65 | return AVERROR_EXTERNAL; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 69 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); | |
| 68 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 69 | + if (!s->qf) { | |
| 70 | + av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 71 | + err = AVERROR(ENOTSUP); | |
| 72 | + goto fail; | |
| 73 | + } | |
| 74 | + | |
| 75 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | |
| 70 | 76 | RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST)); |
| 71 | 77 | |
| 72 | 78 | RET(ff_vk_shader_init(vkctx, &s->shd, "bwdif", |
| @@ -31,7 +31,7 @@ typedef struct ChromaticAberrationVulkanContext { · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | int initialized; |
| 33 | 33 | FFVkExecPool e; |
| 34 | − FFVkQueueFamilyCtx qf; | |
| 34 | + AVVulkanDeviceQueueFamily *qf; | |
| 35 | 35 | FFVulkanShader shd; |
| 36 | 36 | VkSampler sampler; |
| 37 | 37 | |
| @@ -88,8 +88,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 50 unmodified lines | ||
| 88 | 88 | return AVERROR_EXTERNAL; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 92 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); | |
| 91 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 92 | + if (!s->qf) { | |
| 93 | + av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 94 | + err = AVERROR(ENOTSUP); | |
| 95 | + goto fail; | |
| 96 | + } | |
| 97 | + | |
| 98 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | |
| 93 | 99 | RET(ff_vk_init_sampler(vkctx, &s->sampler, 0, VK_FILTER_LINEAR)); |
| 94 | 100 | RET(ff_vk_shader_init(vkctx, &s->shd, "chromatic_abberation", |
| 95 | 101 | VK_SHADER_STAGE_COMPUTE_BIT, |
| @@ -38,7 +38,7 @@ typedef struct FlipVulkanContext { · 37 unmodified lines | ||
| 38 | 38 | |
| 39 | 39 | int initialized; |
| 40 | 40 | FFVkExecPool e; |
| 41 | − FFVkQueueFamilyCtx qf; | |
| 41 | + AVVulkanDeviceQueueFamily *qf; | |
| 42 | 42 | FFVulkanShader shd; |
| 43 | 43 | VkSampler sampler; |
| 44 | 44 | } FlipVulkanContext; |
| @@ -62,8 +62,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType · 17 unmodified lines | ||
| 62 | 62 | return AVERROR_EXTERNAL; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 66 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); | |
| 65 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 66 | + if (!s->qf) { | |
| 67 | + av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 68 | + err = AVERROR(ENOTSUP); | |
| 69 | + goto fail; | |
| 70 | + } | |
| 71 | + | |
| 72 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | |
| 67 | 73 | RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR)); |
| 68 | 74 | RET(ff_vk_shader_init(vkctx, &s->shd, "flip", |
| 69 | 75 | VK_SHADER_STAGE_COMPUTE_BIT, |
| @@ -36,7 +36,7 @@ typedef struct GBlurVulkanContext { · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | int initialized; |
| 38 | 38 | FFVkExecPool e; |
| 39 | − FFVkQueueFamilyCtx qf; | |
| 39 | + AVVulkanDeviceQueueFamily *qf; | |
| 40 | 40 | VkSampler sampler; |
| 41 | 41 | FFVulkanShader shd_hor; |
| 42 | 42 | FFVkBuffer params_hor; |
| @@ -212,8 +212,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 169 unmodified lines | ||
| 212 | 212 | return AVERROR_EXTERNAL; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 216 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); | |
| 215 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 216 | + if (!s->qf) { | |
| 217 | + av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 218 | + err = AVERROR(ENOTSUP); | |
| 219 | + goto fail; | |
| 220 | + } | |
| 221 | + | |
| 222 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | |
| 217 | 223 | RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR)); |
| 218 | 224 | |
| 219 | 225 | desc = (FFVulkanDescriptorSetBinding []) { |
| @@ -36,7 +36,7 @@ typedef struct NLMeansVulkanContext { · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | int initialized; |
| 38 | 38 | FFVkExecPool e; |
| 39 | − FFVkQueueFamilyCtx qf; | |
| 39 | + AVVulkanDeviceQueueFamily *qf; | |
| 40 | 40 | VkSampler sampler; |
| 41 | 41 | |
| 42 | 42 | AVBufferPool *integral_buf_pool; |
| @@ -652,8 +652,14 @@ static av_cold int init_filter(AVFilterContext *ctx) · 609 unmodified lines | ||
| 652 | 652 | return AVERROR_EXTERNAL; |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 656 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, 1, 0, 0, 0, NULL)); | |
| 655 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 656 | + if (!s->qf) { | |
| 657 | + av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 658 | + err = AVERROR(ENOTSUP); | |
| 659 | + goto fail; | |
| 660 | + } | |
| 661 | + | |
| 662 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, 1, 0, 0, 0, NULL)); | |
| 657 | 663 | RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST)); |
| 658 | 664 | |
| 659 | 665 | RET(init_weights_pipeline(vkctx, &s->e, &s->shd_weights, s->sampler, |
| @@ -33,7 +33,7 @@ typedef struct OverlayVulkanContext { · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | int initialized; |
| 35 | 35 | FFVkExecPool e; |
| 36 | − FFVkQueueFamilyCtx qf; | |
| 36 | + AVVulkanDeviceQueueFamily *qf; | |
| 37 | 37 | FFVulkanShader shd; |
| 38 | 38 | VkSampler sampler; |
| 39 | 39 | |
| @@ -101,8 +101,14 @@ static av_cold int init_filter(AVFilterContext *ctx) · 61 unmodified lines | ||
| 101 | 101 | return AVERROR_EXTERNAL; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 105 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); | |
| 104 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 105 | + if (!s->qf) { | |
| 106 | + av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 107 | + err = AVERROR(ENOTSUP); | |
| 108 | + goto fail; | |
| 109 | + } | |
| 110 | + | |
| 111 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | |
| 106 | 112 | RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST)); |
| 107 | 113 | RET(ff_vk_shader_init(vkctx, &s->shd, "overlay", |
| 108 | 114 | VK_SHADER_STAGE_COMPUTE_BIT, |
| @@ -39,7 +39,7 @@ typedef struct ScaleVulkanContext { · 38 unmodified lines | ||
| 39 | 39 | |
| 40 | 40 | int initialized; |
| 41 | 41 | FFVkExecPool e; |
| 42 | − FFVkQueueFamilyCtx qf; | |
| 42 | + AVVulkanDeviceQueueFamily *qf; | |
| 43 | 43 | FFVulkanShader shd; |
| 44 | 44 | VkSampler sampler; |
| 45 | 45 | |
| @@ -142,8 +142,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 96 unmodified lines | ||
| 142 | 142 | return AVERROR_EXTERNAL; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 146 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); | |
| 145 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 146 | + if (!s->qf) { | |
| 147 | + av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 148 | + err = AVERROR(ENOTSUP); | |
| 149 | + goto fail; | |
| 150 | + } | |
| 151 | + | |
| 152 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | |
| 147 | 153 | RET(ff_vk_init_sampler(vkctx, &s->sampler, 0, sampler_mode)); |
| 148 | 154 | RET(ff_vk_shader_init(vkctx, &s->shd, "scale", |
| 149 | 155 | VK_SHADER_STAGE_COMPUTE_BIT, |
| @@ -33,7 +33,7 @@ typedef struct TransposeVulkanContext { · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | int initialized; |
| 35 | 35 | FFVkExecPool e; |
| 36 | − FFVkQueueFamilyCtx qf; | |
| 36 | + AVVulkanDeviceQueueFamily *qf; | |
| 37 | 37 | FFVulkanShader shd; |
| 38 | 38 | VkSampler sampler; |
| 39 | 39 | |
| @@ -61,8 +61,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 21 unmodified lines | ||
| 61 | 61 | return AVERROR_EXTERNAL; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 65 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); | |
| 64 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 65 | + if (!s->qf) { | |
| 66 | + av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 67 | + err = AVERROR(ENOTSUP); | |
| 68 | + goto fail; | |
| 69 | + } | |
| 70 | + | |
| 71 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | |
| 66 | 72 | RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR)); |
| 67 | 73 | RET(ff_vk_shader_init(vkctx, &s->shd, "transpose", |
| 68 | 74 | VK_SHADER_STAGE_COMPUTE_BIT, |
| @@ -41,7 +41,7 @@ typedef struct XFadeVulkanContext { · 40 unmodified lines | ||
| 41 | 41 | |
| 42 | 42 | int initialized; |
| 43 | 43 | FFVkExecPool e; |
| 44 | − FFVkQueueFamilyCtx qf; | |
| 44 | + AVVulkanDeviceQueueFamily *qf; | |
| 45 | 45 | FFVulkanShader shd; |
| 46 | 46 | VkSampler sampler; |
| 47 | 47 | |
| @@ -335,8 +335,14 @@ static av_cold int init_vulkan(AVFilterContext *avctx) · 287 unmodified lines | ||
| 335 | 335 | return AVERROR_EXTERNAL; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 339 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); | |
| 338 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 339 | + if (!s->qf) { | |
| 340 | + av_log(avctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 341 | + err = AVERROR(ENOTSUP); | |
| 342 | + goto fail; | |
| 343 | + } | |
| 344 | + | |
| 345 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | |
| 340 | 346 | RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST)); |
| 341 | 347 | RET(ff_vk_shader_init(vkctx, &s->shd, "xfade", |
| 342 | 348 | VK_SHADER_STAGE_COMPUTE_BIT, |
| @@ -40,7 +40,7 @@ typedef struct TestSrcVulkanContext { · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | int initialized; |
| 42 | 42 | FFVkExecPool e; |
| 43 | − FFVkQueueFamilyCtx qf; | |
| 43 | + AVVulkanDeviceQueueFamily *qf; | |
| 44 | 44 | FFVulkanShader shd; |
| 45 | 45 | |
| 46 | 46 | /* Only used by color_vulkan */ |
| @@ -82,8 +82,14 @@ static av_cold int init_filter(AVFilterContext *ctx, enum TestSrcVulkanMode mode · 35 unmodified lines | ||
| 82 | 82 | return AVERROR_EXTERNAL; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | − ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); | |
| 86 | − RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); | |
| 85 | + s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); | |
| 86 | + if (!s->qf) { | |
| 87 | + av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n"); | |
| 88 | + err = AVERROR(ENOTSUP); | |
| 89 | + goto fail; | |
| 90 | + } | |
| 91 | + | |
| 92 | + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | |
| 87 | 93 | RET(ff_vk_shader_init(vkctx, &s->shd, "scale", |
| 88 | 94 | VK_SHADER_STAGE_COMPUTE_BIT, |
| 89 | 95 | NULL, 0, |