Changeset 90578 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video
- Timestamp:
- Aug 9, 2021 11:02:15 AM (3 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.cpp
r90255 r90578 27 27 #include <iprt/memobj.h> 28 28 29 static NTSTATUS SvgaCmdBufSubmit(VBOXWDDM_EXT_VMSVGA *pSvga, uint32_t cbSubmit) 30 { 29 static NTSTATUS SvgaCmdBufSubmit(VBOXWDDM_EXT_VMSVGA *pSvga, uint32_t cbSubmit, uint32_t idx) 30 { 31 AssertReturn(idx < pSvga->u32NumCmdBufs, VERR_INVALID_PARAMETER); 32 AssertReturn(cbSubmit <= PAGE_SIZE, VERR_INVALID_PARAMETER); 31 33 int rc = STATUS_SUCCESS; 32 SVGACBHeader *pHdr = (SVGACBHeader *)pSvga->pvR0Hdr; 34 SVGACBHeader *pHdr = &((SVGACBHeader *)pSvga->pvR0Hdr)[idx]; 35 RTHCPHYS paHdr = pSvga->paHdr + idx * sizeof(SVGACBHeader); 33 36 34 37 pHdr->status = SVGA_CB_STATUS_NONE; 35 38 pHdr->errorOffset = 0; 36 39 pHdr->id = 0; 37 pHdr->flags = SVGA_CB_FLAG_NO NE;40 pHdr->flags = SVGA_CB_FLAG_NO_IRQ; 38 41 pHdr->length = cbSubmit; 39 42 pHdr->ptr.pa = pSvga->paCmd; 40 43 41 SVGARegWrite(pSvga, SVGA_REG_COMMAND_HIGH, (uint32_t)(p Svga->paHdr >> 32));42 SVGARegWrite(pSvga, SVGA_REG_COMMAND_LOW, (uint32_t)p Svga->paHdr | SVGA_CB_CONTEXT_0);44 SVGARegWrite(pSvga, SVGA_REG_COMMAND_HIGH, (uint32_t)(paHdr >> 32)); 45 SVGARegWrite(pSvga, SVGA_REG_COMMAND_LOW, (uint32_t)paHdr | SVGA_CB_CONTEXT_0); 43 46 44 47 return rc; … … 53 56 if (enable) 54 57 { 55 rc = RTR0MemObjAllocPageTag(&pSvga->hMemObj, 2 << PAGE_SHIFT, 58 pSvga->u32NumCmdBufs = 8; 59 60 rc = RTR0MemObjAllocPageTag(&pSvga->hMemObj, 2 * PAGE_SIZE, 56 61 false /* executable R0 mapping */, "WDDMGA"); 57 62 58 63 pSvga->pvR0Hdr = RTR0MemObjAddress(pSvga->hMemObj); 59 64 pSvga->paHdr = RTR0MemObjGetPagePhysAddr(pSvga->hMemObj, 0/*iPage*/); 65 memset(pSvga->pvR0Hdr, 0, PAGE_SIZE); 60 66 61 67 pSvga->pvR0Cmd = (uint8_t *)pSvga->pvR0Hdr + PAGE_SIZE; 62 68 pSvga->paCmd = RTR0MemObjGetPagePhysAddr(pSvga->hMemObj, 1/*iPage*/); 69 memset(pSvga->pvR0Cmd, 0, PAGE_SIZE); 63 70 } 64 71 … … 68 75 pHdr->errorOffset = 0; 69 76 pHdr->id = 0; 70 pHdr->flags = SVGA_CB_FLAG_NO NE;77 pHdr->flags = SVGA_CB_FLAG_NO_IRQ; 71 78 pHdr->length = sizeof(uint32_t) + sizeof(SVGADCCmdStartStop); 72 79 pHdr->ptr.pa = pSvga->paCmd; … … 87 94 pSvga->hMemObj = NIL_RTR0MEMOBJ; 88 95 } 96 else 97 { 98 uint32_t idx; 99 100 for(idx = 0; idx < pSvga->u32NumCmdBufs; idx++) 101 { 102 pHdr->status = SVGA_CB_STATUS_COMPLETED; 103 pHdr->errorOffset = 0; 104 pHdr->id = 0; 105 pHdr->flags = SVGA_CB_FLAG_NO_IRQ; 106 pHdr->length = 0; 107 pHdr->ptr.pa = 0; 108 109 pHdr++; 110 } 111 } 89 112 90 113 AssertRC(rc); 91 114 return rc; 115 } 116 117 static uint32_t SvgaCmdBufReserve(VBOXWDDM_EXT_VMSVGA *pSvga) 118 { 119 SVGACBHeader *pHdr = (SVGACBHeader *)pSvga->pvR0Hdr; 120 uint32_t idx; 121 122 for(idx = 0; idx < pSvga->u32NumCmdBufs; idx++) 123 { 124 if (ASMAtomicCmpXchgU32((volatile uint32_t *)&pHdr->status, SVGA_CB_STATUS_NONE, SVGA_CB_STATUS_COMPLETED)) 125 { 126 return idx; 127 } 128 129 pHdr++; 130 } 131 132 return UINT32_MAX; 92 133 } 93 134 … … 1128 1169 { 1129 1170 NTSTATUS Status = STATUS_SUCCESS; 1130 1131 1171 uint32_t cbSubmit = 0; 1172 uint32_t idx = UINT32_MAX; 1173 void *pvCmd = NULL; 1174 1132 1175 SvgaGenBlitGMRFBToScreen(pSvga, idDstScreen, xSrc, ySrc, pDstRect, 1133 1176 NULL, 0, &cbSubmit); 1134 1177 1135 void *pvCmd;1136 1137 1178 if (pSvga->u32Caps & SVGA_CAP_COMMAND_BUFFERS) 1138 1179 { 1139 pvCmd = pSvga->pvR0Cmd; 1180 idx = SvgaCmdBufReserve(pSvga); 1181 1182 if (idx < pSvga->u32NumCmdBufs) 1183 { 1184 pvCmd = pSvga->pvR0Cmd; 1185 } 1186 else 1187 { 1188 GALOGREL(32, ("WDDM: SvgaCmdBufReserve failed\n")); 1189 } 1140 1190 } 1141 1191 else … … 1152 1202 if (pSvga->u32Caps & SVGA_CAP_COMMAND_BUFFERS) 1153 1203 { 1154 SvgaCmdBufSubmit(pSvga, cbSubmit );1204 SvgaCmdBufSubmit(pSvga, cbSubmit, idx); 1155 1205 } 1156 1206 else -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.h
r90188 r90578 69 69 RTR0PTR pvR0Hdr, pvR0Cmd; 70 70 RTHCPHYS paHdr, paCmd; 71 uint32_t u32NumCmdBufs; 71 72 72 73 /**
Note:
See TracChangeset
for help on using the changeset viewer.