VBoxMPDevExt.h revision 4c98b8b05f3783351cf256cc90cd4478fb28b62b
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync * VBox Miniport device extension header
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync * Copyright (C) 2011 Oracle Corporation
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync * available from http://www.virtualbox.org. This file is free software;
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync * you can redistribute it and/or modify it under the terms of the GNU
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync * General Public License (GPL) as published by the Free Software
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync ULONG ulApertureSize; /* Size of the LFB aperture (>= VRAM size). */
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync uint32_t cbMiniportHeap; /* The size of reserved VRAM for miniport driver heap.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync * It is at offset:
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync * cbAdapterMemorySize - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE - cbMiniportHeap
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync void *pvMiniportHeap; /* The pointer to the miniport heap VRAM.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync * This is mapped by miniport separately.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync void *pvAdapterInformation; /* The pointer to the last 4K of VRAM.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync * This is mapped by miniport separately.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync /** Whether HGSMI is enabled. */
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync /** Context information needed to receive commands from the host. */
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync /** Context information needed to submit commands to the host. */
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync struct _VBOXMP_DEVEXT *pNext; /* Next extension in the DualView extension list.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync * The primary extension is the first one.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync struct _VBOXMP_DEVEXT *pPrimary; /* Pointer to the primary device extension. */
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync ULONG iDevice; /* Device index: 0 for primary, otherwise a secondary device. */
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync ULONG CurrentMode; /* Saved information about video modes */
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync ULONG ulFrameBufferOffset; /* The framebuffer position in the VRAM. */
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync ULONG ulFrameBufferSize; /* The size of the current framebuffer. */
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync#endif /*VBOX_XPDM_MINIPORT*/
730f8be51b729e8a3c1e32c756cd0f4ec088dd4dvboxsync /* hgsmi allocation manager */
8cb6f31c3048428b42c7370dfbb20e4de7254f40vboxsync /* mutex for context list operations */
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync#endif /*VBOX_WDDM_MINIPORT*/
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync /* Information that is only relevant to the primary device or is the same for all devices. */
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync void *pvReqFlush; /* Pointer to preallocated generic request structure for
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync * VMMDevReq_VideoAccelFlush. Allocated when VBVA status
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync * is changed. Deallocated on HwReset.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync ULONG ulVbvaEnabled; /* Indicates that VBVA mode is enabled. */
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync ULONG ulMaxFrameBufferSize; /* The size of the VRAM allocated for the a single framebuffer. */
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync BOOLEAN fMouseHidden; /* Has the mouse cursor been hidden by the guest? */
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync /* Video Port API dynamically picked up at runtime for binary backwards compatibility with older NT versions */
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsync D3DKMDT_HVIDPN hCommittedVidPn; /* committed VidPn handle */
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync DXGKRNL_INTERFACE DxgkInterface; /* Display Port handle and callbacks */
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsync /* Secondary device information. */
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsync HGSMIAREA areaDisplay; /* Entire VRAM chunk for this display device. */
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsync BOOLEAN fAnyX; /* Unrestricted horizontal resolution flag. */
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsyncDECLINLINE(PVBOXMP_DEVEXT) VBoxCommonToPrimaryExt(PVBOXMP_COMMON pCommon)
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsync return RT_FROM_MEMBER(pCommon, VBOXMP_DEVEXT, u.primary.commonInfo);
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsyncDECLINLINE(PVBOXMP_COMMON) VBoxCommonFromDeviceExt(PVBOXMP_DEVEXT pExt)
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsyncDECLINLINE(ULONG) vboxWddmVramCpuVisibleSize(PVBOXMP_DEVEXT pDevExt)
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsync /* all memory layout info should be initialized */
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync /* page aligned */
cbc215af8423a8326b27143c59c5d8fc9ffb0279vboxsync Assert(!(pDevExt->aSources[0].Vbva.offVBVA & 0xfff));
cbc215af8423a8326b27143c59c5d8fc9ffb0279vboxsync return (ULONG)(pDevExt->aSources[0].Vbva.offVBVA & ~0xfffULL);
cbc215af8423a8326b27143c59c5d8fc9ffb0279vboxsync /* all memory layout info should be initialized */
cbc215af8423a8326b27143c59c5d8fc9ffb0279vboxsync Assert(pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase);
cbc215af8423a8326b27143c59c5d8fc9ffb0279vboxsync /* page aligned */
cbc215af8423a8326b27143c59c5d8fc9ffb0279vboxsync Assert(!(pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase & 0xfff));
cbc215af8423a8326b27143c59c5d8fc9ffb0279vboxsync return pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase & ~0xfffUL;
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsyncDECLINLINE(ULONG) vboxWddmVramCpuVisibleSegmentSize(PVBOXMP_DEVEXT pDevExt)
ece707b8d97e63ed54d4b48d7a8d841187e0023cvboxsyncDECLINLINE(ULONG) vboxWddmVramCpuInvisibleSegmentSize(PVBOXMP_DEVEXT pDevExt)
ece707b8d97e63ed54d4b48d7a8d841187e0023cvboxsyncDECLINLINE(bool) vboxWddmCmpSurfDescsBase(VBOXWDDM_SURFACE_DESC *pDesc1, VBOXWDDM_SURFACE_DESC *pDesc2)
ece707b8d97e63ed54d4b48d7a8d841187e0023cvboxsync return false;
ece707b8d97e63ed54d4b48d7a8d841187e0023cvboxsync return false;
ece707b8d97e63ed54d4b48d7a8d841187e0023cvboxsync return false;
ece707b8d97e63ed54d4b48d7a8d841187e0023cvboxsync return false;
ece707b8d97e63ed54d4b48d7a8d841187e0023cvboxsync return false;
ece707b8d97e63ed54d4b48d7a8d841187e0023cvboxsync return true;
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsyncDECLINLINE(void) vboxWddmAssignShadow(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource, PVBOXWDDM_ALLOCATION pAllocation, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync PVBOXWDDM_ALLOCATION pOldAlloc = pSource->pShadowAllocation;
cbc215af8423a8326b27143c59c5d8fc9ffb0279vboxsync /* clear the visibility info fo the current primary */
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync Assert(pOldAlloc->SurfDesc.VidPnSourceId == srcId);
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync /* release the shadow surface */
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync pOldAlloc->SurfDesc.VidPnSourceId = D3DDDI_ID_UNINITIALIZED;
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync /* this check ensures the shadow is not used for other source simultaneously */
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync Assert(pAllocation->SurfDesc.VidPnSourceId == D3DDDI_ID_UNINITIALIZED);
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync if (!vboxWddmCmpSurfDescsBase(&pSource->SurfDesc, &pAllocation->SurfDesc))
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync pSource->offVram = VBOXVIDEOOFFSET_VOID; /* force guest->host notification */
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsyncDECLINLINE(VOID) vboxWddmAssignPrimary(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource, PVBOXWDDM_ALLOCATION pAllocation, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync PVBOXWDDM_ALLOCATION pOldAlloc = pSource->pPrimaryAllocation;
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync /* clear the visibility info fo the current primary */
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync Assert(pOldAlloc->SurfDesc.VidPnSourceId == srcId);
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync Assert(pAllocation->SurfDesc.VidPnSourceId == srcId);
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync#endif /*VBOX_WDDM_MINIPORT*/
3a45119099f0df5230e8304145168aa5e2a3f1a1vboxsync#endif /*VBOXMPDEVEXT_H*/