FFmpeg
Data Structures | Typedefs | Functions | Variables
hwcontext_d3d12va.c File Reference
#include "config.h"
#include "common.h"
#include "hwcontext.h"
#include "hwcontext_internal.h"
#include "hwcontext_d3d12va_internal.h"
#include "hwcontext_d3d12va.h"
#include "imgutils.h"
#include "mem.h"
#include "pixdesc.h"
#include "pixfmt.h"
#include "thread.h"
#include "compat/w32dlfcn.h"
#include <dxgi1_3.h>

Go to the source code of this file.

Data Structures

struct  D3D12VAFramesContext
 
struct  D3D12VADevicePriv
 

Typedefs

typedef HRESULT(WINAPI * PFN_CREATE_DXGI_FACTORY2) (UINT Flags, REFIID riid, void **ppFactory)
 

Functions

static void d3d12va_default_lock (void *ctx)
 
static void d3d12va_default_unlock (void *ctx)
 
static int d3d12va_fence_completion (AVD3D12VASyncContext *psync_ctx)
 
static int d3d12va_wait_queue_idle (AVD3D12VASyncContext *psync_ctx, ID3D12CommandQueue *command_queue)
 
static int d3d12va_create_staging_buffer_resource (AVHWFramesContext *ctx, D3D12_RESOURCE_STATES states, ID3D12Resource **ppResource, int download)
 
static int d3d12va_create_helper_objects (AVHWFramesContext *ctx)
 
static void d3d12va_frames_uninit (AVHWFramesContext *ctx)
 
static int d3d12va_frames_get_constraints (AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
 
static void free_texture (void *opaque, uint8_t *data)
 
static AVBufferRefd3d12va_pool_alloc (void *opaque, size_t size)
 
static int d3d12va_frames_init (AVHWFramesContext *ctx)
 
static int d3d12va_get_buffer (AVHWFramesContext *ctx, AVFrame *frame)
 
static int d3d12va_transfer_get_formats (AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
 
static int d3d12va_transfer_data (AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
 
static int d3d12va_load_functions (AVHWDeviceContext *hwdev)
 
static void d3d12va_device_free (AVHWDeviceContext *hwdev)
 
static int d3d12va_device_init (AVHWDeviceContext *hwdev)
 
static void d3d12va_device_uninit (AVHWDeviceContext *hwdev)
 
static int d3d12va_device_create (AVHWDeviceContext *hwdev, const char *device, AVDictionary *opts, int flags)
 

Variables

struct {
   DXGI_FORMAT   d3d_format
 
   enum AVPixelFormat   pix_fmt
 
supported_formats []
 
const HWContextType ff_hwcontext_type_d3d12va
 

Typedef Documentation

◆ PFN_CREATE_DXGI_FACTORY2

typedef HRESULT(WINAPI * PFN_CREATE_DXGI_FACTORY2) (UINT Flags, REFIID riid, void **ppFactory)

Definition at line 37 of file hwcontext_d3d12va.c.

Function Documentation

◆ d3d12va_default_lock()

static void d3d12va_default_lock ( void *  ctx)
static

Definition at line 74 of file hwcontext_d3d12va.c.

Referenced by d3d12va_device_init(), and d3d12va_device_uninit().

◆ d3d12va_default_unlock()

static void d3d12va_default_unlock ( void *  ctx)
static

Definition at line 79 of file hwcontext_d3d12va.c.

Referenced by d3d12va_device_init().

◆ d3d12va_fence_completion()

static int d3d12va_fence_completion ( AVD3D12VASyncContext psync_ctx)
static

Definition at line 84 of file hwcontext_d3d12va.c.

Referenced by d3d12va_wait_queue_idle().

◆ d3d12va_wait_queue_idle()

static int d3d12va_wait_queue_idle ( AVD3D12VASyncContext psync_ctx,
ID3D12CommandQueue *  command_queue 
)
inlinestatic

Definition at line 97 of file hwcontext_d3d12va.c.

Referenced by d3d12va_create_helper_objects(), and d3d12va_transfer_data().

◆ d3d12va_create_staging_buffer_resource()

static int d3d12va_create_staging_buffer_resource ( AVHWFramesContext ctx,
D3D12_RESOURCE_STATES  states,
ID3D12Resource **  ppResource,
int  download 
)
static

Definition at line 106 of file hwcontext_d3d12va.c.

Referenced by d3d12va_transfer_data().

◆ d3d12va_create_helper_objects()

static int d3d12va_create_helper_objects ( AVHWFramesContext ctx)
static

Definition at line 134 of file hwcontext_d3d12va.c.

Referenced by d3d12va_transfer_data().

◆ d3d12va_frames_uninit()

static void d3d12va_frames_uninit ( AVHWFramesContext ctx)
static

Definition at line 175 of file hwcontext_d3d12va.c.

◆ d3d12va_frames_get_constraints()

static int d3d12va_frames_get_constraints ( AVHWDeviceContext ctx,
const void *  hwconfig,
AVHWFramesConstraints constraints 
)
static

Definition at line 190 of file hwcontext_d3d12va.c.

◆ free_texture()

static void free_texture ( void *  opaque,
uint8_t *  data 
)
static

Definition at line 219 of file hwcontext_d3d12va.c.

Referenced by d3d12va_pool_alloc().

◆ d3d12va_pool_alloc()

static AVBufferRef* d3d12va_pool_alloc ( void *  opaque,
size_t  size 
)
static

Definition at line 231 of file hwcontext_d3d12va.c.

Referenced by d3d12va_frames_init().

◆ d3d12va_frames_init()

static int d3d12va_frames_init ( AVHWFramesContext ctx)
static

Definition at line 281 of file hwcontext_d3d12va.c.

◆ d3d12va_get_buffer()

static int d3d12va_get_buffer ( AVHWFramesContext ctx,
AVFrame frame 
)
static

Definition at line 310 of file hwcontext_d3d12va.c.

◆ d3d12va_transfer_get_formats()

static int d3d12va_transfer_get_formats ( AVHWFramesContext ctx,
enum AVHWFrameTransferDirection  dir,
enum AVPixelFormat **  formats 
)
static

Definition at line 332 of file hwcontext_d3d12va.c.

◆ d3d12va_transfer_data()

static int d3d12va_transfer_data ( AVHWFramesContext ctx,
AVFrame dst,
const AVFrame src 
)
static

Definition at line 350 of file hwcontext_d3d12va.c.

◆ d3d12va_load_functions()

static int d3d12va_load_functions ( AVHWDeviceContext hwdev)
static

Definition at line 537 of file hwcontext_d3d12va.c.

Referenced by d3d12va_device_create().

◆ d3d12va_device_free()

static void d3d12va_device_free ( AVHWDeviceContext hwdev)
static

Definition at line 569 of file hwcontext_d3d12va.c.

Referenced by d3d12va_device_create().

◆ d3d12va_device_init()

static int d3d12va_device_init ( AVHWDeviceContext hwdev)
static

Definition at line 583 of file hwcontext_d3d12va.c.

◆ d3d12va_device_uninit()

static void d3d12va_device_uninit ( AVHWDeviceContext hwdev)
static

Definition at line 606 of file hwcontext_d3d12va.c.

◆ d3d12va_device_create()

static int d3d12va_device_create ( AVHWDeviceContext hwdev,
const char *  device,
AVDictionary opts,
int  flags 
)
static

Definition at line 619 of file hwcontext_d3d12va.c.

Variable Documentation

◆ d3d_format

DXGI_FORMAT d3d_format

Definition at line 67 of file hwcontext_d3d12va.c.

◆ pix_fmt

enum AVPixelFormat pix_fmt

Definition at line 68 of file hwcontext_d3d12va.c.

◆ supported_formats

const { ... } supported_formats[]
Initial value:
= {
{ DXGI_FORMAT_NV12, AV_PIX_FMT_NV12 },
{ DXGI_FORMAT_P010, AV_PIX_FMT_P010 },
}

Referenced by d3d12va_frames_get_constraints(), and d3d12va_frames_init().

◆ ff_hwcontext_type_d3d12va

const HWContextType ff_hwcontext_type_d3d12va
Initial value:
= {
.name = "D3D12VA",
.device_hwctx_size = sizeof(D3D12VADevicePriv),
.frames_hwctx_size = sizeof(D3D12VAFramesContext),
.device_create = d3d12va_device_create,
.device_init = d3d12va_device_init,
.device_uninit = d3d12va_device_uninit,
.frames_get_constraints = d3d12va_frames_get_constraints,
.frames_init = d3d12va_frames_init,
.frames_uninit = d3d12va_frames_uninit,
.frames_get_buffer = d3d12va_get_buffer,
.transfer_get_formats = d3d12va_transfer_get_formats,
.transfer_data_to = d3d12va_transfer_data,
.transfer_data_from = d3d12va_transfer_data,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_D3D12, AV_PIX_FMT_NONE },
}

Definition at line 679 of file hwcontext_d3d12va.c.

d3d12va_transfer_data
static int d3d12va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
Definition: hwcontext_d3d12va.c:350
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
d3d12va_frames_get_constraints
static int d3d12va_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
Definition: hwcontext_d3d12va.c:190
D3D12VADevicePriv
Definition: hwcontext_d3d12va.c:54
d3d12va_device_create
static int d3d12va_device_create(AVHWDeviceContext *hwdev, const char *device, AVDictionary *opts, int flags)
Definition: hwcontext_d3d12va.c:619
d3d12va_device_init
static int d3d12va_device_init(AVHWDeviceContext *hwdev)
Definition: hwcontext_d3d12va.c:583
AV_PIX_FMT_D3D12
@ AV_PIX_FMT_D3D12
Hardware surfaces for Direct3D 12.
Definition: pixfmt.h:440
AV_HWDEVICE_TYPE_D3D12VA
@ AV_HWDEVICE_TYPE_D3D12VA
Definition: hwcontext.h:40
d3d12va_frames_init
static int d3d12va_frames_init(AVHWFramesContext *ctx)
Definition: hwcontext_d3d12va.c:281
d3d12va_frames_uninit
static void d3d12va_frames_uninit(AVHWFramesContext *ctx)
Definition: hwcontext_d3d12va.c:175
AV_PIX_FMT_NV12
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:96
d3d12va_get_buffer
static int d3d12va_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
Definition: hwcontext_d3d12va.c:310
D3D12VAFramesContext
Definition: hwcontext_d3d12va.c:39
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_P010
#define AV_PIX_FMT_P010
Definition: pixfmt.h:552
d3d12va_transfer_get_formats
static int d3d12va_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
Definition: hwcontext_d3d12va.c:332
d3d12va_device_uninit
static void d3d12va_device_uninit(AVHWDeviceContext *hwdev)
Definition: hwcontext_d3d12va.c:606