VBoxVideoWddm.h revision 7a3c0a6f8961fc1de551aaa9e3728d21f186af49
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync/*
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * Copyright (C) 2010 Oracle Corporation
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync *
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * available from http://www.virtualbox.org. This file is free software;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * you can redistribute it and/or modify it under the terms of the GNU
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * General Public License (GPL) as published by the Free Software
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync */
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#ifndef ___VBoxVideoWddm_h___
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#define ___VBoxVideoWddm_h___
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#include "../VBoxVideo.h"
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync/* one page size */
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#define VBOXWDDM_C_DMA_BUFFER_SIZE 0x1000
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#define VBOXWDDM_C_ALLOC_LIST_SIZE 0xc00
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#define VBOXWDDM_C_PATH_LOCATION_LIST_SIZE 0xc00
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#define VBOXWDDM_C_POINTER_MAX_WIDTH 64
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#define VBOXWDDM_C_POINTER_MAX_HEIGHT 64
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#define VBOXWDDM_C_VDMA_BUFFER_SIZE (64*_1K)
391cf11262671da62bcc02db361038e7ffbab8f7vboxsync
628ddfbd43ad5365d69fddda4007598242956577vboxsync#ifdef VBOXWDDM_WITH_VBVA
628ddfbd43ad5365d69fddda4007598242956577vboxsync# define VBOXWDDM_RENDER_FROM_SHADOW
628ddfbd43ad5365d69fddda4007598242956577vboxsync#endif
628ddfbd43ad5365d69fddda4007598242956577vboxsync
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync#define VBOXWDDM_ROUNDBOUND(_v, _b) (((_v) + ((_b) - 1)) & ~((_b) - 1))
f2fedb6cbb946e9dd6d418b1472373395e2ac34fvboxsync
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsyncPVOID vboxWddmMemAlloc(IN SIZE_T cbSize);
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsyncPVOID vboxWddmMemAllocZero(IN SIZE_T cbSize);
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsyncVOID vboxWddmMemFree(PVOID pvMem);
615105a2b89b7dd89a76504e6a9b8e099704c0d9vboxsync
615105a2b89b7dd89a76504e6a9b8e099704c0d9vboxsynctypedef struct VBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE
391cf11262671da62bcc02db361038e7ffbab8f7vboxsync{
391cf11262671da62bcc02db361038e7ffbab8f7vboxsync D3DDDI_RATIONAL RefreshRate;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync} VBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE, *PVBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync/* allocation */
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsynctypedef struct VBOXWDDM_ALLOCATION
6c5e2fff0e3fdfc7c3f3fb2e7b7ec8ebb2223cecvboxsync{
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync VBOXWDDM_ALLOC_TYPE enmType;
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync UINT SegmentId;
49207a1552ff3752904e36b9269f08fe643ba871vboxsync VBOXVIDEOOFFSET offVram;
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync union
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync {
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync VBOXWDDM_SURFACE_DESC SurfInfo;
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync } u;
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync} VBOXWDDM_ALLOCATION, *PVBOXWDDM_ALLOCATION;
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync
49207a1552ff3752904e36b9269f08fe643ba871vboxsync#define VBOXWDDM_ALLOCATION_HEADSIZE() (sizeof (VBOXWDDM_ALLOCATION))
49207a1552ff3752904e36b9269f08fe643ba871vboxsync#define VBOXWDDM_ALLOCATION_SIZE_FROMBODYSIZE(_s) (VBOXWDDM_ALLOCATION_HEADSIZE() + (_s))
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#define VBOXWDDM_ALLOCATION_SIZE(_tCmd) (VBOXWDDM_ALLOCATION_SIZE_FROMBODYSIZE(sizeof(_tCmd)))
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#define VBOXWDDM_ALLOCATION_BODY(_p, _t) ( (_t*)(((uint8_t*)(_p)) + VBOXWDDM_ALLOCATION_HEADSIZE()) )
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync#define VBOXWDDM_ALLOCATION_HEAD(_pb) ((VBOXWDDM_ALLOCATION*)((uint8_t *)(_pb) - VBOXWDDM_ALLOCATION_HEADSIZE()))
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync
83c86878d483df62ca8db465c671995984838338vboxsync
83c86878d483df62ca8db465c671995984838338vboxsync
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsynctypedef struct VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE
83c86878d483df62ca8db465c671995984838338vboxsync{
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync D3DDDI_RATIONAL RefreshRate;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
83c86878d483df62ca8db465c671995984838338vboxsync// VBOXVIDEOOFFSET offAddress;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync BOOLEAN bVisible;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync BOOLEAN bAssigned;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync} VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE, *PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync#ifdef VBOXWDDM_RENDER_FROM_SHADOW
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsynctypedef struct VBOXWDDM_ALLOCATION_SHADOWSURFACE
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync{
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync// VBOXVIDEOOFFSET offAddress;
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync BOOLEAN bVisible;
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync BOOLEAN bAssigned;
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync} VBOXWDDM_ALLOCATION_SHADOWSURFACE, *PVBOXWDDM_ALLOCATION_SHADOWSURFACE;
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync#endif
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsynctypedef enum
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync{
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync VBOXWDDM_DEVICE_TYPE_UNDEFINED = 0,
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync VBOXWDDM_DEVICE_TYPE_SYSTEM
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync} VBOXWDDM_DEVICE_TYPE;
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsynctypedef struct VBOXWDDM_DEVICE
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync{
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync struct _DEVICE_EXTENSION * pAdapter; /* Adapder info */
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync HANDLE hDevice; /* handle passed to CreateDevice */
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync VBOXWDDM_DEVICE_TYPE enmType; /* device creation flags passed to DxgkDdiCreateDevice, not sure we need it */
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync} VBOXWDDM_DEVICE, *PVBOXWDDM_DEVICE;
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsynctypedef enum
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync{
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync VBOXWDDM_CONTEXT_TYPE_UNDEFINED = 0,
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync VBOXWDDM_CONTEXT_TYPE_SYSTEM
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync} VBOXWDDM_CONTEXT_TYPE;
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsynctypedef struct VBOXWDDM_CONTEXT
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync{
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync struct VBOXWDDM_DEVICE * pDevice;
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync HANDLE hContext;
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync VBOXWDDM_CONTEXT_TYPE enmType;
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync UINT NodeOrdinal;
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync UINT EngineAffinity;
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync UINT uLastCompletedCmdFenceId;
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync} VBOXWDDM_CONTEXT, *PVBOXWDDM_CONTEXT;
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsynctypedef struct VBOXWDDM_DMA_PRIVATE_DATA
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync{
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync PVBOXWDDM_CONTEXT pContext;
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync VBOXVDMACMD_TYPE enmCmd;
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync#ifdef VBOXWDDM_RENDER_FROM_SHADOW
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync RECT rect;
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync VBOXVIDEOOFFSET offShadow;
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync UINT segmentIdShadow;
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId;
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync#endif
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync// uint8_t Reserved[8];
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync}VBOXWDDM_DMA_PRIVATE_DATA, *PVBOXWDDM_DMA_PRIVATE_DATA;
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsynctypedef struct VBOXWDDM_OPENALLOCATION
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync{
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync D3DKMT_HANDLE hAllocation;
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync} VBOXWDDM_OPENALLOCATION, *PVBOXWDDM_OPENALLOCATION;
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync#endif /* #ifndef ___VBoxVideoWddm_h___ */
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync