aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2023-10-22 03:52:33 +0200
committerLynne <dev@lynne.ee>2023-10-24 06:07:09 +0200
commitc258623c0a635d98e7e21123215446ebd2201b1e (patch)
treeea576430c28d6cb7f9cfee0b07deaf8ae63b5af3
parentff5a3575fec2d49d5fae4ec1198a939e203314db (diff)
downloadffmpeg-c258623c0a635d98e7e21123215446ebd2201b1e.tar.gz
hwcontext_vulkan: improve queue family init code
When users zero-init'd the struct, or left it as-is, the encode queue family matched the graphics queue family, which led it to be incorrectly logged as being used for encode. This just improves the logging so this isn't printed anymore.
-rw-r--r--libavutil/hwcontext_vulkan.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index b955ec483e..4adcc0e839 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1475,11 +1475,11 @@ static int vulkan_device_init(AVHWDeviceContext *ctx)
av_free(qf);
- graph_index = hwctx->queue_family_index;
- comp_index = hwctx->queue_family_comp_index;
- tx_index = hwctx->queue_family_tx_index;
- enc_index = hwctx->queue_family_encode_index;
- dec_index = hwctx->queue_family_decode_index;
+ graph_index = hwctx->nb_graphics_queues ? hwctx->queue_family_index : -1;
+ comp_index = hwctx->nb_comp_queues ? hwctx->queue_family_comp_index : -1;
+ tx_index = hwctx->nb_tx_queues ? hwctx->queue_family_tx_index : -1;
+ dec_index = hwctx->nb_decode_queues ? hwctx->queue_family_decode_index : -1;
+ enc_index = hwctx->nb_encode_queues ? hwctx->queue_family_encode_index : -1;
#define CHECK_QUEUE(type, required, fidx, ctx_qf, qc) \
do { \
@@ -1512,10 +1512,10 @@ static int vulkan_device_init(AVHWDeviceContext *ctx)
} while (0)
CHECK_QUEUE("graphics", 0, graph_index, hwctx->queue_family_index, hwctx->nb_graphics_queues);
- CHECK_QUEUE("upload", 1, tx_index, hwctx->queue_family_tx_index, hwctx->nb_tx_queues);
CHECK_QUEUE("compute", 1, comp_index, hwctx->queue_family_comp_index, hwctx->nb_comp_queues);
- CHECK_QUEUE("encode", 0, enc_index, hwctx->queue_family_encode_index, hwctx->nb_encode_queues);
+ CHECK_QUEUE("upload", 1, tx_index, hwctx->queue_family_tx_index, hwctx->nb_tx_queues);
CHECK_QUEUE("decode", 0, dec_index, hwctx->queue_family_decode_index, hwctx->nb_decode_queues);
+ CHECK_QUEUE("encode", 0, enc_index, hwctx->queue_family_encode_index, hwctx->nb_encode_queues);
#undef CHECK_QUEUE