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
26 #include "physicalmonitorenumerationapi.h"
27 #include "lowlevelmonitorconfigurationapi.h"
28 #include "highlevelmonitorconfigurationapi.h"
32 #include "wine/debug.h"
33 #include "wine/heap.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(dxva2
);
37 enum device_handle_flags
39 HANDLE_FLAG_OPEN
= 0x1,
40 HANDLE_FLAG_INVALID
= 0x2,
46 IDirect3DStateBlock9
*state_block
;
51 IDirect3DDeviceManager9 IDirect3DDeviceManager9_iface
;
52 IDirectXVideoProcessorService IDirectXVideoProcessorService_iface
;
55 IDirect3DDevice9
*device
;
58 struct device_handle
*handles
;
62 HANDLE locking_handle
;
65 CONDITION_VARIABLE lock
;
68 struct video_processor
70 IDirectXVideoProcessor IDirectXVideoProcessor_iface
;
73 IDirectXVideoProcessorService
*service
;
76 static BOOL
dxva_array_reserve(void **elements
, size_t *capacity
, size_t count
, size_t size
)
78 size_t new_capacity
, max_capacity
;
81 if (count
<= *capacity
)
84 max_capacity
= ~(SIZE_T
)0 / size
;
85 if (count
> max_capacity
)
88 new_capacity
= max(4, *capacity
);
89 while (new_capacity
< count
&& new_capacity
<= max_capacity
/ 2)
91 if (new_capacity
< count
)
92 new_capacity
= max_capacity
;
94 if (!(new_elements
= heap_realloc(*elements
, new_capacity
* size
)))
97 *elements
= new_elements
;
98 *capacity
= new_capacity
;
103 static struct device_manager
*impl_from_IDirect3DDeviceManager9(IDirect3DDeviceManager9
*iface
)
105 return CONTAINING_RECORD(iface
, struct device_manager
, IDirect3DDeviceManager9_iface
);
108 static struct device_manager
*impl_from_IDirectXVideoProcessorService(IDirectXVideoProcessorService
*iface
)
110 return CONTAINING_RECORD(iface
, struct device_manager
, IDirectXVideoProcessorService_iface
);
113 static struct video_processor
*impl_from_IDirectXVideoProcessor(IDirectXVideoProcessor
*iface
)
115 return CONTAINING_RECORD(iface
, struct video_processor
, IDirectXVideoProcessor_iface
);
118 static HRESULT WINAPI
video_processor_QueryInterface(IDirectXVideoProcessor
*iface
, REFIID riid
, void **obj
)
120 if (IsEqualIID(riid
, &IID_IDirectXVideoProcessor
) ||
121 IsEqualIID(riid
, &IID_IUnknown
))
124 IDirectXVideoProcessor_AddRef(iface
);
128 WARN("Unsupported interface %s.\n", debugstr_guid(riid
));
130 return E_NOINTERFACE
;
133 static ULONG WINAPI
video_processor_AddRef(IDirectXVideoProcessor
*iface
)
135 struct video_processor
*processor
= impl_from_IDirectXVideoProcessor(iface
);
136 ULONG refcount
= InterlockedIncrement(&processor
->refcount
);
138 TRACE("%p, refcount %u.\n", iface
, refcount
);
143 static ULONG WINAPI
video_processor_Release(IDirectXVideoProcessor
*iface
)
145 struct video_processor
*processor
= impl_from_IDirectXVideoProcessor(iface
);
146 ULONG refcount
= InterlockedDecrement(&processor
->refcount
);
148 TRACE("%p, refcount %u.\n", iface
, refcount
);
152 IDirectXVideoProcessorService_Release(processor
->service
);
153 heap_free(processor
);
159 static HRESULT WINAPI
video_processor_GetVideoProcessorService(IDirectXVideoProcessor
*iface
,
160 IDirectXVideoProcessorService
**service
)
162 struct video_processor
*processor
= impl_from_IDirectXVideoProcessor(iface
);
164 TRACE("%p, %p.\n", iface
, service
);
166 *service
= processor
->service
;
167 IDirectXVideoProcessorService_AddRef(*service
);
172 static HRESULT WINAPI
video_processor_GetCreationParameters(IDirectXVideoProcessor
*iface
,
173 GUID
*device
, DXVA2_VideoDesc
*video_desc
, D3DFORMAT
*rt_format
, UINT
*maxstreams
)
175 FIXME("%p, %p, %p, %p, %p.\n", iface
, device
, video_desc
, rt_format
, maxstreams
);
177 if (!device
&& !video_desc
&& !rt_format
&& !maxstreams
)
183 static HRESULT WINAPI
video_processor_GetVideoProcessorCaps(IDirectXVideoProcessor
*iface
,
184 DXVA2_VideoProcessorCaps
*caps
)
186 FIXME("%p, %p.\n", iface
, caps
);
191 static HRESULT WINAPI
video_processor_GetProcAmpRange(IDirectXVideoProcessor
*iface
, UINT cap
, DXVA2_ValueRange
*range
)
193 FIXME("%p, %u, %p.\n", iface
, cap
, range
);
198 static HRESULT WINAPI
video_processor_GetFilterPropertyRange(IDirectXVideoProcessor
*iface
, UINT setting
,
199 DXVA2_ValueRange
*range
)
201 FIXME("%p, %u, %p.\n", iface
, setting
, range
);
206 static HRESULT WINAPI
video_processor_VideoProcessBlt(IDirectXVideoProcessor
*iface
, IDirect3DSurface9
*rt
,
207 const DXVA2_VideoProcessBltParams
*params
, const DXVA2_VideoSample
*samples
, UINT sample_count
,
208 HANDLE
*complete_handle
)
210 FIXME("%p, %p, %p, %p, %u, %p.\n", iface
, rt
, params
, samples
, sample_count
, complete_handle
);
215 static const IDirectXVideoProcessorVtbl video_processor_vtbl
=
217 video_processor_QueryInterface
,
218 video_processor_AddRef
,
219 video_processor_Release
,
220 video_processor_GetVideoProcessorService
,
221 video_processor_GetCreationParameters
,
222 video_processor_GetVideoProcessorCaps
,
223 video_processor_GetProcAmpRange
,
224 video_processor_GetFilterPropertyRange
,
225 video_processor_VideoProcessBlt
,
228 static HRESULT WINAPI
device_manager_processor_service_QueryInterface(IDirectXVideoProcessorService
*iface
,
229 REFIID riid
, void **obj
)
231 if (IsEqualIID(riid
, &IID_IDirectXVideoProcessorService
) ||
232 IsEqualIID(riid
, &IID_IDirectXVideoAccelerationService
) ||
233 IsEqualIID(riid
, &IID_IUnknown
))
236 IDirectXVideoProcessorService_AddRef(iface
);
240 WARN("Unsupported interface %s.\n", debugstr_guid(riid
));
242 return E_NOINTERFACE
;
245 static ULONG WINAPI
device_manager_processor_service_AddRef(IDirectXVideoProcessorService
*iface
)
247 struct device_manager
*manager
= impl_from_IDirectXVideoProcessorService(iface
);
248 return IDirect3DDeviceManager9_AddRef(&manager
->IDirect3DDeviceManager9_iface
);
251 static ULONG WINAPI
device_manager_processor_service_Release(IDirectXVideoProcessorService
*iface
)
253 struct device_manager
*manager
= impl_from_IDirectXVideoProcessorService(iface
);
254 return IDirect3DDeviceManager9_Release(&manager
->IDirect3DDeviceManager9_iface
);
257 static HRESULT WINAPI
device_manager_processor_service_CreateSurface(IDirectXVideoProcessorService
*iface
,
258 UINT width
, UINT height
, UINT backbuffers
, D3DFORMAT format
, D3DPOOL pool
, DWORD usage
, DWORD dxvaType
,
259 IDirect3DSurface9
**surfaces
, HANDLE
*shared_handle
)
261 struct device_manager
*manager
= impl_from_IDirectXVideoProcessorService(iface
);
265 TRACE("%p, %u, %u, %u, %u, %u, %u, %u, %p, %p.\n", iface
, width
, height
, backbuffers
, format
, pool
, usage
, dxvaType
,
266 surfaces
, shared_handle
);
268 if (backbuffers
>= UINT_MAX
)
271 memset(surfaces
, 0, (backbuffers
+ 1) * sizeof(*surfaces
));
273 for (i
= 0; i
< backbuffers
+ 1; ++i
)
275 if (FAILED(hr
= IDirect3DDevice9_CreateOffscreenPlainSurface(manager
->device
, width
, height
, format
,
276 pool
, &surfaces
[i
], NULL
)))
282 for (j
= 0; j
< i
; ++j
)
286 IDirect3DSurface9_Release(surfaces
[j
]);
295 static HRESULT WINAPI
device_manager_processor_service_RegisterVideoProcessorSoftwareDevice(
296 IDirectXVideoProcessorService
*iface
, void *callbacks
)
298 FIXME("%p, %p.\n", iface
, callbacks
);
303 static HRESULT WINAPI
device_manager_processor_service_GetVideoProcessorDeviceGuids(
304 IDirectXVideoProcessorService
*iface
, const DXVA2_VideoDesc
*video_desc
, UINT
*count
, GUID
**guids
)
306 FIXME("%p, %p, %p, %p semi-stub.\n", iface
, video_desc
, count
, guids
);
308 if (!(*guids
= CoTaskMemAlloc(sizeof(**guids
))))
309 return E_OUTOFMEMORY
;
311 memcpy(*guids
, &DXVA2_VideoProcSoftwareDevice
, sizeof(**guids
));
317 static HRESULT WINAPI
device_manager_processor_service_GetVideoProcessorRenderTargets(
318 IDirectXVideoProcessorService
*iface
, REFGUID deviceguid
, const DXVA2_VideoDesc
*video_desc
, UINT
*count
,
321 TRACE("%p, %s, %p, %p, %p.\n", iface
, debugstr_guid(deviceguid
), video_desc
, count
, formats
);
323 if (IsEqualGUID(deviceguid
, &DXVA2_VideoProcSoftwareDevice
))
325 /* FIXME: filter some input formats */
327 if (!(*formats
= CoTaskMemAlloc(2 * sizeof(**formats
))))
328 return E_OUTOFMEMORY
;
331 (*formats
)[0] = D3DFMT_X8R8G8B8
;
332 (*formats
)[1] = D3DFMT_A8R8G8B8
;
337 FIXME("Unsupported device %s.\n", debugstr_guid(deviceguid
));
342 static HRESULT WINAPI
device_manager_processor_service_GetVideoProcessorSubStreamFormats(
343 IDirectXVideoProcessorService
*iface
, REFGUID deviceguid
, const DXVA2_VideoDesc
*video_desc
,
344 D3DFORMAT rt_format
, UINT
*count
, D3DFORMAT
**formats
)
346 FIXME("%p, %s, %p, %u, %p, %p.\n", iface
, debugstr_guid(deviceguid
), video_desc
, rt_format
, count
, formats
);
351 static HRESULT WINAPI
device_manager_processor_service_GetVideoProcessorCaps(
352 IDirectXVideoProcessorService
*iface
, REFGUID deviceguid
, const DXVA2_VideoDesc
*video_desc
,
353 D3DFORMAT rt_format
, DXVA2_VideoProcessorCaps
*caps
)
355 FIXME("%p, %s, %p, %u, %p.\n", iface
, debugstr_guid(deviceguid
), video_desc
, rt_format
, caps
);
360 static HRESULT WINAPI
device_manager_processor_service_GetProcAmpRange(
361 IDirectXVideoProcessorService
*iface
, REFGUID deviceguid
, const DXVA2_VideoDesc
*video_desc
,
362 D3DFORMAT rt_format
, UINT ProcAmpCap
, DXVA2_ValueRange
*range
)
364 FIXME("%p, %s, %p, %u, %u, %p.\n", iface
, debugstr_guid(deviceguid
), video_desc
, rt_format
, ProcAmpCap
, range
);
369 static HRESULT WINAPI
device_manager_processor_service_GetFilterPropertyRange(
370 IDirectXVideoProcessorService
*iface
, REFGUID deviceguid
, const DXVA2_VideoDesc
*video_desc
,
371 D3DFORMAT rt_format
, UINT filter_setting
, DXVA2_ValueRange
*range
)
373 FIXME("%p, %s, %p, %d, %d, %p.\n", iface
, debugstr_guid(deviceguid
), video_desc
, rt_format
, filter_setting
, range
);
378 static HRESULT WINAPI
device_manager_processor_service_CreateVideoProcessor(IDirectXVideoProcessorService
*iface
,
379 REFGUID deviceguid
, const DXVA2_VideoDesc
*video_desc
, D3DFORMAT rt_format
, UINT max_substreams
,
380 IDirectXVideoProcessor
**processor
)
382 struct video_processor
*object
;
384 FIXME("%p, %s, %p, %d, %u, %p.\n", iface
, debugstr_guid(deviceguid
), video_desc
, rt_format
, max_substreams
,
387 /* FIXME: validate render target format */
389 if (!(object
= heap_alloc_zero(sizeof(*object
))))
390 return E_OUTOFMEMORY
;
392 object
->IDirectXVideoProcessor_iface
.lpVtbl
= &video_processor_vtbl
;
393 object
->refcount
= 1;
394 object
->service
= iface
;
395 IDirectXVideoProcessorService_AddRef(object
->service
);
397 *processor
= &object
->IDirectXVideoProcessor_iface
;
402 static const IDirectXVideoProcessorServiceVtbl device_manager_processor_service_vtbl
=
404 device_manager_processor_service_QueryInterface
,
405 device_manager_processor_service_AddRef
,
406 device_manager_processor_service_Release
,
407 device_manager_processor_service_CreateSurface
,
408 device_manager_processor_service_RegisterVideoProcessorSoftwareDevice
,
409 device_manager_processor_service_GetVideoProcessorDeviceGuids
,
410 device_manager_processor_service_GetVideoProcessorRenderTargets
,
411 device_manager_processor_service_GetVideoProcessorSubStreamFormats
,
412 device_manager_processor_service_GetVideoProcessorCaps
,
413 device_manager_processor_service_GetProcAmpRange
,
414 device_manager_processor_service_GetFilterPropertyRange
,
415 device_manager_processor_service_CreateVideoProcessor
,
418 static HRESULT WINAPI
device_manager_QueryInterface(IDirect3DDeviceManager9
*iface
, REFIID riid
, void **obj
)
420 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(riid
), obj
);
422 if (IsEqualIID(&IID_IDirect3DDeviceManager9
, riid
) ||
423 IsEqualIID(&IID_IUnknown
, riid
))
426 IDirect3DDeviceManager9_AddRef(iface
);
430 WARN("Unsupported interface %s.\n", debugstr_guid(riid
));
432 return E_NOINTERFACE
;
435 static ULONG WINAPI
device_manager_AddRef(IDirect3DDeviceManager9
*iface
)
437 struct device_manager
*manager
= impl_from_IDirect3DDeviceManager9(iface
);
438 ULONG refcount
= InterlockedIncrement(&manager
->refcount
);
440 TRACE("%p, refcount %u.\n", iface
, refcount
);
445 static ULONG WINAPI
device_manager_Release(IDirect3DDeviceManager9
*iface
)
447 struct device_manager
*manager
= impl_from_IDirect3DDeviceManager9(iface
);
448 ULONG refcount
= InterlockedDecrement(&manager
->refcount
);
451 TRACE("%p, refcount %u.\n", iface
, refcount
);
456 IDirect3DDevice9_Release(manager
->device
);
457 DeleteCriticalSection(&manager
->cs
);
458 for (i
= 0; i
< manager
->count
; ++i
)
460 if (manager
->handles
[i
].state_block
)
461 IDirect3DStateBlock9_Release(manager
->handles
[i
].state_block
);
463 heap_free(manager
->handles
);
470 static HRESULT WINAPI
device_manager_ResetDevice(IDirect3DDeviceManager9
*iface
, IDirect3DDevice9
*device
,
473 struct device_manager
*manager
= impl_from_IDirect3DDeviceManager9(iface
);
476 TRACE("%p, %p, %#x.\n", iface
, device
, token
);
478 if (token
!= manager
->token
)
481 EnterCriticalSection(&manager
->cs
);
484 for (i
= 0; i
< manager
->count
; ++i
)
486 if (manager
->handles
[i
].state_block
)
487 IDirect3DStateBlock9_Release(manager
->handles
[i
].state_block
);
488 manager
->handles
[i
].state_block
= NULL
;
489 manager
->handles
[i
].flags
|= HANDLE_FLAG_INVALID
;
491 manager
->locking_handle
= NULL
;
492 IDirect3DDevice9_Release(manager
->device
);
494 manager
->device
= device
;
495 IDirect3DDevice9_AddRef(manager
->device
);
496 LeaveCriticalSection(&manager
->cs
);
498 WakeAllConditionVariable(&manager
->lock
);
503 static HRESULT WINAPI
device_manager_OpenDeviceHandle(IDirect3DDeviceManager9
*iface
, HANDLE
*hdevice
)
505 struct device_manager
*manager
= impl_from_IDirect3DDeviceManager9(iface
);
509 TRACE("%p, %p.\n", iface
, hdevice
);
513 EnterCriticalSection(&manager
->cs
);
514 if (!manager
->device
)
515 hr
= DXVA2_E_NOT_INITIALIZED
;
518 for (i
= 0; i
< manager
->count
; ++i
)
520 if (!(manager
->handles
[i
].flags
& HANDLE_FLAG_OPEN
))
522 manager
->handles
[i
].flags
|= HANDLE_FLAG_OPEN
;
523 *hdevice
= ULongToHandle(i
+ 1);
528 if (dxva_array_reserve((void **)&manager
->handles
, &manager
->capacity
, manager
->count
+ 1,
529 sizeof(*manager
->handles
)))
531 *hdevice
= ULongToHandle(manager
->count
+ 1);
532 manager
->handles
[manager
->count
].flags
= HANDLE_FLAG_OPEN
;
533 manager
->handles
[manager
->count
].state_block
= NULL
;
539 LeaveCriticalSection(&manager
->cs
);
544 static HRESULT
device_manager_get_handle_index(struct device_manager
*manager
, HANDLE hdevice
, size_t *idx
)
546 if (hdevice
> ULongToHandle(manager
->count
))
548 *idx
= (ULONG_PTR
)hdevice
- 1;
552 static HRESULT WINAPI
device_manager_CloseDeviceHandle(IDirect3DDeviceManager9
*iface
, HANDLE hdevice
)
554 struct device_manager
*manager
= impl_from_IDirect3DDeviceManager9(iface
);
558 TRACE("%p, %p.\n", iface
, hdevice
);
560 EnterCriticalSection(&manager
->cs
);
561 if (SUCCEEDED(hr
= device_manager_get_handle_index(manager
, hdevice
, &idx
)))
563 if (manager
->handles
[idx
].flags
& HANDLE_FLAG_OPEN
)
565 if (manager
->locking_handle
== hdevice
)
566 manager
->locking_handle
= NULL
;
567 manager
->handles
[idx
].flags
= 0;
568 if (idx
== manager
->count
- 1)
570 if (manager
->handles
[idx
].state_block
)
571 IDirect3DStateBlock9_Release(manager
->handles
[idx
].state_block
);
572 manager
->handles
[idx
].state_block
= NULL
;
577 LeaveCriticalSection(&manager
->cs
);
579 WakeAllConditionVariable(&manager
->lock
);
584 static HRESULT WINAPI
device_manager_TestDevice(IDirect3DDeviceManager9
*iface
, HANDLE hdevice
)
586 struct device_manager
*manager
= impl_from_IDirect3DDeviceManager9(iface
);
590 TRACE("%p, %p.\n", iface
, hdevice
);
592 EnterCriticalSection(&manager
->cs
);
593 if (SUCCEEDED(hr
= device_manager_get_handle_index(manager
, hdevice
, &idx
)))
595 unsigned int flags
= manager
->handles
[idx
].flags
;
597 if (flags
& HANDLE_FLAG_INVALID
)
598 hr
= DXVA2_E_NEW_VIDEO_DEVICE
;
599 else if (!(flags
& HANDLE_FLAG_OPEN
))
602 LeaveCriticalSection(&manager
->cs
);
607 static HRESULT WINAPI
device_manager_LockDevice(IDirect3DDeviceManager9
*iface
, HANDLE hdevice
,
608 IDirect3DDevice9
**device
, BOOL block
)
610 struct device_manager
*manager
= impl_from_IDirect3DDeviceManager9(iface
);
614 TRACE("%p, %p, %p, %d.\n", iface
, hdevice
, device
, block
);
616 EnterCriticalSection(&manager
->cs
);
617 if (!manager
->device
)
618 hr
= DXVA2_E_NOT_INITIALIZED
;
619 else if (SUCCEEDED(hr
= device_manager_get_handle_index(manager
, hdevice
, &idx
)))
621 if (manager
->locking_handle
&& !block
)
622 hr
= DXVA2_E_VIDEO_DEVICE_LOCKED
;
625 while (manager
->locking_handle
&& block
)
627 SleepConditionVariableCS(&manager
->lock
, &manager
->cs
, INFINITE
);
630 if (SUCCEEDED(hr
= device_manager_get_handle_index(manager
, hdevice
, &idx
)))
632 if (manager
->handles
[idx
].flags
& HANDLE_FLAG_INVALID
)
633 hr
= DXVA2_E_NEW_VIDEO_DEVICE
;
636 if (manager
->handles
[idx
].state_block
)
638 if (FAILED(IDirect3DStateBlock9_Apply(manager
->handles
[idx
].state_block
)))
639 WARN("Failed to apply state.\n");
640 IDirect3DStateBlock9_Release(manager
->handles
[idx
].state_block
);
641 manager
->handles
[idx
].state_block
= NULL
;
643 *device
= manager
->device
;
644 IDirect3DDevice9_AddRef(*device
);
645 manager
->locking_handle
= hdevice
;
650 LeaveCriticalSection(&manager
->cs
);
655 static HRESULT WINAPI
device_manager_UnlockDevice(IDirect3DDeviceManager9
*iface
, HANDLE hdevice
, BOOL savestate
)
657 struct device_manager
*manager
= impl_from_IDirect3DDeviceManager9(iface
);
661 TRACE("%p, %p, %d.\n", iface
, hdevice
, savestate
);
663 EnterCriticalSection(&manager
->cs
);
665 if (hdevice
!= manager
->locking_handle
)
667 else if (SUCCEEDED(hr
= device_manager_get_handle_index(manager
, hdevice
, &idx
)))
669 manager
->locking_handle
= NULL
;
671 IDirect3DDevice9_CreateStateBlock(manager
->device
, D3DSBT_ALL
, &manager
->handles
[idx
].state_block
);
674 LeaveCriticalSection(&manager
->cs
);
676 WakeAllConditionVariable(&manager
->lock
);
681 static HRESULT WINAPI
device_manager_GetVideoService(IDirect3DDeviceManager9
*iface
, HANDLE hdevice
, REFIID riid
,
684 struct device_manager
*manager
= impl_from_IDirect3DDeviceManager9(iface
);
688 TRACE("%p, %p, %s, %p.\n", iface
, hdevice
, debugstr_guid(riid
), obj
);
690 EnterCriticalSection(&manager
->cs
);
691 if (SUCCEEDED(hr
= device_manager_get_handle_index(manager
, hdevice
, &idx
)))
693 unsigned int flags
= manager
->handles
[idx
].flags
;
695 if (flags
& HANDLE_FLAG_INVALID
)
696 hr
= DXVA2_E_NEW_VIDEO_DEVICE
;
697 else if (!(flags
& HANDLE_FLAG_OPEN
))
700 hr
= IDirectXVideoProcessorService_QueryInterface(&manager
->IDirectXVideoProcessorService_iface
,
703 LeaveCriticalSection(&manager
->cs
);
708 static const IDirect3DDeviceManager9Vtbl device_manager_vtbl
=
710 device_manager_QueryInterface
,
711 device_manager_AddRef
,
712 device_manager_Release
,
713 device_manager_ResetDevice
,
714 device_manager_OpenDeviceHandle
,
715 device_manager_CloseDeviceHandle
,
716 device_manager_TestDevice
,
717 device_manager_LockDevice
,
718 device_manager_UnlockDevice
,
719 device_manager_GetVideoService
,
722 BOOL WINAPI
CapabilitiesRequestAndCapabilitiesReply( HMONITOR monitor
, LPSTR buffer
, DWORD length
)
724 FIXME("(%p, %p, %d): stub\n", monitor
, buffer
, length
);
726 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
730 HRESULT WINAPI
DXVA2CreateDirect3DDeviceManager9(UINT
*token
, IDirect3DDeviceManager9
**manager
)
732 struct device_manager
*object
;
734 TRACE("%p, %p.\n", token
, manager
);
738 if (!(object
= heap_alloc_zero(sizeof(*object
))))
739 return E_OUTOFMEMORY
;
741 object
->IDirect3DDeviceManager9_iface
.lpVtbl
= &device_manager_vtbl
;
742 object
->IDirectXVideoProcessorService_iface
.lpVtbl
= &device_manager_processor_service_vtbl
;
743 object
->refcount
= 1;
744 object
->token
= GetTickCount();
745 InitializeCriticalSection(&object
->cs
);
746 InitializeConditionVariable(&object
->lock
);
748 *token
= object
->token
;
749 *manager
= &object
->IDirect3DDeviceManager9_iface
;
754 HRESULT WINAPI
DXVA2CreateVideoService(IDirect3DDevice9
*device
, REFIID riid
, void **obj
)
756 IDirect3DDeviceManager9
*manager
;
761 TRACE("%p, %s, %p.\n", device
, debugstr_guid(riid
), obj
);
763 if (FAILED(hr
= DXVA2CreateDirect3DDeviceManager9(&token
, &manager
)))
766 if (FAILED(hr
= IDirect3DDeviceManager9_ResetDevice(manager
, device
, token
)))
769 if (FAILED(hr
= IDirect3DDeviceManager9_OpenDeviceHandle(manager
, &handle
)))
772 hr
= IDirect3DDeviceManager9_GetVideoService(manager
, handle
, riid
, obj
);
773 IDirect3DDeviceManager9_CloseDeviceHandle(manager
, handle
);
776 IDirect3DDeviceManager9_Release(manager
);
781 BOOL WINAPI
DegaussMonitor( HMONITOR monitor
)
783 FIXME("(%p): stub\n", monitor
);
785 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
789 BOOL WINAPI
DestroyPhysicalMonitor( HMONITOR monitor
)
791 FIXME("(%p): stub\n", monitor
);
793 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
797 BOOL WINAPI
DestroyPhysicalMonitors( DWORD arraySize
, LPPHYSICAL_MONITOR array
)
799 FIXME("(0x%x, %p): stub\n", arraySize
, array
);
801 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
805 BOOL WINAPI
GetCapabilitiesStringLength( HMONITOR monitor
, LPDWORD length
)
807 FIXME("(%p, %p): stub\n", monitor
, length
);
809 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
813 BOOL WINAPI
GetMonitorBrightness( HMONITOR monitor
, LPDWORD minimum
, LPDWORD current
, LPDWORD maximum
)
815 FIXME("(%p, %p, %p, %p): stub\n", monitor
, minimum
, current
, maximum
);
817 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
821 BOOL WINAPI
GetMonitorCapabilities( HMONITOR monitor
, LPDWORD capabilities
, LPDWORD temperatures
)
823 FIXME("(%p, %p, %p): stub\n", monitor
, capabilities
, temperatures
);
825 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
830 BOOL WINAPI
GetMonitorColorTemperature( HMONITOR monitor
, LPMC_COLOR_TEMPERATURE temperature
)
832 FIXME("(%p, %p): stub\n", monitor
, temperature
);
834 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
838 BOOL WINAPI
GetMonitorContrast( HMONITOR monitor
, LPDWORD minimum
, LPDWORD current
, LPDWORD maximum
)
840 FIXME("(%p, %p, %p, %p): stub\n", monitor
, minimum
, current
, maximum
);
842 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
846 BOOL WINAPI
GetMonitorDisplayAreaPosition( HMONITOR monitor
, MC_POSITION_TYPE type
, LPDWORD minimum
,
847 LPDWORD current
, LPDWORD maximum
)
849 FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor
, type
, minimum
, current
, maximum
);
851 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
855 BOOL WINAPI
GetMonitorDisplayAreaSize( HMONITOR monitor
, MC_SIZE_TYPE type
, LPDWORD minimum
,
856 LPDWORD current
, LPDWORD maximum
)
858 FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor
, type
, minimum
, current
, maximum
);
860 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
864 BOOL WINAPI
GetMonitorRedGreenOrBlueDrive( HMONITOR monitor
, MC_DRIVE_TYPE type
, LPDWORD minimum
,
865 LPDWORD current
, LPDWORD maximum
)
867 FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor
, type
, minimum
, current
, maximum
);
869 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
873 BOOL WINAPI
GetMonitorRedGreenOrBlueGain( HMONITOR monitor
, MC_GAIN_TYPE type
, LPDWORD minimum
,
874 LPDWORD current
, LPDWORD maximum
)
876 FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor
, type
, minimum
, current
, maximum
);
878 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
882 BOOL WINAPI
GetMonitorTechnologyType( HMONITOR monitor
, LPMC_DISPLAY_TECHNOLOGY_TYPE type
)
884 FIXME("(%p, %p): stub\n", monitor
, type
);
886 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
890 BOOL WINAPI
GetNumberOfPhysicalMonitorsFromHMONITOR( HMONITOR monitor
, LPDWORD number
)
892 FIXME("(%p, %p): stub\n", monitor
, number
);
894 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
898 HRESULT WINAPI
GetNumberOfPhysicalMonitorsFromIDirect3DDevice9( IDirect3DDevice9
*device
, LPDWORD number
)
900 FIXME("(%p, %p): stub\n", device
, number
);
905 BOOL WINAPI
GetPhysicalMonitorsFromHMONITOR( HMONITOR monitor
, DWORD arraySize
, LPPHYSICAL_MONITOR array
)
907 FIXME("(%p, 0x%x, %p): stub\n", monitor
, arraySize
, array
);
909 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
913 HRESULT WINAPI
GetPhysicalMonitorsFromIDirect3DDevice9( IDirect3DDevice9
*device
, DWORD arraySize
, LPPHYSICAL_MONITOR array
)
915 FIXME("(%p, 0x%x, %p): stub\n", device
, arraySize
, array
);
920 BOOL WINAPI
GetTimingReport( HMONITOR monitor
, LPMC_TIMING_REPORT timingReport
)
922 FIXME("(%p, %p): stub\n", monitor
, timingReport
);
924 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
928 BOOL WINAPI
GetVCPFeatureAndVCPFeatureReply( HMONITOR monitor
, BYTE vcpCode
, LPMC_VCP_CODE_TYPE pvct
,
929 LPDWORD current
, LPDWORD maximum
)
931 FIXME("(%p, 0x%02x, %p, %p, %p): stub\n", monitor
, vcpCode
, pvct
, current
, maximum
);
933 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
937 HRESULT WINAPI
OPMGetVideoOutputsFromHMONITOR( HMONITOR monitor
, /* OPM_VIDEO_OUTPUT_SEMANTICS */ int vos
,
938 ULONG
*numVideoOutputs
, /* IOPMVideoOutput */ void ***videoOutputs
)
940 FIXME("(%p, 0x%x, %p, %p): stub\n", monitor
, vos
, numVideoOutputs
, videoOutputs
);
945 HRESULT WINAPI
OPMGetVideoOutputsFromIDirect3DDevice9Object( IDirect3DDevice9
*device
, /* OPM_VIDEO_OUTPUT_SEMANTICS */ int vos
,
946 ULONG
*numVideoOutputs
, /* IOPMVideoOutput */ void ***videoOutputs
)
948 FIXME("(%p, 0x%x, %p, %p): stub\n", device
, vos
, numVideoOutputs
, videoOutputs
);
953 BOOL WINAPI
RestoreMonitorFactoryColorDefaults( HMONITOR monitor
)
955 FIXME("(%p): stub\n", monitor
);
957 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
961 BOOL WINAPI
RestoreMonitorFactoryDefaults( HMONITOR monitor
)
963 FIXME("(%p): stub\n", monitor
);
965 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
969 BOOL WINAPI
SaveCurrentMonitorSettings( HMONITOR monitor
)
971 FIXME("(%p): stub\n", monitor
);
973 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
977 BOOL WINAPI
SaveCurrentSettings( HMONITOR monitor
)
979 FIXME("(%p): stub\n", monitor
);
981 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
985 BOOL WINAPI
SetMonitorBrightness( HMONITOR monitor
, DWORD brightness
)
987 FIXME("(%p, 0x%x): stub\n", monitor
, brightness
);
989 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
993 BOOL WINAPI
SetMonitorColorTemperature( HMONITOR monitor
, MC_COLOR_TEMPERATURE temperature
)
995 FIXME("(%p, 0x%x): stub\n", monitor
, temperature
);
997 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1001 BOOL WINAPI
SetMonitorContrast( HMONITOR monitor
, DWORD contrast
)
1003 FIXME("(%p, 0x%x): stub\n", monitor
, contrast
);
1005 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1009 BOOL WINAPI
SetMonitorDisplayAreaPosition( HMONITOR monitor
, MC_POSITION_TYPE type
, DWORD position
)
1011 FIXME("(%p, 0x%x, 0x%x): stub\n", monitor
, type
, position
);
1013 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1017 BOOL WINAPI
SetMonitorDisplayAreaSize( HMONITOR monitor
, MC_SIZE_TYPE type
, DWORD size
)
1019 FIXME("(%p, 0x%x, 0x%x): stub\n", monitor
, type
, size
);
1021 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1025 BOOL WINAPI
SetMonitorRedGreenOrBlueDrive( HMONITOR monitor
, MC_DRIVE_TYPE type
, DWORD drive
)
1027 FIXME("(%p, 0x%x, 0x%x): stub\n", monitor
, type
, drive
);
1029 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1033 BOOL WINAPI
SetMonitorRedGreenOrBlueGain( HMONITOR monitor
, MC_GAIN_TYPE type
, DWORD gain
)
1035 FIXME("(%p, 0x%x, 0x%x): stub\n", monitor
, type
, gain
);
1037 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1041 BOOL WINAPI
SetVCPFeature( HMONITOR monitor
, BYTE vcpCode
, DWORD value
)
1043 FIXME("(%p, 0x%02x, 0x%x): stub\n", monitor
, vcpCode
, value
);
1045 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1049 BOOL WINAPI
DllMain (HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
1051 TRACE("%p,%x,%p\n", hinstDLL
, fdwReason
, lpvReserved
);
1053 switch (fdwReason
) {
1054 case DLL_WINE_PREATTACH
:
1055 return FALSE
; /* prefer native version */
1056 case DLL_PROCESS_ATTACH
:
1057 DisableThreadLibraryCalls(hinstDLL
);