[vlc-devel] [PATCH 13/14] d3d9_fmt: always tie the adapter ID to the d3d9_device_t

Steve Lhomme robux4 at videolabs.io
Sat Nov 18 14:26:46 CET 2017


---
 modules/video_chroma/d3d9_fmt.c        | 9 ++++-----
 modules/video_chroma/d3d9_fmt.h        | 2 +-
 modules/video_output/win32/direct3d9.c | 2 +-
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/modules/video_chroma/d3d9_fmt.c b/modules/video_chroma/d3d9_fmt.c
index dd2694b18a..6e66060ad5 100644
--- a/modules/video_chroma/d3d9_fmt.c
+++ b/modules/video_chroma/d3d9_fmt.c
@@ -84,8 +84,8 @@ HRESULT D3D9_CreateDevice(vlc_object_t *o, d3d9_handle_t *hd3d, HWND hwnd,
         return E_INVALIDARG;
     }
 
-    out->hwnd      = hwnd;
-    if (D3D9_FillPresentationParameters(o, hd3d, AdapterToUse, source, out))
+    out->adapterId = AdapterToUse;
+    if (D3D9_FillPresentationParameters(o, hd3d, source, out))
         return E_INVALIDARG;
 
     /* */
@@ -121,7 +121,6 @@ HRESULT D3D9_CreateDevice(vlc_object_t *o, d3d9_handle_t *hd3d, HWND hwnd,
     if (SUCCEEDED(hr))
     {
         out->owner = true;
-        out->adapterId = AdapterToUse;
     }
     return hr;
 }
@@ -139,7 +138,7 @@ void D3D9_ReleaseDevice(d3d9_device_t *d3d_dev)
  * It setup vout_display_sys_t::d3dpp and vout_display_sys_t::rect_display
  * from the default adapter.
  */
-int D3D9_FillPresentationParameters(vlc_object_t *o, d3d9_handle_t *hd3d, UINT AdapterToUse,
+int D3D9_FillPresentationParameters(vlc_object_t *o, d3d9_handle_t *hd3d,
                                     const video_format_t *source, d3d9_device_t *out)
 {
     /*
@@ -149,7 +148,7 @@ int D3D9_FillPresentationParameters(vlc_object_t *o, d3d9_handle_t *hd3d, UINT A
     D3DDISPLAYMODE d3ddm;
     if (source->i_width)
     {
-        HRESULT hr = IDirect3D9_GetAdapterDisplayMode(hd3d->obj, AdapterToUse, &d3ddm);
+        HRESULT hr = IDirect3D9_GetAdapterDisplayMode(hd3d->obj, out->adapterId, &d3ddm);
         if (FAILED(hr)) {
            msg_Err(o, "Could not read adapter display mode. (hr=0x%0lx)", hr);
            return VLC_EGENERIC;
diff --git a/modules/video_chroma/d3d9_fmt.h b/modules/video_chroma/d3d9_fmt.h
index 30f2336277..23671f4a38 100644
--- a/modules/video_chroma/d3d9_fmt.h
+++ b/modules/video_chroma/d3d9_fmt.h
@@ -84,7 +84,7 @@ int D3D9_Create(vlc_object_t *, d3d9_handle_t *);
 
 void D3D9_Destroy(d3d9_handle_t *);
 
-int D3D9_FillPresentationParameters(vlc_object_t *, d3d9_handle_t *, UINT AdapterToUse,
+int D3D9_FillPresentationParameters(vlc_object_t *, d3d9_handle_t *,
                                     const video_format_t *, d3d9_device_t *out);
 
 #endif /* VLC_VIDEOCHROMA_D3D9_FMT_H_ */
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 7392f17712..4e4d1cdd8e 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -817,7 +817,7 @@ static int Direct3D9Reset(vout_display_t *vd)
     vout_display_sys_t *sys = vd->sys;
     d3d9_device_t *p_d3d9_dev = &sys->d3d_dev;
 
-    if (D3D9_FillPresentationParameters(VLC_OBJECT(vd), &sys->hd3d, p_d3d9_dev->adapterId, &vd->source, p_d3d9_dev))
+    if (D3D9_FillPresentationParameters(VLC_OBJECT(vd), &sys->hd3d, &vd->source, p_d3d9_dev))
         return VLC_EGENERIC;
 
     /* release all D3D objects */
-- 
2.14.2



More information about the vlc-devel mailing list