wined3d: Use wined3d_bit_scan() in vshader_get_input().
[wine.git] / dlls / dxva2 / main.c
blob5beac4164a6182455c59a39d3cee38a50d82357c
1 /*
2 * Copyright 2014 Michael Müller for Pipelight
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 #define COBJMACROS
21 #include <stdarg.h>
22 #include <limits.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "d3d9.h"
26 #include "physicalmonitorenumerationapi.h"
27 #include "lowlevelmonitorconfigurationapi.h"
28 #include "highlevelmonitorconfigurationapi.h"
29 #include "initguid.h"
30 #include "dxva2api.h"
32 #include "wine/debug.h"
33 #include "wine/heap.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(dxva2);
37 #define D3DFMT_NV12 MAKEFOURCC('N','V','1','2')
39 enum device_handle_flags
41 HANDLE_FLAG_OPEN = 0x1,
42 HANDLE_FLAG_INVALID = 0x2,
45 struct device_handle
47 unsigned int flags;
48 IDirect3DStateBlock9 *state_block;
51 struct device_manager
53 IDirect3DDeviceManager9 IDirect3DDeviceManager9_iface;
54 IDirectXVideoProcessorService IDirectXVideoProcessorService_iface;
55 IDirectXVideoDecoderService IDirectXVideoDecoderService_iface;
56 LONG refcount;
58 IDirect3DDevice9 *device;
59 UINT token;
61 struct device_handle *handles;
62 size_t count;
63 size_t capacity;
65 HANDLE locking_handle;
67 CRITICAL_SECTION cs;
68 CONDITION_VARIABLE lock;
71 struct video_processor
73 IDirectXVideoProcessor IDirectXVideoProcessor_iface;
74 LONG refcount;
76 IDirectXVideoProcessorService *service;
77 GUID device;
78 DXVA2_VideoDesc video_desc;
79 D3DFORMAT rt_format;
80 unsigned int max_substreams;
83 static BOOL dxva_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
85 size_t new_capacity, max_capacity;
86 void *new_elements;
88 if (count <= *capacity)
89 return TRUE;
91 max_capacity = ~(SIZE_T)0 / size;
92 if (count > max_capacity)
93 return FALSE;
95 new_capacity = max(4, *capacity);
96 while (new_capacity < count && new_capacity <= max_capacity / 2)
97 new_capacity *= 2;
98 if (new_capacity < count)
99 new_capacity = max_capacity;
101 if (!(new_elements = heap_realloc(*elements, new_capacity * size)))
102 return FALSE;
104 *elements = new_elements;
105 *capacity = new_capacity;
107 return TRUE;
110 static struct device_manager *impl_from_IDirect3DDeviceManager9(IDirect3DDeviceManager9 *iface)
112 return CONTAINING_RECORD(iface, struct device_manager, IDirect3DDeviceManager9_iface);
115 static struct device_manager *impl_from_IDirectXVideoProcessorService(IDirectXVideoProcessorService *iface)
117 return CONTAINING_RECORD(iface, struct device_manager, IDirectXVideoProcessorService_iface);
120 static struct device_manager *impl_from_IDirectXVideoDecoderService(IDirectXVideoDecoderService *iface)
122 return CONTAINING_RECORD(iface, struct device_manager, IDirectXVideoDecoderService_iface);
125 static struct video_processor *impl_from_IDirectXVideoProcessor(IDirectXVideoProcessor *iface)
127 return CONTAINING_RECORD(iface, struct video_processor, IDirectXVideoProcessor_iface);
130 static const DXVA2_VideoProcessorCaps software_processor_caps =
132 .DeviceCaps = DXVA2_VPDev_SoftwareDevice,
133 .InputPool = D3DPOOL_SYSTEMMEM,
134 .VideoProcessorOperations = DXVA2_VideoProcess_PlanarAlpha | DXVA2_VideoProcess_YUV2RGB |
135 DXVA2_VideoProcess_StretchX | DXVA2_VideoProcess_StretchY | DXVA2_VideoProcess_SubRects |
136 DXVA2_VideoProcess_SubStreams | DXVA2_VideoProcess_SubStreamsExtended | DXVA2_VideoProcess_YUV2RGBExtended,
139 static const DXVA2_VideoProcessorCaps progressive_processor_caps =
141 .DeviceCaps = DXVA2_VPDev_HardwareDevice,
142 .InputPool = D3DPOOL_DEFAULT,
143 .VideoProcessorOperations = DXVA2_VideoProcess_YUV2RGB | DXVA2_VideoProcess_StretchX | DXVA2_VideoProcess_StretchY,
146 static HRESULT WINAPI video_processor_QueryInterface(IDirectXVideoProcessor *iface, REFIID riid, void **obj)
148 if (IsEqualIID(riid, &IID_IDirectXVideoProcessor) ||
149 IsEqualIID(riid, &IID_IUnknown))
151 *obj = iface;
152 IDirectXVideoProcessor_AddRef(iface);
153 return S_OK;
156 WARN("Unsupported interface %s.\n", debugstr_guid(riid));
157 *obj = NULL;
158 return E_NOINTERFACE;
161 static ULONG WINAPI video_processor_AddRef(IDirectXVideoProcessor *iface)
163 struct video_processor *processor = impl_from_IDirectXVideoProcessor(iface);
164 ULONG refcount = InterlockedIncrement(&processor->refcount);
166 TRACE("%p, refcount %u.\n", iface, refcount);
168 return refcount;
171 static ULONG WINAPI video_processor_Release(IDirectXVideoProcessor *iface)
173 struct video_processor *processor = impl_from_IDirectXVideoProcessor(iface);
174 ULONG refcount = InterlockedDecrement(&processor->refcount);
176 TRACE("%p, refcount %u.\n", iface, refcount);
178 if (!refcount)
180 IDirectXVideoProcessorService_Release(processor->service);
181 heap_free(processor);
184 return refcount;
187 static HRESULT WINAPI video_processor_GetVideoProcessorService(IDirectXVideoProcessor *iface,
188 IDirectXVideoProcessorService **service)
190 struct video_processor *processor = impl_from_IDirectXVideoProcessor(iface);
192 TRACE("%p, %p.\n", iface, service);
194 *service = processor->service;
195 IDirectXVideoProcessorService_AddRef(*service);
197 return S_OK;
200 static HRESULT WINAPI video_processor_GetCreationParameters(IDirectXVideoProcessor *iface,
201 GUID *device, DXVA2_VideoDesc *video_desc, D3DFORMAT *rt_format, UINT *max_substreams)
203 struct video_processor *processor = impl_from_IDirectXVideoProcessor(iface);
205 TRACE("%p, %p, %p, %p, %p.\n", iface, device, video_desc, rt_format, max_substreams);
207 if (!device && !video_desc && !rt_format && !max_substreams)
208 return E_INVALIDARG;
210 if (device)
211 *device = processor->device;
212 if (video_desc)
213 *video_desc = processor->video_desc;
214 if (rt_format)
215 *rt_format = processor->rt_format;
216 if (max_substreams)
217 *max_substreams = processor->max_substreams;
219 return S_OK;
222 static HRESULT WINAPI video_processor_GetVideoProcessorCaps(IDirectXVideoProcessor *iface,
223 DXVA2_VideoProcessorCaps *caps)
225 struct video_processor *processor = impl_from_IDirectXVideoProcessor(iface);
227 TRACE("%p, %p.\n", iface, caps);
229 if (IsEqualGUID(&processor->device, &DXVA2_VideoProcSoftwareDevice))
231 *caps = software_processor_caps;
233 else if (IsEqualGUID(&processor->device, &DXVA2_VideoProcProgressiveDevice))
235 *caps = progressive_processor_caps;
237 else
239 FIXME("Unsupported device %s.\n", debugstr_guid(&processor->device));
240 return E_FAIL;
243 return S_OK;
246 static HRESULT WINAPI video_processor_GetProcAmpRange(IDirectXVideoProcessor *iface, UINT cap, DXVA2_ValueRange *range)
248 FIXME("%p, %u, %p.\n", iface, cap, range);
250 return E_NOTIMPL;
253 static HRESULT WINAPI video_processor_GetFilterPropertyRange(IDirectXVideoProcessor *iface, UINT setting,
254 DXVA2_ValueRange *range)
256 FIXME("%p, %u, %p.\n", iface, setting, range);
258 return E_NOTIMPL;
261 static BOOL intersect_rect(RECT *dest, const RECT *src1, const RECT *src2)
263 if (IsRectEmpty(src1) || IsRectEmpty(src2) ||
264 (src1->left >= src2->right) || (src2->left >= src1->right) ||
265 (src1->top >= src2->bottom) || (src2->top >= src1->bottom))
267 SetRectEmpty(dest);
268 return FALSE;
270 dest->left = max(src1->left, src2->left);
271 dest->right = min(src1->right, src2->right);
272 dest->top = max(src1->top, src2->top);
273 dest->bottom = min(src1->bottom, src2->bottom);
275 return TRUE;
278 static D3DCOLOR video_processor_get_background_color(const DXVA2_AYUVSample16 *ayuv)
280 float y, cb, cr;
281 BYTE r, g, b;
283 y = (ayuv->Y >> 8) - 16;
284 cb = (ayuv->Cb >> 8) - 128;
285 cr = (ayuv->Cr >> 8) - 128;
287 y = 255.0f * y / 219.0f;
288 cb = 255.0f * cb / 224.0f;
289 cr = 255.0f * cr / 224.0f;
291 r = y + 1.402 * cr;
292 g = y - 0.344 * cb - 0.714 * cr;
293 b = y + 1.772 * cb;
295 return D3DCOLOR_XRGB(r, g, b);
298 static HRESULT WINAPI video_processor_VideoProcessBlt(IDirectXVideoProcessor *iface, IDirect3DSurface9 *rt,
299 const DXVA2_VideoProcessBltParams *params, const DXVA2_VideoSample *samples, UINT sample_count,
300 HANDLE *complete_handle)
302 IDirect3DDevice9 *device;
303 unsigned int i;
304 RECT dst_rect;
305 HRESULT hr;
307 TRACE("%p, %p, %p, %p, %u, %p.\n", iface, rt, params, samples, sample_count, complete_handle);
309 if (params->BackgroundColor.Alpha != 0xffff)
311 WARN("Unexpected background alpha %#x.\n", params->BackgroundColor.Alpha);
312 return E_INVALIDARG;
315 if (FAILED(hr = IDirect3DSurface9_GetDevice(rt, &device)))
317 WARN("Failed to get surface device, hr %#x.\n", hr);
318 return hr;
321 IDirect3DDevice9_ColorFill(device, rt, &params->TargetRect, video_processor_get_background_color(&params->BackgroundColor));
323 for (i = 0; i < sample_count; ++i)
325 dst_rect = params->TargetRect;
327 if (!intersect_rect(&dst_rect, &dst_rect, &samples[i].DstRect))
328 continue;
330 if (FAILED(hr = IDirect3DDevice9_StretchRect(device, samples[i].SrcSurface, &samples[i].SrcRect,
331 rt, &dst_rect, D3DTEXF_POINT)))
333 WARN("Failed to copy sample %u, hr %#x.\n", i, hr);
337 IDirect3DDevice9_Release(device);
339 return S_OK;
342 static const IDirectXVideoProcessorVtbl video_processor_vtbl =
344 video_processor_QueryInterface,
345 video_processor_AddRef,
346 video_processor_Release,
347 video_processor_GetVideoProcessorService,
348 video_processor_GetCreationParameters,
349 video_processor_GetVideoProcessorCaps,
350 video_processor_GetProcAmpRange,
351 video_processor_GetFilterPropertyRange,
352 video_processor_VideoProcessBlt,
355 static HRESULT WINAPI device_manager_processor_service_QueryInterface(IDirectXVideoProcessorService *iface,
356 REFIID riid, void **obj)
358 struct device_manager *manager = impl_from_IDirectXVideoProcessorService(iface);
360 if (IsEqualIID(riid, &IID_IDirectXVideoProcessorService) ||
361 IsEqualIID(riid, &IID_IDirectXVideoAccelerationService) ||
362 IsEqualIID(riid, &IID_IUnknown))
364 *obj = iface;
366 else if (IsEqualIID(riid, &IID_IDirectXVideoDecoderService))
368 *obj = &manager->IDirectXVideoDecoderService_iface;
370 else
372 WARN("Unsupported interface %s.\n", debugstr_guid(riid));
373 *obj = NULL;
374 return E_NOINTERFACE;
377 IUnknown_AddRef((IUnknown *)*obj);
378 return S_OK;
381 static ULONG WINAPI device_manager_processor_service_AddRef(IDirectXVideoProcessorService *iface)
383 struct device_manager *manager = impl_from_IDirectXVideoProcessorService(iface);
384 return IDirect3DDeviceManager9_AddRef(&manager->IDirect3DDeviceManager9_iface);
387 static ULONG WINAPI device_manager_processor_service_Release(IDirectXVideoProcessorService *iface)
389 struct device_manager *manager = impl_from_IDirectXVideoProcessorService(iface);
390 return IDirect3DDeviceManager9_Release(&manager->IDirect3DDeviceManager9_iface);
393 static HRESULT WINAPI device_manager_processor_service_CreateSurface(IDirectXVideoProcessorService *iface,
394 UINT width, UINT height, UINT backbuffers, D3DFORMAT format, D3DPOOL pool, DWORD usage, DWORD dxvaType,
395 IDirect3DSurface9 **surfaces, HANDLE *shared_handle)
397 struct device_manager *manager = impl_from_IDirectXVideoProcessorService(iface);
398 unsigned int i, j;
399 HRESULT hr;
401 TRACE("%p, %u, %u, %u, %u, %u, %u, %u, %p, %p.\n", iface, width, height, backbuffers, format, pool, usage, dxvaType,
402 surfaces, shared_handle);
404 if (backbuffers >= UINT_MAX)
405 return E_INVALIDARG;
407 memset(surfaces, 0, (backbuffers + 1) * sizeof(*surfaces));
409 for (i = 0; i < backbuffers + 1; ++i)
411 if (FAILED(hr = IDirect3DDevice9_CreateOffscreenPlainSurface(manager->device, width, height, format,
412 pool, &surfaces[i], NULL)))
413 break;
416 if (FAILED(hr))
418 for (j = 0; j < i; ++j)
420 if (surfaces[j])
422 IDirect3DSurface9_Release(surfaces[j]);
423 surfaces[j] = NULL;
428 return hr;
431 static HRESULT WINAPI device_manager_processor_service_RegisterVideoProcessorSoftwareDevice(
432 IDirectXVideoProcessorService *iface, void *callbacks)
434 FIXME("%p, %p.\n", iface, callbacks);
436 return E_NOTIMPL;
439 struct dxva_processor_device_desc
441 const GUID *guid;
442 const D3DFORMAT *input_formats;
445 static const D3DFORMAT software_processor_input_formats[] =
447 D3DFMT_A8R8G8B8, D3DFMT_X8R8G8B8, D3DFMT_YUY2, 0
450 static const D3DFORMAT progressive_processor_input_formats[] =
452 D3DFMT_A8R8G8B8, D3DFMT_X8R8G8B8, D3DFMT_YUY2, D3DFMT_NV12, 0
455 static const struct dxva_processor_device_desc processor_devices[] =
457 { &DXVA2_VideoProcProgressiveDevice, progressive_processor_input_formats },
458 { &DXVA2_VideoProcSoftwareDevice, software_processor_input_formats },
461 static BOOL dxva_is_supported_stream_format(const DXVA2_VideoDesc *video_desc, const D3DFORMAT *formats)
463 while (*formats)
465 if (*formats == video_desc->Format) return TRUE;
466 formats++;
469 return FALSE;
472 static HRESULT WINAPI device_manager_processor_service_GetVideoProcessorDeviceGuids(
473 IDirectXVideoProcessorService *iface, const DXVA2_VideoDesc *video_desc, UINT *count, GUID **guids)
475 unsigned int i;
477 FIXME("%p, %p, %p, %p semi-stub.\n", iface, video_desc, count, guids);
479 *count = 0;
481 if (!(*guids = CoTaskMemAlloc(ARRAY_SIZE(processor_devices) * sizeof(**guids))))
482 return E_OUTOFMEMORY;
484 for (i = 0; i < ARRAY_SIZE(processor_devices); ++i)
486 if (dxva_is_supported_stream_format(video_desc, processor_devices[i].input_formats))
488 (*guids)[*count] = *processor_devices[i].guid;
489 *count += 1;
493 if (!*count)
495 CoTaskMemFree(*guids);
496 *guids = NULL;
497 return E_FAIL;
500 return S_OK;
503 static HRESULT WINAPI device_manager_processor_service_GetVideoProcessorRenderTargets(
504 IDirectXVideoProcessorService *iface, REFGUID deviceguid, const DXVA2_VideoDesc *video_desc, UINT *count,
505 D3DFORMAT **formats)
507 TRACE("%p, %s, %p, %p, %p.\n", iface, debugstr_guid(deviceguid), video_desc, count, formats);
509 if (IsEqualGUID(deviceguid, &DXVA2_VideoProcSoftwareDevice))
511 if (!dxva_is_supported_stream_format(video_desc, software_processor_input_formats))
513 WARN("Unsupported content format %#x.\n", video_desc->Format);
514 return E_FAIL;
517 if (!(*formats = CoTaskMemAlloc(2 * sizeof(**formats))))
518 return E_OUTOFMEMORY;
520 *count = 2;
521 (*formats)[0] = D3DFMT_X8R8G8B8;
522 (*formats)[1] = D3DFMT_A8R8G8B8;
524 return S_OK;
526 else if (IsEqualGUID(deviceguid, &DXVA2_VideoProcProgressiveDevice))
528 if (!dxva_is_supported_stream_format(video_desc, progressive_processor_input_formats))
530 WARN("Unsupported content format %#x.\n", video_desc->Format);
531 return E_FAIL;
534 if (!(*formats = CoTaskMemAlloc(2 * sizeof(**formats))))
535 return E_OUTOFMEMORY;
537 *count = 2;
538 (*formats)[0] = D3DFMT_X8R8G8B8;
539 (*formats)[1] = D3DFMT_NV12;
541 return S_OK;
543 else
544 FIXME("Unsupported device %s.\n", debugstr_guid(deviceguid));
546 return E_NOTIMPL;
549 static HRESULT WINAPI device_manager_processor_service_GetVideoProcessorSubStreamFormats(
550 IDirectXVideoProcessorService *iface, REFGUID deviceguid, const DXVA2_VideoDesc *video_desc,
551 D3DFORMAT rt_format, UINT *count, D3DFORMAT **formats)
553 FIXME("%p, %s, %p, %u, %p, %p.\n", iface, debugstr_guid(deviceguid), video_desc, rt_format, count, formats);
555 return E_NOTIMPL;
558 static HRESULT WINAPI device_manager_processor_service_GetVideoProcessorCaps(
559 IDirectXVideoProcessorService *iface, REFGUID device, const DXVA2_VideoDesc *video_desc,
560 D3DFORMAT rt_format, DXVA2_VideoProcessorCaps *caps)
562 TRACE("%p, %s, %p, %u, %p.\n", iface, debugstr_guid(device), video_desc, rt_format, caps);
564 if (IsEqualGUID(device, &DXVA2_VideoProcSoftwareDevice))
566 *caps = software_processor_caps;
568 else if (IsEqualGUID(device, &DXVA2_VideoProcProgressiveDevice))
570 *caps = progressive_processor_caps;
572 else
574 FIXME("Unrecognized device %s.\n", debugstr_guid(device));
575 return E_NOTIMPL;
578 return S_OK;
581 static HRESULT WINAPI device_manager_processor_service_GetProcAmpRange(
582 IDirectXVideoProcessorService *iface, REFGUID deviceguid, const DXVA2_VideoDesc *video_desc,
583 D3DFORMAT rt_format, UINT ProcAmpCap, DXVA2_ValueRange *range)
585 FIXME("%p, %s, %p, %u, %u, %p.\n", iface, debugstr_guid(deviceguid), video_desc, rt_format, ProcAmpCap, range);
587 return E_NOTIMPL;
590 static HRESULT WINAPI device_manager_processor_service_GetFilterPropertyRange(
591 IDirectXVideoProcessorService *iface, REFGUID deviceguid, const DXVA2_VideoDesc *video_desc,
592 D3DFORMAT rt_format, UINT filter_setting, DXVA2_ValueRange *range)
594 FIXME("%p, %s, %p, %d, %d, %p.\n", iface, debugstr_guid(deviceguid), video_desc, rt_format, filter_setting, range);
596 return E_NOTIMPL;
599 static HRESULT WINAPI device_manager_processor_service_CreateVideoProcessor(IDirectXVideoProcessorService *iface,
600 REFGUID device, const DXVA2_VideoDesc *video_desc, D3DFORMAT rt_format, UINT max_substreams,
601 IDirectXVideoProcessor **processor)
603 struct video_processor *object;
605 FIXME("%p, %s, %p, %d, %u, %p.\n", iface, debugstr_guid(device), video_desc, rt_format, max_substreams,
606 processor);
608 /* FIXME: validate render target format */
610 if (max_substreams >= 16)
612 WARN("Invalid substreams count %u.\n", max_substreams);
613 return E_INVALIDARG;
616 if (!(object = heap_alloc_zero(sizeof(*object))))
617 return E_OUTOFMEMORY;
619 object->IDirectXVideoProcessor_iface.lpVtbl = &video_processor_vtbl;
620 object->refcount = 1;
621 object->service = iface;
622 IDirectXVideoProcessorService_AddRef(object->service);
623 object->device = *device;
624 object->video_desc = *video_desc;
625 object->rt_format = rt_format;
626 object->max_substreams = max_substreams;
628 *processor = &object->IDirectXVideoProcessor_iface;
630 return S_OK;
633 static const IDirectXVideoProcessorServiceVtbl device_manager_processor_service_vtbl =
635 device_manager_processor_service_QueryInterface,
636 device_manager_processor_service_AddRef,
637 device_manager_processor_service_Release,
638 device_manager_processor_service_CreateSurface,
639 device_manager_processor_service_RegisterVideoProcessorSoftwareDevice,
640 device_manager_processor_service_GetVideoProcessorDeviceGuids,
641 device_manager_processor_service_GetVideoProcessorRenderTargets,
642 device_manager_processor_service_GetVideoProcessorSubStreamFormats,
643 device_manager_processor_service_GetVideoProcessorCaps,
644 device_manager_processor_service_GetProcAmpRange,
645 device_manager_processor_service_GetFilterPropertyRange,
646 device_manager_processor_service_CreateVideoProcessor,
649 static HRESULT WINAPI device_manager_decoder_service_QueryInterface(IDirectXVideoDecoderService *iface,
650 REFIID riid, void **obj)
652 if (IsEqualIID(riid, &IID_IDirectXVideoDecoderService) ||
653 IsEqualIID(riid, &IID_IDirectXVideoAccelerationService) ||
654 IsEqualIID(riid, &IID_IUnknown))
656 *obj = iface;
657 IDirectXVideoDecoderService_AddRef(iface);
658 return S_OK;
661 WARN("Unsupported interface %s.\n", debugstr_guid(riid));
662 *obj = NULL;
663 return E_NOINTERFACE;
666 static ULONG WINAPI device_manager_decoder_service_AddRef(IDirectXVideoDecoderService *iface)
668 struct device_manager *manager = impl_from_IDirectXVideoDecoderService(iface);
669 return IDirect3DDeviceManager9_AddRef(&manager->IDirect3DDeviceManager9_iface);
672 static ULONG WINAPI device_manager_decoder_service_Release(IDirectXVideoDecoderService *iface)
674 struct device_manager *manager = impl_from_IDirectXVideoDecoderService(iface);
675 return IDirect3DDeviceManager9_Release(&manager->IDirect3DDeviceManager9_iface);
678 static HRESULT WINAPI device_manager_decoder_service_CreateSurface(IDirectXVideoDecoderService *iface,
679 UINT width, UINT height, UINT backbuffers, D3DFORMAT format, D3DPOOL pool, DWORD usage, DWORD dxvaType,
680 IDirect3DSurface9 **surfaces, HANDLE *shared_handle)
682 FIXME("%p, %u, %u, %u, %#x, %d, %d, %d, %p, %p.\n", iface, width, height, backbuffers, format, pool, usage,
683 dxvaType, surfaces, shared_handle);
685 return E_NOTIMPL;
688 static HRESULT WINAPI device_manager_decoder_service_GetDecoderDeviceGuids(IDirectXVideoDecoderService *iface,
689 UINT *count, GUID **guids)
691 FIXME("%p, %p, %p.\n", iface, count, guids);
693 return E_NOTIMPL;
696 static HRESULT WINAPI device_manager_decoder_service_GetDecoderRenderTargets(IDirectXVideoDecoderService *iface,
697 REFGUID guid, UINT *count, D3DFORMAT **formats)
699 FIXME("%p, %s, %p, %p.\n", iface, debugstr_guid(guid), count, formats);
701 return E_NOTIMPL;
704 static HRESULT WINAPI device_manager_decoder_service_GetDecoderConfigurations(IDirectXVideoDecoderService *iface,
705 REFGUID guid, const DXVA2_VideoDesc *video_desc, IUnknown *reserved, UINT *count, DXVA2_ConfigPictureDecode **configs)
707 FIXME("%p, %s, %p, %p, %p, %p.\n", iface, debugstr_guid(guid), video_desc, reserved, count, configs);
709 return E_NOTIMPL;
712 static HRESULT WINAPI device_manager_decoder_service_CreateVideoDecoder(IDirectXVideoDecoderService *iface,
713 REFGUID guid, const DXVA2_VideoDesc *video_desc, DXVA2_ConfigPictureDecode *config, IDirect3DSurface9 **rts,
714 UINT num_surfaces, IDirectXVideoDecoder **decoder)
716 FIXME("%p, %s, %p, %p, %p, %u, %p.\n", iface, debugstr_guid(guid), video_desc, config, rts, num_surfaces,
717 decoder);
719 return E_NOTIMPL;
722 static const IDirectXVideoDecoderServiceVtbl device_manager_decoder_service_vtbl =
724 device_manager_decoder_service_QueryInterface,
725 device_manager_decoder_service_AddRef,
726 device_manager_decoder_service_Release,
727 device_manager_decoder_service_CreateSurface,
728 device_manager_decoder_service_GetDecoderDeviceGuids,
729 device_manager_decoder_service_GetDecoderRenderTargets,
730 device_manager_decoder_service_GetDecoderConfigurations,
731 device_manager_decoder_service_CreateVideoDecoder,
734 static HRESULT WINAPI device_manager_QueryInterface(IDirect3DDeviceManager9 *iface, REFIID riid, void **obj)
736 TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
738 if (IsEqualIID(&IID_IDirect3DDeviceManager9, riid) ||
739 IsEqualIID(&IID_IUnknown, riid))
741 *obj = iface;
742 IDirect3DDeviceManager9_AddRef(iface);
743 return S_OK;
746 WARN("Unsupported interface %s.\n", debugstr_guid(riid));
747 *obj = NULL;
748 return E_NOINTERFACE;
751 static ULONG WINAPI device_manager_AddRef(IDirect3DDeviceManager9 *iface)
753 struct device_manager *manager = impl_from_IDirect3DDeviceManager9(iface);
754 ULONG refcount = InterlockedIncrement(&manager->refcount);
756 TRACE("%p, refcount %u.\n", iface, refcount);
758 return refcount;
761 static ULONG WINAPI device_manager_Release(IDirect3DDeviceManager9 *iface)
763 struct device_manager *manager = impl_from_IDirect3DDeviceManager9(iface);
764 ULONG refcount = InterlockedDecrement(&manager->refcount);
765 size_t i;
767 TRACE("%p, refcount %u.\n", iface, refcount);
769 if (!refcount)
771 if (manager->device)
772 IDirect3DDevice9_Release(manager->device);
773 DeleteCriticalSection(&manager->cs);
774 for (i = 0; i < manager->count; ++i)
776 if (manager->handles[i].state_block)
777 IDirect3DStateBlock9_Release(manager->handles[i].state_block);
779 heap_free(manager->handles);
780 heap_free(manager);
783 return refcount;
786 static HRESULT WINAPI device_manager_ResetDevice(IDirect3DDeviceManager9 *iface, IDirect3DDevice9 *device,
787 UINT token)
789 struct device_manager *manager = impl_from_IDirect3DDeviceManager9(iface);
790 size_t i;
792 TRACE("%p, %p, %#x.\n", iface, device, token);
794 if (token != manager->token)
795 return E_INVALIDARG;
797 EnterCriticalSection(&manager->cs);
798 if (manager->device)
800 for (i = 0; i < manager->count; ++i)
802 if (manager->handles[i].state_block)
803 IDirect3DStateBlock9_Release(manager->handles[i].state_block);
804 manager->handles[i].state_block = NULL;
805 manager->handles[i].flags |= HANDLE_FLAG_INVALID;
807 manager->locking_handle = NULL;
808 IDirect3DDevice9_Release(manager->device);
810 manager->device = device;
811 IDirect3DDevice9_AddRef(manager->device);
812 LeaveCriticalSection(&manager->cs);
814 WakeAllConditionVariable(&manager->lock);
816 return S_OK;
819 static HRESULT WINAPI device_manager_OpenDeviceHandle(IDirect3DDeviceManager9 *iface, HANDLE *hdevice)
821 struct device_manager *manager = impl_from_IDirect3DDeviceManager9(iface);
822 HRESULT hr = S_OK;
823 size_t i;
825 TRACE("%p, %p.\n", iface, hdevice);
827 *hdevice = NULL;
829 EnterCriticalSection(&manager->cs);
830 if (!manager->device)
831 hr = DXVA2_E_NOT_INITIALIZED;
832 else
834 for (i = 0; i < manager->count; ++i)
836 if (!(manager->handles[i].flags & HANDLE_FLAG_OPEN))
838 manager->handles[i].flags |= HANDLE_FLAG_OPEN;
839 *hdevice = ULongToHandle(i + 1);
840 break;
844 if (dxva_array_reserve((void **)&manager->handles, &manager->capacity, manager->count + 1,
845 sizeof(*manager->handles)))
847 *hdevice = ULongToHandle(manager->count + 1);
848 manager->handles[manager->count].flags = HANDLE_FLAG_OPEN;
849 manager->handles[manager->count].state_block = NULL;
850 manager->count++;
852 else
853 hr = E_OUTOFMEMORY;
855 LeaveCriticalSection(&manager->cs);
857 return hr;
860 static HRESULT device_manager_get_handle_index(struct device_manager *manager, HANDLE hdevice, size_t *idx)
862 if (!hdevice || hdevice > ULongToHandle(manager->count))
863 return E_HANDLE;
864 *idx = (ULONG_PTR)hdevice - 1;
865 return S_OK;
868 static HRESULT WINAPI device_manager_CloseDeviceHandle(IDirect3DDeviceManager9 *iface, HANDLE hdevice)
870 struct device_manager *manager = impl_from_IDirect3DDeviceManager9(iface);
871 HRESULT hr;
872 size_t idx;
874 TRACE("%p, %p.\n", iface, hdevice);
876 EnterCriticalSection(&manager->cs);
877 if (SUCCEEDED(hr = device_manager_get_handle_index(manager, hdevice, &idx)))
879 if (manager->handles[idx].flags & HANDLE_FLAG_OPEN)
881 if (manager->locking_handle == hdevice)
882 manager->locking_handle = NULL;
883 manager->handles[idx].flags = 0;
884 if (idx == manager->count - 1)
885 manager->count--;
886 if (manager->handles[idx].state_block)
887 IDirect3DStateBlock9_Release(manager->handles[idx].state_block);
888 manager->handles[idx].state_block = NULL;
890 else
891 hr = E_HANDLE;
893 LeaveCriticalSection(&manager->cs);
895 WakeAllConditionVariable(&manager->lock);
897 return hr;
900 static HRESULT WINAPI device_manager_TestDevice(IDirect3DDeviceManager9 *iface, HANDLE hdevice)
902 struct device_manager *manager = impl_from_IDirect3DDeviceManager9(iface);
903 HRESULT hr;
904 size_t idx;
906 TRACE("%p, %p.\n", iface, hdevice);
908 EnterCriticalSection(&manager->cs);
909 if (SUCCEEDED(hr = device_manager_get_handle_index(manager, hdevice, &idx)))
911 unsigned int flags = manager->handles[idx].flags;
913 if (flags & HANDLE_FLAG_INVALID)
914 hr = DXVA2_E_NEW_VIDEO_DEVICE;
915 else if (!(flags & HANDLE_FLAG_OPEN))
916 hr = E_HANDLE;
918 LeaveCriticalSection(&manager->cs);
920 return hr;
923 static HRESULT WINAPI device_manager_LockDevice(IDirect3DDeviceManager9 *iface, HANDLE hdevice,
924 IDirect3DDevice9 **device, BOOL block)
926 struct device_manager *manager = impl_from_IDirect3DDeviceManager9(iface);
927 HRESULT hr;
928 size_t idx;
930 TRACE("%p, %p, %p, %d.\n", iface, hdevice, device, block);
932 EnterCriticalSection(&manager->cs);
933 if (!manager->device)
934 hr = DXVA2_E_NOT_INITIALIZED;
935 else if (SUCCEEDED(hr = device_manager_get_handle_index(manager, hdevice, &idx)))
937 if (manager->locking_handle && !block)
938 hr = DXVA2_E_VIDEO_DEVICE_LOCKED;
939 else
941 while (manager->locking_handle && block)
943 SleepConditionVariableCS(&manager->lock, &manager->cs, INFINITE);
946 if (SUCCEEDED(hr = device_manager_get_handle_index(manager, hdevice, &idx)))
948 if (manager->handles[idx].flags & HANDLE_FLAG_INVALID)
949 hr = DXVA2_E_NEW_VIDEO_DEVICE;
950 else
952 if (manager->handles[idx].state_block)
954 if (FAILED(IDirect3DStateBlock9_Apply(manager->handles[idx].state_block)))
955 WARN("Failed to apply state.\n");
956 IDirect3DStateBlock9_Release(manager->handles[idx].state_block);
957 manager->handles[idx].state_block = NULL;
959 *device = manager->device;
960 IDirect3DDevice9_AddRef(*device);
961 manager->locking_handle = hdevice;
966 LeaveCriticalSection(&manager->cs);
968 return hr;
971 static HRESULT WINAPI device_manager_UnlockDevice(IDirect3DDeviceManager9 *iface, HANDLE hdevice, BOOL savestate)
973 struct device_manager *manager = impl_from_IDirect3DDeviceManager9(iface);
974 HRESULT hr;
975 size_t idx;
977 TRACE("%p, %p, %d.\n", iface, hdevice, savestate);
979 EnterCriticalSection(&manager->cs);
981 if (hdevice != manager->locking_handle)
982 hr = E_INVALIDARG;
983 else if (SUCCEEDED(hr = device_manager_get_handle_index(manager, hdevice, &idx)))
985 manager->locking_handle = NULL;
986 if (savestate)
987 IDirect3DDevice9_CreateStateBlock(manager->device, D3DSBT_ALL, &manager->handles[idx].state_block);
990 LeaveCriticalSection(&manager->cs);
992 WakeAllConditionVariable(&manager->lock);
994 return hr;
997 static HRESULT WINAPI device_manager_GetVideoService(IDirect3DDeviceManager9 *iface, HANDLE hdevice, REFIID riid,
998 void **obj)
1000 struct device_manager *manager = impl_from_IDirect3DDeviceManager9(iface);
1001 HRESULT hr;
1002 size_t idx;
1004 TRACE("%p, %p, %s, %p.\n", iface, hdevice, debugstr_guid(riid), obj);
1006 EnterCriticalSection(&manager->cs);
1007 if (SUCCEEDED(hr = device_manager_get_handle_index(manager, hdevice, &idx)))
1009 unsigned int flags = manager->handles[idx].flags;
1011 if (flags & HANDLE_FLAG_INVALID)
1012 hr = DXVA2_E_NEW_VIDEO_DEVICE;
1013 else if (!(flags & HANDLE_FLAG_OPEN))
1014 hr = E_HANDLE;
1015 else
1016 hr = IDirectXVideoProcessorService_QueryInterface(&manager->IDirectXVideoProcessorService_iface,
1017 riid, obj);
1019 LeaveCriticalSection(&manager->cs);
1021 return hr;
1024 static const IDirect3DDeviceManager9Vtbl device_manager_vtbl =
1026 device_manager_QueryInterface,
1027 device_manager_AddRef,
1028 device_manager_Release,
1029 device_manager_ResetDevice,
1030 device_manager_OpenDeviceHandle,
1031 device_manager_CloseDeviceHandle,
1032 device_manager_TestDevice,
1033 device_manager_LockDevice,
1034 device_manager_UnlockDevice,
1035 device_manager_GetVideoService,
1038 BOOL WINAPI CapabilitiesRequestAndCapabilitiesReply( HMONITOR monitor, LPSTR buffer, DWORD length )
1040 FIXME("(%p, %p, %d): stub\n", monitor, buffer, length);
1042 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1043 return FALSE;
1046 HRESULT WINAPI DXVA2CreateDirect3DDeviceManager9(UINT *token, IDirect3DDeviceManager9 **manager)
1048 struct device_manager *object;
1050 TRACE("%p, %p.\n", token, manager);
1052 *manager = NULL;
1054 if (!(object = heap_alloc_zero(sizeof(*object))))
1055 return E_OUTOFMEMORY;
1057 object->IDirect3DDeviceManager9_iface.lpVtbl = &device_manager_vtbl;
1058 object->IDirectXVideoProcessorService_iface.lpVtbl = &device_manager_processor_service_vtbl;
1059 object->IDirectXVideoDecoderService_iface.lpVtbl = &device_manager_decoder_service_vtbl;
1060 object->refcount = 1;
1061 object->token = GetTickCount();
1062 InitializeCriticalSection(&object->cs);
1063 InitializeConditionVariable(&object->lock);
1065 *token = object->token;
1066 *manager = &object->IDirect3DDeviceManager9_iface;
1068 return S_OK;
1071 HRESULT WINAPI DXVA2CreateVideoService(IDirect3DDevice9 *device, REFIID riid, void **obj)
1073 IDirect3DDeviceManager9 *manager;
1074 HANDLE handle;
1075 HRESULT hr;
1076 UINT token;
1078 TRACE("%p, %s, %p.\n", device, debugstr_guid(riid), obj);
1080 if (FAILED(hr = DXVA2CreateDirect3DDeviceManager9(&token, &manager)))
1081 return hr;
1083 if (FAILED(hr = IDirect3DDeviceManager9_ResetDevice(manager, device, token)))
1084 goto done;
1086 if (FAILED(hr = IDirect3DDeviceManager9_OpenDeviceHandle(manager, &handle)))
1087 goto done;
1089 hr = IDirect3DDeviceManager9_GetVideoService(manager, handle, riid, obj);
1090 IDirect3DDeviceManager9_CloseDeviceHandle(manager, handle);
1092 done:
1093 IDirect3DDeviceManager9_Release(manager);
1095 return hr;
1098 BOOL WINAPI DegaussMonitor( HMONITOR monitor )
1100 FIXME("(%p): stub\n", monitor);
1102 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1103 return FALSE;
1106 BOOL WINAPI DestroyPhysicalMonitor( HMONITOR monitor )
1108 FIXME("(%p): stub\n", monitor);
1110 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1111 return FALSE;
1114 BOOL WINAPI DestroyPhysicalMonitors( DWORD arraySize, LPPHYSICAL_MONITOR array )
1116 FIXME("(0x%x, %p): stub\n", arraySize, array);
1118 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1119 return FALSE;
1122 BOOL WINAPI GetCapabilitiesStringLength( HMONITOR monitor, LPDWORD length )
1124 FIXME("(%p, %p): stub\n", monitor, length);
1126 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1127 return FALSE;
1130 BOOL WINAPI GetMonitorBrightness( HMONITOR monitor, LPDWORD minimum, LPDWORD current, LPDWORD maximum )
1132 FIXME("(%p, %p, %p, %p): stub\n", monitor, minimum, current, maximum);
1134 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1135 return FALSE;
1138 BOOL WINAPI GetMonitorCapabilities( HMONITOR monitor, LPDWORD capabilities, LPDWORD temperatures )
1140 FIXME("(%p, %p, %p): stub\n", monitor, capabilities, temperatures);
1142 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1143 return FALSE;
1147 BOOL WINAPI GetMonitorColorTemperature( HMONITOR monitor, LPMC_COLOR_TEMPERATURE temperature )
1149 FIXME("(%p, %p): stub\n", monitor, temperature);
1151 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1152 return FALSE;
1155 BOOL WINAPI GetMonitorContrast( HMONITOR monitor, LPDWORD minimum, LPDWORD current, LPDWORD maximum )
1157 FIXME("(%p, %p, %p, %p): stub\n", monitor, minimum, current, maximum);
1159 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1160 return FALSE;
1163 BOOL WINAPI GetMonitorDisplayAreaPosition( HMONITOR monitor, MC_POSITION_TYPE type, LPDWORD minimum,
1164 LPDWORD current, LPDWORD maximum )
1166 FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor, type, minimum, current, maximum);
1168 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1169 return FALSE;
1172 BOOL WINAPI GetMonitorDisplayAreaSize( HMONITOR monitor, MC_SIZE_TYPE type, LPDWORD minimum,
1173 LPDWORD current, LPDWORD maximum )
1175 FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor, type, minimum, current, maximum);
1177 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1178 return FALSE;
1181 BOOL WINAPI GetMonitorRedGreenOrBlueDrive( HMONITOR monitor, MC_DRIVE_TYPE type, LPDWORD minimum,
1182 LPDWORD current, LPDWORD maximum )
1184 FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor, type, minimum, current, maximum);
1186 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1187 return FALSE;
1190 BOOL WINAPI GetMonitorRedGreenOrBlueGain( HMONITOR monitor, MC_GAIN_TYPE type, LPDWORD minimum,
1191 LPDWORD current, LPDWORD maximum )
1193 FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor, type, minimum, current, maximum);
1195 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1196 return FALSE;
1199 BOOL WINAPI GetMonitorTechnologyType( HMONITOR monitor, LPMC_DISPLAY_TECHNOLOGY_TYPE type )
1201 FIXME("(%p, %p): stub\n", monitor, type);
1203 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1204 return FALSE;
1207 BOOL WINAPI GetNumberOfPhysicalMonitorsFromHMONITOR( HMONITOR monitor, LPDWORD number )
1209 FIXME("(%p, %p): stub\n", monitor, number);
1211 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1212 return FALSE;
1215 HRESULT WINAPI GetNumberOfPhysicalMonitorsFromIDirect3DDevice9( IDirect3DDevice9 *device, LPDWORD number )
1217 FIXME("(%p, %p): stub\n", device, number);
1219 return E_NOTIMPL;
1222 BOOL WINAPI GetPhysicalMonitorsFromHMONITOR( HMONITOR monitor, DWORD arraySize, LPPHYSICAL_MONITOR array )
1224 FIXME("(%p, 0x%x, %p): stub\n", monitor, arraySize, array);
1226 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1227 return FALSE;
1230 HRESULT WINAPI GetPhysicalMonitorsFromIDirect3DDevice9( IDirect3DDevice9 *device, DWORD arraySize, LPPHYSICAL_MONITOR array )
1232 FIXME("(%p, 0x%x, %p): stub\n", device, arraySize, array);
1234 return E_NOTIMPL;
1237 BOOL WINAPI GetTimingReport( HMONITOR monitor, LPMC_TIMING_REPORT timingReport )
1239 FIXME("(%p, %p): stub\n", monitor, timingReport);
1241 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1242 return FALSE;
1245 BOOL WINAPI GetVCPFeatureAndVCPFeatureReply( HMONITOR monitor, BYTE vcpCode, LPMC_VCP_CODE_TYPE pvct,
1246 LPDWORD current, LPDWORD maximum )
1248 FIXME("(%p, 0x%02x, %p, %p, %p): stub\n", monitor, vcpCode, pvct, current, maximum);
1250 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1251 return FALSE;
1254 HRESULT WINAPI OPMGetVideoOutputsFromHMONITOR( HMONITOR monitor, /* OPM_VIDEO_OUTPUT_SEMANTICS */ int vos,
1255 ULONG *numVideoOutputs, /* IOPMVideoOutput */ void ***videoOutputs )
1257 FIXME("(%p, 0x%x, %p, %p): stub\n", monitor, vos, numVideoOutputs, videoOutputs);
1259 return E_NOTIMPL;
1262 HRESULT WINAPI OPMGetVideoOutputsFromIDirect3DDevice9Object( IDirect3DDevice9 *device, /* OPM_VIDEO_OUTPUT_SEMANTICS */ int vos,
1263 ULONG *numVideoOutputs, /* IOPMVideoOutput */ void ***videoOutputs )
1265 FIXME("(%p, 0x%x, %p, %p): stub\n", device, vos, numVideoOutputs, videoOutputs);
1267 return E_NOTIMPL;
1270 BOOL WINAPI RestoreMonitorFactoryColorDefaults( HMONITOR monitor )
1272 FIXME("(%p): stub\n", monitor);
1274 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1275 return FALSE;
1278 BOOL WINAPI RestoreMonitorFactoryDefaults( HMONITOR monitor )
1280 FIXME("(%p): stub\n", monitor);
1282 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1283 return FALSE;
1286 BOOL WINAPI SaveCurrentMonitorSettings( HMONITOR monitor )
1288 FIXME("(%p): stub\n", monitor);
1290 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1291 return FALSE;
1294 BOOL WINAPI SaveCurrentSettings( HMONITOR monitor )
1296 FIXME("(%p): stub\n", monitor);
1298 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1299 return FALSE;
1302 BOOL WINAPI SetMonitorBrightness( HMONITOR monitor, DWORD brightness )
1304 FIXME("(%p, 0x%x): stub\n", monitor, brightness);
1306 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1307 return FALSE;
1310 BOOL WINAPI SetMonitorColorTemperature( HMONITOR monitor, MC_COLOR_TEMPERATURE temperature )
1312 FIXME("(%p, 0x%x): stub\n", monitor, temperature);
1314 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1315 return FALSE;
1318 BOOL WINAPI SetMonitorContrast( HMONITOR monitor, DWORD contrast )
1320 FIXME("(%p, 0x%x): stub\n", monitor, contrast);
1322 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1323 return FALSE;
1326 BOOL WINAPI SetMonitorDisplayAreaPosition( HMONITOR monitor, MC_POSITION_TYPE type, DWORD position )
1328 FIXME("(%p, 0x%x, 0x%x): stub\n", monitor, type, position);
1330 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1331 return FALSE;
1334 BOOL WINAPI SetMonitorDisplayAreaSize( HMONITOR monitor, MC_SIZE_TYPE type, DWORD size )
1336 FIXME("(%p, 0x%x, 0x%x): stub\n", monitor, type, size);
1338 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1339 return FALSE;
1342 BOOL WINAPI SetMonitorRedGreenOrBlueDrive( HMONITOR monitor, MC_DRIVE_TYPE type, DWORD drive )
1344 FIXME("(%p, 0x%x, 0x%x): stub\n", monitor, type, drive);
1346 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1347 return FALSE;
1350 BOOL WINAPI SetMonitorRedGreenOrBlueGain( HMONITOR monitor, MC_GAIN_TYPE type, DWORD gain )
1352 FIXME("(%p, 0x%x, 0x%x): stub\n", monitor, type, gain);
1354 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1355 return FALSE;
1358 BOOL WINAPI SetVCPFeature( HMONITOR monitor, BYTE vcpCode, DWORD value )
1360 FIXME("(%p, 0x%02x, 0x%x): stub\n", monitor, vcpCode, value);
1362 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1363 return FALSE;