gdi32: Implement D3DKMTCreateDevice.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
344556f7d5
commit
733a92df4b
|
@ -12,7 +12,7 @@
|
||||||
@ stub D3DKMTCreateAllocation2
|
@ stub D3DKMTCreateAllocation2
|
||||||
@ stub D3DKMTCreateContext
|
@ stub D3DKMTCreateContext
|
||||||
@ stdcall D3DKMTCreateDCFromMemory(ptr) gdi32.D3DKMTCreateDCFromMemory
|
@ stdcall D3DKMTCreateDCFromMemory(ptr) gdi32.D3DKMTCreateDCFromMemory
|
||||||
@ stub D3DKMTCreateDevice
|
@ stdcall D3DKMTCreateDevice(ptr) gdi32.D3DKMTCreateDevice
|
||||||
@ stub D3DKMTCreateKeyedMutex
|
@ stub D3DKMTCreateKeyedMutex
|
||||||
@ stub D3DKMTCreateKeyedMutex2
|
@ stub D3DKMTCreateKeyedMutex2
|
||||||
@ stub D3DKMTCreateOutputDupl
|
@ stub D3DKMTCreateOutputDupl
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
@ stdcall D3DKMTCloseAdapter(ptr) gdi32.D3DKMTCloseAdapter
|
@ stdcall D3DKMTCloseAdapter(ptr) gdi32.D3DKMTCloseAdapter
|
||||||
@ stub D3DKMTCreateAllocation
|
@ stub D3DKMTCreateAllocation
|
||||||
@ stub D3DKMTCreateContext
|
@ stub D3DKMTCreateContext
|
||||||
@ stub D3DKMTCreateDevice
|
@ stdcall D3DKMTCreateDevice(ptr) gdi32.D3DKMTCreateDevice
|
||||||
@ stub D3DKMTCreateSynchronizationObject
|
@ stub D3DKMTCreateSynchronizationObject
|
||||||
@ stub D3DKMTDestroyAllocation
|
@ stub D3DKMTDestroyAllocation
|
||||||
@ stub D3DKMTDestroyContext
|
@ stub D3DKMTDestroyContext
|
||||||
|
|
|
@ -59,10 +59,17 @@ struct d3dkmt_adapter
|
||||||
struct list entry; /* List entry */
|
struct list entry; /* List entry */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct d3dkmt_device
|
||||||
|
{
|
||||||
|
D3DKMT_HANDLE handle; /* Kernel mode graphics device handle*/
|
||||||
|
struct list entry; /* List entry */
|
||||||
|
};
|
||||||
|
|
||||||
static struct list drivers = LIST_INIT( drivers );
|
static struct list drivers = LIST_INIT( drivers );
|
||||||
static struct graphics_driver *display_driver;
|
static struct graphics_driver *display_driver;
|
||||||
|
|
||||||
static struct list d3dkmt_adapters = LIST_INIT( d3dkmt_adapters );
|
static struct list d3dkmt_adapters = LIST_INIT( d3dkmt_adapters );
|
||||||
|
static struct list d3dkmt_devices = LIST_INIT( d3dkmt_devices );
|
||||||
|
|
||||||
const struct gdi_dc_funcs *font_driver = NULL;
|
const struct gdi_dc_funcs *font_driver = NULL;
|
||||||
|
|
||||||
|
@ -1342,3 +1349,48 @@ NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName( D3DKMT_OPENADAPTERFROMGDIDI
|
||||||
desc->VidPnSourceId = 0;
|
desc->VidPnSourceId = 0;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* D3DKMTCreateDevice [GDI32.@]
|
||||||
|
*/
|
||||||
|
NTSTATUS WINAPI D3DKMTCreateDevice( D3DKMT_CREATEDEVICE *desc )
|
||||||
|
{
|
||||||
|
static D3DKMT_HANDLE handle_start = 0;
|
||||||
|
struct d3dkmt_adapter *adapter;
|
||||||
|
struct d3dkmt_device *device;
|
||||||
|
BOOL found = FALSE;
|
||||||
|
|
||||||
|
TRACE("(%p)\n", desc);
|
||||||
|
|
||||||
|
if (!desc)
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
EnterCriticalSection( &driver_section );
|
||||||
|
LIST_FOR_EACH_ENTRY( adapter, &d3dkmt_adapters, struct d3dkmt_adapter, entry )
|
||||||
|
{
|
||||||
|
if (adapter->handle == desc->hAdapter)
|
||||||
|
{
|
||||||
|
found = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LeaveCriticalSection( &driver_section );
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
if (desc->Flags.LegacyMode || desc->Flags.RequestVSync || desc->Flags.DisableGpuTimeout)
|
||||||
|
FIXME("Flags unsupported.\n");
|
||||||
|
|
||||||
|
device = heap_alloc_zero( sizeof( *device ) );
|
||||||
|
if (!device)
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
|
||||||
|
EnterCriticalSection( &driver_section );
|
||||||
|
device->handle = ++handle_start;
|
||||||
|
list_add_tail( &d3dkmt_devices, &device->entry );
|
||||||
|
LeaveCriticalSection( &driver_section );
|
||||||
|
|
||||||
|
desc->hDevice = device->handle;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
@ stdcall CreateSolidBrush(long)
|
@ stdcall CreateSolidBrush(long)
|
||||||
@ stdcall D3DKMTCloseAdapter(ptr)
|
@ stdcall D3DKMTCloseAdapter(ptr)
|
||||||
@ stdcall D3DKMTCreateDCFromMemory(ptr)
|
@ stdcall D3DKMTCreateDCFromMemory(ptr)
|
||||||
|
@ stdcall D3DKMTCreateDevice(ptr)
|
||||||
@ stdcall D3DKMTDestroyDCFromMemory(ptr)
|
@ stdcall D3DKMTDestroyDCFromMemory(ptr)
|
||||||
@ stdcall D3DKMTEscape(ptr)
|
@ stdcall D3DKMTEscape(ptr)
|
||||||
@ stdcall D3DKMTOpenAdapterFromGdiDisplayName(ptr)
|
@ stdcall D3DKMTOpenAdapterFromGdiDisplayName(ptr)
|
||||||
|
|
|
@ -194,7 +194,7 @@ static void test_D3DKMTCreateDevice(void)
|
||||||
D3DKMT_DESTROYDEVICE destroy_device_desc;
|
D3DKMT_DESTROYDEVICE destroy_device_desc;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
if (!pD3DKMTCreateDevice || pD3DKMTCreateDevice(NULL) == STATUS_PROCEDURE_NOT_FOUND)
|
if (!pD3DKMTCreateDevice || pD3DKMTCreateDevice(NULL) == STATUS_PROCEDURE_NOT_FOUND || !pD3DKMTDestroyDevice)
|
||||||
{
|
{
|
||||||
skip("D3DKMTCreateDevice() or D3DKMTDestroyDevice() is unavailable.\n");
|
skip("D3DKMTCreateDevice() or D3DKMTDestroyDevice() is unavailable.\n");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -166,6 +166,7 @@ extern "C"
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
NTSTATUS WINAPI D3DKMTCloseAdapter(const D3DKMT_CLOSEADAPTER *desc);
|
NTSTATUS WINAPI D3DKMTCloseAdapter(const D3DKMT_CLOSEADAPTER *desc);
|
||||||
|
NTSTATUS WINAPI D3DKMTCreateDevice(D3DKMT_CREATEDEVICE *desc);
|
||||||
NTSTATUS WINAPI D3DKMTCreateDCFromMemory(D3DKMT_CREATEDCFROMMEMORY *desc);
|
NTSTATUS WINAPI D3DKMTCreateDCFromMemory(D3DKMT_CREATEDCFROMMEMORY *desc);
|
||||||
NTSTATUS WINAPI D3DKMTDestroyDCFromMemory(const D3DKMT_DESTROYDCFROMMEMORY *desc);
|
NTSTATUS WINAPI D3DKMTDestroyDCFromMemory(const D3DKMT_DESTROYDCFROMMEMORY *desc);
|
||||||
NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName(D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME *desc);
|
NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName(D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME *desc);
|
||||||
|
|
Loading…
Reference in New Issue