Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d11va: enable D3D11_RESOURCE_MISC_SHARED for texture
@ 2022-04-20  4:10 Tong Wu
  2022-04-20  6:35 ` Hendrik Leppkes
  0 siblings, 1 reply; 3+ messages in thread
From: Tong Wu @ 2022-04-20  4:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Tong Wu

Add D3D11_RESOURCE_MISC_SHARED flag for texture to make it shareable.
This can fix the green frames issue when mapping from d3d11va to opencl.
Sample command line: ffmpeg.exe -hwaccel d3d11va -hwaccel_output_format
d3d11 -i input.264 -vf
"hwmap=derive_device=opencl,format=opencl,hwdownload,format=nv12" -c:v
libx264 output.mp4

Signed-off-by: Tong Wu <tong1.wu@intel.com>
---
 libavutil/hwcontext_d3d11va.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index 8ab96bad25..c7227a13b4 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -199,7 +199,7 @@ static AVBufferRef *d3d11va_alloc_single(AVHWFramesContext *ctx)
         .ArraySize  = 1,
         .Usage      = D3D11_USAGE_DEFAULT,
         .BindFlags  = hwctx->BindFlags,
-        .MiscFlags  = hwctx->MiscFlags,
+        .MiscFlags  = hwctx->MiscFlags | D3D11_RESOURCE_MISC_SHARED,
     };
 
     hr = ID3D11Device_CreateTexture2D(device_hwctx->device, &texDesc, NULL, &tex);
@@ -263,7 +263,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx)
         .ArraySize  = ctx->initial_pool_size,
         .Usage      = D3D11_USAGE_DEFAULT,
         .BindFlags  = hwctx->BindFlags,
-        .MiscFlags  = hwctx->MiscFlags,
+        .MiscFlags  = hwctx->MiscFlags | D3D11_RESOURCE_MISC_SHARED,
     };
 
     if (hwctx->texture) {
-- 
2.35.3.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] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d11va: enable D3D11_RESOURCE_MISC_SHARED for texture
  2022-04-20  4:10 [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d11va: enable D3D11_RESOURCE_MISC_SHARED for texture Tong Wu
@ 2022-04-20  6:35 ` Hendrik Leppkes
  2022-04-20  7:42   ` Wu, Tong1
  0 siblings, 1 reply; 3+ messages in thread
From: Hendrik Leppkes @ 2022-04-20  6:35 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Wed, Apr 20, 2022 at 6:11 AM Tong Wu
<tong1.wu-at-intel.com@ffmpeg.org> wrote:
>
> Add D3D11_RESOURCE_MISC_SHARED flag for texture to make it shareable.
> This can fix the green frames issue when mapping from d3d11va to opencl.
> Sample command line: ffmpeg.exe -hwaccel d3d11va -hwaccel_output_format
> d3d11 -i input.264 -vf
> "hwmap=derive_device=opencl,format=opencl,hwdownload,format=nv12" -c:v
> libx264 output.mp4
>

The flags are configurable, we should not force them for specific cases.
Specifically, there is also two ways to share a texture, this flag and
the D3D11_RESOURCE_MISC_SHARED_NTHANDLE flag (which is preferable for
new code), which would conflict with each other, making it impossible
to set it.

- Hendrik
_______________________________________________
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] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d11va: enable D3D11_RESOURCE_MISC_SHARED for texture
  2022-04-20  6:35 ` Hendrik Leppkes
@ 2022-04-20  7:42   ` Wu, Tong1
  0 siblings, 0 replies; 3+ messages in thread
From: Wu, Tong1 @ 2022-04-20  7:42 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Hendrik Leppkes
> Sent: Wednesday, April 20, 2022 2:35 PM
> To: FFmpeg development discussions and patches <ffmpeg-
> devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d11va: enable
> D3D11_RESOURCE_MISC_SHARED for texture
> 
> On Wed, Apr 20, 2022 at 6:11 AM Tong Wu
> <tong1.wu-at-intel.com@ffmpeg.org> wrote:
> >
> > Add D3D11_RESOURCE_MISC_SHARED flag for texture to make it shareable.
> > This can fix the green frames issue when mapping from d3d11va to opencl.
> > Sample command line: ffmpeg.exe -hwaccel d3d11va
> > -hwaccel_output_format
> > d3d11 -i input.264 -vf
> > "hwmap=derive_device=opencl,format=opencl,hwdownload,format=nv12"
> -c:v
> > libx264 output.mp4
> >
> 
> The flags are configurable, we should not force them for specific cases.
> Specifically, there is also two ways to share a texture, this flag and the
> D3D11_RESOURCE_MISC_SHARED_NTHANDLE flag (which is preferable for
> new code), which would conflict with each other, making it impossible to set
> it.
> 

Thanks for the review. Since the flags should not be set for those specific cases
like that, is there any feasible way to enable the share resource between d3d11 
and opencl and make the sample command line work?

> - Hendrik
> _______________________________________________
> 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".
_______________________________________________
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] 3+ messages in thread

end of thread, other threads:[~2022-04-20  7:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20  4:10 [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d11va: enable D3D11_RESOURCE_MISC_SHARED for texture Tong Wu
2022-04-20  6:35 ` Hendrik Leppkes
2022-04-20  7:42   ` 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