Changeset 35268 in vbox
- Timestamp:
- Dec 20, 2010 11:30:58 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/x11/vboxvideo
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/vboxvideo/vboxutils.c
r35267 r35268 244 244 pViews[i].u32ViewOffset = 0; 245 245 pViews[i].u32ViewSize = pVBox->cbView; 246 pViews[i].u32MaxScreenSize = pVBox->cbF ramebuffer;246 pViews[i].u32MaxScreenSize = pVBox->cbFBMax; 247 247 } 248 248 return VINF_SUCCESS; … … 309 309 return FALSE; 310 310 } 311 pVBox->cbView = pVBox->cbF ramebuffer= offVRAMBaseMapping;311 pVBox->cbView = pVBox->cbFBMax = offVRAMBaseMapping; 312 312 pVBox->cScreens = VBoxHGSMIGetMonitorCount(&pVBox->guestCtx); 313 313 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Requested monitor count: %u\n", … … 315 315 for (i = 0; i < pVBox->cScreens; ++i) 316 316 { 317 pVBox->cbF ramebuffer-= VBVA_MIN_BUFFER_SIZE;318 pVBox->aoffVBVABuffer[i] = pVBox->cbF ramebuffer;317 pVBox->cbFBMax -= VBVA_MIN_BUFFER_SIZE; 318 pVBox->aoffVBVABuffer[i] = pVBox->cbFBMax; 319 319 TRACE_LOG("VBVA buffer offset for screen %u: 0x%lx\n", i, 320 (unsigned long) pVBox->cbF ramebuffer);320 (unsigned long) pVBox->cbFBMax); 321 321 VBoxVBVASetupBufferContext(&pVBox->aVbvaCtx[i], 322 322 pVBox->aoffVBVABuffer[i], … … 324 324 } 325 325 TRACE_LOG("Maximum framebuffer size: %lu (0x%lx)\n", 326 (unsigned long) pVBox->cbF ramebuffer,327 (unsigned long) pVBox->cbF ramebuffer);326 (unsigned long) pVBox->cbFBMax, 327 (unsigned long) pVBox->cbFBMax); 328 328 rc = VBoxHGSMISendViewInfo(&pVBox->guestCtx, pVBox->cScreens, 329 329 vboxFillViewInfo, (void *)pVBox); -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
r35267 r35268 837 837 /* Using the PCI information caused problems with non-powers-of-two 838 838 sized video RAM configurations */ 839 pVBox->cbF ramebuffer= inl(VBE_DISPI_IOPORT_DATA);840 pScrn->videoRam = pVBox->cbF ramebuffer/ 1024;839 pVBox->cbFBMax = inl(VBE_DISPI_IOPORT_DATA); 840 pScrn->videoRam = pVBox->cbFBMax / 1024; 841 841 842 842 /* Check if the chip restricts horizontal resolution or not. */ … … 1152 1152 } 1153 1153 1154 /** Clear the virtual framebuffer in VRAM. Optionally also clear up to the 1155 * size of a new framebuffer. Framebuffer sizes larger than available VRAM 1156 * be treated as zero and passed over. */ 1157 static void 1158 vboxClearVRAM(ScrnInfoPtr pScrn, int32_t cNewX, int32_t cNewY) 1159 { 1160 VBOXPtr pVBox = VBOXGetRec(pScrn); 1161 int64_t cbOldFB, cbNewFB; 1162 1163 cbOldFB = pVBox->cbLine * pScrn->virtualX; 1164 cbNewFB = vboxLineLength(pScrn, cNewX) * cNewY; 1165 if (cbOldFB > pVBox->cbFBMax) 1166 cbOldFB = 0; 1167 if (cbNewFB > pVBox->cbFBMax) 1168 cbNewFB = 0; 1169 memset(pVBox->base, 0, max(cbOldFB, cbNewFB)); 1170 } 1171 1154 1172 static Bool 1155 1173 VBOXEnterVT(int scrnIndex, int flags) … … 1159 1177 1160 1178 TRACE_ENTRY(); 1179 vboxClearVRAM(pScrn, 0, 0); 1161 1180 if (pVBox->fHaveHGSMI) 1162 1181 vboxEnableVbva(pScrn); … … 1186 1205 TRACE_ENTRY(); 1187 1206 pVBox->vtSwitch = TRUE; 1188 VBOXSaveRestore(pScrn, MODE_RESTORE);1189 1207 if (pVBox->fHaveHGSMI) 1190 1208 vboxDisableVbva(pScrn); 1209 vboxClearVRAM(pScrn, 0, 0); 1210 VBOXSaveRestore(pScrn, MODE_RESTORE); 1191 1211 vboxDisableGraphicsCap(pVBox); 1192 1212 #ifdef VBOX_DRI … … 1203 1223 VBOXPtr pVBox = VBOXGetRec(pScrn); 1204 1224 1225 if (pVBox->fHaveHGSMI) 1226 vboxDisableVbva(pScrn); 1227 vboxDisableGraphicsCap(pVBox); 1228 vboxClearVRAM(pScrn, 0, 0); 1205 1229 #ifdef VBOX_DRI 1206 1230 if (pVBox->useDRI) … … 1209 1233 #endif 1210 1234 1211 if (pVBox->fHaveHGSMI)1212 vboxDisableVbva(pScrn);1213 vboxDisableGraphicsCap(pVBox);1214 1235 if (pScrn->vtSema) { 1215 1236 VBOXSaveRestore(xf86Screens[scrnIndex], MODE_RESTORE); … … 1289 1310 * too large for VRAM as we sometimes have to do this - see comments in 1290 1311 * VBOXPreInit. */ 1291 if ( offStart + pVBox->cbLine * cHeight > pVBox->cbF ramebuffer1292 || pVBox->cbLine * pScrn->virtualY > pVBox->cbF ramebuffer)1312 if ( offStart + pVBox->cbLine * cHeight > pVBox->cbFBMax 1313 || pVBox->cbLine * pScrn->virtualY > pVBox->cbFBMax) 1293 1314 fActive = FALSE; 1294 1315 /* Deactivate the screen if it is outside of the virtual framebuffer and … … 1329 1350 VBOXPtr pVBox = VBOXGetRec(pScrn); 1330 1351 uint64_t cbLine = vboxLineLength(pScrn, width); 1331 uint32_t cbOldPixmap;1332 1352 1333 1353 TRACE_LOG("width=%d, height=%d\n", width, height); … … 1337 1357 return FALSE; 1338 1358 } 1339 if (cbLine > UINT32_MAX || cbLine * height >= pVBox->cbF ramebuffer)1359 if (cbLine > UINT32_MAX || cbLine * height >= pVBox->cbFBMax) 1340 1360 { 1341 1361 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, 1342 1362 "Unable to set up a virtual screen size of %dx%d with %lu of %d Kb of video memory available. Please increase the video memory size.\n", 1343 width, height, pVBox->cbF ramebuffer/ 1024, pScrn->videoRam);1363 width, height, pVBox->cbFBMax / 1024, pScrn->videoRam); 1344 1364 return FALSE; 1345 1365 } … … 1347 1367 pScrn->depth, vboxBPP(pScrn), cbLine, 1348 1368 pVBox->base); 1349 cbOldPixmap = pVBox->cbLine * pScrn->virtualY; 1350 if (cbOldPixmap > pVBox->cbFramebuffer) 1351 cbOldPixmap = 0; 1369 vboxClearVRAM(pScrn, width, height); 1352 1370 pScrn->virtualX = width; 1353 1371 pScrn->virtualY = height; 1354 1372 pScrn->displayWidth = vboxDisplayPitch(pScrn, cbLine); 1355 1373 pVBox->cbLine = cbLine; 1356 /* Clear video RAM for esthetic reasons */1357 memset(pVBox->base, 0, max(cbLine * height, cbOldPixmap));1358 1374 #ifdef VBOX_DRI 1359 1375 if (pVBox->useDRI) -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h
r35207 r35268 184 184 void *base; 185 185 /** The amount of VRAM available for use as a framebuffer */ 186 unsigned long cbF ramebuffer;186 unsigned long cbFBMax; 187 187 /** The size of the framebuffer and the VBVA buffers at the end of it. */ 188 188 unsigned long cbView; -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_dri.c
r34715 r35268 175 175 || (pVBox->pciInfo == NULL) 176 176 || (pVBox->base == NULL) 177 || (pVBox->cbF ramebuffer== 0))177 || (pVBox->cbFBMax == 0)) 178 178 { 179 179 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: preconditions failed\n", … … 256 256 pDRIInfo->maxDrawableTableEntry = VBOX_MAX_DRAWABLES; 257 257 pDRIInfo->frameBufferPhysicalAddress = (pointer)pScrn->memPhysBase; 258 pDRIInfo->frameBufferSize = pVBox->cbF ramebuffer;258 pDRIInfo->frameBufferSize = pVBox->cbFBMax; 259 259 pDRIInfo->frameBufferStride = pScrn->displayWidth 260 260 * pScrn->bitsPerPixel / 8;
Note:
See TracChangeset
for help on using the changeset viewer.