* [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d12va: wait the texture is used before to free it.
@ 2024-04-08 15:27 Renan Lavarec via ffmpeg-devel
2024-04-09 7:50 ` Wu, Tong1
0 siblings, 1 reply; 2+ messages in thread
From: Renan Lavarec via ffmpeg-devel @ 2024-04-08 15:27 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Renan Lavarec
From: Renan Lavarec 124602499+rlavarec-gpsw@users.noreply.github.com<mailto:124602499+rlavarec-gpsw@users.noreply.github.com>
Date: Mon, 8 Apr 2024 14:38:10 +0200
Subject: [PATCH] avutil/hwcontext_d3d12va: wait the texture is used inside the
GPU before to free it.
fix: ID3D12Resource2::<final-release>: CORRUPTION: An ID3D12Resource object (0x00000222D58B5450:'Unnamed Object') is referenced by GPU operations in-flight on Command Queue (0x00000222EEC87090:'Unnamed ID3D12CommandQueue Object').
It is not safe to final-release objects that may have GPU operations pending. This can result in application instability. [ EXECUTION ERROR #921: OBJECT_DELETED_WHILE_STILL_IN_USE]
---
libavutil/hwcontext_d3d12va.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavutil/hwcontext_d3d12va.c b/libavutil/hwcontext_d3d12va.c
index cfc016315d..621a79d257 100644
--- a/libavutil/hwcontext_d3d12va.c
+++ b/libavutil/hwcontext_d3d12va.c
@@ -220,6 +220,9 @@ static void free_texture(void *opaque, uint8_t *data)
{
AVD3D12VAFrame *frame = (AVD3D12VAFrame *)data;
+ // Wait texture to be available
+ d3d12va_fence_completion(&frame->sync_ctx);
+
D3D12_OBJECT_RELEASE(frame->texture);
D3D12_OBJECT_RELEASE(frame->sync_ctx.fence);
if (frame->sync_ctx.event)
--
2.44.0.windows.1
_______________________________________________
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] [PATCH] avutil/hwcontext_d3d12va: wait the texture is used before to free it.
2024-04-08 15:27 [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d12va: wait the texture is used before to free it Renan Lavarec via ffmpeg-devel
@ 2024-04-09 7:50 ` Wu, Tong1
0 siblings, 0 replies; 2+ messages in thread
From: Wu, Tong1 @ 2024-04-09 7:50 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Renan Lavarec
Hi,
>From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Renan
>Lavarec via ffmpeg-devel
>Sent: Monday, April 8, 2024 11:27 PM
>To: ffmpeg-devel@ffmpeg.org
>Cc: Renan Lavarec <rlavarec@gopro.com>
>Subject: [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d12va: wait the texture is
>used before to free it.
>
>From: Renan Lavarec 124602499+rlavarec-
>gpsw@users.noreply.github.com<mailto:124602499+rlavarec-
>gpsw@users.noreply.github.com>
>Date: Mon, 8 Apr 2024 14:38:10 +0200
>Subject: [PATCH] avutil/hwcontext_d3d12va: wait the texture is used inside the
>GPU before to free it.
>
>fix: ID3D12Resource2::<final-release>: CORRUPTION: An ID3D12Resource
>object (0x00000222D58B5450:'Unnamed Object') is referenced by GPU
>operations in-flight on Command Queue (0x00000222EEC87090:'Unnamed
>ID3D12CommandQueue Object').
> It is not safe to final-release objects that may have GPU operations pending.
>This can result in application instability. [ EXECUTION ERROR #921:
>OBJECT_DELETED_WHILE_STILL_IN_USE]
>---
>libavutil/hwcontext_d3d12va.c | 3 +++
>1 file changed, 3 insertions(+)
>
>diff --git a/libavutil/hwcontext_d3d12va.c b/libavutil/hwcontext_d3d12va.c
>index cfc016315d..621a79d257 100644
>--- a/libavutil/hwcontext_d3d12va.c
>+++ b/libavutil/hwcontext_d3d12va.c
>@@ -220,6 +220,9 @@ static void free_texture(void *opaque, uint8_t *data)
>{
> AVD3D12VAFrame *frame = (AVD3D12VAFrame *)data;
>
>+ // Wait texture to be available
>+ d3d12va_fence_completion(&frame->sync_ctx);
>+
> D3D12_OBJECT_RELEASE(frame->texture);
> D3D12_OBJECT_RELEASE(frame->sync_ctx.fence);
> if (frame->sync_ctx.event)
>--
>2.44.0.windows.1
At what scenario will this happen? I think decoder should be responsible for the completion of the CommandQueue before releasing the buffer pool. And that's what d3d12va_decode has already done in uninit call. Thanks.
-Tong
_______________________________________________
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:[~2024-04-09 7:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08 15:27 [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d12va: wait the texture is used before to free it Renan Lavarec via ffmpeg-devel
2024-04-09 7:50 ` Wu, Tong1
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