VBoxDispD3D.h revision a01afe7f8dda9ca4e0adfa38edcbb40153ae5e4d
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland/** @file
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland *
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * VBoxVideo Display D3D User mode dll
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland *
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Copyright (C) 2010 Oracle Corporation
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland *
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * This file is part of VirtualBox Open Source Edition (OSE), as
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * available from http://www.virtualbox.org. This file is free software;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * you can redistribute it and/or modify it under the terms of the GNU
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * General Public License (GPL) as published by the Free Software
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Foundation, in version 2 as it comes in the "COPYING" file of the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#ifndef ___VBoxDispD3D_h___
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define ___VBoxDispD3D_h___
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#include "VBoxDispD3DIf.h"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#include "../../Miniport/wddm/VBoxVideoIf.h"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#include <iprt/cdefs.h>
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#include <iprt/list.h>
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define VBOXWDDMDISP_MAX_VERTEX_STREAMS 16
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#ifdef VBOX_WITH_VIDEOHWACCEL
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandtypedef struct VBOXDISPVHWA_INFO
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland{
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland VBOXVHWA_INFO Settings;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland}VBOXDISPVHWA_INFO;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland/* represents settings secific to
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * display device (head) on the multiple-head graphics card
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * currently used for 2D (overlay) only since in theory its settings
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * can differ per each frontend's framebuffer. */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandtypedef struct VBOXWDDMDISP_HEAD
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland{
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland VBOXDISPVHWA_INFO Vhwa;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland} VBOXWDDMDISP_HEAD;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#endif
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandtypedef struct VBOXWDDMDISP_ADAPTER
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland{
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland HANDLE hAdapter;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland UINT uIfVersion;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland UINT uRtVersion;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland VBOXDISPD3D D3D;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland VBOXDISPWORKER WndWorker;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland IDirect3D9Ex * pD3D9If;
D3DDDI_ADAPTERCALLBACKS RtCallbacks;
uint32_t cFormstOps;
FORMATOP *paFormstOps;
uint32_t cSurfDescs;
DDSURFACEDESC *paSurfDescs;
#ifdef VBOX_WITH_VIDEOHWACCEL
uint32_t cHeads;
VBOXWDDMDISP_HEAD aHeads[1];
#endif
} VBOXWDDMDISP_ADAPTER, *PVBOXWDDMDISP_ADAPTER;
typedef struct VBOXWDDMDISP_CONTEXT
{
RTLISTNODE ListNode;
struct VBOXWDDMDISP_DEVICE *pDevice;
D3DDDICB_CREATECONTEXT ContextInfo;
} VBOXWDDMDISP_CONTEXT, *PVBOXWDDMDISP_CONTEXT;
typedef struct VBOXWDDMDISP_STREAMSOURCEUM
{
CONST VOID* pvBuffer;
UINT cbStride;
} VBOXWDDMDISP_STREAMSOURCEUM, *PVBOXWDDMDISP_STREAMSOURCEUM;
typedef struct VBOXWDDMDISP_INDICIESUM
{
CONST VOID* pvBuffer;
UINT cbSize;
} VBOXWDDMDISP_INDICIESUM, *PVBOXWDDMDISP_INDICIESUM;
struct VBOXWDDMDISP_ALLOCATION;
typedef struct VBOXWDDMDISP_STREAM_SOURCE_INFO
{
UINT uiOffset;
UINT uiStride;
} VBOXWDDMDISP_STREAM_SOURCE_INFO;
typedef struct VBOXWDDMDISP_INDICES_INFO
{
UINT uiStride;
} VBOXWDDMDISP_INDICES_INFO;
typedef struct VBOXWDDMDISP_DEVICE
{
HANDLE hDevice;
PVBOXWDDMDISP_ADAPTER pAdapter;
UINT u32IfVersion;
UINT uRtVersion;
D3DDDI_DEVICECALLBACKS RtCallbacks;
VOID *pvCmdBuffer;
UINT cbCmdBuffer;
D3DDDI_CREATEDEVICEFLAGS fFlags;
HWND hWnd;
struct VBOXWDDMDISP_RESOURCE *pRenderTargetRc;
uint32_t iRenderTargetFrontBuf;
/* number of StreamSources set */
UINT cStreamSources;
VBOXWDDMDISP_STREAMSOURCEUM aStreamSourceUm[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
VBOXWDDMDISP_ALLOCATION *aStreamSource[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
VBOXWDDMDISP_STREAM_SOURCE_INFO StreamSourceInfo[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
VBOXWDDMDISP_INDICIESUM IndiciesUm;
VBOXWDDMDISP_ALLOCATION *pIndicesAlloc;
VBOXWDDMDISP_INDICES_INFO IndiciesInfo;
IDirect3DDevice9 *pDevice9If;
/* need to cache the ViewPort data because IDirect3DDevice9::SetViewport
* is split into two calls : SetViewport & SetZRange */
D3DVIEWPORT9 ViewPort;
VBOXWDDMDISP_CONTEXT DefaultContext;
} VBOXWDDMDISP_DEVICE, *PVBOXWDDMDISP_DEVICE;
typedef struct VBOXWDDMDISP_LOCKINFO
{
uint32_t cLocks;
union {
D3DDDIRANGE Range;
RECT Area;
D3DDDIBOX Box;
};
D3DDDI_LOCKFLAGS fFlags;
D3DLOCKED_RECT LockedRect;
} VBOXWDDMDISP_LOCKINFO;
typedef enum
{
VBOXDISP_D3DIFTYPE_UNDEFINED = 0,
VBOXDISP_D3DIFTYPE_SURFACE,
VBOXDISP_D3DIFTYPE_TEXTURE,
VBOXDISP_D3DIFTYPE_VERTEXBUFFER,
VBOXDISP_D3DIFTYPE_INDEXBUFFER
} VBOXDISP_D3DIFTYPE;
typedef struct VBOXWDDMDISP_ALLOCATION
{
D3DKMT_HANDLE hAllocation;
VBOXWDDM_ALLOC_TYPE enmType;
void* pvMem;
/* object type is defined by enmD3DIfType enum */
IUnknown *pD3DIf;
VBOXDISP_D3DIFTYPE enmD3DIfType;
VBOXWDDMDISP_LOCKINFO LockInfo;
VBOXWDDM_DIRTYREGION DirtyRegion; /* <- dirty region to notify host about */
VBOXWDDM_SURFACE_DESC SurfDesc;
} VBOXWDDMDISP_ALLOCATION, *PVBOXWDDMDISP_ALLOCATION;
typedef struct VBOXWDDMDISP_RESOURCE
{
HANDLE hResource;
D3DKMT_HANDLE hKMResource;
PVBOXWDDMDISP_DEVICE pDevice;
uint32_t fFlags;
VBOXWDDM_RC_DESC RcDesc;
UINT cAllocations;
VBOXWDDMDISP_ALLOCATION aAllocations[1];
} VBOXWDDMDISP_RESOURCE, *PVBOXWDDMDISP_RESOURCE;
typedef struct VBOXWDDMDISP_TSS_LOOKUP
{
BOOL bSamplerState;
DWORD dType;
} VBOXWDDMDISP_TSS_LOOKUP;
typedef struct VBOXWDDMDISP_OVERLAY
{
D3DKMT_HANDLE hOverlay;
D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
PVBOXWDDMDISP_RESOURCE *pResource;
} VBOXWDDMDISP_OVERLAY, *PVBOXWDDMDISP_OVERLAY;
#define VBOXDISPMODE_IS_3D(_p) (!!((_p)->pD3D9If))
#endif /* #ifndef ___VBoxDispD3D_h___ */