Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dxgi/adapter.c | 2 +- dlls/dxgi/dxgi_private.h | 2 +- dlls/dxgi/output.c | 166 ++++++++++++++++++++++++++++----------- 3 files changed, 123 insertions(+), 47 deletions(-)
diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c index ad4e4b13057..72f1a2df6b1 100644 --- a/dlls/dxgi/adapter.c +++ b/dlls/dxgi/adapter.c @@ -145,7 +145,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *ifac return hr; }
- *output = (IDXGIOutput *)&output_object->IDXGIOutput4_iface; + *output = (IDXGIOutput *)&output_object->IDXGIOutput6_iface;
TRACE("Returning output %p.\n", *output);
diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h index a125a7667d9..e43ee59461c 100644 --- a/dlls/dxgi/dxgi_private.h +++ b/dlls/dxgi/dxgi_private.h @@ -144,7 +144,7 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l /* IDXGIOutput */ struct dxgi_output { - IDXGIOutput4 IDXGIOutput4_iface; + IDXGIOutput6 IDXGIOutput6_iface; LONG refcount; struct wined3d_output *wined3d_output; struct wined3d_private_store private_store; diff --git a/dlls/dxgi/output.c b/dlls/dxgi/output.c index 5d31a0093cb..03b5384f326 100644 --- a/dlls/dxgi/output.c +++ b/dlls/dxgi/output.c @@ -181,18 +181,20 @@ static HRESULT dxgi_output_get_display_mode_list(struct dxgi_output *output, return S_OK; }
-static inline struct dxgi_output *impl_from_IDXGIOutput4(IDXGIOutput4 *iface) +static inline struct dxgi_output *impl_from_IDXGIOutput6(IDXGIOutput6 *iface) { - return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput4_iface); + return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput6_iface); }
/* IUnknown methods */
-static HRESULT STDMETHODCALLTYPE dxgi_output_QueryInterface(IDXGIOutput4 *iface, REFIID iid, void **object) +static HRESULT STDMETHODCALLTYPE dxgi_output_QueryInterface(IDXGIOutput6 *iface, REFIID iid, void **object) { TRACE("iface %p, iid %s, object %p.\n", iface, debugstr_guid(iid), object);
- if (IsEqualGUID(iid, &IID_IDXGIOutput4) + if (IsEqualGUID(iid, &IID_IDXGIOutput6) + || IsEqualGUID(iid, &IID_IDXGIOutput5) + || IsEqualGUID(iid, &IID_IDXGIOutput4) || IsEqualGUID(iid, &IID_IDXGIOutput3) || IsEqualGUID(iid, &IID_IDXGIOutput2) || IsEqualGUID(iid, &IID_IDXGIOutput1) @@ -211,9 +213,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_QueryInterface(IDXGIOutput4 *iface, return E_NOINTERFACE; }
-static ULONG STDMETHODCALLTYPE dxgi_output_AddRef(IDXGIOutput4 *iface) +static ULONG STDMETHODCALLTYPE dxgi_output_AddRef(IDXGIOutput6 *iface) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface); ULONG refcount = InterlockedIncrement(&output->refcount);
TRACE("%p increasing refcount to %u.\n", output, refcount); @@ -221,9 +223,9 @@ static ULONG STDMETHODCALLTYPE dxgi_output_AddRef(IDXGIOutput4 *iface) return refcount; }
-static ULONG STDMETHODCALLTYPE dxgi_output_Release(IDXGIOutput4 *iface) +static ULONG STDMETHODCALLTYPE dxgi_output_Release(IDXGIOutput6 *iface) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface); ULONG refcount = InterlockedDecrement(&output->refcount);
TRACE("%p decreasing refcount to %u.\n", output, refcount); @@ -240,40 +242,40 @@ static ULONG STDMETHODCALLTYPE dxgi_output_Release(IDXGIOutput4 *iface)
/* IDXGIObject methods */
-static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateData(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateData(IDXGIOutput6 *iface, REFGUID guid, UINT data_size, const void *data) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
return dxgi_set_private_data(&output->private_store, guid, data_size, data); }
-static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateDataInterface(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateDataInterface(IDXGIOutput6 *iface, REFGUID guid, const IUnknown *object) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
return dxgi_set_private_data_interface(&output->private_store, guid, object); }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetPrivateData(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_GetPrivateData(IDXGIOutput6 *iface, REFGUID guid, UINT *data_size, void *data) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
return dxgi_get_private_data(&output->private_store, guid, data_size, data); }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetParent(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_GetParent(IDXGIOutput6 *iface, REFIID riid, void **parent) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
TRACE("iface %p, riid %s, parent %p.\n", iface, debugstr_guid(riid), parent);
@@ -282,9 +284,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetParent(IDXGIOutput4 *iface,
/* IDXGIOutput methods */
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput4 *iface, DXGI_OUTPUT_DESC *desc) +static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput6 *iface, DXGI_OUTPUT_DESC *desc) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface); struct wined3d_output_desc wined3d_desc; HRESULT hr;
@@ -312,10 +314,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput4 *iface, DXGI_O return S_OK; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput6 *iface, DXGI_FORMAT format, UINT flags, UINT *mode_count, DXGI_MODE_DESC *modes) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
FIXME("iface %p, format %s, flags %#x, mode_count %p, modes %p partial stub!\n", iface, debug_dxgi_format(format), flags, mode_count, modes); @@ -324,10 +326,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput4 *if format, mode_count, modes, DXGI_MODE_STRUCT_VERSION_0); }
-static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode(IDXGIOutput6 *iface, const DXGI_MODE_DESC *mode, DXGI_MODE_DESC *closest_match, IUnknown *device) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface); struct wined3d_display_mode wined3d_mode; HRESULT hr;
@@ -347,7 +349,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode(IDXGIOutput return hr; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_WaitForVBlank(IDXGIOutput4 *iface) +static HRESULT STDMETHODCALLTYPE dxgi_output_WaitForVBlank(IDXGIOutput6 *iface) { static BOOL once = FALSE;
@@ -359,9 +361,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_WaitForVBlank(IDXGIOutput4 *iface) return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_TakeOwnership(IDXGIOutput4 *iface, IUnknown *device, BOOL exclusive) +static HRESULT STDMETHODCALLTYPE dxgi_output_TakeOwnership(IDXGIOutput6 *iface, IUnknown *device, BOOL exclusive) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface); HRESULT hr;
TRACE("iface %p, device %p, exclusive %d.\n", iface, device, exclusive); @@ -376,9 +378,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_TakeOwnership(IDXGIOutput4 *iface, return hr; }
-static void STDMETHODCALLTYPE dxgi_output_ReleaseOwnership(IDXGIOutput4 *iface) +static void STDMETHODCALLTYPE dxgi_output_ReleaseOwnership(IDXGIOutput6 *iface) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
TRACE("iface %p.\n", iface);
@@ -387,7 +389,7 @@ static void STDMETHODCALLTYPE dxgi_output_ReleaseOwnership(IDXGIOutput4 *iface) wined3d_mutex_unlock(); }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControlCapabilities(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControlCapabilities(IDXGIOutput6 *iface, DXGI_GAMMA_CONTROL_CAPABILITIES *gamma_caps) { unsigned int i; @@ -408,7 +410,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControlCapabilities(IDXGIOu return S_OK; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_SetGammaControl(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_SetGammaControl(IDXGIOutput6 *iface, const DXGI_GAMMA_CONTROL *gamma_control) { FIXME("iface %p, gamma_control %p stub!\n", iface, gamma_control); @@ -416,7 +418,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_SetGammaControl(IDXGIOutput4 *iface return S_OK; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControl(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControl(IDXGIOutput6 *iface, DXGI_GAMMA_CONTROL *gamma_control) { FIXME("iface %p, gamma_control %p stub!\n", iface, gamma_control); @@ -424,21 +426,21 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControl(IDXGIOutput4 *iface return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_SetDisplaySurface(IDXGIOutput4 *iface, IDXGISurface *surface) +static HRESULT STDMETHODCALLTYPE dxgi_output_SetDisplaySurface(IDXGIOutput6 *iface, IDXGISurface *surface) { FIXME("iface %p, surface %p stub!\n", iface, surface);
return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplaySurfaceData(IDXGIOutput4 *iface, IDXGISurface *surface) +static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplaySurfaceData(IDXGIOutput6 *iface, IDXGISurface *surface) { FIXME("iface %p, surface %p stub!\n", iface, surface);
return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetFrameStatistics(IDXGIOutput4 *iface, DXGI_FRAME_STATISTICS *stats) +static HRESULT STDMETHODCALLTYPE dxgi_output_GetFrameStatistics(IDXGIOutput6 *iface, DXGI_FRAME_STATISTICS *stats) { FIXME("iface %p, stats %p stub!\n", iface, stats);
@@ -447,10 +449,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetFrameStatistics(IDXGIOutput4 *if
/* IDXGIOutput1 methods */
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList1(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList1(IDXGIOutput6 *iface, DXGI_FORMAT format, UINT flags, UINT *mode_count, DXGI_MODE_DESC1 *modes) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
FIXME("iface %p, format %s, flags %#x, mode_count %p, modes %p partial stub!\n", iface, debug_dxgi_format(format), flags, mode_count, modes); @@ -459,10 +461,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList1(IDXGIOutput4 *i format, mode_count, modes, DXGI_MODE_STRUCT_VERSION_1); }
-static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode1(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode1(IDXGIOutput6 *iface, const DXGI_MODE_DESC1 *mode, DXGI_MODE_DESC1 *closest_match, IUnknown *device) { - struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + struct dxgi_output *output = impl_from_IDXGIOutput6(iface); struct wined3d_display_mode wined3d_mode; HRESULT hr;
@@ -482,7 +484,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode1(IDXGIOutpu return hr; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplaySurfaceData1(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplaySurfaceData1(IDXGIOutput6 *iface, IDXGIResource *resource) { FIXME("iface %p, resource %p stub!\n", iface, resource); @@ -490,7 +492,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplaySurfaceData1(IDXGIOutput4 return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_DuplicateOutput(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_DuplicateOutput(IDXGIOutput6 *iface, IUnknown *device, IDXGIOutputDuplication **output_duplication) { FIXME("iface %p, device %p, output_duplication %p stub!\n", iface, device, output_duplication); @@ -500,7 +502,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_DuplicateOutput(IDXGIOutput4 *iface
/* IDXGIOutput2 methods */
-static BOOL STDMETHODCALLTYPE dxgi_output_SupportsOverlays(IDXGIOutput4 *iface) +static BOOL STDMETHODCALLTYPE dxgi_output_SupportsOverlays(IDXGIOutput6 *iface) { FIXME("iface %p stub!\n", iface);
@@ -509,7 +511,7 @@ static BOOL STDMETHODCALLTYPE dxgi_output_SupportsOverlays(IDXGIOutput4 *iface)
/* IDXGIOutput3 methods */
-static HRESULT STDMETHODCALLTYPE dxgi_output_CheckOverlaySupport(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_CheckOverlaySupport(IDXGIOutput6 *iface, DXGI_FORMAT format, IUnknown *device, UINT *flags) { FIXME("iface %p, format %#x, device %p, flags %p stub!\n", iface, format, device, flags); @@ -519,7 +521,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_CheckOverlaySupport(IDXGIOutput4 *i
/* IDXGIOutput4 methods */
-static HRESULT STDMETHODCALLTYPE dxgi_output_CheckOverlayColorSpaceSupport(IDXGIOutput4 *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_CheckOverlayColorSpaceSupport(IDXGIOutput6 *iface, DXGI_FORMAT format, DXGI_COLOR_SPACE_TYPE color_space, IUnknown *device, UINT *flags) { FIXME("iface %p, format %#x, color_space %#x, device %p, flags %p stub!\n", @@ -528,7 +530,76 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_CheckOverlayColorSpaceSupport(IDXGI return E_NOTIMPL; }
-static const struct IDXGIOutput4Vtbl dxgi_output_vtbl = +/* IDXGIOutput5 methods */ + +static HRESULT STDMETHODCALLTYPE dxgi_output_DuplicateOutput1(IDXGIOutput6 *iface, + IUnknown *device, UINT flags, UINT format_count, const DXGI_FORMAT *formats, + IDXGIOutputDuplication **output_duplication) +{ + FIXME("iface %p, device %p, flags %#x, format_count %u, formats %p, " + "output_duplication %p stub!\n", iface, device, flags, format_count, + formats, output_duplication); + + return E_NOTIMPL; +} + +/* IDXGIOutput6 methods */ + +static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc1(IDXGIOutput6 *iface, + DXGI_OUTPUT_DESC1 *desc) +{ + struct dxgi_output *output = impl_from_IDXGIOutput6(iface); + struct wined3d_output_desc wined3d_desc; + HRESULT hr; + + FIXME("iface %p, desc %p semi-stub!\n", iface, desc); + + if (!desc) + return E_INVALIDARG; + + wined3d_mutex_lock(); + hr = wined3d_output_get_desc(output->wined3d_output, &wined3d_desc); + wined3d_mutex_unlock(); + + if (FAILED(hr)) + { + WARN("Failed to get output desc, hr %#x.\n", hr); + return hr; + } + + memcpy(desc->DeviceName, wined3d_desc.device_name, sizeof(desc->DeviceName)); + desc->DesktopCoordinates = wined3d_desc.desktop_rect; + desc->AttachedToDesktop = wined3d_desc.attached_to_desktop; + desc->Rotation = wined3d_desc.rotation; + desc->Monitor = wined3d_desc.monitor; + + /* FIXME: fill this from monitor EDID */ + desc->BitsPerColor = 0; + desc->ColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; + desc->RedPrimary[0] = 0.f; + desc->RedPrimary[1] = 0.f; + desc->GreenPrimary[0] = 0.f; + desc->GreenPrimary[1] = 0.f; + desc->BluePrimary[0] = 0.f; + desc->BluePrimary[1] = 0.f; + desc->WhitePoint[0] = 0.f; + desc->WhitePoint[1] = 0.f; + desc->MinLuminance = 0.f; + desc->MaxLuminance = 0.f; + desc->MaxFullFrameLuminance = 0.f; + + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE dxgi_output_CheckHardwareCompositionSupport(IDXGIOutput6 *iface, + UINT *flags) +{ + FIXME("iface %p, flags %p stub!\n", iface, flags); + + return E_NOTIMPL; +} + +static const struct IDXGIOutput6Vtbl dxgi_output_vtbl = { dxgi_output_QueryInterface, dxgi_output_AddRef, @@ -562,6 +633,11 @@ static const struct IDXGIOutput4Vtbl dxgi_output_vtbl = dxgi_output_CheckOverlaySupport, /* IDXGIOutput4 methods */ dxgi_output_CheckOverlayColorSpaceSupport, + /* IDXGIOutput5 methods */ + dxgi_output_DuplicateOutput1, + /* IDXGIOutput6 methods */ + dxgi_output_GetDesc1, + dxgi_output_CheckHardwareCompositionSupport, };
struct dxgi_output *unsafe_impl_from_IDXGIOutput(IDXGIOutput *iface) @@ -569,13 +645,13 @@ struct dxgi_output *unsafe_impl_from_IDXGIOutput(IDXGIOutput *iface) if (!iface) return NULL; assert(iface->lpVtbl == (IDXGIOutputVtbl *)&dxgi_output_vtbl); - return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput4_iface); + return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput6_iface); }
static void dxgi_output_init(struct dxgi_output *output, unsigned int output_idx, struct dxgi_adapter *adapter) { - output->IDXGIOutput4_iface.lpVtbl = &dxgi_output_vtbl; + output->IDXGIOutput6_iface.lpVtbl = &dxgi_output_vtbl; output->refcount = 1; output->wined3d_output = wined3d_adapter_get_output(adapter->wined3d_adapter, output_idx); wined3d_private_store_init(&output->private_store);