[vlc-devel] [PATCH] direct3d11: keep the surface buffer locked until we're finished writing
Steve Lhomme
robux4 at videolabs.io
Wed Oct 14 14:09:29 CEST 2015
From: Steve Lhomme <robux4 at gmail.com>
---
modules/video_output/msw/direct3d11.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/modules/video_output/msw/direct3d11.c b/modules/video_output/msw/direct3d11.c
index ccb7ea6..a6813a7 100644
--- a/modules/video_output/msw/direct3d11.c
+++ b/modules/video_output/msw/direct3d11.c
@@ -139,6 +139,7 @@ static void Direct3D11DestroyPool(vout_display_t *);
static void DestroyDisplayPicture(picture_t *);
static void DestroyDisplayPoolPicture(picture_t *);
static int Direct3D11MapTexture(picture_t *);
+static int Direct3D11UnmapTexture(picture_t *);
static void Direct3D11DeleteRegions(int, picture_t **);
static int Direct3D11MapSubpicture(vout_display_t *, int *, picture_t ***, subpicture_t *);
@@ -1421,6 +1422,7 @@ static int Direct3D11CreatePool(vout_display_t *vd, video_format_t *fmt)
pool_cfg.picture_count = 1;
pool_cfg.picture = &picture;
pool_cfg.lock = Direct3D11MapTexture;
+ pool_cfg.unlock = Direct3D11UnmapTexture;
sys->pool = picture_pool_NewExtended(&pool_cfg);
if (!sys->pool) {
@@ -1604,9 +1606,15 @@ static int Direct3D11MapTexture(picture_t *picture)
msg_Dbg( vd, "failed to map the texture (hr=0x%lX)", hr );
return VLC_EGENERIC;
}
- res = CommonUpdatePicture(picture, NULL, mappedResource.pData, mappedResource.RowPitch);
- ID3D11DeviceContext_Unmap(vd->sys->d3dcontext,(ID3D11Resource *)p_sys->texture, 0);
- return res;
+ return CommonUpdatePicture(picture, NULL, mappedResource.pData, mappedResource.RowPitch);
+}
+
+static int Direct3D11UnmapTexture(picture_t *picture)
+{
+ picture_sys_pool_t *p_sys = (picture_sys_pool_t*)picture->p_sys;
+ vout_display_t *vd = p_sys->vd;
+ ID3D11DeviceContext_Unmap(vd->sys->d3dcontext, (ID3D11Resource *)p_sys->texture, 0);
+ return VLC_SUCCESS;
}
static void Direct3D11DeleteRegions(int count, picture_t **region)
--
2.6.0
More information about the vlc-devel
mailing list