- Timestamp:
- Mar 26, 2010 4:43:43 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r27560 r27754 5303 5303 } 5304 5304 5305 static DECLCALLBACK(void) vgaPortUpdateDisplayRectEx (PPDMIDISPLAYPORT pInterface, 5306 int32_t x, 5307 int32_t y, 5308 uint32_t w, 5309 uint32_t h, 5310 const uint8_t *pu8SrcVRAM, 5311 uint32_t u32SrcWidth, 5312 uint32_t u32SrcHeight, 5313 uint32_t u32SrcLineSize, 5314 uint32_t u32SrcBitsPerPixel, 5315 uint8_t *pu8DstBuffer, 5316 uint32_t u32DstWidth, 5317 uint32_t u32DstHeight, 5318 uint32_t u32DstLineSize, 5319 uint32_t u32DstBitsPerPixel) 5320 { 5321 NOREF(u32DstWidth); 5322 NOREF(u32DstHeight); 5323 5324 uint32_t v; 5325 vga_draw_line_func *vga_draw_line; 5326 5327 uint32_t cbPixelDst; 5328 uint32_t cbLineDst; 5329 uint8_t *pu8Dst; 5330 5331 uint32_t cbPixelSrc; 5332 uint32_t cbLineSrc; 5333 const uint8_t *pu8Src; 5334 5335 uint32_t u32OffsetSrc, u32Dummy; 5336 5337 PVGASTATE s = IDISPLAYPORT_2_VGASTATE(pInterface); 5338 5339 #ifdef DEBUG_sunlover 5340 LogFlow(("vgaPortUpdateDisplayRectEx: %d,%d %dx%d\n", x, y, w, h)); 5341 #endif /* DEBUG_sunlover */ 5342 5343 Assert(pInterface); 5344 Assert(s->pDrv); 5345 5346 int rc = PDMCritSectEnter(&s->lock, VERR_SEM_BUSY); 5347 AssertRC(rc); 5348 5349 /* Correct negative x and y coordinates. */ 5350 if (x < 0) 5351 { 5352 x += w; /* Compute xRight which is also the new width. */ 5353 w = (x < 0) ? 0 : x; 5354 x = 0; 5355 } 5356 5357 if (y < 0) 5358 { 5359 y += h; /* Compute yBottom, which is also the new height. */ 5360 h = (y < 0) ? 0 : y; 5361 y = 0; 5362 } 5363 5364 /* Also check if coords are greater than the display resolution. */ 5365 if (x + w > u32SrcWidth) 5366 { 5367 // x < 0 is not possible here 5368 w = u32SrcWidth > (uint32_t)x? u32SrcWidth - x: 0; 5369 } 5370 5371 if (y + h > u32SrcHeight) 5372 { 5373 // y < 0 is not possible here 5374 h = u32SrcHeight > (uint32_t)y? u32SrcHeight - y: 0; 5375 } 5376 5377 #ifdef DEBUG_sunlover 5378 LogFlow(("vgaPortUpdateDisplayRectEx: %d,%d %dx%d (corrected coords)\n", x, y, w, h)); 5379 #endif /* DEBUG_sunlover */ 5380 5381 /* Check if there is something to do at all. */ 5382 if (w == 0 || h == 0) 5383 { 5384 /* Empty rectangle. */ 5385 #ifdef DEBUG_sunlover 5386 LogFlow(("vgaPortUpdateDisplayRectEx: nothing to do: %dx%d\n", w, h)); 5387 #endif /* DEBUG_sunlover */ 5388 PDMCritSectLeave(&s->lock); 5389 return; 5390 } 5391 5392 /* Choose the rendering function. */ 5393 switch(u32SrcBitsPerPixel) 5394 { 5395 default: 5396 case 0: 5397 /* Nothing to do, just return. */ 5398 return; 5399 case 8: 5400 v = VGA_DRAW_LINE8; 5401 break; 5402 case 15: 5403 v = VGA_DRAW_LINE15; 5404 break; 5405 case 16: 5406 v = VGA_DRAW_LINE16; 5407 break; 5408 case 24: 5409 v = VGA_DRAW_LINE24; 5410 break; 5411 case 32: 5412 v = VGA_DRAW_LINE32; 5413 break; 5414 } 5415 5416 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(u32DstBitsPerPixel)]; 5417 5418 /* Compute source and destination addresses and pitches. */ 5419 cbPixelDst = (u32DstBitsPerPixel + 7) / 8; 5420 cbLineDst = u32DstLineSize; 5421 pu8Dst = pu8DstBuffer + y * cbLineDst + x * cbPixelDst; 5422 5423 cbPixelSrc = (u32SrcBitsPerPixel + 7) / 8; 5424 cbLineSrc = u32SrcLineSize; 5425 5426 pu8Src = pu8SrcVRAM; 5427 pu8Src += y * cbLineSrc + x * cbPixelSrc; 5428 5429 /* Render VRAM to the buffer. */ 5430 5431 #ifdef DEBUG_sunlover 5432 LogFlow(("vgaPortUpdateDisplayRectEx: dst: %p, %d, %d. src: %p, %d, %d\n", pu8Dst, cbLineDst, cbPixelDst, pu8Src, cbLineSrc, cbPixelSrc)); 5433 #endif /* DEBUG_sunlover */ 5434 5435 while (h-- > 0) 5436 { 5437 vga_draw_line (s, pu8Dst, pu8Src, w); 5438 pu8Dst += cbLineDst; 5439 pu8Src += cbLineSrc; 5440 } 5441 PDMCritSectLeave(&s->lock); 5442 5443 #ifdef DEBUG_sunlover 5444 LogFlow(("vgaPortUpdateDisplayRectEx: completed.\n")); 5445 #endif /* DEBUG_sunlover */ 5446 } 5447 5305 5448 static DECLCALLBACK(void) vgaPortSetRenderVRAM(PPDMIDISPLAYPORT pInterface, bool fRender) 5306 5449 { … … 5973 6116 pThis->IPort.pfnDisplayBlt = vgaPortDisplayBlt; 5974 6117 pThis->IPort.pfnUpdateDisplayRect = vgaPortUpdateDisplayRect; 6118 pThis->IPort.pfnUpdateDisplayRectEx = vgaPortUpdateDisplayRectEx; 5975 6119 pThis->IPort.pfnSetRenderVRAM = vgaPortSetRenderVRAM; 5976 6120 -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r27339 r27754 322 322 /** LUN\#0: The display port interface. */ 323 323 PDMIDISPLAYPORT IPort; 324 # if HC_ARCH_BITS == 32325 uint32_t Padding8;326 # endif327 324 #if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL) 328 325 /** LUN\#0: VBVA callbacks interface */ -
trunk/src/VBox/Main/DisplayImpl.cpp
r27751 r27754 927 927 mpDrv->pUpPort->pfnSetRenderVRAM (mpDrv->pUpPort, pFBInfo->fDefaultFormat); 928 928 } 929 else if (!pFBInfo->pFramebuffer.isNull()) 930 { 931 BOOL usesGuestVRAM = FALSE; 932 pFBInfo->pFramebuffer->COMGETTER(UsesGuestVRAM) (&usesGuestVRAM); 933 934 pFBInfo->fDefaultFormat = (usesGuestVRAM == FALSE); 935 } 936 LogFlow(("[%d]: default format %d\n", uScreenId, pFBInfo->fDefaultFormat)); 929 937 930 938 #ifdef DEBUG_sunlover … … 3308 3316 if (pFBInfo->fDefaultFormat) 3309 3317 { 3310 pDrv->pUpPort->pfnUpdateDisplayRect (pDrv->pUpPort, pCmd->x, pCmd->y, pCmd->w, pCmd->h); 3318 if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 3319 { 3320 pDrv->pUpPort->pfnUpdateDisplayRect (pDrv->pUpPort, pCmd->x, pCmd->y, pCmd->w, pCmd->h); 3321 } 3322 else if (!pFBInfo->pFramebuffer.isNull()) 3323 { 3324 /* Render VRAM content to the framebuffer. */ 3325 BYTE *address = NULL; 3326 HRESULT hrc = pFBInfo->pFramebuffer->COMGETTER(Address) (&address); 3327 if (SUCCEEDED(hrc) && address != NULL) 3328 { 3329 pDrv->pUpPort->pfnUpdateDisplayRectEx (pDrv->pUpPort, 3330 pCmd->x - pFBInfo->xOrigin, pCmd->y - pFBInfo->yOrigin, pCmd->w, pCmd->h, 3331 pFBInfo->pu8FramebufferVRAM, pFBInfo->w, pFBInfo->h, 3332 pFBInfo->u32LineSize, pFBInfo->u16BitsPerPixel, 3333 address, pFBInfo->w, pFBInfo->h, 3334 pFBInfo->w * 4, 32); 3335 } 3336 } 3311 3337 pThis->handleDisplayUpdate (pCmd->x + pFBInfo->xOrigin, 3312 3338 pCmd->y + pFBInfo->yOrigin, pCmd->w, pCmd->h);
Note:
See TracChangeset
for help on using the changeset viewer.