PR #25652 opened by JuliusBairaktaris URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25652 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25652.patch
`d3d11va_transfer_data()` takes the device lock and returns without releasing it when the staging texture cannot be created, so every other thread that takes the lock afterwards blocks. Found by the Forgejo_Fairy review of #25458. Tested on Windows 11, RX 9070 XT, driver 32.0.32015.7029, with a program that uploads a yuv420p frame to a frames context with that sw_format (DXGI_FORMAT_420_OPAQUE cannot be a staging texture): before, a second thread could not take the lock within 2 s after the failed upload; now it can. Written with Claude Opus 5.5 in Claude Code; `Assisted-by` trailer on the commit. >From edda25f8c5140f2a89b283219e6cc5cccb5540d2 Mon Sep 17 00:00:00 2001 From: Julius Bairaktaris <[email protected]> Date: Sun, 1 Nov 2026 13:01:15 +0100 Subject: [PATCH] avutil/hwcontext_d3d11va: unlock the device when the staging texture fails d3d11va_transfer_data() takes the device lock and then returns without releasing it when the staging texture cannot be created. Every other thread that takes the lock afterwards, such as a decoder or another transfer on the same device, blocks forever. Release the lock on that error path. Reported by the Forgejo_Fairy review of #25458. Tested on Windows 11, RX 9070 XT, driver 32.0.32015.7029, with a test program that uploads a yuv420p frame to a frames context with that sw_format, whose DXGI_FORMAT_420_OPAQUE cannot be used for a staging texture: before, a second thread could not take the lock within 2 s after the failed upload; now it can. Assisted-by: Claude Opus 5.5 Signed-off-by: Julius Bairaktaris <[email protected]> --- libavutil/hwcontext_d3d11va.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index be0523b05b2..703df48d38f 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -457,8 +457,10 @@ static int d3d11va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, if (!s->staging_texture) { ID3D11Texture2D_GetDesc((ID3D11Texture2D *)texture, &desc); res = d3d11va_create_staging_texture(ctx, desc.Format); - if (res < 0) + if (res < 0) { + device_hwctx->unlock(device_hwctx->lock_ctx); return res; + } } staging = (ID3D11Resource *)s->staging_texture; -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
