Changeset 50827 in vbox
- Timestamp:
- Mar 19, 2014 4:57:33 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 92889
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
r50812 r50827 45 45 static uint32_t g_u32ScreenCount = 0; 46 46 static PVM g_pVM = NULL; 47 static uint32_t g_u32fCrHgcmDisabled = 0; 47 48 48 49 #ifndef RT_OS_WINDOWS … … 558 559 559 560 NOREF(pvClient); 561 562 if (g_u32fCrHgcmDisabled) 563 { 564 WARN(("cr hgcm disabled!")); 565 return; 566 } 560 567 561 568 Log(("SHARED_CROPENGL svcCall: u32ClientID = %d, fn = %d, cParms = %d, pparms = %d\n", u32ClientID, u32Function, cParms, paParms)); … … 1519 1526 if (paParms->u.pointer.size != sizeof (VBOXCRCMDCTL)) 1520 1527 WARN(("invalid param size")); 1521 return crVBoxServerHgcmDisable(); 1528 int rc = crVBoxServerHgcmDisable(); 1529 if (RT_SUCCESS(rc)) 1530 g_u32fCrHgcmDisabled = 1; 1531 else 1532 WARN(("crVBoxServerHgcmDisable failed %d", rc)); 1533 return rc; 1522 1534 } 1523 1535 case VBOXCRCMDCTL_TYPE_ENABLE: … … 1526 1538 WARN(("invalid param size")); 1527 1539 VBOXCRCMDCTL_ENABLE *pEnable = (VBOXCRCMDCTL_ENABLE*)pCtl; 1528 return crVBoxServerHgcmEnable(pEnable->hRHCmd, pEnable->pfnRHCmd); 1540 int rc = crVBoxServerHgcmEnable(pEnable->hRHCmd, pEnable->pfnRHCmd); 1541 if (RT_SUCCESS(rc)) 1542 g_u32fCrHgcmDisabled = 0; 1543 else 1544 WARN(("crVBoxServerHgcmEnable failed %d", rc)); 1545 return rc; 1529 1546 } 1530 1547 default: … … 1536 1553 } 1537 1554 default: 1555 if (g_u32fCrHgcmDisabled) 1556 { 1557 WARN(("cr hgcm disabled!")); 1558 return VERR_INVALID_STATE; 1559 } 1538 1560 return svcHostCallPerform(u32Function, cParms, paParms); 1539 1561 } … … 1562 1584 { 1563 1585 g_pHelpers = ptable->pHelpers; 1586 1587 g_u32fCrHgcmDisabled = 0; 1564 1588 1565 1589 ptable->cbClient = sizeof (void*); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r50817 r50827 3355 3355 if (RT_SUCCESS(rc)) 3356 3356 { 3357 rc = CrHTablePutToSlot(&cr_server.clientTable, u32ClientId, pClient);3357 rc = crVBoxServerClientObjSetVersion(pClient, pConnect->u32MajorVersion, pConnect->u32MinorVersion); 3358 3358 if (RT_SUCCESS(rc)) 3359 return VINF_SUCCESS; 3359 { 3360 rc = crVBoxServerClientObjSetPID(pClient, pConnect->u64Pid); 3361 if (RT_SUCCESS(rc)) 3362 { 3363 rc = CrHTablePutToSlot(&cr_server.clientTable, u32ClientId, pClient); 3364 if (RT_SUCCESS(rc)) 3365 return VINF_SUCCESS; 3366 else 3367 WARN(("CrHTablePutToSlot failed %d", rc)); 3368 } 3369 else 3370 WARN(("crVBoxServerClientObjSetPID failed %d", rc)); 3371 } 3360 3372 else 3361 WARN((" CrHTablePutToSlotfailed %d", rc));3373 WARN(("crVBoxServerClientObjSetVersion failed %d", rc)); 3362 3374 3363 3375 crVBoxServerRemoveClientObj(pClient); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r50773 r50827 681 681 } 682 682 683 #if 0 684 static int crFbBltPutContentsVram(HCR_FRAMEBUFFER hFb, const RTPOINT *pDstPoint, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg, float strX, float strY) 683 static void crFbBltPutContentsVram(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 685 684 { 686 685 const RTRECT *pCompRect = CrVrScrCompositorRectGet(&hFb->Compositor); 687 const RTPOINT ZeroPoint = {0};688 689 uint32_t fbWidth = (pCompRect->xRight - pCompRect->xLeft);690 uint32_t fbHeight = pCompRect->yBottom - pCompRect->yTop;691 692 uint32_t stretchedWidth = CR_FLOAT_RCAST(uint32_t, strX * fbWidth);693 uint32_t stretchedHeight = CR_FLOAT_RCAST(uint32_t, strY * fbHeight);694 686 695 687 CR_BLITTER_IMG FbImg; 696 688 697 bool fScale = fbWidth != stretchedWidth || fbHeight != stretchedHeight;698 699 689 crFbImgFromFb(hFb, &FbImg); 700 690 691 int32_t srcWidth = pSrcRect->xRight - pSrcRect->xLeft; 692 int32_t srcHeight = pSrcRect->yBottom - pSrcRect->yTop; 693 int32_t dstWidth = pDstRect->xRight - pDstRect->xLeft; 694 int32_t dstHeight = pDstRect->yBottom - pDstRect->yTop; 695 696 RTPOINT DstPoint = {pDstRect->xLeft, pDstRect->yTop}; 697 float strX = ((float)dstWidth) / srcWidth; 698 float strY = ((float)dstHeight) / srcHeight; 699 bool fScale = (dstWidth != srcWidth || dstHeight != srcHeight); 700 701 701 RTRECT Intersection; 702 const RTPOINT ZeroPoint = {0, 0}; 702 703 703 704 for (uint32_t i = 0; i < cRects; ++i) … … 709 710 continue; 710 711 712 RTRECT ScaledSrcRect; 713 ScaledSrcRect.xLeft = 0; 714 ScaledSrcRect.yTop = 0; 715 ScaledSrcRect.xRight = CR_FLOAT_RCAST(int32_t, strX * pImg->width); 716 ScaledSrcRect.yBottom = CR_FLOAT_RCAST(int32_t, strY * pImg->height); 717 718 VBoxRectTranslate(&ScaledSrcRect, pDstRect->xLeft, pDstRect->yTop); 719 720 VBoxRectIntersect(&Intersection, &ScaledSrcRect); 721 722 if (VBoxRectIsZero(&Intersection)) 723 continue; 724 711 725 if (!fScale) 712 crFbBltImg(pImg, pDstPoint, false, &Intersection, &ZeroPoint, &FbImg);726 crFbBltImg(pImg, &DstPoint, false, &Intersection, &ZeroPoint, &FbImg); 713 727 else 714 crFbBltImgScaled(pImg, pDstPoint, false, &Intersection, &ZeroPoint, strX, strY, &FbImg); 728 crFbBltImgScaled(pImg, &DstPoint, false, &Intersection, &ZeroPoint, strX, strY, &FbImg); 729 } 730 } 731 732 static int crFbBltPutContentsNonscaled(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 733 { 734 crFbBltPutContentsVram(hFb, pSrcRect, pDstRect, cRects, pRects, pImg); 735 736 RTPOINT DstPoint = {pDstRect->xLeft, pDstRect->yTop}; 737 738 int rc = CrFbEntryRegionsAdd(hFb, NULL, &DstPoint, cRects, pRects, false); 739 if (!RT_SUCCESS(rc)) 740 { 741 WARN(("CrFbEntryRegionsAdd failed %d", rc)); 742 return rc; 715 743 } 716 744 … … 718 746 } 719 747 720 int CrFbBltPutContents(HCR_FRAMEBUFFER hFb, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 721 { 722 RTPOINT DstPoint = {pDstRect->xLeft, pDstRect->yTop}; 723 float strX = ((float)pImg->width) / (pDstRect->xRight - pDstRect->xLeft); 724 float strY = ((float)pImg->height) / (pDstRect->yBottom - pDstRect->yTop); 725 726 int rc = CrFbEntryRegionsAdd(hFb, NULL, const RTPOINT *pPos, cRects, pRects, true) 748 int CrFbBltPutContents(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 749 { 727 750 if (!hFb->cUpdating) 728 751 { 729 WARN((" not updating\n"));752 WARN(("framebuffer not updating")); 730 753 return VERR_INVALID_STATE; 731 754 } 732 } 733 734 int CrFbBltPutContentsNe(HCR_FRAMEBUFFER hFb, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 735 { 755 756 int32_t srcWidth = pSrcRect->xRight - pSrcRect->xLeft; 757 int32_t srcHeight = pSrcRect->yBottom - pSrcRect->yTop; 758 int32_t dstWidth = pDstRect->xRight - pDstRect->xLeft; 759 int32_t dstHeight = pDstRect->yBottom - pDstRect->yTop; 760 761 bool fScale = (dstWidth != srcWidth || dstHeight != srcHeight); 762 if (fScale) 763 { 764 WARN(("scaling not supported")); 765 return VERR_NOT_IMPLEMENTED; 766 } 767 768 return crFbBltPutContentsNonscaled(hFb, pSrcRect, pDstRect, cRects, pRects, pImg); 769 } 770 771 int CrFbBltPutContentsNe(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 772 { 773 int32_t srcWidth = pSrcRect->xRight - pSrcRect->xLeft; 774 int32_t srcHeight = pSrcRect->yBottom - pSrcRect->yTop; 775 int32_t dstWidth = pDstRect->xRight - pDstRect->xLeft; 776 int32_t dstHeight = pDstRect->yBottom - pDstRect->yTop; 777 778 bool fScale = (dstWidth != srcWidth || dstHeight != srcHeight); 779 if (fScale) 780 { 781 WARN(("scaling not supported")); 782 return VERR_NOT_IMPLEMENTED; 783 } 784 736 785 uint32_t cCompRects; 737 786 const RTRECT *pCompRects; … … 746 795 for (uint32_t i = 0; i < cCompRects; ++i) 747 796 { 748 const RTRECT *pCompRect = pCompRects[i];797 const RTRECT *pCompRect = &pCompRects[i]; 749 798 for (uint32_t j = 0; j < cRects; ++j) 750 799 { 751 const RTRECT *pRect = pRects[j];800 const RTRECT *pRect = &pRects[j]; 752 801 if (VBoxRectIsIntersect(pCompRect, pRect)) 753 802 { … … 763 812 if (RT_SUCCESS(rc)) 764 813 { 765 rc = CrFbBltPutContents(hFb, p DstRect, cRects, pRects, pImg);814 rc = CrFbBltPutContents(hFb, pSrcRect, pDstRect, cRects, pRects, pImg); 766 815 if (!RT_SUCCESS(rc)) 767 816 WARN(("CrFbBltPutContents failed rc %d", rc)); … … 774 823 } 775 824 776 return crFbBltPutContentsVram(HCR_FRAMEBUFFER hFb, const RTPOINT *pDstPoint, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg, float strX, float strY); 777 778 const RTPOINT ZeroPoint = {0, 0}; 779 780 c2DRects = VBoxVrListRectsCount(&List); 781 if (c2DRects) 782 { 783 if (g_CrPresenter.cbTmpBuf2 < c2DRects * sizeof (RTRECT)) 784 { 785 if (g_CrPresenter.pvTmpBuf2) 786 RTMemFree(g_CrPresenter.pvTmpBuf2); 787 788 g_CrPresenter.cbTmpBuf2 = (c2DRects + 10) * sizeof (RTRECT); 789 g_CrPresenter.pvTmpBuf2 = RTMemAlloc(g_CrPresenter.cbTmpBuf2); 790 if (!g_CrPresenter.pvTmpBuf2) 791 { 792 WARN(("RTMemAlloc failed!")); 793 g_CrPresenter.cbTmpBuf2 = 0; 794 rc = VERR_NO_MEMORY; 795 goto end; 796 } 797 } 798 799 RTRECT *p2DRects = (RTRECT *)g_CrPresenter.pvTmpBuf2; 800 801 rc = VBoxVrListRectsGet(&List, c2DRects, p2DRects); 802 if (!RT_SUCCESS(rc)) 803 { 804 WARN(("VBoxVrListRectsGet failed, rc %d", rc)); 805 goto end; 806 } 807 808 RTPOINT Pos = {0}; 809 const RTRECT *pCompRect = CrVrScrCompositorRectGet(&hFb->Compositor); 810 811 CR_BLITTER_IMG FbImg; 812 813 crFbImgFromFb(hFb, &FbImg); 814 815 for (uint32_t i = 0; i < cRects; ++i) 816 { 817 const RTRECT * pRect = &pRects[i]; 818 for (uint32_t j = 0; j < c2DRects; ++j) 819 { 820 const RTRECT * p2DRect = &p2DRects[j]; 821 RTRECT Intersection; 822 VBoxRectIntersected(pRect, p2DRect, &Intersection); 823 if (VBoxRectIsZero(&Intersection)) 824 continue; 825 826 if (!fScale) 827 crFbBltImg(&FbImg, &ZeroPoint, false, &Intersection, &SrcPoint, pImg); 828 else 829 crFbBltImgScaled(&FbImg, &ZeroPoint, false, &Intersection, &SrcPoint, strX, strY, pImg); 830 } 831 } 832 } 833 834 end: 835 836 if (pEnteredTex) 837 CrTdBltLeave(pEnteredTex); 838 839 if (pEnteredBlitter) 840 CrBltLeave(pEnteredBlitter); 841 842 VBoxVrListClear(&List); 843 844 return rc; 845 } 846 #endif 825 crFbBltPutContentsVram(hFb, pSrcRect, pDstRect, cRects, pRects, pImg); 826 return VINF_SUCCESS; 827 } 847 828 848 829 int CrFbResize(CR_FRAMEBUFFER *pFb, const struct VBVAINFOSCREEN * pScreen, void *pvVRAM) … … 4693 4674 { 4694 4675 /* blit to primary from non-primary */ 4695 uint32_t texId;4696 4676 if (u8Flags & VBOXCMDVBVA_OPF_ALLOC_DSTID) 4697 4677 { 4698 4678 /* TexPresent */ 4699 texId = pBlt->alloc.u.id; 4679 uint32_t texId = pBlt->alloc.u.id; 4680 4681 crServerDispatchVBoxTexPresent(texId, u8PrimaryID, pBlt->Pos.x, pBlt->Pos.y, cRects, (const GLint*)pRects); 4700 4682 } 4701 4683 else … … 4713 4695 4714 4696 uint8_t *pu8Buf = g_pvVRamBase + offVRAM; 4715 texId = 0; 4716 // cr_server.CrCmdClientInfo.pfnCltScrUpdateBegin(cr_server.CrCmdClientInfo.hCltScr); 4717 /*todo: notify VGA device to perform updates */ 4697 const RTRECT *pCompRect = CrVrScrCompositorRectGet(&hFb->Compositor); 4698 CR_BLITTER_IMG Img; 4699 crFbImgFromScreenVram(pScreen, pu8Buf, &Img); 4700 int rc = CrFbBltPutContentsNe(hFb, pCompRect, pCompRect, cRects, pRects, &Img); 4701 if (!RT_SUCCESS(rc)) 4702 { 4703 WARN(("CrFbBltPutContentsNe failed %d", rc)); 4704 return rc; 4705 } 4706 4707 if (cRects) 4708 { 4709 bool fDirtyEmpty = true; 4710 RTRECT dirtyRect; 4711 cr_server.CrCmdClientInfo.pfnCltScrUpdateBegin(cr_server.CrCmdClientInfo.hCltScr, u8PrimaryID); 4712 4713 VBVACMDHDR hdr; 4714 for (uint32_t i = 0; i < cRects; ++i) 4715 { 4716 hdr.x = pRects[i].xLeft; 4717 hdr.y = pRects[i].yTop; 4718 hdr.w = hdr.x + pRects[i].xRight; 4719 hdr.h = hdr.y + pRects[i].yBottom; 4720 4721 cr_server.CrCmdClientInfo.pfnCltScrUpdateProcess(cr_server.CrCmdClientInfo.hCltScr, u8PrimaryID, &hdr, sizeof (hdr)); 4722 4723 if (fDirtyEmpty) 4724 { 4725 /* This is the first rectangle to be added. */ 4726 dirtyRect.xLeft = pRects[i].xLeft; 4727 dirtyRect.yTop = pRects[i].yTop; 4728 dirtyRect.xRight = pRects[i].xRight; 4729 dirtyRect.yBottom = pRects[i].yBottom; 4730 fDirtyEmpty = false; 4731 } 4732 else 4733 { 4734 /* Adjust region coordinates. */ 4735 if (dirtyRect.xLeft > pRects[i].xLeft) 4736 { 4737 dirtyRect.xLeft = pRects[i].xLeft; 4738 } 4739 4740 if (dirtyRect.yTop > pRects[i].yTop) 4741 { 4742 dirtyRect.yTop = pRects[i].yTop; 4743 } 4744 4745 if (dirtyRect.xRight < pRects[i].xRight) 4746 { 4747 dirtyRect.xRight = pRects[i].xRight; 4748 } 4749 4750 if (dirtyRect.yBottom < pRects[i].yBottom) 4751 { 4752 dirtyRect.yBottom = pRects[i].yBottom; 4753 } 4754 } 4755 } 4756 4757 if (dirtyRect.xRight - dirtyRect.xLeft) 4758 { 4759 cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, u8PrimaryID, dirtyRect.xLeft, dirtyRect.yTop, 4760 dirtyRect.xRight - dirtyRect.xLeft, dirtyRect.yBottom - dirtyRect.yTop); 4761 } 4762 else 4763 { 4764 cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, u8PrimaryID, 0, 0, 0, 0); 4765 } 4766 } 4718 4767 } 4719 4720 crServerDispatchVBoxTexPresent(texId, u8PrimaryID, pBlt->Pos.x, pBlt->Pos.y, cRects, (const GLint*)pRects); 4768 return VINF_SUCCESS; 4721 4769 } 4722 4770 else
Note:
See TracChangeset
for help on using the changeset viewer.