Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] hwcontext_vulkan: improve queue family init code
@ 2023-10-22  1:56 Lynne
       [not found] ` <NhK5Gyn--3-9@lynne.ee-NhK5Jx_--3-9>
  0 siblings, 1 reply; 2+ messages in thread
From: Lynne @ 2023-10-22  1:56 UTC (permalink / raw)
  To: Ffmpeg Devel

[-- Attachment #1: Type: text/plain, Size: 257 bytes --]

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.

Patch attached.


[-- Attachment #2: 0001-hwcontext_vulkan-improve-queue-family-init-code.patch --]
[-- Type: text/x-diff, Size: 2540 bytes --]

From 39ff0b95e9d7038775da8c07af526c4a50b0af24 Mon Sep 17 00:00:00 2001
From: Lynne <dev@lynne.ee>
Date: Sun, 22 Oct 2023 03:52:33 +0200
Subject: [PATCH] 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.
---
 libavutil/hwcontext_vulkan.c | 14 +++++++-------
 1 file 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
 
-- 
2.42.0


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] hwcontext_vulkan: improve queue family init code
       [not found] ` <NhK5Gyn--3-9@lynne.ee-NhK5Jx_--3-9>
@ 2023-10-24  4:09   ` Lynne
  0 siblings, 0 replies; 2+ messages in thread
From: Lynne @ 2023-10-24  4:09 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Oct 22, 2023, 03:56 by dev@lynne.ee:

> 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.
>
> Patch attached.
>

pushed
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-24  4:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-22  1:56 [FFmpeg-devel] hwcontext_vulkan: improve queue family init code Lynne
     [not found] ` <NhK5Gyn--3-9@lynne.ee-NhK5Jx_--3-9>
2023-10-24  4:09   ` Lynne

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