[vlc-devel] [PATCH 2/2] Direct3D: add a new state handling when the device is lost but cannot be reset yet.
Felix Abecassis
felix.abecassis at gmail.com
Tue Jan 21 11:30:12 CET 2014
In this state, do not call Direct3D functions and exit the "Display"
and "Prepare" functions early.
---
modules/video_output/msw/common.h | 1 +
modules/video_output/msw/direct3d.c | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/modules/video_output/msw/common.h b/modules/video_output/msw/common.h
index 8de45c5..122d80a 100644
--- a/modules/video_output/msw/common.h
+++ b/modules/video_output/msw/common.h
@@ -164,6 +164,7 @@ struct vout_display_sys_t
/* */
bool reset_device;
bool reopen_device;
+ bool lost_not_ready;
bool clear_scene;
/* It protects the following variables */
diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c
index d81d16e..e2d7387 100644
--- a/modules/video_output/msw/direct3d.c
+++ b/modules/video_output/msw/direct3d.c
@@ -161,6 +161,7 @@ static int Open(vlc_object_t *object)
sys->use_desktop = var_CreateGetBool(vd, "video-wallpaper");
sys->reset_device = false;
sys->reopen_device = false;
+ sys->lost_not_ready = false;
sys->allow_hw_yuv = var_CreateGetBool(vd, "directx-hw-yuv");
sys->desktop_save.is_fullscreen = vd->cfg->is_fullscreen;
sys->desktop_save.is_on_top = false;
@@ -283,6 +284,11 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
if (hr == D3DERR_DEVICENOTRESET && !sys->reset_device) {
vout_display_SendEventPicturesInvalid(vd);
sys->reset_device = true;
+ sys->lost_not_ready = false;
+ }
+ if (hr == D3DERR_DEVICELOST && !sys->lost_not_ready) {
+ /* Device is lost but not yet ready for reset. */
+ sys->lost_not_ready = true;
}
return;
}
@@ -309,6 +315,13 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
vout_display_sys_t *sys = vd->sys;
LPDIRECT3DDEVICE9 d3ddev = sys->d3ddev;
+ if (sys->lost_not_ready) {
+ picture_Release(picture);
+ if (subpicture)
+ subpicture_Delete(subpicture);
+ return;
+ }
+
// Present the back buffer contents to the display
// No stretching should happen here !
const RECT src = sys->rect_dest_clipped;
--
1.7.10.4
More information about the vlc-devel
mailing list