- Timestamp:
- Apr 21, 2014 6:22:49 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxVideo.h
r51081 r51111 1603 1603 1604 1604 #define VBOXCMDVBVA_OPF_BLT_TYPE_MASK 7 1605 1606 1607 #define VBOXCMDVBVA_OPF_CLRFILL_TYPE_PRIMARY 0 1608 #define VBOXCMDVBVA_OPF_CLRFILL_TYPE_GENERIC_A8R8G8B8 1 1609 1610 #define VBOXCMDVBVA_OPF_CLRFILL_TYPE_MASK 1 1611 1612 1605 1613 /* blit direction is from first operand to second */ 1606 1614 #define VBOXCMDVBVA_OPF_BLT_DIR_IN_2 0x10 … … 1682 1690 { 1683 1691 VBOXCMDVBVA_ALLOCINFO Info; 1684 uint16_t width;1685 uint16_t height;1692 uint16_t u16Width; 1693 uint16_t u16Height; 1686 1694 } VBOXCMDVBVA_ALLOCDESC; 1687 1695 … … 1749 1757 } VBOXCMDVBVA_FLIP; 1750 1758 1751 typedef struct VBOXCMDVBVA_CLRFILL 1759 typedef struct VBOXCMDVBVA_CLRFILL_HDR 1752 1760 { 1753 1761 VBOXCMDVBVA_HDR Hdr; 1754 VBOXCMDVBVA_ALLOCINFO dst; 1762 uint32_t u32Color; 1763 } VBOXCMDVBVA_CLRFILL_HDR; 1764 1765 typedef struct VBOXCMDVBVA_CLRFILL_PRIMARY 1766 { 1767 VBOXCMDVBVA_CLRFILL_HDR Hdr; 1755 1768 VBOXCMDVBVA_RECT aRects[1]; 1756 } VBOXCMDVBVA_CLRFILL; 1769 } VBOXCMDVBVA_CLRFILL_PRIMARY; 1770 1771 typedef struct VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8 1772 { 1773 VBOXCMDVBVA_CLRFILL_HDR Hdr; 1774 VBOXCMDVBVA_ALLOCDESC dst; 1775 VBOXCMDVBVA_RECT aRects[1]; 1776 } VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8; 1777 1778 #define VBOXCMDVBVA_SIZEOF_CLRFILLSTRUCT_MAX (sizeof (VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8)) 1757 1779 1758 1780 #if 0 … … 1784 1806 { 1785 1807 VBOXCMDVBVA_HDR Hdr; 1786 uint32_t cbFill;1787 uint32_t Pattern;1808 uint32_t u32CbFill; 1809 uint32_t u32Pattern; 1788 1810 /* paging transfer can NOT be initiated for allocations having host 3D object (hostID) associated */ 1789 1811 VBOXCMDVBVAOFFSET offVRAM; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r51081 r51111 3512 3512 LOGF(("ENTER, context(0x%x)", hAdapter)); 3513 3513 3514 if (pBuildPagingBuffer->DmaBufferPrivateDataSize < sizeof (VBOXCMDVBVA_HDR)) 3515 { 3516 WARN(("private data too small")); 3517 return STATUS_INVALID_PARAMETER; 3518 } 3519 3520 VBOXCMDVBVA_HDR *pHdr = (VBOXCMDVBVA_HDR*)pBuildPagingBuffer->pDmaBufferPrivateData; 3521 3514 3522 switch (pBuildPagingBuffer->Operation) 3515 3523 { … … 3547 3555 if (pAlloc->AllocData.hostID) 3548 3556 { 3549 VBOXCMDVBVA_HDR *pHdr = (VBOXCMDVBVA_HDR*)pBuildPagingBuffer->pDmaBufferPrivateData;3550 3551 3557 cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE; 3552 3558 cbPrivateData = sizeof (*pHdr); … … 3556 3562 pHdr->u.u8PrimaryID = 0; 3557 3563 pHdr->u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3558 pHdr->u2.complexCmdEl.u16CbCmdHost = cbPrivateData;3559 pHdr->u2.complexCmdEl.u16CbCmdGuest = cbBuffer;3560 3564 break; 3561 3565 } … … 3632 3636 pSysMemCmd->Hdr.u.u8PrimaryID = (cbBuffer >> 8) & 0xff; 3633 3637 pSysMemCmd->Hdr.u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3634 pSysMemCmd->Hdr.u2.complexCmdEl.u16CbCmdHost = cbPrivateData;3635 pSysMemCmd->Hdr.u2.complexCmdEl.u16CbCmdGuest = cbBuffer;3636 3638 pSysMemCmd->phCmd = 0; 3637 3639 … … 3648 3650 } 3649 3651 3650 if (pBuildPagingBuffer->DmaBufferPrivateDataSize < sizeof (VBOXCMDVBVA_HDR)) 3652 if (pAlloc->AllocData.hostID || pBuildPagingBuffer->Fill.Destination.SegmentId != 1) 3653 { 3654 if (!pAlloc->AllocData.hostID) 3655 { 3656 WARN(("unexpected segment id")); 3657 } 3658 3659 cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE; 3660 cbPrivateData = sizeof (*pHdr); 3661 3662 pHdr->u8OpCode = VBOXCMDVBVA_OPTYPE_NOPCMD; 3663 pHdr->u8Flags = 0; 3664 pHdr->u.u8PrimaryID = 0; 3665 pHdr->u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3666 break; 3667 } 3668 3669 if (pBuildPagingBuffer->DmaBufferPrivateDataSize < sizeof (VBOXCMDVBVA_PAGING_FILL)) 3651 3670 { 3652 3671 WARN(("private data too small")); … … 3654 3673 } 3655 3674 3675 VBOXCMDVBVA_PAGING_FILL *pFill = (VBOXCMDVBVA_PAGING_FILL*)pBuildPagingBuffer->pDmaBufferPrivateData; 3676 pFill->Hdr.u8OpCode = VBOXCMDVBVA_OPTYPE_PAGING_FILL; 3677 pFill->Hdr.u8Flags = 0; 3678 pFill->Hdr.u.u8PrimaryID = 0; 3679 pFill->Hdr.u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3680 pFill->u32CbFill = (uint32_t)pBuildPagingBuffer->Fill.FillSize; 3681 pFill->u32Pattern = pBuildPagingBuffer->Fill.FillPattern; 3682 Assert(!pBuildPagingBuffer->Fill.Destination.SegmentAddress.HighPart); 3683 pFill->offVRAM = pBuildPagingBuffer->Fill.Destination.SegmentAddress.LowPart; 3684 3656 3685 cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE; 3657 3658 VBOXCMDVBVA_HDR *pHdr = (VBOXCMDVBVA_HDR*)pBuildPagingBuffer->pDmaBufferPrivateData; 3659 3660 cbPrivateData = sizeof (*pHdr); 3661 3662 pHdr->u8OpCode = VBOXCMDVBVA_OPTYPE_NOPCMD; 3663 pHdr->u8Flags = 0; 3664 pHdr->u.u8PrimaryID = 0; 3665 pHdr->u8State = VBOXCMDVBVA_STATE_SUBMITTED; 3666 pHdr->u2.complexCmdEl.u16CbCmdHost = cbPrivateData; 3667 pHdr->u2.complexCmdEl.u16CbCmdGuest = cbBuffer; 3668 3669 /** @todo: add necessary bits */ 3670 // WARN(("Impl!")); 3686 cbPrivateData = sizeof (*pFill); 3687 3671 3688 break; 3672 3689 } … … 3694 3711 Assert(cbBuffer == 0 || cbBuffer >= sizeof (VBOXCMDVBVA_PAGING_TRANSFER) || cbBuffer == VBOXWDDM_DUMMY_DMABUFFER_SIZE); 3695 3712 AssertCompile(VBOXWDDM_DUMMY_DMABUFFER_SIZE < 8); 3713 3714 pHdr->u2.complexCmdEl.u16CbCmdHost = cbPrivateData; 3715 pHdr->u2.complexCmdEl.u16CbCmdGuest = cbBuffer; 3716 3696 3717 pBuildPagingBuffer->pDmaBuffer = ((uint8_t*)pBuildPagingBuffer->pDmaBuffer) + cbBuffer; 3697 3718 pBuildPagingBuffer->pDmaBufferPrivateData = ((uint8_t*)pBuildPagingBuffer->pDmaBufferPrivateData) + cbPrivateData; … … 6248 6269 pDesc->Info.u.id = pAlloc->AllocData.hostID; 6249 6270 /* we do not care about wdth and height, zero them up though */ 6250 pDesc-> width = 0;6251 pDesc-> height = 0;6271 pDesc->u16Width = 0; 6272 pDesc->u16Height = 0; 6252 6273 } 6253 6274 … … 6261 6282 { 6262 6283 VBoxCVDdiFillAllocInfoOffVRAM(&pDesc->Info, pList); 6263 pDesc-> width = (uint16_t)pAlloc->AllocData.SurfDesc.width;6264 pDesc-> height = (uint16_t)pAlloc->AllocData.SurfDesc.height;6284 pDesc->u16Width = (uint16_t)pAlloc->AllocData.SurfDesc.width; 6285 pDesc->u16Height = (uint16_t)pAlloc->AllocData.SurfDesc.height; 6265 6286 } 6266 6287 … … 6569 6590 else if (pPresent->Flags.ColorFill) 6570 6591 { 6592 #ifdef DEBUG_misha 6571 6593 WARN(("test color fill!")); 6572 #if 0 6573 if (pPresent->DmaBufferPrivateDataSize < sizeof (VBOXCMDVBVA_CLRFILL)) 6574 { 6575 WARN(("Present->DmaBufferPrivateDataSize(%d) < sizeof VBOXCMDVBVA_CLRFILL (%d)", pPresent->DmaBufferPrivateDataSize , sizeof (VBOXCMDVBVA_CLRFILL))); 6576 /* @todo: can this actually happen? what status to return? */ 6577 return STATUS_INVALID_PARAMETER; 6578 } 6594 #endif 6579 6595 6580 6596 fPatchDst = TRUE; … … 6591 6607 } 6592 6608 6593 pHdr->u8OpCode = VBOXCMDVBVA_OPTYPE_CLRFILL; 6594 pHdr->u8Flags = 0; 6595 VBOXCMDVBVA_CLRFILL *pCFill = (VBOXCMDVBVA_CLRFILL*)pHdr; 6596 6597 if (VBoxCVDdiFillAllocInfo(pHdr, &pCFill->dst, pDstAlloc, pDst, true)) 6598 u32DstPatch = RT_OFFSETOF(VBOXCMDVBVA_CLRFILL, dst.u.offVRAM); 6599 6600 paRects = pCFill->aRects; 6601 cbPrivateData = RT_OFFSETOF(VBOXCMDVBVA_CLRFILL, aRects); 6602 #endif 6603 cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE; 6609 if (pDstAlloc->AllocData.hostID) 6610 { 6611 WARN(("color fill present for texid not supported")); 6612 pHdr->u8OpCode = VBOXCMDVBVA_OPTYPE_NOPCMD; 6613 pHdr->u8Flags = 0; 6614 pHdr->u8State = VBOXCMDVBVA_STATE_SUBMITTED; 6615 cbPrivateData = sizeof (VBOXCMDVBVA_HDR); 6616 cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE; 6617 } 6618 else 6619 { 6620 BOOLEAN fDstPrimary = (!pDstAlloc->AllocData.hostID 6621 && pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE 6622 && pDstAlloc->bAssigned); 6623 6624 if (pPresent->DmaBufferPrivateDataSize < VBOXCMDVBVA_SIZEOF_CLRFILLSTRUCT_MAX) 6625 { 6626 WARN(("Present->DmaBufferPrivateDataSize(%d) < VBOXCMDVBVA_SIZEOF_CLRFILLSTRUCT_MAX (%d)", pPresent->DmaBufferPrivateDataSize , VBOXCMDVBVA_SIZEOF_CLRFILLSTRUCT_MAX)); 6627 /* @todo: can this actually happen? what status to return? */ 6628 return STATUS_INVALID_PARAMETER; 6629 } 6630 6631 VBOXCMDVBVA_CLRFILL_HDR *pClrFillHdr = (VBOXCMDVBVA_CLRFILL_HDR*)pHdr; 6632 6633 pClrFillHdr->Hdr.u8OpCode = VBOXCMDVBVA_OPTYPE_CLRFILL; 6634 pClrFillHdr->u32Color = pPresent->Color; 6635 6636 if (fDstPrimary) 6637 { 6638 pHdr->u8Flags = VBOXCMDVBVA_OPF_CLRFILL_TYPE_PRIMARY; 6639 pHdr->u.u8PrimaryID = pDstAlloc->AllocData.SurfDesc.VidPnSourceId; 6640 6641 VBOXCMDVBVA_CLRFILL_PRIMARY *pCFill = (VBOXCMDVBVA_CLRFILL_PRIMARY*)pHdr; 6642 paRects = pCFill->aRects; 6643 cbPrivateData = RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_PRIMARY, aRects); 6644 } 6645 else 6646 { 6647 pHdr->u8Flags = VBOXCMDVBVA_OPF_CLRFILL_TYPE_GENERIC_A8R8G8B8; 6648 pHdr->u.u8PrimaryID = 0; 6649 6650 VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8 *pCFill = (VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8*)pHdr; 6651 VBoxCVDdiFillAllocInfoOffVRAM(&pCFill->dst.Info, pDst); 6652 pCFill->dst.u16Width = (uint16_t)pDstAlloc->AllocData.SurfDesc.width; 6653 pCFill->dst.u16Height = (uint16_t)pDstAlloc->AllocData.SurfDesc.height; 6654 u32DstPatch = RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8, dst.Info.u.offVRAM); 6655 paRects = pCFill->aRects; 6656 cbPrivateData = RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8, aRects); 6657 } 6658 6659 cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE; 6660 } 6604 6661 } 6605 6662 else -
trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
r51101 r51111 1539 1539 } 1540 1540 1541 static int8_t vboxVDMACrCmdVbvaPagingFill(PVGASTATE pVGAState, VBOXCMDVBVA_PAGING_FILL *pFill) 1542 { 1543 VBOXCMDVBVAOFFSET offVRAM = pFill->offVRAM; 1544 if (offVRAM & PAGE_OFFSET_MASK) 1545 { 1546 WARN(("offVRAM address is not on page boundary\n")); 1547 return -1; 1548 } 1549 1550 uint8_t * pu8VramBase = pVGAState->vram_ptrR3; 1551 uint8_t *pu8VramMax = pu8VramBase + pVGAState->vram_size; 1552 if (offVRAM >= pVGAState->vram_size) 1553 { 1554 WARN(("invalid vram offset")); 1555 return -1; 1556 } 1557 1558 uint32_t cbFill = pFill->u32CbFill; 1559 1560 if (offVRAM + cbFill >= pVGAState->vram_size) 1561 { 1562 WARN(("invalid cPages")); 1563 return -1; 1564 } 1565 1566 uint32_t *pu32Vram = (uint32_t*)(pu8VramBase + offVRAM); 1567 uint32_t u32Color = pFill->u32Pattern; 1568 1569 Assert(!(cbFill % 4)); 1570 for (uint32_t i = 0; i < cbFill / 4; ++i) 1571 { 1572 pu32Vram[i] = u32Color; 1573 } 1574 1575 return 0; 1576 } 1577 1541 1578 static int8_t vboxVDMACrCmdVbvaProcessCmdData(struct VBOXVDMAHOST *pVdma, const VBOXCMDVBVA_HDR *pCmd, uint32_t cbCmd) 1542 1579 { … … 1572 1609 } 1573 1610 case VBOXCMDVBVA_OPTYPE_PAGING_FILL: 1574 WARN(("VBOXCMDVBVA_OPTYPE_PAGING_FILL not implemented")); 1575 return -1; 1611 { 1612 PVGASTATE pVGAState = pVdma->pVGAState; 1613 if (cbCmd != sizeof (VBOXCMDVBVA_PAGING_FILL)) 1614 { 1615 WARN(("cmd too small")); 1616 return -1; 1617 } 1618 1619 return vboxVDMACrCmdVbvaPagingFill(pVGAState, (VBOXCMDVBVA_PAGING_FILL*)pCmd); 1620 } 1576 1621 default: 1577 1622 return pVdma->CrSrvInfo.pfnCmd(pVdma->CrSrvInfo.hSvr, pCmd, cbCmd); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r51069 r51111 470 470 471 471 int8_t crVBoxServerCrCmdBltProcess(const VBOXCMDVBVA_BLT_HDR *pCmd, uint32_t cbCmd); 472 int8_t crVBoxServerCrCmdClrFillProcess(const VBOXCMDVBVA_CLRFILL_HDR *pCmd, uint32_t cbCmd); 472 473 int8_t crVBoxServerCrCmdFlipProcess(const VBOXCMDVBVA_FLIP *pFlip); 473 474 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r51110 r51111 3818 3818 return crVBoxServerCrCmdBltProcess((const VBOXCMDVBVA_BLT_HDR*)pCmd, cbCmd); 3819 3819 } 3820 case VBOXCMDVBVA_OPTYPE_CLRFILL: 3821 { 3822 if (cbCmd < sizeof (VBOXCMDVBVA_CLRFILL_HDR)) 3823 { 3824 WARN(("invalid buffer size")); 3825 return -1; 3826 } 3827 3828 return crVBoxServerCrCmdClrFillProcess((const VBOXCMDVBVA_CLRFILL_HDR*)pCmd, cbCmd); 3829 } 3820 3830 default: 3821 3831 WARN(("unsupported command")); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r51109 r51111 231 231 } 232 232 233 static void crFbClrFillMem(uint32_t *pu32Dst, int32_t cbDstPitch, uint32_t width, uint32_t height, uint32_t u32Color) 234 { 235 for (uint32_t i = 0; i < height; ++i) 236 { 237 for (uint32_t j = 0; j < width; ++j) 238 { 239 pu32Dst[j] = u32Color; 240 } 241 242 pu32Dst = (uint32_t*)(((uint8_t*)pu32Dst) + cbDstPitch); 243 } 244 } 245 246 static void crFbClrFillImgRect(CR_BLITTER_IMG *pDst, const RTRECT *pCopyRect, uint32_t u32Color) 247 { 248 int32_t x = pCopyRect->xLeft; 249 int32_t y = pCopyRect->yTop; 250 int32_t width = pCopyRect->xRight - pCopyRect->xLeft; 251 int32_t height = pCopyRect->yBottom - pCopyRect->yTop; 252 Assert(x >= 0); 253 Assert(y >= 0); 254 uint8_t *pu8Dst = ((uint8_t*)pDst->pvData) + pDst->pitch * y + x * 4; 255 256 crFbClrFillMem((uint32_t*)pu8Dst, pDst->pitch, width, height, u32Color); 257 } 258 233 259 static void crFbBltMem(uint8_t *pu8Src, int32_t cbSrcPitch, uint8_t *pu8Dst, int32_t cbDstPitch, uint32_t width, uint32_t height) 234 260 { … … 244 270 } 245 271 246 static void crFbBltImg (const CR_BLITTER_IMG *pSrc, const RTPOINT *pSrcDataPoint, bool fSrcInvert, const RTRECT *pCopyRect, const RTPOINT *pDstDataPoint, CR_BLITTER_IMG *pDst)272 static void crFbBltImgRect(const CR_BLITTER_IMG *pSrc, const RTPOINT *pSrcDataPoint, bool fSrcInvert, const RTRECT *pCopyRect, const RTPOINT *pDstDataPoint, CR_BLITTER_IMG *pDst) 247 273 { 248 274 int32_t srcX = pCopyRect->xLeft - pSrcDataPoint->x; … … 272 298 } 273 299 274 static void crFbBltImg Scaled(const CR_BLITTER_IMG *pSrc, const RTPOINT *pSrcDataPoint, bool fSrcInvert, const RTRECT *pCopyRect, const RTPOINT *pDstDataPoint, float strX, float strY, CR_BLITTER_IMG *pDst)300 static void crFbBltImgRectScaled(const CR_BLITTER_IMG *pSrc, const RTPOINT *pSrcDataPoint, bool fSrcInvert, const RTRECT *pCopyRect, const RTPOINT *pDstDataPoint, float strX, float strY, CR_BLITTER_IMG *pDst) 275 301 { 276 302 int32_t srcX = pCopyRect->xLeft - pSrcDataPoint->x; … … 330 356 } 331 357 332 static void crFbBltImg ScaledRects(const CR_BLITTER_IMG *pSrc, const RTPOINT *pSrcDataPoint, bool fSrcInvert, const RTRECT *pCopyRect, const RTPOINT *pDstDataPoint, float strX, float strY, CR_BLITTER_IMG *pDst)358 static void crFbBltImgRectScaledRect(const CR_BLITTER_IMG *pSrc, const RTPOINT *pSrcDataPoint, bool fSrcInvert, const RTRECT *pCopyRect, const RTPOINT *pDstDataPoint, float strX, float strY, CR_BLITTER_IMG *pDst) 333 359 { 334 360 int32_t srcX = pCopyRect->xLeft - pSrcDataPoint->x; … … 399 425 } 400 426 401 static void crFbImgFromDim VramBGRA(void *pvVram, uint32_t width, uint32_t height, CR_BLITTER_IMG *pImg)427 static void crFbImgFromDimPtrBGRA(void *pvVram, uint32_t width, uint32_t height, CR_BLITTER_IMG *pImg) 402 428 { 403 429 pImg->pvData = pvVram; … … 410 436 } 411 437 438 static int8_t crFbImgFromDimOffVramBGRA(VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, CR_BLITTER_IMG *pImg) 439 { 440 uint32_t cbBuff = width * height * 4; 441 if (offVRAM >= g_cbVRam 442 || offVRAM + cbBuff >= g_cbVRam) 443 { 444 WARN(("invalid param")); 445 return -1; 446 } 447 448 uint8_t *pu8Buf = g_pvVRamBase + offVRAM; 449 crFbImgFromDimPtrBGRA(pu8Buf, width, height, pImg); 450 451 return 0; 452 } 453 454 static int8_t crFbImgFromDescBGRA(const VBOXCMDVBVA_ALLOCDESC *pDesc, CR_BLITTER_IMG *pImg) 455 { 456 return crFbImgFromDimOffVramBGRA(pDesc->Info.u.offVRAM, pDesc->u16Width, pDesc->u16Height, pImg); 457 } 458 412 459 static void crFbImgFromFb(HCR_FRAMEBUFFER hFb, CR_BLITTER_IMG *pImg) 413 460 { … … 456 503 continue; 457 504 458 crFbBltImg (pSrcImg, &ScaledEntryPoint, false, &Intersection, &ZeroPoint, pImg);505 crFbBltImgRect(pSrcImg, &ScaledEntryPoint, false, &Intersection, &ZeroPoint, pImg); 459 506 } 460 507 … … 602 649 bool fInvert = !(CrVrScrCompositorEntryFlagsGet(pEntry) & CRBLT_F_INVERT_SRC_YCOORDS); 603 650 604 crFbBltImg (pSrcImg, &ScaledEntryPoint, fInvert, &Intersection, &ZeroPoint, pImg);651 crFbBltImgRect(pSrcImg, &ScaledEntryPoint, fInvert, &Intersection, &ZeroPoint, pImg); 605 652 606 653 CrTdBltDataReleaseScaled(pTex, pSrcImg); … … 662 709 663 710 if (!fScale) 664 crFbBltImg (&FbImg, &DstPoint, false, &Intersection, &ZeroPoint, pImg);711 crFbBltImgRect(&FbImg, &DstPoint, false, &Intersection, &ZeroPoint, pImg); 665 712 else 666 crFbBltImg ScaledRects(&FbImg, &DstPoint, false, &Intersection, &ZeroPoint, strX, strY, pImg);713 crFbBltImgRectScaledRect(&FbImg, &DstPoint, false, &Intersection, &ZeroPoint, strX, strY, pImg); 667 714 } 668 715 } … … 749 796 } 750 797 751 static void crFbBltPutContentsVram(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 752 { 753 const RTRECT *pCompRect = CrVrScrCompositorRectGet(&hFb->Compositor); 754 755 CR_BLITTER_IMG FbImg; 756 757 crFbImgFromFb(hFb, &FbImg); 758 798 static void crFbBltImg(CR_BLITTER_IMG *pDst, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 799 { 759 800 int32_t srcWidth = pSrcRect->xRight - pSrcRect->xLeft; 760 801 int32_t srcHeight = pSrcRect->yBottom - pSrcRect->yTop; … … 767 808 bool fScale = (dstWidth != srcWidth || dstHeight != srcHeight); 768 809 810 RTRECT RestrictRect; 811 RestrictRect.xLeft = 0; 812 RestrictRect.yTop = 0; 813 RestrictRect.xRight = pDst->width; 814 RestrictRect.yBottom = pDst->height; 769 815 RTRECT Intersection; 770 816 const RTPOINT ZeroPoint = {0, 0}; … … 773 819 { 774 820 const RTRECT * pRect = &pRects[i]; 775 VBoxRectIntersected(pRect, pCompRect, &Intersection);821 VBoxRectIntersected(pRect, &RestrictRect, &Intersection); 776 822 777 823 if (VBoxRectIsZero(&Intersection)) … … 792 838 793 839 if (!fScale) 794 crFbBltImg (pImg, &DstPoint, false, &Intersection, &ZeroPoint, &FbImg);840 crFbBltImgRect(pImg, &DstPoint, false, &Intersection, &ZeroPoint, pDst); 795 841 else 796 crFbBltImgScaled(pImg, &DstPoint, false, &Intersection, &ZeroPoint, strX, strY, &FbImg); 797 } 842 crFbBltImgRectScaled(pImg, &DstPoint, false, &Intersection, &ZeroPoint, strX, strY, pDst); 843 } 844 } 845 846 static void crFbBltImgPos(CR_BLITTER_IMG *pDst, uint32_t xPos, uint32_t yPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 847 { 848 RTRECT SrcRect, DstRect; 849 850 SrcRect.xLeft = 0; 851 SrcRect.yTop = 0; 852 SrcRect.xRight = pImg->width; 853 SrcRect.yBottom = pImg->height; 854 855 DstRect.xLeft = xPos; 856 DstRect.yTop = yPos; 857 DstRect.xRight = DstRect.xLeft + pImg->width; 858 DstRect.yBottom = DstRect.yTop + pImg->height; 859 860 crFbBltImg(pDst, &SrcRect, &DstRect, cRects, pRects, pImg); 861 } 862 863 864 static void crFbBltPutContentsFbVram(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 865 { 866 const RTRECT *pCompRect = CrVrScrCompositorRectGet(&hFb->Compositor); 867 868 CR_BLITTER_IMG FbImg; 869 870 crFbImgFromFb(hFb, &FbImg); 871 872 crFbBltImg(&FbImg, pSrcRect, pDstRect, cRects, pRects, pImg); 873 } 874 875 static void crFbClrFillImg(CR_BLITTER_IMG *pImg, uint32_t cRects, const RTRECT *pRects, uint32_t u32Color) 876 { 877 RTRECT Rect; 878 Rect.xLeft = 0; 879 Rect.yTop = 0; 880 Rect.xRight = pImg->width; 881 Rect.yBottom = pImg->height; 882 883 884 RTRECT Intersection; 885 const RTPOINT ZeroPoint = {0, 0}; 886 887 for (uint32_t i = 0; i < cRects; ++i) 888 { 889 const RTRECT * pRect = &pRects[i]; 890 VBoxRectIntersected(pRect, &Rect, &Intersection); 891 892 if (VBoxRectIsZero(&Intersection)) 893 continue; 894 895 crFbClrFillImgRect(pImg, &Intersection, u32Color); 896 } 897 } 898 899 static void crFbClrFillFbVram(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, uint32_t u32Color) 900 { 901 CR_BLITTER_IMG FbImg; 902 903 crFbImgFromFb(hFb, &FbImg); 904 905 crFbClrFillImg(&FbImg, cRects, pRects, u32Color); 906 } 907 908 int CrFbClrFill(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, uint32_t u32Color) 909 { 910 if (!hFb->cUpdating) 911 { 912 WARN(("framebuffer not updating")); 913 return VERR_INVALID_STATE; 914 } 915 916 crFbClrFillFbVram(hFb, cRects, pRects, u32Color); 917 918 RTPOINT DstPoint = {0, 0}; 919 920 int rc = CrFbEntryRegionsAdd(hFb, NULL, &DstPoint, cRects, pRects, false); 921 if (!RT_SUCCESS(rc)) 922 { 923 WARN(("CrFbEntryRegionsAdd failed %d", rc)); 924 return rc; 925 } 926 927 return VINF_SUCCESS; 798 928 } 799 929 800 930 static int crFbBltPutContentsNonscaled(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 801 931 { 802 crFbBltPutContents Vram(hFb, pSrcRect, pDstRect, cRects, pRects, pImg);932 crFbBltPutContentsFbVram(hFb, pSrcRect, pDstRect, cRects, pRects, pImg); 803 933 804 934 RTPOINT DstPoint = {pDstRect->xLeft, pDstRect->yTop}; … … 837 967 } 838 968 969 static int crFbRegionsIsIntersectRects(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, bool *pfRegChanged) 970 { 971 uint32_t cCompRects; 972 const RTRECT *pCompRects; 973 int rc = CrVrScrCompositorRegionsGet(&hFb->Compositor, &cCompRects, NULL, NULL, &pCompRects); 974 if (!RT_SUCCESS(rc)) 975 { 976 WARN(("CrVrScrCompositorRegionsGet failed rc %d", rc)); 977 return rc; 978 } 979 980 bool fRegChanged = false; 981 for (uint32_t i = 0; i < cCompRects; ++i) 982 { 983 const RTRECT *pCompRect = &pCompRects[i]; 984 for (uint32_t j = 0; j < cRects; ++j) 985 { 986 const RTRECT *pRect = &pRects[j]; 987 if (VBoxRectIsIntersect(pCompRect, pRect)) 988 { 989 *pfRegChanged = true; 990 return VINF_SUCCESS; 991 } 992 } 993 } 994 995 *pfRegChanged = false; 996 return VINF_SUCCESS; 997 } 998 839 999 int CrFbBltPutContentsNe(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 840 1000 { … … 851 1011 } 852 1012 853 uint32_t cCompRects; 854 const RTRECT *pCompRects; 855 int rc = CrVrScrCompositorRegionsGet(&hFb->Compositor, &cCompRects, NULL, NULL, &pCompRects); 1013 bool fRegChanged = false; 1014 int rc = crFbRegionsIsIntersectRects(hFb, cRects, pRects, &fRegChanged); 856 1015 if (!RT_SUCCESS(rc)) 857 1016 { 858 WARN((" CrVrScrCompositorRegionsGetfailed rc %d", rc));1017 WARN(("crFbRegionsIsIntersectRects failed rc %d", rc)); 859 1018 return rc; 860 }861 862 bool fRegChanged = false;863 for (uint32_t i = 0; i < cCompRects; ++i)864 {865 const RTRECT *pCompRect = &pCompRects[i];866 for (uint32_t j = 0; j < cRects; ++j)867 {868 const RTRECT *pRect = &pRects[j];869 if (VBoxRectIsIntersect(pCompRect, pRect))870 {871 fRegChanged = true;872 break;873 }874 }875 1019 } 876 1020 … … 891 1035 } 892 1036 893 crFbBltPutContentsVram(hFb, pSrcRect, pDstRect, cRects, pRects, pImg); 1037 crFbBltPutContentsFbVram(hFb, pSrcRect, pDstRect, cRects, pRects, pImg); 1038 return VINF_SUCCESS; 1039 } 1040 1041 int CrFbClrFillNe(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, uint32_t u32Color) 1042 { 1043 bool fRegChanged = false; 1044 int rc = crFbRegionsIsIntersectRects(hFb, cRects, pRects, &fRegChanged); 1045 if (!RT_SUCCESS(rc)) 1046 { 1047 WARN(("crFbRegionsIsIntersectRects failed rc %d", rc)); 1048 return rc; 1049 } 1050 1051 if (fRegChanged) 1052 { 1053 rc = CrFbUpdateBegin(hFb); 1054 if (RT_SUCCESS(rc)) 1055 { 1056 rc = CrFbClrFill(hFb, cRects, pRects, u32Color); 1057 if (!RT_SUCCESS(rc)) 1058 WARN(("CrFbClrFill failed rc %d", rc)); 1059 CrFbUpdateEnd(hFb); 1060 } 1061 else 1062 WARN(("CrFbUpdateBegin failed rc %d", rc)); 1063 1064 return rc; 1065 } 1066 1067 crFbClrFillFbVram(hFb, cRects, pRects, u32Color); 894 1068 return VINF_SUCCESS; 895 1069 } … … 4875 5049 { 4876 5050 CR_BLITTER_IMG Img; 4877 uint32_t cbBuff = width * height * 4; 4878 if (offVRAM >= g_cbVRam 4879 || offVRAM + cbBuff >= g_cbVRam) 5051 int8_t i8Result = crFbImgFromDimOffVramBGRA(offVRAM, width, height, &Img); 5052 if (i8Result) 4880 5053 { 4881 5054 WARN(("invalid param")); … … 4883 5056 } 4884 5057 4885 uint8_t *pu8Buf = g_pvVRamBase + offVRAM;4886 5058 RTRECT SrcRect, DstRect; 4887 5059 … … 4896 5068 DstRect.yBottom = DstRect.yTop + height; 4897 5069 4898 crFbImgFromDimVramBGRA(pu8Buf, width, height, &Img);4899 4900 5070 HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(u32PrimaryID); 4901 5071 if (!hFb) … … 4999 5169 } 5000 5170 5001 static int8_t crVBoxServerCrCmdBltOffIdProcess(const VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID *pCmd, uint32_t cbCmd) 5002 { 5003 uint32_t cRects; 5004 const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects; 5005 if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects)) % sizeof (VBOXCMDVBVA_RECT)) 5006 { 5007 WARN(("invalid argument size")); 5008 return -1; 5009 } 5010 5011 cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects)) / sizeof (VBOXCMDVBVA_RECT); 5012 5013 RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects); 5014 if (!pRects) 5015 { 5016 WARN(("crVBoxServerCrCmdBltRecsUnpack failed")); 5017 return -1; 5018 } 5019 5020 uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags; 5021 uint32_t hostId = pCmd->id; 5022 5023 Assert(u8Flags & VBOXCMDVBVA_OPF_OPERAND2_ISID); 5024 5025 if (!hostId) 5026 { 5027 WARN(("zero host id")); 5028 return -1; 5029 } 5030 5031 if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID) 5032 { 5033 WARN(("blit from texture to texture not implemented")); 5034 return -1; 5035 } 5036 5037 if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2) 5038 { 5039 WARN(("blit to texture not implemented")); 5040 return -1; 5041 } 5042 5171 static int8_t crVBoxServerCrCmdBltIdToVram(uint32_t hostId, VBOXCMDVBVAOFFSET offVRAM, const VBOXCMDVBVA_POINT *pPos, uint32_t width, uint32_t height, uint32_t cRects, const RTRECT *pRects) 5172 { 5043 5173 CR_TEXDATA* pTex = CrFbTexDataAcquire(hostId); 5044 5174 if (!pTex) … … 5050 5180 const VBOXVR_TEXTURE *pVrTex = CrTdTexGet(pTex); 5051 5181 RTRECT SrcRect, DstRect; 5052 uint32_t width = pVrTex->width; 5053 uint32_t height = pVrTex->height; 5182 if (!width) 5183 { 5184 width = pVrTex->width; 5185 height = pVrTex->height; 5186 } 5054 5187 5055 5188 SrcRect.xLeft = 0; … … 5058 5191 SrcRect.yBottom = height; 5059 5192 5060 DstRect.xLeft = p Cmd->Hdr.Pos.x;5061 DstRect.yTop = p Cmd->Hdr.Pos.y;5193 DstRect.xLeft = pPos->x; 5194 DstRect.yTop = pPos->y; 5062 5195 DstRect.xRight = DstRect.xLeft + width; 5063 5196 DstRect.yBottom = DstRect.yTop + height; 5064 5197 5065 VBOXCMDVBVAOFFSET offVRAM = pCmd->alloc.u.offVRAM; 5066 uint32_t cbBuff = width * height * 4; 5067 if (offVRAM >= g_cbVRam 5068 || offVRAM + cbBuff >= g_cbVRam) 5198 CR_BLITTER_IMG Img; 5199 int8_t i8Result = crFbImgFromDimOffVramBGRA(offVRAM, width, height, &Img); 5200 if (i8Result) 5069 5201 { 5070 5202 WARN(("invalid param")); … … 5079 5211 } 5080 5212 5081 uint8_t *pu8Buf = g_pvVRamBase + offVRAM;5082 CR_BLITTER_IMG Img;5083 crFbImgFromDimVramBGRA(pu8Buf, width, height, &Img);5084 5085 5213 rc = crFbTexDataGetContents(pTex, &SrcRect, &DstRect, cRects, pRects, &Img); 5086 5214 … … 5096 5224 5097 5225 return 0; 5226 } 5227 5228 static int8_t crVBoxServerCrCmdBltOffIdProcess(const VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID *pCmd, uint32_t cbCmd) 5229 { 5230 uint32_t cRects; 5231 const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects; 5232 if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects)) % sizeof (VBOXCMDVBVA_RECT)) 5233 { 5234 WARN(("invalid argument size")); 5235 return -1; 5236 } 5237 5238 cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects)) / sizeof (VBOXCMDVBVA_RECT); 5239 5240 RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects); 5241 if (!pRects) 5242 { 5243 WARN(("crVBoxServerCrCmdBltRecsUnpack failed")); 5244 return -1; 5245 } 5246 5247 uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags; 5248 uint32_t hostId = pCmd->id; 5249 5250 Assert(u8Flags & VBOXCMDVBVA_OPF_OPERAND2_ISID); 5251 5252 if (!hostId) 5253 { 5254 WARN(("zero host id")); 5255 return -1; 5256 } 5257 5258 if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID) 5259 { 5260 WARN(("blit from texture to texture not implemented")); 5261 return -1; 5262 } 5263 5264 if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2) 5265 { 5266 WARN(("blit to texture not implemented")); 5267 return -1; 5268 } 5269 5270 VBOXCMDVBVAOFFSET offVRAM = pCmd->alloc.u.offVRAM; 5271 5272 return crVBoxServerCrCmdBltIdToVram(hostId, offVRAM, &pCmd->Hdr.Pos, 0, 0, cRects, pRects); 5098 5273 } 5099 5274 … … 5154 5329 if (fToPrymary) 5155 5330 { 5156 width = pCmd->alloc. width;5157 height = pCmd->alloc. height;5331 width = pCmd->alloc.u16Width; 5332 height = pCmd->alloc.u16Height; 5158 5333 } 5159 5334 else … … 5203 5378 uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags; 5204 5379 5205 WARN(("crVBoxServerCrCmdBltGenericBGRAProcess: not supported")); 5206 return -1; 5380 if (u8Flags & VBOXCMDVBVA_OPF_OPERAND2_ISID) 5381 { 5382 if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID) 5383 { 5384 WARN(("blit from texture to texture not implemented")); 5385 return -1; 5386 } 5387 5388 if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2) 5389 { 5390 WARN(("blit to texture not implemented")); 5391 return -1; 5392 } 5393 5394 return crVBoxServerCrCmdBltIdToVram(pCmd->alloc2.Info.u.id, pCmd->alloc1.Info.u.offVRAM, &pCmd->Hdr.Pos, pCmd->alloc1.u16Width, pCmd->alloc1.u16Height, cRects, pRects); 5395 } 5396 else 5397 { 5398 if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID) 5399 { 5400 if (!(u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)) 5401 { 5402 WARN(("blit to texture not implemented")); 5403 return -1; 5404 } 5405 5406 return crVBoxServerCrCmdBltIdToVram(pCmd->alloc1.Info.u.id, pCmd->alloc2.Info.u.offVRAM, &pCmd->Hdr.Pos, pCmd->alloc2.u16Width, pCmd->alloc2.u16Height, cRects, pRects); 5407 } 5408 5409 CR_BLITTER_IMG Img1, Img2; 5410 int8_t i8Result = crFbImgFromDescBGRA(&pCmd->alloc1, &Img1); 5411 if (i8Result) 5412 { 5413 WARN(("crFbImgFromDescBGRA failed")); 5414 return i8Result; 5415 } 5416 5417 i8Result = crFbImgFromDescBGRA(&pCmd->alloc2, &Img2); 5418 if (i8Result) 5419 { 5420 WARN(("crFbImgFromDescBGRA failed")); 5421 return i8Result; 5422 } 5423 5424 if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2) 5425 crFbBltImgPos(&Img2, pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y, cRects, pRects, &Img1); 5426 else 5427 crFbBltImgPos(&Img1, pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y, cRects, pRects, &Img2); 5428 5429 return 0; 5430 } 5207 5431 } 5208 5432 … … 5238 5462 WARN(("crVBoxServerCrCmdBltPrimaryPrimaryProcess: not supported")); 5239 5463 return -1; 5464 } 5465 5466 static int8_t crVBoxServerCrCmdClrFillPrimaryGenericProcess(uint32_t u32PrimaryID, const RTRECT *pRects, uint32_t cRects, uint32_t u32Color) 5467 { 5468 HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(u32PrimaryID); 5469 if (!hFb) 5470 { 5471 LOG(("request to present on disabled framebuffer, ignore")); 5472 return 0; 5473 } 5474 5475 int rc = CrFbClrFillNe(hFb, cRects, pRects, u32Color); 5476 if (!RT_SUCCESS(rc)) 5477 { 5478 WARN(("CrFbBltPutContentsNe failed %d", rc)); 5479 return -1; 5480 } 5481 5482 return 0; 5483 } 5484 5485 static int8_t crVBoxServerCrCmdClrFillVramGenericProcess(VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTRECT *pRects, uint32_t cRects, uint32_t u32Color) 5486 { 5487 CR_BLITTER_IMG Img; 5488 int8_t i8Result = crFbImgFromDimOffVramBGRA(offVRAM, width, height, &Img); 5489 if (i8Result) 5490 { 5491 WARN(("invalid param")); 5492 return -1; 5493 } 5494 5495 crFbClrFillImg(&Img, cRects, pRects, u32Color); 5496 5497 return 0; 5498 } 5499 5500 static int8_t crVBoxServerCrCmdClrFillPrimaryProcess(const VBOXCMDVBVA_CLRFILL_PRIMARY *pCmd, uint32_t cbCmd) 5501 { 5502 uint32_t u32PrimaryID = (uint32_t)pCmd->Hdr.Hdr.u.u8PrimaryID; 5503 HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(u32PrimaryID); 5504 if (!hFb) 5505 { 5506 LOG(("request to present on disabled framebuffer, ignore")); 5507 return 0; 5508 } 5509 5510 uint32_t cRects; 5511 const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects; 5512 if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_PRIMARY, aRects)) % sizeof (VBOXCMDVBVA_RECT)) 5513 { 5514 WARN(("invalid argument size")); 5515 return -1; 5516 } 5517 5518 cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_PRIMARY, aRects)) / sizeof (VBOXCMDVBVA_RECT); 5519 5520 RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects); 5521 if (!pRects) 5522 { 5523 WARN(("crVBoxServerCrCmdBltRecsUnpack failed")); 5524 return -1; 5525 } 5526 5527 // uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags; 5528 int8_t i8Result = crVBoxServerCrCmdClrFillPrimaryGenericProcess(u32PrimaryID, pRects, cRects, pCmd->Hdr.u32Color); 5529 if (i8Result < 0) 5530 { 5531 WARN(("crVBoxServerCrCmdClrFillPrimaryGenericProcess failed")); 5532 return i8Result; 5533 } 5534 5535 crVBoxServerCrCmdBltPrimaryUpdate(CrFbGetScreenInfo(hFb), pRects, cRects, u32PrimaryID); 5536 5537 return 0; 5538 } 5539 5540 static int8_t crVBoxServerCrCmdClrFillGenericBGRAProcess(const VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8 *pCmd, uint32_t cbCmd) 5541 { 5542 uint32_t cRects; 5543 const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects; 5544 if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8, aRects)) % sizeof (VBOXCMDVBVA_RECT)) 5545 { 5546 WARN(("invalid argument size")); 5547 return -1; 5548 } 5549 5550 cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8, aRects)) / sizeof (VBOXCMDVBVA_RECT); 5551 5552 RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects); 5553 if (!pRects) 5554 { 5555 WARN(("crVBoxServerCrCmdBltRecsUnpack failed")); 5556 return -1; 5557 } 5558 5559 // uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags; 5560 int8_t i8Result = crVBoxServerCrCmdClrFillVramGenericProcess(pCmd->dst.Info.u.offVRAM, pCmd->dst.u16Width, pCmd->dst.u16Height, pRects, cRects, pCmd->Hdr.u32Color); 5561 if (i8Result < 0) 5562 { 5563 WARN(("crVBoxServerCrCmdClrFillVramGenericProcess failed")); 5564 return i8Result; 5565 } 5566 5567 return 0; 5568 } 5569 5570 int8_t crVBoxServerCrCmdClrFillProcess(const VBOXCMDVBVA_CLRFILL_HDR *pCmd, uint32_t cbCmd) 5571 { 5572 uint8_t u8Flags = pCmd->Hdr.u8Flags; 5573 uint8_t u8Cmd = (VBOXCMDVBVA_OPF_CLRFILL_TYPE_MASK & u8Flags); 5574 5575 switch (u8Cmd) 5576 { 5577 case VBOXCMDVBVA_OPF_CLRFILL_TYPE_PRIMARY: 5578 { 5579 if (cbCmd < sizeof (VBOXCMDVBVA_CLRFILL_PRIMARY)) 5580 { 5581 WARN(("VBOXCMDVBVA_CLRFILL_PRIMARY: invalid command size")); 5582 return -1; 5583 } 5584 5585 return crVBoxServerCrCmdClrFillPrimaryProcess((const VBOXCMDVBVA_CLRFILL_PRIMARY*)pCmd, cbCmd); 5586 } 5587 case VBOXCMDVBVA_OPF_CLRFILL_TYPE_GENERIC_A8R8G8B8: 5588 { 5589 if (cbCmd < sizeof (VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8)) 5590 { 5591 WARN(("VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8: invalid command size")); 5592 return -1; 5593 } 5594 5595 return crVBoxServerCrCmdClrFillGenericBGRAProcess((const VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8*)pCmd, cbCmd); 5596 } 5597 default: 5598 WARN(("unsupported command")); 5599 return -1; 5600 } 5601 5240 5602 } 5241 5603
Note:
See TracChangeset
for help on using the changeset viewer.