VirtualBox

Changeset 55837 in vbox


Ignore:
Timestamp:
May 13, 2015 6:55:42 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100280
Message:

DisplayImpl: getScreenResolution, etc should use framebuffer info.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r55133 r55837  
    10001000
    10011001#ifdef DEBUG_sunlover
    1002     LogFlowFunc(("[%d] %d,%d %dx%d (%d,%d)\n",
    1003                  uScreenId, x, y, w, h, mpDrv->IConnector.cx, mpDrv->IConnector.cy));
     1002    LogFlowFunc(("[%d] %d,%d %dx%d\n",
     1003                 uScreenId, x, y, w, h));
    10041004#endif /* DEBUG_sunlover */
    10051005
     
    10141014        return; */
    10151015
    1016     if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
    1017         i_checkCoordBounds (&x, &y, &w, &h, mpDrv->IConnector.cx, mpDrv->IConnector.cy);
    1018     else
    1019         i_checkCoordBounds (&x, &y, &w, &h, maFramebuffers[uScreenId].w,
    1020                                           maFramebuffers[uScreenId].h);
     1016    i_checkCoordBounds (&x, &y, &w, &h, maFramebuffers[uScreenId].w,
     1017                                        maFramebuffers[uScreenId].h);
    10211018
    10221019    IFramebuffer *pFramebuffer = maFramebuffers[uScreenId].pFramebuffer;
     
    11551152        x1 = (int32_t)maFramebuffers[0].xOrigin;
    11561153        y1 = (int32_t)maFramebuffers[0].yOrigin;
    1157         x2 = mpDrv->IConnector.cx + (int32_t)maFramebuffers[0].xOrigin;
    1158         y2 = mpDrv->IConnector.cy + (int32_t)maFramebuffers[0].yOrigin;
     1154        x2 = (int32_t)maFramebuffers[0].w + (int32_t)maFramebuffers[0].xOrigin;
     1155        y2 = (int32_t)maFramebuffers[0].h + (int32_t)maFramebuffers[0].yOrigin;
    11591156    }
    11601157    if (cxInputMapping && cyInputMapping)
     
    12721269             */
    12731270            RTRECT rectFramebuffer;
    1274             if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
    1275             {
    1276                 rectFramebuffer.xLeft   = 0;
    1277                 rectFramebuffer.yTop    = 0;
    1278                 if (mpDrv)
    1279                 {
    1280                     rectFramebuffer.xRight  = mpDrv->IConnector.cx;
    1281                     rectFramebuffer.yBottom = mpDrv->IConnector.cy;
    1282                 }
    1283                 else
    1284                 {
    1285                     rectFramebuffer.xRight  = 0;
    1286                     rectFramebuffer.yBottom = 0;
    1287                 }
    1288             }
    1289             else
    1290             {
    1291                 rectFramebuffer.xLeft   = pFBInfo->xOrigin;
    1292                 rectFramebuffer.yTop    = pFBInfo->yOrigin;
    1293                 rectFramebuffer.xRight  = pFBInfo->xOrigin + pFBInfo->w;
    1294                 rectFramebuffer.yBottom = pFBInfo->yOrigin + pFBInfo->h;
    1295             }
     1271            rectFramebuffer.xLeft   = pFBInfo->xOrigin;
     1272            rectFramebuffer.yTop    = pFBInfo->yOrigin;
     1273            rectFramebuffer.xRight  = pFBInfo->xOrigin + pFBInfo->w;
     1274            rectFramebuffer.yBottom = pFBInfo->yOrigin + pFBInfo->h;
    12961275
    12971276            uint32_t cRectVisibleRegion = 0;
     
    15471526    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    15481527
    1549     uint32_t u32Width = 0;
    1550     uint32_t u32Height = 0;
    1551     uint32_t u32BitsPerPixel = 0;
    1552     int32_t xOrigin = 0;
    1553     int32_t yOrigin = 0;
     1528    if (aScreenId >= mcMonitors)
     1529        return E_INVALIDARG;
     1530
     1531    DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId];
     1532
    15541533    GuestMonitorStatus_T guestMonitorStatus = GuestMonitorStatus_Enabled;
    1555 
    1556     if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
    1557     {
    1558         if (mpDrv)
    1559         {
    1560             u32Width = mpDrv->IConnector.cx;
    1561             u32Height = mpDrv->IConnector.cy;
    1562 
    1563             alock.release();
    1564 
    1565             int rc = mpDrv->pUpPort->pfnQueryColorDepth(mpDrv->pUpPort, &u32BitsPerPixel);
    1566             AssertRC(rc);
    1567 
    1568             alock.acquire();
    1569         }
    1570     }
    1571     else if (aScreenId < mcMonitors)
    1572     {
    1573         DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId];
    1574         u32Width = pFBInfo->w;
    1575         u32Height = pFBInfo->h;
    1576         u32BitsPerPixel = pFBInfo->u16BitsPerPixel;
    1577         xOrigin = pFBInfo->xOrigin;
    1578         yOrigin = pFBInfo->yOrigin;
    1579         if (pFBInfo->flags & VBVA_SCREEN_F_DISABLED)
    1580             guestMonitorStatus = GuestMonitorStatus_Disabled;
    1581     }
    1582     else
    1583     {
    1584         return E_INVALIDARG;
    1585     }
     1534    if (pFBInfo->flags & VBVA_SCREEN_F_DISABLED)
     1535        guestMonitorStatus = GuestMonitorStatus_Disabled;
    15861536
    15871537    if (aWidth)
    1588         *aWidth = u32Width;
     1538        *aWidth = pFBInfo->w;
    15891539    if (aHeight)
    1590         *aHeight = u32Height;
     1540        *aHeight = pFBInfo->h;
    15911541    if (aBitsPerPixel)
    1592         *aBitsPerPixel = u32BitsPerPixel;
     1542        *aBitsPerPixel = pFBInfo->u16BitsPerPixel;
    15931543    if (aXOrigin)
    1594         *aXOrigin = xOrigin;
     1544        *aXOrigin = pFBInfo->xOrigin;
    15951545    if (aYOrigin)
    1596         *aYOrigin = yOrigin;
     1546        *aYOrigin = pFBInfo->yOrigin;
    15971547    if (aGuestMonitorStatus)
    15981548        *aGuestMonitorStatus = guestMonitorStatus;
     
    17361686                                  ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel)
    17371687{
    1738     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     1688    if (aWidth == 0 || aHeight == 0 || aBitsPerPixel == 0)
     1689    {
     1690        /* Some of parameters must not change. Query current mode. */
     1691        ULONG ulWidth        = 0;
     1692        ULONG ulHeight       = 0;
     1693        ULONG ulBitsPerPixel = 0;
     1694        HRESULT hr = getScreenResolution(aDisplay, &ulWidth, &ulHeight, &ulBitsPerPixel, NULL, NULL, NULL);
     1695        if (FAILED(hr))
     1696            return hr;
     1697
     1698        /* Assign current values to not changing parameters. */
     1699        if (aWidth == 0)
     1700            aWidth = ulWidth;
     1701        if (aHeight == 0)
     1702            aHeight = ulHeight;
     1703        if (aBitsPerPixel == 0)
     1704             aBitsPerPixel = ulBitsPerPixel;
     1705    }
     1706
     1707    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1708
     1709    if (aDisplay >= mcMonitors)
     1710        return E_INVALIDARG;
    17391711
    17401712    CHECK_CONSOLE_DRV(mpDrv);
    17411713
    17421714    /*
    1743      * Do some rough checks for valid input.
     1715     * It is up to the guest to decide whether the hint is
     1716     * valid. Therefore don't do any VRAM sanity checks here.
    17441717     */
    1745     ULONG width  = aWidth;
    1746     if (!width)
    1747         width    = mpDrv->IConnector.cx;
    1748     ULONG height = aHeight;
    1749     if (!height)
    1750         height   = mpDrv->IConnector.cy;
    1751     ULONG bpp    = aBitsPerPixel;
    1752     if (!bpp)
    1753     {
    1754         alock.release();
    1755 
    1756         uint32_t cBits = 0;
    1757         int rc = mpDrv->pUpPort->pfnQueryColorDepth(mpDrv->pUpPort, &cBits);
    1758         AssertRC(rc);
    1759         bpp = cBits;
    1760 
    1761         alock.acquire();
    1762     }
    1763     ULONG cMonitors;
    1764     mParent->i_machine()->COMGETTER(MonitorCount)(&cMonitors);
    1765     if (cMonitors == 0 && aDisplay > 0)
    1766         return E_INVALIDARG;
    1767     if (aDisplay >= cMonitors)
    1768         return E_INVALIDARG;
    1769 
    1770    /*
    1771     * sunlover 20070614: It is up to the guest to decide whether the hint is
    1772     * valid. Therefore don't do any VRAM sanity checks here!
    1773     */
    17741718
    17751719    /* Have to release the lock because the pfnRequestDisplayChange
     
    17891733        && !(mfGuestVBVACapabilities & VBVACAPS_IRQ))
    17901734    {
    1791         HRESULT hrc = mParent->i_sendACPIMonitorHotPlugEvent();
    1792         if (FAILED(hrc))
    1793             return hrc;
     1735        mParent->i_sendACPIMonitorHotPlugEvent();
    17941736    }
    17951737
     
    36073549                    int rc;
    36083550
    3609                     pData->fUnscaledHiDPI          = fUnscaledHiDPI;
     3551                    pData->fUnscaledHiDPI          = RT_BOOL(fUnscaledHiDPI);
    36103552
    36113553                    pCtl->Hdr.enmType              = VBOXCRCMDCTL_TYPE_HGCM;
Note: See TracChangeset for help on using the changeset viewer.

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