Changeset 109165 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.h
- Timestamp:
- May 5, 2025 6:17:33 PM (4 days ago)
- svn:sync-xref-src-repo-rev:
- 168723
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.h
r108786 r109165 5 5 6 6 /* 7 * Copyright (C) 2016-202 4Oracle and/or its affiliates.7 * Copyright (C) 2016-2025 Oracle and/or its affiliates. 8 8 * 9 9 * This file is part of VirtualBox base platform packages, as … … 34 34 #include "VBoxMPGaUtils.h" 35 35 36 #include <iprt/asm.h> 36 37 #include <iprt/assert.h> 37 38 #include <iprt/avl.h> … … 164 165 typedef struct VMSVGAGBO 165 166 { 167 int32_t volatile cRefs; /* Reference count */ 168 struct 169 { 170 uint32_t fMdl : 1; 171 uint32_t reserved : 31; 172 } flags; 166 173 uint32_t cbGbo; /* Size of gbo in bytes. */ 167 174 uint32_t cPTPages; /* How many pages are required to hold PPN64 page table. */ 168 175 SVGAMobFormat enmMobFormat; /* Page table format. */ 176 union /* Backing memory. */ 177 { 178 PMDL pMdl; 179 RTR0MEMOBJ hMemObj; 180 }; 169 181 PPN64 base; /* Page which contains the page table. */ 170 182 RTR0MEMOBJ hMemObjPT; /* Page table pages. */ … … 174 186 #define SVGA3D_MAX_MOBS (SVGA3D_MAX_CONTEXT_IDS + SVGA3D_MAX_CONTEXT_IDS + SVGA3D_MAX_SURFACE_IDS) 175 187 176 /* Memory OBject: a gbo with an id, possibly bound to an allocation. */177 typedef struct VMSVGAMOB178 {179 AVLU32NODECORE core; /* AVL entry. Key is mobid, allocated by the miniport. */180 HANDLE hAllocation; /* Allocation which is bound to the mob. */181 VMSVGAGBO gbo; /* Gbo for this mob. */182 RTR0MEMOBJ hMemObj; /* The guest memory if allocated by miniport. */183 uint32_t u64MobFence; /* Free by the guest when the host reports this fence value. */184 RTLISTNODE node; /* VBOXWDDM_EXT_VMSVGA::listMobDeferredDestruction */185 } VMSVGAMOB, *PVMSVGAMOB;186 187 #define VMSVGAMOB_ID(a_pMob) ((a_pMob)->core.Key)188 189 188 typedef struct VMSVGAOT 190 189 { 191 VMSVGAGBO gbo; 192 RTR0MEMOBJ hMemObj; 190 PVMSVGAGBO pGbo; 193 191 uint32_t cEntries; /* How many objects can be stored in the OTable. */ 194 192 } VMSVGAOT, *PVMSVGAOT; … … 213 211 uint32_t u32GmrMaxPages; /** SVGA_REG_GMRS_MAX_PAGES */ 214 212 uint32_t u32MemorySize; /** SVGA_REG_MEMORY_SIZE */ 213 uint32_t u32MaxMobSize; /** SVGA_REG_MOB_MAX_SIZE */ 215 214 uint32_t u32MaxTextureWidth; /** SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH */ 216 215 uint32_t u32MaxTextureHeight; /** SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT */ … … 261 260 VMSVGAOT aOT[SVGA_OTABLE_DX_MAX]; 262 261 263 PVMSVGAMOB pMiniportMob; /* Used by miniport to communicate with the device. */ 262 /* Used by miniport to communicate with the device. */ 263 PVMSVGAGBO pMiniportGbo; 264 SVGAMobId mobidMiniport; 264 265 struct VMSVGAMINIPORTMOB volatile *pMiniportMobData; /* Pointer to the miniport mob content. */ 265 266 266 267 uint64_t volatile u64MobFence; 267 268 RTLISTANCHOR listMobDeferredDestruction; /* Mob to be deleted after. */ 269 int32_t volatile cQueuedWorkItems; 268 270 269 271 #ifdef DEBUG 270 272 /* Statistics. */ 273 uint32_t volatile cAllocatedGbos; 271 274 uint32_t volatile cAllocatedMobs; 272 uint32_t volatile cAllocatedMobPages;273 275 uint32_t volatile cAllocatedGmrs; 274 276 uint32_t volatile cAllocatedGmrPages; … … 303 305 typedef struct VMSVGACOT 304 306 { 305 PVMSVGAMOB pMob;/* COTable mob. */307 SVGAMobId mobid; /* COTable mob. */ 306 308 uint32_t cEntries; /* How many objects can be stored in the COTable. */ 307 309 } VMSVGACOT, *PVMSVGACOT; … … 644 646 #endif 645 647 646 NTSTATUS SvgaGboInit(VMSVGAGBO *pGbo, uint32_t cPages); 647 void SvgaGboFree(VMSVGAGBO *pGbo); 648 NTSTATUS SvgaGboFillPageTableForMDL(PVMSVGAGBO pGbo, 649 PMDL pMdl, 650 uint32_t MdlOffset); 651 NTSTATUS SvgaGboFillPageTableForMemObj(PVMSVGAGBO pGbo, 652 RTR0MEMOBJ hMemObj); 648 NTSTATUS SvgaGboCreate(VBOXWDDM_EXT_VMSVGA *pSvga, 649 PVMSVGAGBO *ppGbo, 650 uint32_t cbGbo, 651 const char *pszTag); 652 NTSTATUS SvgaGboCreateForMdl(VBOXWDDM_EXT_VMSVGA *pSvga, 653 PVMSVGAGBO *ppGbo, 654 SIZE_T NumberOfPages, 655 PMDL pMdl, 656 ULONG MdlOffset); 657 void SvgaGboFree(VBOXWDDM_EXT_VMSVGA *pSvga, 658 VMSVGAGBO *pGbo); 659 660 DECLINLINE(void) SvgaGboReference(PVMSVGAGBO pGbo) 661 { 662 if (pGbo) 663 { 664 int32_t const c = ASMAtomicIncS32(&pGbo->cRefs); 665 Assert(c > 0); RT_NOREF(c); 666 } 667 } 668 669 DECLINLINE(void) SvgaGboUnreference(VBOXWDDM_EXT_VMSVGA *pSvga, 670 PVMSVGAGBO *ppGbo) 671 { 672 if (*ppGbo) 673 { 674 int32_t const c = ASMAtomicDecS32(&(*ppGbo)->cRefs); 675 Assert(c >= 0); 676 if (c == 0) 677 SvgaGboFree(pSvga, *ppGbo); 678 *ppGbo = NULL; 679 } 680 } 653 681 654 682 void SvgaMobFree(VBOXWDDM_EXT_VMSVGA *pSvga, 655 PVMSVGAMOB pMob); 656 PVMSVGAMOB SvgaMobQuery(VBOXWDDM_EXT_VMSVGA *pSvga, 657 uint32_t mobid); 658 NTSTATUS SvgaMobCreate(VBOXWDDM_EXT_VMSVGA *pSvga, 659 PVMSVGAMOB *ppMob, 660 uint32_t cMobPages, 661 HANDLE hAllocation); 662 NTSTATUS SvgaMobSetMemObj(PVMSVGAMOB pMob, 663 RTR0MEMOBJ hMemObj); 683 SVGAMobId *pMobid); 684 NTSTATUS SvgaMobAlloc(VBOXWDDM_EXT_VMSVGA *pSvga, 685 SVGAMobId *pMobid, 686 PVMSVGAGBO pGbo); 687 void *SvgaMobAddress(VBOXWDDM_EXT_VMSVGA *pSvga, 688 SVGAMobId mobid); 689 NTSTATUS SvgaMobDefine(VBOXWDDM_EXT_VMSVGA *pSvga, 690 SVGAMobId mobid, 691 void *pvCmd, 692 uint32_t cbReserved, 693 uint32_t *pcbCmd); 664 694 NTSTATUS SvgaMobDestroy(VBOXWDDM_EXT_VMSVGA *pSvga, 665 PVMSVGAMOB pMob,695 SVGAMobId mobid, 666 696 void *pvCmd, 667 697 uint32_t cbReserved, 668 698 uint32_t *pcbCmd); 699 void SvgaDeferredMobDestruction(PVBOXWDDM_EXT_VMSVGA pSvga); 669 700 670 701 NTSTATUS SvgaCOTNotifyId(VBOXWDDM_EXT_VMSVGA *pSvga,
Note:
See TracChangeset
for help on using the changeset viewer.