1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avfilter/hwmap: Set default BindFlags for reverse hw mapping to d3d11

When reverse mapping, hwmap creates a new hw frames context with default
parameters. In case of d3d11, the default for BindFlags is 0, for which
fixed-size pool allocation fails and for which textures are hardly
usable for anything in terms of video acceleration.

While the author would have preferred a solution in hwcontext_d3d11va,
the discussion ended up favoring this way.

See here: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24046

Signed-off-by: softworkz <softworkz@hotmail.com>
This commit is contained in:
softworkz
2026-08-12 02:13:03 +02:00
committed by Kacper Michajłow
parent 78f50dc45a
commit c7cf091d67

View File

@@ -22,6 +22,10 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#if CONFIG_D3D11VA
#include "libavutil/hwcontext_d3d11va.h"
#endif
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
@@ -151,6 +155,12 @@ static int hwmap_config_output(AVFilterLink *outlink)
if (avctx->extra_hw_frames >= 0)
frames->initial_pool_size = 2 + avctx->extra_hw_frames;
#if CONFIG_D3D11VA
if (frames->format == AV_PIX_FMT_D3D11) {
AVD3D11VAFramesContext *frames_d3d11 = frames->hwctx;
frames_d3d11->BindFlags = D3D11_BIND_DECODER | D3D11_BIND_SHADER_RESOURCE;
}
#endif
err = av_hwframe_ctx_init(ctx->hwframes_ref);
if (err < 0) {
av_log(avctx, AV_LOG_ERROR, "Failed to initialise "