VirtualBox

Changeset 107829 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jan 16, 2025 7:21:04 PM (3 weeks ago)
Author:
vboxsync
Message:

3D: The command SVGA_CMD_UPDATE implemented to support multiple monitors. bugref:10831

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp

    r106953 r107829  
    72517251    Log(("SVGA_CMD_UPDATE %d,%d %dx%d\n", pCmd->x, pCmd->y, pCmd->width, pCmd->height));
    72527252
    7253     /** @todo Multiple screens? */
    7254     VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
    7255     if (!pScreen) /* Can happen if screen is not defined (aScreens[idScreen].fDefined == false) yet. */
    7256         return;
    7257 
    7258     vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->x, pCmd->y, pCmd->width, pCmd->height);
     7253    /* These conditions are too strict but prevent any further integer overflow */
     7254    ASSERT_GUEST_RETURN_VOID(pCmd->x < pThis->svga.u32MaxWidth);
     7255    ASSERT_GUEST_RETURN_VOID(pCmd->y < pThis->svga.u32MaxHeight);
     7256    ASSERT_GUEST_RETURN_VOID(pCmd->width  < pThis->svga.u32MaxWidth);
     7257    ASSERT_GUEST_RETURN_VOID(pCmd->height < pThis->svga.u32MaxHeight);
     7258    RT_UNTRUSTED_VALIDATED_FENCE();
     7259
     7260    for (uint32_t idScreen = 0; idScreen < (uint32_t)RT_ELEMENTS(pSvgaR3State->aScreens); idScreen++)
     7261    {
     7262        VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, idScreen);
     7263        if (!pScreen) /* Can happen if screen is not defined (aScreens[idScreen].fDefined == false) yet. */
     7264            continue;
     7265
     7266        /* Clip updated Rect to the screen dimensions. */
     7267        SVGASignedRect screenRect;
     7268        screenRect.left   = pScreen->xOrigin;
     7269        screenRect.top    = pScreen->yOrigin;
     7270        screenRect.right  = pScreen->xOrigin + pScreen->cWidth;
     7271        screenRect.bottom = pScreen->yOrigin + pScreen->cHeight;
     7272
     7273        SVGASignedRect clipRect;
     7274        clipRect.left = (int32)pCmd->x;
     7275        clipRect.top  = (int32)pCmd->y;
     7276        clipRect.right  = (int32)(pCmd->x + pCmd->width);
     7277        clipRect.bottom = (int32)(pCmd->y + pCmd->height);
     7278        vmsvgaR3ClipRect(&screenRect, &clipRect);
     7279
     7280        if (clipRect.left == clipRect.right || clipRect.top == clipRect.bottom)
     7281            continue;
     7282
     7283        vmsvgaR3UpdateScreen(pThisCC, pScreen,
     7284            clipRect.left - screenRect.left,
     7285            clipRect.top  - screenRect.top,
     7286            clipRect.right  - clipRect.left,
     7287            clipRect.bottom - clipRect.top);
     7288    }
    72597289}
    72607290
     
    72637293void vmsvgaR3CmdUpdateVerbose(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdUpdateVerbose const *pCmd)
    72647294{
    7265     RT_NOREF(pThis);
    72667295    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
    72677296
     
    72697298    Log(("SVGA_CMD_UPDATE_VERBOSE %d,%d %dx%d reason %#x\n", pCmd->x, pCmd->y, pCmd->width, pCmd->height, pCmd->reason));
    72707299
    7271     /** @todo Multiple screens? */
    7272     VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
    7273     if (!pScreen) /* Can happen if screen is not defined (aScreens[idScreen].fDefined == false) yet. */
    7274         return;
    7275 
    7276     vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->x, pCmd->y, pCmd->width, pCmd->height);
     7300    /* Just like SVGA_CMD_UPDATE, but also provides a per-rectangle 'reason' value */
     7301    vmsvgaR3CmdUpdate(pThis, pThisCC, (SVGAFifoCmdUpdate const *)pCmd);
    72777302}
    72787303
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette