Changeset 28220 in vbox
- Timestamp:
- Apr 12, 2010 5:04:54 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 59960
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r28129 r28220 5304 5304 } 5305 5305 5306 static DECLCALLBACK(void) vgaPortUpdateDisplayRectEx (PPDMIDISPLAYPORT pInterface, 5307 int32_t x, 5308 int32_t y, 5309 uint32_t w, 5310 uint32_t h, 5311 const uint8_t *pu8SrcVRAM, 5312 uint32_t u32SrcWidth, 5313 uint32_t u32SrcHeight, 5314 uint32_t u32SrcLineSize, 5315 uint32_t u32SrcBitsPerPixel, 5316 uint8_t *pu8DstBuffer, 5317 uint32_t u32DstWidth, 5318 uint32_t u32DstHeight, 5319 uint32_t u32DstLineSize, 5320 uint32_t u32DstBitsPerPixel) 5321 { 5322 NOREF(u32DstWidth); 5323 NOREF(u32DstHeight); 5324 5306 static DECLCALLBACK(int) vgaPortCopyRect (PPDMIDISPLAYPORT pInterface, 5307 uint32_t w, 5308 uint32_t h, 5309 const uint8_t *pu8Src, 5310 int32_t xSrc, 5311 int32_t ySrc, 5312 uint32_t u32SrcWidth, 5313 uint32_t u32SrcHeight, 5314 uint32_t u32SrcLineSize, 5315 uint32_t u32SrcBitsPerPixel, 5316 uint8_t *pu8Dst, 5317 int32_t xDst, 5318 int32_t yDst, 5319 uint32_t u32DstWidth, 5320 uint32_t u32DstHeight, 5321 uint32_t u32DstLineSize, 5322 uint32_t u32DstBitsPerPixel) 5323 { 5325 5324 uint32_t v; 5326 5325 vga_draw_line_func *vga_draw_line; … … 5328 5327 uint32_t cbPixelDst; 5329 5328 uint32_t cbLineDst; 5330 uint8_t *pu8Dst ;5329 uint8_t *pu8DstPtr; 5331 5330 5332 5331 uint32_t cbPixelSrc; 5333 5332 uint32_t cbLineSrc; 5334 const uint8_t *pu8Src; 5335 5336 uint32_t u32OffsetSrc, u32Dummy; 5333 const uint8_t *pu8SrcPtr; 5334 5335 #ifdef DEBUG_sunlover 5336 LogFlow(("vgaPortCopyRect: %d,%d %dx%d -> %d,%d\n", xSrc, ySrc, w, h, xDst, yDst)); 5337 #endif /* DEBUG_sunlover */ 5337 5338 5338 5339 PVGASTATE s = IDISPLAYPORT_2_VGASTATE(pInterface); 5339 5340 #ifdef DEBUG_sunlover5341 LogFlow(("vgaPortUpdateDisplayRectEx: %d,%d %dx%d\n", x, y, w, h));5342 #endif /* DEBUG_sunlover */5343 5340 5344 5341 Assert(pInterface); 5345 5342 Assert(s->pDrv); 5346 5343 5347 int rc = PDMCritSectEnter(&s->lock, VERR_SEM_BUSY); 5348 AssertRC(rc); 5349 5350 /* Correct negative x and y coordinates. */ 5351 if (x < 0) 5352 { 5353 x += w; /* Compute xRight which is also the new width. */ 5354 w = (x < 0) ? 0 : x; 5355 x = 0; 5356 } 5357 5358 if (y < 0) 5359 { 5360 y += h; /* Compute yBottom, which is also the new height. */ 5361 h = (y < 0) ? 0 : y; 5362 y = 0; 5344 int32_t xSrcCorrected = xSrc; 5345 int32_t ySrcCorrected = ySrc; 5346 uint32_t wCorrected = w; 5347 uint32_t hCorrected = h; 5348 5349 /* Correct source coordinates to be within the source bitmap. */ 5350 if (xSrcCorrected < 0) 5351 { 5352 xSrcCorrected += wCorrected; /* Compute xRight which is also the new width. */ 5353 wCorrected = (xSrcCorrected < 0) ? 0 : xSrcCorrected; 5354 xSrcCorrected = 0; 5355 } 5356 5357 if (ySrcCorrected < 0) 5358 { 5359 ySrcCorrected += hCorrected; /* Compute yBottom, which is also the new height. */ 5360 hCorrected = (ySrcCorrected < 0) ? 0 : ySrcCorrected; 5361 ySrcCorrected = 0; 5363 5362 } 5364 5363 5365 5364 /* Also check if coords are greater than the display resolution. */ 5366 if (x + w> u32SrcWidth)5367 { 5368 / / x < 0 is not possible here5369 w = u32SrcWidth > (uint32_t)x? u32SrcWidth - x: 0;5370 } 5371 5372 if (y + h> u32SrcHeight)5373 { 5374 / / y < 0 is not possible here5375 h = u32SrcHeight > (uint32_t)y? u32SrcHeight - y: 0;5365 if (xSrcCorrected + wCorrected > u32SrcWidth) 5366 { 5367 /* xSrcCorrected < 0 is not possible here */ 5368 wCorrected = u32SrcWidth > (uint32_t)xSrcCorrected? u32SrcWidth - xSrcCorrected: 0; 5369 } 5370 5371 if (ySrcCorrected + hCorrected > u32SrcHeight) 5372 { 5373 /* y < 0 is not possible here */ 5374 hCorrected = u32SrcHeight > (uint32_t)ySrcCorrected? u32SrcHeight - ySrcCorrected: 0; 5376 5375 } 5377 5376 5378 5377 #ifdef DEBUG_sunlover 5379 LogFlow(("vgaPort UpdateDisplayRectEx: %d,%d %dx%d (corrected coords)\n", x, y, w, h));5378 LogFlow(("vgaPortCopyRect: %d,%d %dx%d (corrected coords)\n", xSrcCorrected, ySrcCorrected, wCorrected, hCorrected)); 5380 5379 #endif /* DEBUG_sunlover */ 5381 5380 5382 5381 /* Check if there is something to do at all. */ 5383 if (w == 0 || h== 0)5382 if (wCorrected == 0 || hCorrected == 0) 5384 5383 { 5385 5384 /* Empty rectangle. */ 5386 5385 #ifdef DEBUG_sunlover 5387 LogFlow(("vgaPortUpdateDisplayRectEx: nothing to do: %dx%d\n", w , h));5386 LogFlow(("vgaPortUpdateDisplayRectEx: nothing to do: %dx%d\n", wCorrected, hCorrected)); 5388 5387 #endif /* DEBUG_sunlover */ 5389 PDMCritSectLeave(&s->lock); 5390 return; 5388 return VINF_SUCCESS; 5389 } 5390 5391 /* Check that the corrected source rectangle is within the destination. 5392 * Note: source rectangle is adjusted, but the target must be large enough. 5393 */ 5394 if ( xDst < 0 5395 || yDst < 0 5396 || xDst + wCorrected > u32DstWidth 5397 || yDst + hCorrected > u32SrcHeight) 5398 { 5399 return VERR_INVALID_PARAMETER; 5391 5400 } 5392 5401 … … 5397 5406 case 0: 5398 5407 /* Nothing to do, just return. */ 5399 PDMCritSectLeave(&s->lock); 5400 return; 5408 return VINF_SUCCESS; 5401 5409 case 8: 5402 5410 v = VGA_DRAW_LINE8; … … 5415 5423 break; 5416 5424 } 5425 5426 int rc = PDMCritSectEnter(&s->lock, VERR_SEM_BUSY); 5427 AssertRC(rc); 5417 5428 5418 5429 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(u32DstBitsPerPixel)]; … … 5421 5432 cbPixelDst = (u32DstBitsPerPixel + 7) / 8; 5422 5433 cbLineDst = u32DstLineSize; 5423 pu8Dst = pu8DstBuffer + y * cbLineDst + x* cbPixelDst;5434 pu8DstPtr = pu8Dst + yDst * cbLineDst + xDst * cbPixelDst; 5424 5435 5425 5436 cbPixelSrc = (u32SrcBitsPerPixel + 7) / 8; 5426 5437 cbLineSrc = u32SrcLineSize; 5427 5428 pu8Src = pu8SrcVRAM; 5429 pu8Src += y * cbLineSrc + x * cbPixelSrc; 5430 5431 /* Render VRAM to the buffer. */ 5438 pu8SrcPtr = pu8Src + ySrcCorrected * cbLineSrc + xSrcCorrected * cbPixelSrc; 5432 5439 5433 5440 #ifdef DEBUG_sunlover 5434 LogFlow(("vgaPort UpdateDisplayRectEx: dst: %p, %d, %d. src: %p, %d, %d\n", pu8Dst, cbLineDst, cbPixelDst, pu8Src, cbLineSrc, cbPixelSrc));5441 LogFlow(("vgaPortCopyRect: dst: %p, %d, %d. src: %p, %d, %d\n", pu8DstPtr, cbLineDst, cbPixelDst, pu8SrcPtr, cbLineSrc, cbPixelSrc)); 5435 5442 #endif /* DEBUG_sunlover */ 5436 5443 5437 while (h -- > 0)5438 { 5439 vga_draw_line (s, pu8Dst , pu8Src, w);5440 pu8Dst += cbLineDst;5441 pu8Src += cbLineSrc;5444 while (hCorrected-- > 0) 5445 { 5446 vga_draw_line (s, pu8DstPtr, pu8SrcPtr, wCorrected); 5447 pu8DstPtr += cbLineDst; 5448 pu8SrcPtr += cbLineSrc; 5442 5449 } 5443 5450 PDMCritSectLeave(&s->lock); 5444 5451 5445 5452 #ifdef DEBUG_sunlover 5446 LogFlow(("vgaPort UpdateDisplayRectEx: completed.\n"));5453 LogFlow(("vgaPortCopyRect: completed.\n")); 5447 5454 #endif /* DEBUG_sunlover */ 5455 5456 return VINF_SUCCESS; 5448 5457 } 5449 5458 … … 6118 6127 pThis->IPort.pfnDisplayBlt = vgaPortDisplayBlt; 6119 6128 pThis->IPort.pfnUpdateDisplayRect = vgaPortUpdateDisplayRect; 6120 pThis->IPort.pfn UpdateDisplayRectEx = vgaPortUpdateDisplayRectEx;6129 pThis->IPort.pfnCopyRect = vgaPortCopyRect; 6121 6130 pThis->IPort.pfnSetRenderVRAM = vgaPortSetRenderVRAM; 6122 6131 -
trunk/src/VBox/Main/DisplayImpl.cpp
r28215 r28220 2380 2380 2381 2381 #ifdef VBOX_WITH_OLD_VBVA_LOCK 2382 int Display:: DrawToScreenEMT(Display *pDisplay, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height)2382 int Display::drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height) 2383 2383 { 2384 2384 int rc; 2385 2385 pDisplay->vbvaLock(); 2386 rc = pDisplay->mpDrv->pUpPort->pfnDisplayBlt(pDisplay->mpDrv->pUpPort, address, x, y, width, height); 2386 if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 2387 { 2388 rc = pDisplay->mpDrv->pUpPort->pfnDisplayBlt(pDisplay->mpDrv->pUpPort, address, x, y, width, height); 2389 } 2390 else if (aScreenId < pDisplay->mcMonitors) 2391 { 2392 DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[aScreenId]; 2393 2394 const uint8_t *pu8Src = address; 2395 int32_t xSrc = 0; 2396 int32_t ySrc = 0; 2397 uint32_t u32SrcWidth = width; 2398 uint32_t u32SrcHeight = height; 2399 uint32_t u32SrcLineSize = width * 4; 2400 uint32_t u32SrcBitsPerPixel = 32; 2401 2402 uint8_t *pu8Dst = pFBInfo->pu8FramebufferVRAM; 2403 int32_t xDst = x; 2404 int32_t yDst = y; 2405 uint32_t u32DstWidth = pFBInfo->w; 2406 uint32_t u32DstHeight = pFBInfo->h; 2407 uint32_t u32DstLineSize = pFBInfo->u32LineSize; 2408 uint32_t u32DstBitsPerPixel = pFBInfo->u16BitsPerPixel; 2409 2410 rc = pDisplay->mpDrv->pUpPort->pfnCopyRect(pDisplay->mpDrv->pUpPort, 2411 width, height, 2412 pu8Src, 2413 xSrc, ySrc, 2414 u32SrcWidth, u32SrcHeight, 2415 u32SrcLineSize, u32SrcBitsPerPixel, 2416 pu8Dst, 2417 xDst, yDst, 2418 u32DstWidth, u32DstHeight, 2419 u32DstLineSize, u32DstBitsPerPixel); 2420 } 2421 else 2422 { 2423 rc = VERR_INVALID_PARAMETER; 2424 } 2387 2425 pDisplay->vbvaUnlock(); 2388 2426 return rc; … … 2422 2460 */ 2423 2461 #ifdef VBOX_WITH_OLD_VBVA_LOCK 2424 int rcVBox = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)Display:: DrawToScreenEMT, 6,2425 this, a ddress, x, y, width, height);2462 int rcVBox = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)Display::drawToScreenEMT, 7, 2463 this, aScreenId, address, x, y, width, height); 2426 2464 #else 2427 2465 int rcVBox = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)mpDrv->pUpPort->pfnDisplayBlt, 6, … … 3286 3324 if (SUCCEEDED(hrc) && address != NULL) 3287 3325 { 3288 pDrv->pUpPort->pfnUpdateDisplayRectEx (pDrv->pUpPort, 3289 pCmd->x - pFBInfo->xOrigin, pCmd->y - pFBInfo->yOrigin, pCmd->w, pCmd->h, 3290 pFBInfo->pu8FramebufferVRAM, pFBInfo->w, pFBInfo->h, 3291 pFBInfo->u32LineSize, pFBInfo->u16BitsPerPixel, 3292 address, pFBInfo->w, pFBInfo->h, 3293 pFBInfo->w * 4, 32); 3326 uint32_t width = pCmd->w; 3327 uint32_t height = pCmd->h; 3328 3329 const uint8_t *pu8Src = pFBInfo->pu8FramebufferVRAM; 3330 int32_t xSrc = pCmd->x - pFBInfo->xOrigin; 3331 int32_t ySrc = pCmd->y - pFBInfo->yOrigin; 3332 uint32_t u32SrcWidth = pFBInfo->w; 3333 uint32_t u32SrcHeight = pFBInfo->h; 3334 uint32_t u32SrcLineSize = pFBInfo->u32LineSize; 3335 uint32_t u32SrcBitsPerPixel = pFBInfo->u16BitsPerPixel; 3336 3337 uint8_t *pu8Dst = address; 3338 int32_t xDst = xSrc; 3339 int32_t yDst = ySrc; 3340 uint32_t u32DstWidth = u32SrcWidth; 3341 uint32_t u32DstHeight = u32SrcHeight; 3342 uint32_t u32DstLineSize = u32DstWidth * 4; 3343 uint32_t u32DstBitsPerPixel = 32; 3344 3345 pDrv->pUpPort->pfnCopyRect(pDrv->pUpPort, 3346 width, height, 3347 pu8Src, 3348 xSrc, ySrc, 3349 u32SrcWidth, u32SrcHeight, 3350 u32SrcLineSize, u32SrcBitsPerPixel, 3351 pu8Dst, 3352 xDst, yDst, 3353 u32DstWidth, u32DstHeight, 3354 u32DstLineSize, u32DstBitsPerPixel); 3294 3355 } 3295 3356 } -
trunk/src/VBox/Main/include/DisplayImpl.h
r28215 r28220 354 354 private: 355 355 static void InvalidateAndUpdateEMT(Display *pDisplay); 356 static int DrawToScreenEMT(Display *pDisplay, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);356 static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height); 357 357 358 358 int videoAccelRefreshProcess(void);
Note:
See TracChangeset
for help on using the changeset viewer.