summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-05-24 14:30:15 +0200
committerwm4 <wm4@nowhere>2016-05-24 14:30:15 +0200
commit8ff96f0216884f9bd3c60857e629a25aaa8704de (patch)
tree1f0dc15225a97006a9d3082dc4905c2e81af6627
parentd941a57bd3c8d7a738c814a7da90ce7d04deac68 (diff)
downloadmpv-8ff96f0216884f9bd3c60857e629a25aaa8704de.tar.bz2
mpv-8ff96f0216884f9bd3c60857e629a25aaa8704de.tar.xz
hwdec_d3d11egl: call ID3D11DeviceContext::Flush
This must be called if a texture shared between D3D devices is updated. Often enough, the shared devices will be the same device, but ANGLE forces using shared surfaces. I suppose there is no guarantee the driver will do the expected thing. Internally, the driver could for example not insert the required barriers before the shared texture is used.
-rw-r--r--video/out/opengl/hwdec_d3d11egl.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/video/out/opengl/hwdec_d3d11egl.c b/video/out/opengl/hwdec_d3d11egl.c
index c257145470..1810105d5a 100644
--- a/video/out/opengl/hwdec_d3d11egl.c
+++ b/video/out/opengl/hwdec_d3d11egl.c
@@ -39,6 +39,7 @@ struct priv {
struct mp_hwdec_ctx hwctx;
ID3D11Device *d3d11_device;
+ ID3D11DeviceContext *device_ctx;
ID3D11VideoDevice *video_dev;
ID3D11VideoContext *video_ctx;
@@ -142,6 +143,10 @@ static void destroy(struct gl_hwdec *hw)
ID3D11VideoDevice_Release(p->video_dev);
p->video_dev = NULL;
+ if (p->device_ctx)
+ ID3D11DeviceContext_Release(p->device_ctx);
+ p->device_ctx = NULL;
+
if (p->d3d11_device)
ID3D11Device_Release(p->d3d11_device);
p->d3d11_device = NULL;
@@ -270,13 +275,11 @@ static int create(struct gl_hwdec *hw)
if (FAILED(hr))
goto fail;
- ID3D11DeviceContext *device_ctx;
- ID3D11Device_GetImmediateContext(p->d3d11_device, &device_ctx);
- if (!device_ctx)
+ ID3D11Device_GetImmediateContext(p->d3d11_device, &p->device_ctx);
+ if (!p->device_ctx)
goto fail;
- hr = ID3D11DeviceContext_QueryInterface(device_ctx, &IID_ID3D11VideoContext,
+ hr = ID3D11DeviceContext_QueryInterface(p->device_ctx, &IID_ID3D11VideoContext,
(void **)&p->video_ctx);
- ID3D11DeviceContext_Release(device_ctx);
if (FAILED(hr))
goto fail;
@@ -576,6 +579,11 @@ static int map_frame_video_proc(struct gl_hwdec *hw, ID3D11Texture2D *d3d_tex,
return -1;
}
+ // Make sure the texture is updated correctly on the shared context.
+ // I'm not sure if this is needed if the shared context is the same
+ // context. (ANGLE API does not allow not using sharing.)
+ ID3D11DeviceContext_Flush(p->device_ctx);
+
*out_frame = (struct gl_hwdec_frame){
.planes = {
{