win32u: Don't report cloned monitors in EnumDisplayMonitors().
[wine.git] / dlls / dxgi / output.c
blob797851c67f1112ba397a056635b5d019c2e5da38
1 /*
2 * Copyright 2009 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "dxgi_private.h"
21 WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
23 static inline DXGI_MODE_SCANLINE_ORDER dxgi_mode_scanline_order_from_wined3d(enum wined3d_scanline_ordering ordering)
25 return (DXGI_MODE_SCANLINE_ORDER)ordering;
28 static inline DXGI_MODE_ROTATION dxgi_mode_rotation_from_wined3d(enum wined3d_display_rotation rotation)
30 return (DXGI_MODE_ROTATION)rotation;
33 static void dxgi_mode_from_wined3d(DXGI_MODE_DESC *mode, const struct wined3d_display_mode *wined3d_mode)
35 mode->Width = wined3d_mode->width;
36 mode->Height = wined3d_mode->height;
37 mode->RefreshRate.Numerator = wined3d_mode->refresh_rate;
38 mode->RefreshRate.Denominator = 1;
39 mode->Format = dxgi_format_from_wined3dformat(wined3d_mode->format_id);
40 mode->ScanlineOrdering = dxgi_mode_scanline_order_from_wined3d(wined3d_mode->scanline_ordering);
41 mode->Scaling = DXGI_MODE_SCALING_UNSPECIFIED; /* FIXME */
44 static void dxgi_mode1_from_wined3d(DXGI_MODE_DESC1 *mode, const struct wined3d_display_mode *wined3d_mode)
46 mode->Width = wined3d_mode->width;
47 mode->Height = wined3d_mode->height;
48 mode->RefreshRate.Numerator = wined3d_mode->refresh_rate;
49 mode->RefreshRate.Denominator = 1;
50 mode->Format = dxgi_format_from_wined3dformat(wined3d_mode->format_id);
51 mode->ScanlineOrdering = dxgi_mode_scanline_order_from_wined3d(wined3d_mode->scanline_ordering);
52 mode->Scaling = DXGI_MODE_SCALING_UNSPECIFIED; /* FIXME */
53 mode->Stereo = FALSE; /* FIXME */
56 static HRESULT dxgi_output_find_closest_matching_mode(struct dxgi_output *output,
57 struct wined3d_display_mode *mode, IUnknown *device)
59 HRESULT hr;
61 if (!mode->width != !mode->height)
62 return DXGI_ERROR_INVALID_CALL;
64 if (mode->format_id == WINED3DFMT_UNKNOWN && !device)
65 return DXGI_ERROR_INVALID_CALL;
67 if (mode->format_id == WINED3DFMT_UNKNOWN)
69 FIXME("Matching formats to device not implemented.\n");
70 return E_NOTIMPL;
73 wined3d_mutex_lock();
74 hr = wined3d_output_find_closest_matching_mode(output->wined3d_output, mode);
75 wined3d_mutex_unlock();
77 return hr;
80 static int dxgi_mode_desc_compare(const void *l, const void *r)
82 const DXGI_MODE_DESC *left = l, *right = r;
83 int a, b;
85 if (left->Width != right->Width)
86 return left->Width - right->Width;
88 if (left->Height != right->Height)
89 return left->Height - right->Height;
91 a = left->RefreshRate.Numerator * right->RefreshRate.Denominator;
92 b = right->RefreshRate.Numerator * left->RefreshRate.Denominator;
93 if (a != b)
94 return a - b;
96 return 0;
99 enum dxgi_mode_struct_version
101 DXGI_MODE_STRUCT_VERSION_0,
102 DXGI_MODE_STRUCT_VERSION_1,
105 static HRESULT dxgi_output_get_display_mode_list(struct dxgi_output *output,
106 DXGI_FORMAT format, unsigned int *mode_count, void *modes,
107 enum dxgi_mode_struct_version struct_version)
109 enum wined3d_format_id wined3d_format;
110 struct wined3d_display_mode mode;
111 unsigned int i, max_count;
112 HRESULT hr;
114 if (!mode_count)
115 return DXGI_ERROR_INVALID_CALL;
117 if (format == DXGI_FORMAT_UNKNOWN)
119 *mode_count = 0;
120 return S_OK;
123 wined3d_format = wined3dformat_from_dxgi_format(format);
125 wined3d_mutex_lock();
126 max_count = wined3d_output_get_mode_count(output->wined3d_output,
127 wined3d_format, WINED3D_SCANLINE_ORDERING_UNKNOWN);
129 if (!modes)
131 wined3d_mutex_unlock();
132 *mode_count = max_count;
133 return S_OK;
136 if (max_count > *mode_count)
138 wined3d_mutex_unlock();
139 return DXGI_ERROR_MORE_DATA;
142 *mode_count = max_count;
144 for (i = 0; i < *mode_count; ++i)
146 if (FAILED(hr = wined3d_output_get_mode(output->wined3d_output, wined3d_format,
147 WINED3D_SCANLINE_ORDERING_UNKNOWN, i, &mode)))
149 WARN("Failed to get output mode %u, hr %#lx.\n", i, hr);
150 wined3d_mutex_unlock();
151 return hr;
154 switch (struct_version)
156 case DXGI_MODE_STRUCT_VERSION_0:
158 DXGI_MODE_DESC *desc = modes;
159 dxgi_mode_from_wined3d(&desc[i], &mode);
160 break;
163 case DXGI_MODE_STRUCT_VERSION_1:
165 DXGI_MODE_DESC1 *desc = modes;
166 dxgi_mode1_from_wined3d(&desc[i], &mode);
167 break;
171 wined3d_mutex_unlock();
173 switch (struct_version)
175 case DXGI_MODE_STRUCT_VERSION_0:
176 qsort(modes, *mode_count, sizeof(DXGI_MODE_DESC), dxgi_mode_desc_compare);
177 break;
178 case DXGI_MODE_STRUCT_VERSION_1:
179 qsort(modes, *mode_count, sizeof(DXGI_MODE_DESC1), dxgi_mode_desc_compare);
180 break;
183 return S_OK;
186 static inline struct dxgi_output *impl_from_IDXGIOutput6(IDXGIOutput6 *iface)
188 return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput6_iface);
191 /* IUnknown methods */
193 static HRESULT STDMETHODCALLTYPE dxgi_output_QueryInterface(IDXGIOutput6 *iface, REFIID iid, void **object)
195 TRACE("iface %p, iid %s, object %p.\n", iface, debugstr_guid(iid), object);
197 if (IsEqualGUID(iid, &IID_IDXGIOutput6)
198 || IsEqualGUID(iid, &IID_IDXGIOutput5)
199 || IsEqualGUID(iid, &IID_IDXGIOutput4)
200 || IsEqualGUID(iid, &IID_IDXGIOutput3)
201 || IsEqualGUID(iid, &IID_IDXGIOutput2)
202 || IsEqualGUID(iid, &IID_IDXGIOutput1)
203 || IsEqualGUID(iid, &IID_IDXGIOutput)
204 || IsEqualGUID(iid, &IID_IDXGIObject)
205 || IsEqualGUID(iid, &IID_IUnknown))
207 IUnknown_AddRef(iface);
208 *object = iface;
209 return S_OK;
212 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
214 *object = NULL;
215 return E_NOINTERFACE;
218 static ULONG STDMETHODCALLTYPE dxgi_output_AddRef(IDXGIOutput6 *iface)
220 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
221 ULONG refcount = InterlockedIncrement(&output->refcount);
223 TRACE("%p increasing refcount to %lu.\n", output, refcount);
225 return refcount;
228 static ULONG STDMETHODCALLTYPE dxgi_output_Release(IDXGIOutput6 *iface)
230 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
231 ULONG refcount = InterlockedDecrement(&output->refcount);
233 TRACE("%p decreasing refcount to %lu.\n", output, refcount);
235 if (!refcount)
237 wined3d_private_store_cleanup(&output->private_store);
238 IWineDXGIAdapter_Release(&output->adapter->IWineDXGIAdapter_iface);
239 heap_free(output);
242 return refcount;
245 /* IDXGIObject methods */
247 static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateData(IDXGIOutput6 *iface,
248 REFGUID guid, UINT data_size, const void *data)
250 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
252 TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
254 return dxgi_set_private_data(&output->private_store, guid, data_size, data);
257 static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateDataInterface(IDXGIOutput6 *iface,
258 REFGUID guid, const IUnknown *object)
260 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
262 TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
264 return dxgi_set_private_data_interface(&output->private_store, guid, object);
267 static HRESULT STDMETHODCALLTYPE dxgi_output_GetPrivateData(IDXGIOutput6 *iface,
268 REFGUID guid, UINT *data_size, void *data)
270 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
272 TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
274 return dxgi_get_private_data(&output->private_store, guid, data_size, data);
277 static HRESULT STDMETHODCALLTYPE dxgi_output_GetParent(IDXGIOutput6 *iface,
278 REFIID riid, void **parent)
280 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
282 TRACE("iface %p, riid %s, parent %p.\n", iface, debugstr_guid(riid), parent);
284 return IWineDXGIAdapter_QueryInterface(&output->adapter->IWineDXGIAdapter_iface, riid, parent);
287 /* IDXGIOutput methods */
289 static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput6 *iface, DXGI_OUTPUT_DESC *desc)
291 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
292 struct wined3d_output_desc wined3d_desc;
293 enum wined3d_display_rotation rotation;
294 struct wined3d_display_mode mode;
295 HRESULT hr;
297 TRACE("iface %p, desc %p.\n", iface, desc);
299 if (!desc)
300 return E_INVALIDARG;
302 wined3d_mutex_lock();
303 hr = wined3d_output_get_desc(output->wined3d_output, &wined3d_desc);
304 if (FAILED(hr))
306 WARN("Failed to get output desc, hr %#lx.\n", hr);
307 wined3d_mutex_unlock();
308 return hr;
311 hr = wined3d_output_get_display_mode(output->wined3d_output, &mode, &rotation);
312 if (FAILED(hr))
314 WARN("Failed to get output display mode, hr %#lx.\n", hr);
315 wined3d_mutex_unlock();
316 return hr;
318 wined3d_mutex_unlock();
320 memcpy(desc->DeviceName, wined3d_desc.device_name, sizeof(desc->DeviceName));
321 desc->DesktopCoordinates = wined3d_desc.desktop_rect;
322 desc->AttachedToDesktop = wined3d_desc.attached_to_desktop;
323 desc->Rotation = dxgi_mode_rotation_from_wined3d(rotation);
324 desc->Monitor = wined3d_desc.monitor;
326 return S_OK;
329 static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput6 *iface,
330 DXGI_FORMAT format, UINT flags, UINT *mode_count, DXGI_MODE_DESC *modes)
332 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
334 FIXME("iface %p, format %s, flags %#x, mode_count %p, modes %p partial stub!\n",
335 iface, debug_dxgi_format(format), flags, mode_count, modes);
337 return dxgi_output_get_display_mode_list(output,
338 format, mode_count, modes, DXGI_MODE_STRUCT_VERSION_0);
341 static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode(IDXGIOutput6 *iface,
342 const DXGI_MODE_DESC *mode, DXGI_MODE_DESC *closest_match, IUnknown *device)
344 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
345 struct wined3d_display_mode wined3d_mode;
346 HRESULT hr;
348 TRACE("iface %p, mode %p, closest_match %p, device %p.\n",
349 iface, mode, closest_match, device);
351 TRACE("Mode: %s.\n", debug_dxgi_mode(mode));
353 wined3d_display_mode_from_dxgi(&wined3d_mode, mode);
354 hr = dxgi_output_find_closest_matching_mode(output, &wined3d_mode, device);
355 if (SUCCEEDED(hr))
357 dxgi_mode_from_wined3d(closest_match, &wined3d_mode);
358 TRACE("Returning %s.\n", debug_dxgi_mode(closest_match));
361 return hr;
364 static HRESULT STDMETHODCALLTYPE dxgi_output_WaitForVBlank(IDXGIOutput6 *iface)
366 static BOOL once = FALSE;
368 if (!once++)
369 FIXME("iface %p stub!\n", iface);
370 else
371 TRACE("iface %p stub!\n", iface);
373 return E_NOTIMPL;
376 static HRESULT STDMETHODCALLTYPE dxgi_output_TakeOwnership(IDXGIOutput6 *iface, IUnknown *device, BOOL exclusive)
378 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
379 HRESULT hr;
381 TRACE("iface %p, device %p, exclusive %d.\n", iface, device, exclusive);
383 if (!device)
384 return DXGI_ERROR_INVALID_CALL;
386 wined3d_mutex_lock();
387 hr = wined3d_output_take_ownership(output->wined3d_output, exclusive);
388 wined3d_mutex_unlock();
390 return hr;
393 static void STDMETHODCALLTYPE dxgi_output_ReleaseOwnership(IDXGIOutput6 *iface)
395 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
397 TRACE("iface %p.\n", iface);
399 wined3d_mutex_lock();
400 wined3d_output_release_ownership(output->wined3d_output);
401 wined3d_mutex_unlock();
404 static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControlCapabilities(IDXGIOutput6 *iface,
405 DXGI_GAMMA_CONTROL_CAPABILITIES *gamma_caps)
407 unsigned int i;
409 TRACE("iface %p, gamma_caps %p.\n", iface, gamma_caps);
411 if (!gamma_caps)
412 return E_INVALIDARG;
414 gamma_caps->ScaleAndOffsetSupported = FALSE;
415 gamma_caps->MaxConvertedValue = 1.0f;
416 gamma_caps->MinConvertedValue = 0.0f;
417 gamma_caps->NumGammaControlPoints = 256;
419 for (i = 0; i < gamma_caps->NumGammaControlPoints; ++i)
420 gamma_caps->ControlPointPositions[i] = i / 255.0f;
422 return S_OK;
425 static WORD uint16_from_float(float f)
427 f *= 65535.0f;
428 if (f < 0.0f)
429 f = 0.0f;
430 else if (f > 65535.0f)
431 f = 65535.0f;
433 return f + 0.5f;
436 static HRESULT STDMETHODCALLTYPE dxgi_output_SetGammaControl(IDXGIOutput6 *iface,
437 const DXGI_GAMMA_CONTROL *gamma_control)
439 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
440 struct wined3d_gamma_ramp ramp;
441 const DXGI_RGB *p;
442 unsigned int i;
444 TRACE("iface %p, gamma_control %p.\n", iface, gamma_control);
446 if (gamma_control->Scale.Red != 1.0f || gamma_control->Scale.Green != 1.0f || gamma_control->Scale.Blue != 1.0f)
447 FIXME("Ignoring unhandled scale {%.8e, %.8e, %.8e}.\n", gamma_control->Scale.Red,
448 gamma_control->Scale.Green, gamma_control->Scale.Blue);
449 if (gamma_control->Offset.Red != 0.0f || gamma_control->Offset.Green != 0.0f || gamma_control->Offset.Blue != 0.0f)
450 FIXME("Ignoring unhandled offset {%.8e, %.8e, %.8e}.\n", gamma_control->Offset.Red,
451 gamma_control->Offset.Green, gamma_control->Offset.Blue);
453 for (i = 0; i < 256; ++i)
455 p = &gamma_control->GammaCurve[i];
456 ramp.red[i] = uint16_from_float(p->Red);
457 ramp.green[i] = uint16_from_float(p->Green);
458 ramp.blue[i] = uint16_from_float(p->Blue);
461 wined3d_mutex_lock();
462 wined3d_output_set_gamma_ramp(output->wined3d_output, &ramp);
463 wined3d_mutex_unlock();
465 return S_OK;
468 static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControl(IDXGIOutput6 *iface,
469 DXGI_GAMMA_CONTROL *gamma_control)
471 FIXME("iface %p, gamma_control %p stub!\n", iface, gamma_control);
473 return E_NOTIMPL;
476 static HRESULT STDMETHODCALLTYPE dxgi_output_SetDisplaySurface(IDXGIOutput6 *iface, IDXGISurface *surface)
478 FIXME("iface %p, surface %p stub!\n", iface, surface);
480 return E_NOTIMPL;
483 static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplaySurfaceData(IDXGIOutput6 *iface, IDXGISurface *surface)
485 FIXME("iface %p, surface %p stub!\n", iface, surface);
487 return E_NOTIMPL;
490 static HRESULT STDMETHODCALLTYPE dxgi_output_GetFrameStatistics(IDXGIOutput6 *iface, DXGI_FRAME_STATISTICS *stats)
492 FIXME("iface %p, stats %p stub!\n", iface, stats);
494 return E_NOTIMPL;
497 /* IDXGIOutput1 methods */
499 static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList1(IDXGIOutput6 *iface,
500 DXGI_FORMAT format, UINT flags, UINT *mode_count, DXGI_MODE_DESC1 *modes)
502 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
504 FIXME("iface %p, format %s, flags %#x, mode_count %p, modes %p partial stub!\n",
505 iface, debug_dxgi_format(format), flags, mode_count, modes);
507 return dxgi_output_get_display_mode_list(output,
508 format, mode_count, modes, DXGI_MODE_STRUCT_VERSION_1);
511 static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode1(IDXGIOutput6 *iface,
512 const DXGI_MODE_DESC1 *mode, DXGI_MODE_DESC1 *closest_match, IUnknown *device)
514 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
515 struct wined3d_display_mode wined3d_mode;
516 HRESULT hr;
518 TRACE("iface %p, mode %p, closest_match %p, device %p.\n",
519 iface, mode, closest_match, device);
521 TRACE("Mode: %s.\n", debug_dxgi_mode1(mode));
523 wined3d_display_mode_from_dxgi1(&wined3d_mode, mode);
524 hr = dxgi_output_find_closest_matching_mode(output, &wined3d_mode, device);
525 if (SUCCEEDED(hr))
527 dxgi_mode1_from_wined3d(closest_match, &wined3d_mode);
528 TRACE("Returning %s.\n", debug_dxgi_mode1(closest_match));
531 return hr;
534 static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplaySurfaceData1(IDXGIOutput6 *iface,
535 IDXGIResource *resource)
537 FIXME("iface %p, resource %p stub!\n", iface, resource);
539 return E_NOTIMPL;
542 static HRESULT STDMETHODCALLTYPE dxgi_output_DuplicateOutput(IDXGIOutput6 *iface,
543 IUnknown *device, IDXGIOutputDuplication **output_duplication)
545 FIXME("iface %p, device %p, output_duplication %p stub!\n", iface, device, output_duplication);
547 return E_NOTIMPL;
550 /* IDXGIOutput2 methods */
552 static BOOL STDMETHODCALLTYPE dxgi_output_SupportsOverlays(IDXGIOutput6 *iface)
554 FIXME("iface %p stub!\n", iface);
556 return FALSE;
559 /* IDXGIOutput3 methods */
561 static HRESULT STDMETHODCALLTYPE dxgi_output_CheckOverlaySupport(IDXGIOutput6 *iface,
562 DXGI_FORMAT format, IUnknown *device, UINT *flags)
564 FIXME("iface %p, format %#x, device %p, flags %p stub!\n", iface, format, device, flags);
566 return E_NOTIMPL;
569 /* IDXGIOutput4 methods */
571 static HRESULT STDMETHODCALLTYPE dxgi_output_CheckOverlayColorSpaceSupport(IDXGIOutput6 *iface,
572 DXGI_FORMAT format, DXGI_COLOR_SPACE_TYPE color_space, IUnknown *device, UINT *flags)
574 FIXME("iface %p, format %#x, color_space %#x, device %p, flags %p stub!\n",
575 iface, format, color_space, device, flags);
577 return E_NOTIMPL;
580 /* IDXGIOutput5 methods */
582 static HRESULT STDMETHODCALLTYPE dxgi_output_DuplicateOutput1(IDXGIOutput6 *iface,
583 IUnknown *device, UINT flags, UINT format_count, const DXGI_FORMAT *formats,
584 IDXGIOutputDuplication **output_duplication)
586 FIXME("iface %p, device %p, flags %#x, format_count %u, formats %p, "
587 "output_duplication %p stub!\n", iface, device, flags, format_count,
588 formats, output_duplication);
590 return E_NOTIMPL;
593 /* IDXGIOutput6 methods */
595 static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc1(IDXGIOutput6 *iface,
596 DXGI_OUTPUT_DESC1 *desc)
598 struct dxgi_output *output = impl_from_IDXGIOutput6(iface);
599 struct wined3d_output_desc wined3d_desc;
600 enum wined3d_display_rotation rotation;
601 struct wined3d_display_mode mode;
602 HRESULT hr;
604 FIXME("iface %p, desc %p semi-stub!\n", iface, desc);
606 if (!desc)
607 return E_INVALIDARG;
609 wined3d_mutex_lock();
610 hr = wined3d_output_get_desc(output->wined3d_output, &wined3d_desc);
611 if (FAILED(hr))
613 WARN("Failed to get output desc, hr %#lx.\n", hr);
614 wined3d_mutex_unlock();
615 return hr;
618 hr = wined3d_output_get_display_mode(output->wined3d_output, &mode, &rotation);
619 if (FAILED(hr))
621 WARN("Failed to get output display mode, hr %#lx.\n", hr);
622 wined3d_mutex_unlock();
623 return hr;
625 wined3d_mutex_unlock();
627 if (FAILED(hr))
629 WARN("Failed to get output desc, hr %#lx.\n", hr);
630 return hr;
633 memcpy(desc->DeviceName, wined3d_desc.device_name, sizeof(desc->DeviceName));
634 desc->DesktopCoordinates = wined3d_desc.desktop_rect;
635 desc->AttachedToDesktop = wined3d_desc.attached_to_desktop;
636 desc->Rotation = dxgi_mode_rotation_from_wined3d(rotation);
637 desc->Monitor = wined3d_desc.monitor;
639 /* FIXME: fill this from monitor EDID */
640 desc->BitsPerColor = 0;
641 desc->ColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
642 desc->RedPrimary[0] = 0.f;
643 desc->RedPrimary[1] = 0.f;
644 desc->GreenPrimary[0] = 0.f;
645 desc->GreenPrimary[1] = 0.f;
646 desc->BluePrimary[0] = 0.f;
647 desc->BluePrimary[1] = 0.f;
648 desc->WhitePoint[0] = 0.f;
649 desc->WhitePoint[1] = 0.f;
650 desc->MinLuminance = 0.f;
651 desc->MaxLuminance = 0.f;
652 desc->MaxFullFrameLuminance = 0.f;
654 return S_OK;
657 static HRESULT STDMETHODCALLTYPE dxgi_output_CheckHardwareCompositionSupport(IDXGIOutput6 *iface,
658 UINT *flags)
660 FIXME("iface %p, flags %p stub!\n", iface, flags);
662 return E_NOTIMPL;
665 static const struct IDXGIOutput6Vtbl dxgi_output_vtbl =
667 dxgi_output_QueryInterface,
668 dxgi_output_AddRef,
669 dxgi_output_Release,
670 /* IDXGIObject methods */
671 dxgi_output_SetPrivateData,
672 dxgi_output_SetPrivateDataInterface,
673 dxgi_output_GetPrivateData,
674 dxgi_output_GetParent,
675 /* IDXGIOutput methods */
676 dxgi_output_GetDesc,
677 dxgi_output_GetDisplayModeList,
678 dxgi_output_FindClosestMatchingMode,
679 dxgi_output_WaitForVBlank,
680 dxgi_output_TakeOwnership,
681 dxgi_output_ReleaseOwnership,
682 dxgi_output_GetGammaControlCapabilities,
683 dxgi_output_SetGammaControl,
684 dxgi_output_GetGammaControl,
685 dxgi_output_SetDisplaySurface,
686 dxgi_output_GetDisplaySurfaceData,
687 dxgi_output_GetFrameStatistics,
688 /* IDXGIOutput1 methods */
689 dxgi_output_GetDisplayModeList1,
690 dxgi_output_FindClosestMatchingMode1,
691 dxgi_output_GetDisplaySurfaceData1,
692 dxgi_output_DuplicateOutput,
693 /* IDXGIOutput2 methods */
694 dxgi_output_SupportsOverlays,
695 /* IDXGIOutput3 methods */
696 dxgi_output_CheckOverlaySupport,
697 /* IDXGIOutput4 methods */
698 dxgi_output_CheckOverlayColorSpaceSupport,
699 /* IDXGIOutput5 methods */
700 dxgi_output_DuplicateOutput1,
701 /* IDXGIOutput6 methods */
702 dxgi_output_GetDesc1,
703 dxgi_output_CheckHardwareCompositionSupport,
706 struct dxgi_output *unsafe_impl_from_IDXGIOutput(IDXGIOutput *iface)
708 if (!iface)
709 return NULL;
710 assert(iface->lpVtbl == (IDXGIOutputVtbl *)&dxgi_output_vtbl);
711 return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput6_iface);
714 static void dxgi_output_init(struct dxgi_output *output, unsigned int output_idx,
715 struct dxgi_adapter *adapter)
717 output->IDXGIOutput6_iface.lpVtbl = &dxgi_output_vtbl;
718 output->refcount = 1;
719 output->wined3d_output = wined3d_adapter_get_output(adapter->wined3d_adapter, output_idx);
720 wined3d_private_store_init(&output->private_store);
721 output->adapter = adapter;
722 IWineDXGIAdapter_AddRef(&output->adapter->IWineDXGIAdapter_iface);
725 HRESULT dxgi_output_create(struct dxgi_adapter *adapter, unsigned int output_idx,
726 struct dxgi_output **output)
728 if (!(*output = heap_alloc_zero(sizeof(**output))))
729 return E_OUTOFMEMORY;
731 dxgi_output_init(*output, output_idx, adapter);
732 return S_OK;