[vlc-commits] direct3d11: don't store a d3d11_device_t in the video context
Steve Lhomme
git at videolan.org
Fri Feb 7 15:59:00 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Feb 6 10:01:48 2020 +0100| [d585abe3752db2f9beb65cd7836221d91b836d08] | committer: Steve Lhomme
direct3d11: don't store a d3d11_device_t in the video context
It's already stored in the decoder device that the video context holds.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d585abe3752db2f9beb65cd7836221d91b836d08
---
modules/codec/avcodec/d3d11va.c | 2 --
modules/hw/d3d11/d3d11_deinterlace.c | 3 ++-
modules/hw/d3d11/d3d11_filters.c | 3 ++-
modules/hw/d3d11/d3d11_surface.c | 1 -
modules/video_chroma/d3d11_fmt.c | 14 ++++----------
modules/video_chroma/d3d11_fmt.h | 1 -
modules/video_output/win32/direct3d11.c | 6 +++---
7 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 4eef4fe6b6..5c03285577 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -321,8 +321,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat hwfmt, const
d3d11_video_context_t *priv = GetD3D11ContextPrivate(sys->vctx);
priv->format = sys->render_fmt->formatTexture;
- priv->d3d_dev = devsys->d3d_dev;
- ID3D11DeviceContext_AddRef(priv->d3d_dev.d3dcontext);
va->ops = &ops;
*fmt_out = final_fmt;
diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index 62dd18464a..7ea90c7698 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_deinterlace.c
@@ -262,7 +262,8 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
goto error;
}
- sys->d3d_dev = &vtcx_sys->d3d_dev;
+ d3d11_decoder_device_t *dev_sys = GetD3D11OpaqueContext( filter->vctx_in );
+ sys->d3d_dev = &dev_sys->d3d_dev;
if (D3D11_CreateProcessor(filter, sys->d3d_dev, D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST,
&filter->fmt_out.video, &filter->fmt_out.video, &sys->d3d_proc) != VLC_SUCCESS)
goto error;
diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c
index 3374a35c00..368e24cc5e 100644
--- a/modules/hw/d3d11/d3d11_filters.c
+++ b/modules/hw/d3d11/d3d11_filters.c
@@ -361,7 +361,8 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
memset(sys, 0, sizeof (*sys));
d3d11_video_context_t *vtcx_sys = GetD3D11ContextPrivate( filter->vctx_in );
- sys->d3d_dev = &vtcx_sys->d3d_dev;
+ d3d11_decoder_device_t *dev_sys = GetD3D11OpaqueContext( filter->vctx_in );
+ sys->d3d_dev = &dev_sys->d3d_dev;
DXGI_FORMAT format = vtcx_sys->format;
if (D3D11_CreateProcessor(filter, sys->d3d_dev, D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE,
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index b50ee16be0..98c14f00cf 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -797,7 +797,6 @@ int D3D11OpenCPUConverter( vlc_object_t *obj )
default:
vlc_assert_unreachable();
}
- vctx_sys->d3d_dev = devsys->d3d_dev;
p_filter->p_sys = p_sys;
vlc_fourcc_t d3d_fourcc = DxgiFormatFourcc(vctx_sys->format);
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index fbfa61a4cb..bbea1cc081 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -774,14 +774,8 @@ void D3D11_Destroy(d3d11_handle_t *hd3d)
#endif
}
-static void ReleaseD3D11ContextPrivate(void *private)
-{
- d3d11_video_context_t *octx = private;
- ID3D11DeviceContext_Release(octx->d3d_dev.d3dcontext);
-}
-
const struct vlc_video_context_operations d3d11_vctx_ops = {
- ReleaseD3D11ContextPrivate,
+ NULL,
};
void d3d11_pic_context_destroy(picture_context_t *ctx)
@@ -819,8 +813,8 @@ picture_t *D3D11_AllocPicture(vlc_object_t *obj,
return NULL;
}
- d3d11_video_context_t *vctx_sys = GetD3D11ContextPrivate(vctx_out);
- if (AllocateTextures(obj, &vctx_sys->d3d_dev, cfg,
+ d3d11_decoder_device_t *dev_sys = GetD3D11OpaqueContext(vctx_out);
+ if (AllocateTextures(obj, &dev_sys->d3d_dev, cfg,
fmt, 1, pic_ctx->picsys.texture, NULL) != VLC_SUCCESS)
{
picture_Release(pic);
@@ -828,7 +822,7 @@ picture_t *D3D11_AllocPicture(vlc_object_t *obj,
return NULL;
}
- D3D11_AllocateResourceView(obj, vctx_sys->d3d_dev.d3ddevice, cfg, pic_ctx->picsys.texture, 0, pic_ctx->picsys.renderSrc);
+ D3D11_AllocateResourceView(obj, dev_sys->d3d_dev.d3ddevice, cfg, pic_ctx->picsys.texture, 0, pic_ctx->picsys.renderSrc);
pic_ctx->s = (picture_context_t) {
d3d11_pic_context_destroy, d3d11_pic_context_copy,
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index cd67afcb13..6d17cf57d2 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -93,7 +93,6 @@ typedef struct
typedef struct
{
- d3d11_device_t d3d_dev;
DXGI_FORMAT format;
} d3d11_video_context_t;
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 479c012065..88c49cc385 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -318,10 +318,10 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
sys->startEndRenderingCb = var_InheritAddress( vd, "vout-cb-make-current" );
sys->selectPlaneCb = var_InheritAddress( vd, "vout-cb-select-plane" );
- d3d11_video_context_t *vctx_sys = GetD3D11ContextPrivate(context);
- if ( vctx_sys != NULL )
+ d3d11_decoder_device_t *dev_sys = GetD3D11OpaqueContext(context);
+ if ( dev_sys != NULL )
{
- sys->d3d_dev = &vctx_sys->d3d_dev;
+ sys->d3d_dev = &dev_sys->d3d_dev;
}
else
{
More information about the vlc-commits
mailing list