Re: [FFmpeg-devel] [PATCH v6 1/9] libavutil: add hwcontext_d3d12va and AV_PIX_FMT_D3D12

2023-08-28 Thread Wu, Tong1



>-Original Message-
>From: ffmpeg-devel  On Behalf Of Lynne
>Sent: Saturday, August 26, 2023 3:17 AM
>To: FFmpeg development discussions and patches de...@ffmpeg.org>
>Subject: Re: [FFmpeg-devel] [PATCH v6 1/9] libavutil: add hwcontext_d3d12va
>and AV_PIX_FMT_D3D12
>
>Aug 25, 2023, 10:49 by tong1.wu-at-intel@ffmpeg.org:
>
>> V6 major changes
>> 1. the way d3dlibs created, adding a load function. Added dlclose in free
>function.
>> 2. Simplified the public sync API by only keeping av_d3d12va_wait_idle.
>> 3. Wrapping data->[0], data[1], data[2] into one single structure.
>>
>
>This hasn't fixed my issues with the previous version.
>av_d3d12va_wait_idle is in particular looks like a convenience function
>rather than something that must always be called for valid API usage.

Ok it makes sense. I'll remove it from API in v7.
>Also, we have dlopen/dlclose wrappers that you should be using
>instead.

dlopen has already been a wrapper for LoadLibrary on Windows. Please see 
compat/w32dlfcn.h

#define dlopen(name, flags) win32_dlopen(name)

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-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v6 1/9] libavutil: add hwcontext_d3d12va and AV_PIX_FMT_D3D12

2023-08-25 Thread Lynne
Aug 25, 2023, 10:49 by tong1.wu-at-intel@ffmpeg.org:

> V6 major changes
> 1. the way d3dlibs created, adding a load function. Added dlclose in free 
> function.
> 2. Simplified the public sync API by only keeping av_d3d12va_wait_idle.
> 3. Wrapping data->[0], data[1], data[2] into one single structure.
>

This hasn't fixed my issues with the previous version.
av_d3d12va_wait_idle is in particular looks like a convenience function
rather than something that must always be called for valid API usage.
Also, we have dlopen/dlclose wrappers that you should be using
instead.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v6 1/9] libavutil: add hwcontext_d3d12va and AV_PIX_FMT_D3D12

2023-08-25 Thread Wu, Tong1
V6 major changes
1. the way d3dlibs created, adding a load function. Added dlclose in free 
function.
2. Simplified the public sync API by only keeping av_d3d12va_wait_idle.
3. Wrapping data->[0], data[1], data[2] into one single structure.


>Subject: [PATCH v6 1/9] libavutil: add hwcontext_d3d12va and
>AV_PIX_FMT_D3D12
>
>From: Wu Jianhua 
>
>Signed-off-by: Wu Jianhua 
>Signed-off-by: Tong Wu 
>---
> configure  |   5 +
> doc/APIchanges |   7 +
> libavutil/Makefile |   3 +
> libavutil/hwcontext.c  |   4 +
> libavutil/hwcontext.h  |   1 +
> libavutil/hwcontext_d3d12va.c  | 693 +
> libavutil/hwcontext_d3d12va.h  | 155 ++
> libavutil/hwcontext_d3d12va_internal.h |  59 +++
> libavutil/hwcontext_internal.h |   1 +
> libavutil/pixdesc.c|   4 +
> libavutil/pixfmt.h |   7 +
> libavutil/tests/hwdevice.c |   2 +
> libavutil/version.h|   2 +-
> 13 files changed, 942 insertions(+), 1 deletion(-)
> create mode 100644 libavutil/hwcontext_d3d12va.c
> create mode 100644 libavutil/hwcontext_d3d12va.h
> create mode 100644 libavutil/hwcontext_d3d12va_internal.h
>
>diff --git a/configure b/configure
>index 04bb9fe9dd..b74a668f87 100755
>--- a/configure
>+++ b/configure
>@@ -338,6 +338,7 @@ External library support:
>   --disable-cuda-llvm  disable CUDA compilation using clang [autodetect]
>   --disable-cuvid  disable Nvidia CUVID support [autodetect]
>   --disable-d3d11vadisable Microsoft Direct3D 11 video acceleration 
> code
>[autodetect]
>+  --disable-d3d12vadisable Microsoft Direct3D 12 video acceleration 
>code
>[autodetect]
>   --disable-dxva2  disable Microsoft DirectX 9 video acceleration code
>[autodetect]
>   --disable-ffnvcodec  disable dynamically linked Nvidia code [autodetect]
>   --enable-libdrm  enable DRM code (Linux) [no]
>@@ -1926,6 +1927,7 @@ HWACCEL_AUTODETECT_LIBRARY_LIST="
> cuda_llvm
> cuvid
> d3d11va
>+d3d12va
> dxva2
> ffnvcodec
> nvdec
>@@ -3053,6 +3055,7 @@ crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
> cuda_deps="ffnvcodec"
> cuvid_deps="ffnvcodec"
> d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
>+d3d12va_deps="dxva_h ID3D12Device ID3D12VideoDecoder"
> dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
> ffnvcodec_deps_any="libdl LoadLibrary"
> mediacodec_deps="android"
>@@ -6546,6 +6549,8 @@ check_type "windows.h dxgi1_2.h" "IDXGIOutput1"
> check_type "windows.h dxgi1_5.h" "IDXGIOutput5"
> check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
> check_type "windows.h d3d11.h" "ID3D11VideoContext"
>+check_type "windows.h d3d12.h" "ID3D12Device"
>+check_type "windows.h d3d12video.h" "ID3D12VideoDecoder"
> check_type "windows.h" "DPI_AWARENESS_CONTEXT" -
>D_WIN32_WINNT=0x0A00
> check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -
>D_WIN32_WINNT=0x0602
> check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat
>diff --git a/doc/APIchanges b/doc/APIchanges
>index ad1efe708d..37ce29323d 100644
>--- a/doc/APIchanges
>+++ b/doc/APIchanges
>@@ -2,6 +2,13 @@ The last version increases of all libraries were on 2023-02-
>09
>
> API changes, most recent first:
>
>+2023-07-xx - xx - lavu 58.18.100 - pixfmt.h hwcontext.h
>hwcontext_d3d12va.h
>+  Add AV_HWDEVICE_TYPE_D3D12VA and AV_PIX_FMT_D3D12.
>+  Add AVD3D12VADeviceContext, AVD3D12VASyncContext, AVD3D12VAFrame
>and
>+  AVD3D12VAFramesContext.
>+  Add av_d3d12va_map_sw_to_hw_format, av_d3d12va_sync_context_alloc,
>+  av_d3d12va_sync_context_free, av_d3d12va_wait_idle.
>+
> 2023-08-18 - xx - lavu 58.17.100 - channel_layout.h
>   All AV_CHANNEL_LAYOUT_* macros are now compatible with C++ 17 and
>older.
>
>diff --git a/libavutil/Makefile b/libavutil/Makefile
>index 7828c94dc5..db318534eb 100644
>--- a/libavutil/Makefile
>+++ b/libavutil/Makefile
>@@ -41,6 +41,7 @@ HEADERS = adler32.h  
>   \
>   hwcontext.h   \
>   hwcontext_cuda.h  \
>   hwcontext_d3d11va.h   \
>+  hwcontext_d3d12va.h   \
>   hwcontext_drm.h   \
>   hwcontext_dxva2.h \
>   hwcontext_qsv.h   \
>@@ -188,6 +189,7 @@ OBJS = adler32.o   
> \
>
> OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
> OBJS-$(CONFIG_D3D11VA)  += hwcontext_d3d11va.o
>+OBJS-$(CONFIG_D3D12VA)  += hwcontext_d3d12va.o
> OBJS-$(CONFIG_DXVA2)+= hwcontext_dxva2.o

[FFmpeg-devel] [PATCH v6 1/9] libavutil: add hwcontext_d3d12va and AV_PIX_FMT_D3D12

2023-08-25 Thread Tong Wu
From: Wu Jianhua 

Signed-off-by: Wu Jianhua 
Signed-off-by: Tong Wu 
---
 configure  |   5 +
 doc/APIchanges |   7 +
 libavutil/Makefile |   3 +
 libavutil/hwcontext.c  |   4 +
 libavutil/hwcontext.h  |   1 +
 libavutil/hwcontext_d3d12va.c  | 693 +
 libavutil/hwcontext_d3d12va.h  | 155 ++
 libavutil/hwcontext_d3d12va_internal.h |  59 +++
 libavutil/hwcontext_internal.h |   1 +
 libavutil/pixdesc.c|   4 +
 libavutil/pixfmt.h |   7 +
 libavutil/tests/hwdevice.c |   2 +
 libavutil/version.h|   2 +-
 13 files changed, 942 insertions(+), 1 deletion(-)
 create mode 100644 libavutil/hwcontext_d3d12va.c
 create mode 100644 libavutil/hwcontext_d3d12va.h
 create mode 100644 libavutil/hwcontext_d3d12va_internal.h

diff --git a/configure b/configure
index 04bb9fe9dd..b74a668f87 100755
--- a/configure
+++ b/configure
@@ -338,6 +338,7 @@ External library support:
   --disable-cuda-llvm  disable CUDA compilation using clang [autodetect]
   --disable-cuvid  disable Nvidia CUVID support [autodetect]
   --disable-d3d11vadisable Microsoft Direct3D 11 video acceleration 
code [autodetect]
+  --disable-d3d12vadisable Microsoft Direct3D 12 video acceleration 
code [autodetect]
   --disable-dxva2  disable Microsoft DirectX 9 video acceleration code 
[autodetect]
   --disable-ffnvcodec  disable dynamically linked Nvidia code [autodetect]
   --enable-libdrm  enable DRM code (Linux) [no]
@@ -1926,6 +1927,7 @@ HWACCEL_AUTODETECT_LIBRARY_LIST="
 cuda_llvm
 cuvid
 d3d11va
+d3d12va
 dxva2
 ffnvcodec
 nvdec
@@ -3053,6 +3055,7 @@ crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
 cuda_deps="ffnvcodec"
 cuvid_deps="ffnvcodec"
 d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
+d3d12va_deps="dxva_h ID3D12Device ID3D12VideoDecoder"
 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
 ffnvcodec_deps_any="libdl LoadLibrary"
 mediacodec_deps="android"
@@ -6546,6 +6549,8 @@ check_type "windows.h dxgi1_2.h" "IDXGIOutput1"
 check_type "windows.h dxgi1_5.h" "IDXGIOutput5"
 check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
 check_type "windows.h d3d11.h" "ID3D11VideoContext"
+check_type "windows.h d3d12.h" "ID3D12Device"
+check_type "windows.h d3d12video.h" "ID3D12VideoDecoder"
 check_type "windows.h" "DPI_AWARENESS_CONTEXT" -D_WIN32_WINNT=0x0A00
 check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
 check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat
diff --git a/doc/APIchanges b/doc/APIchanges
index ad1efe708d..37ce29323d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,13 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2023-07-xx - xx - lavu 58.18.100 - pixfmt.h hwcontext.h 
hwcontext_d3d12va.h
+  Add AV_HWDEVICE_TYPE_D3D12VA and AV_PIX_FMT_D3D12.
+  Add AVD3D12VADeviceContext, AVD3D12VASyncContext, AVD3D12VAFrame and
+  AVD3D12VAFramesContext.
+  Add av_d3d12va_map_sw_to_hw_format, av_d3d12va_sync_context_alloc,
+  av_d3d12va_sync_context_free, av_d3d12va_wait_idle.
+
 2023-08-18 - xx - lavu 58.17.100 - channel_layout.h
   All AV_CHANNEL_LAYOUT_* macros are now compatible with C++ 17 and older.
 
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 7828c94dc5..db318534eb 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -41,6 +41,7 @@ HEADERS = adler32.h   
  \
   hwcontext.h   \
   hwcontext_cuda.h  \
   hwcontext_d3d11va.h   \
+  hwcontext_d3d12va.h   \
   hwcontext_drm.h   \
   hwcontext_dxva2.h \
   hwcontext_qsv.h   \
@@ -188,6 +189,7 @@ OBJS = adler32.o
\
 
 OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
 OBJS-$(CONFIG_D3D11VA)  += hwcontext_d3d11va.o
+OBJS-$(CONFIG_D3D12VA)  += hwcontext_d3d12va.o
 OBJS-$(CONFIG_DXVA2)+= hwcontext_dxva2.o
 OBJS-$(CONFIG_LIBDRM)   += hwcontext_drm.o
 OBJS-$(CONFIG_MACOS_KPERF)  += macos_kperf.o
@@ -211,6 +213,7 @@ SKIPHEADERS-$(HAVE_CUDA_H) += hwcontext_cuda.h
 SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda_internal.h \
   cuda_check.h
 SKIPHEADERS-$(CONFIG_D3D11VA)  += hwcontext_d3d11va.h
+SKIPHEADERS-$(CONFIG_D3D12VA)