VirtualBox

Changeset 41404 in vbox


Ignore:
Timestamp:
May 22, 2012 4:41:38 PM (13 years ago)
Author:
vboxsync
Message:

crOpenGL: VM window scroll handling

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/HostServices/VBoxCrOpenGLSvc.h

    r36843 r41404  
    4242#define SHCRGL_HOST_FN_CRHGSMI_CTL (11)
    4343#endif
     44#define SHCRGL_HOST_FN_VIEWPORT_CHANGED (15)
    4445#define SHCRGL_HOST_FN_SET_OUTPUT_REDIRECT (20)
    4546/* crOpenGL guest functions */
     
    6768#define SHCRGL_CPARMS_WRITE_READ_BUFFERED (3)
    6869#define SHCRGL_CPARMS_SET_OUTPUT_REDIRECT (1)
    69 
     70#define SHCRGL_CPARMS_VIEWPORT_CHANGED (5)
    7071
    7172/* @todo Move to H3DOR.h begin */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r41107 r41404  
    791791}
    792792
     793void UIMachineView::scrollContentsBy(int dx, int dy)
     794{
    793795#ifdef VBOX_WITH_VIDEOHWACCEL
    794 void UIMachineView::scrollContentsBy(int dx, int dy)
    795 {
    796796    if (m_pFrameBuffer)
    797797    {
    798798        m_pFrameBuffer->viewportScrolled(dx, dy);
    799799    }
     800#endif /* VBOX_WITH_VIDEOHWACCEL */
    800801    QAbstractScrollArea::scrollContentsBy(dx, dy);
    801 }
    802 #endif /* VBOX_WITH_VIDEOHWACCEL */
     802
     803    session().GetConsole().GetDisplay().ViewportChanged(screenId(),
     804                            contentsX(),
     805                            contentsY(),
     806                            contentsWidth(),
     807                            contentsHeight());
     808}
     809
    803810
    804811#ifdef Q_WS_MAC
     
    10031010bool UIMachineView::eventFilter(QObject *pWatched, QEvent *pEvent)
    10041011{
    1005 #ifdef VBOX_WITH_VIDEOHWACCEL
    10061012    if (pWatched == viewport())
    10071013    {
     
    10101016            case QEvent::Resize:
    10111017            {
     1018                QResizeEvent* pResizeEvent = static_cast<QResizeEvent*>(pEvent);
     1019#ifdef VBOX_WITH_VIDEOHWACCEL
    10121020                if (m_pFrameBuffer)
    1013                     m_pFrameBuffer->viewportResized(static_cast<QResizeEvent*>(pEvent));
     1021                    m_pFrameBuffer->viewportResized(pResizeEvent);
     1022#endif /* VBOX_WITH_VIDEOHWACCEL */
     1023                session().GetConsole().GetDisplay().ViewportChanged(screenId(),
     1024                        contentsX(),
     1025                        contentsY(),
     1026                        contentsWidth(),
     1027                        contentsHeight());
    10141028                break;
    10151029            }
     
    10181032        }
    10191033    }
    1020 #endif /* VBOX_WITH_VIDEOHWACCEL */
    10211034    if (pWatched == machineWindow())
    10221035    {
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r41107 r41404  
    165165    void scrollBy(int dx, int dy);
    166166    static void dimImage(QImage &img);
    167 #ifdef VBOX_WITH_VIDEOHWACCEL
    168167    void scrollContentsBy(int dx, int dy);
    169 #endif /* VBOX_WITH_VIDEOHWACCEL */
    170168#ifdef Q_WS_MAC
    171169    void updateDockIcon();
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h

    r41380 r41404  
    169169
    170170typedef struct {
     171    int32_t    x, y;
     172    uint32_t   w, h;
     173} CRScreenViewportInfo;
     174
     175
     176typedef struct {
    171177    unsigned short tcpip_port;
    172178
    173179    CRScreenInfo screen[CR_MAX_GUEST_MONITORS];
     180    CRScreenViewportInfo screenVieport[CR_MAX_GUEST_MONITORS];
    174181    int          screenCount;
    175182
     
    312319extern DECLEXPORT(int32_t) crVBoxServerOutputRedirectSet(const CROutputRedirect *pCallbacks);
    313320
     321extern DECLEXPORT(int32_t) crVBoxServerSetScreenViewport(int sIndex, int32_t x, int32_t y, uint32_t w, uint32_t h);
     322
    314323#ifdef VBOX_WITH_CRHGSMI
    315324/* We moved all CrHgsmi command processing to crserverlib to keep the logic of dealing with CrHgsmi commands in one place.
  • trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp

    r41128 r41404  
    11331133                rc = VINF_SUCCESS;
    11341134            }
     1135            break;
     1136        }
     1137        case SHCRGL_HOST_FN_VIEWPORT_CHANGED:
     1138        {
     1139            Log(("svcCall: SHCRGL_HOST_FN_VIEWPORT_CHANGED\n"));
     1140
     1141            /* Verify parameter count and types. */
     1142            if (cParms != SHCRGL_CPARMS_VIEWPORT_CHANGED)
     1143            {
     1144                LogRel(("SHCRGL_HOST_FN_VIEWPORT_CHANGED: cParms invalid - %d", cParms));
     1145                rc = VERR_INVALID_PARAMETER;
     1146                break;
     1147            }
     1148
     1149            for (int i = 0; i < SHCRGL_CPARMS_VIEWPORT_CHANGED; ++i)
     1150            {
     1151                if (paParms[i].type != VBOX_HGCM_SVC_PARM_32BIT)
     1152                {
     1153                    LogRel(("SHCRGL_HOST_FN_VIEWPORT_CHANGED: param[%d] type invalid - %d", i, paParms[i].type));
     1154                    rc = VERR_INVALID_PARAMETER;
     1155                    break;
     1156                }
     1157            }
     1158
     1159            if (!RT_SUCCESS(rc))
     1160            {
     1161                LogRel(("SHCRGL_HOST_FN_VIEWPORT_CHANGED: param validation failed, returning.."));
     1162                break;
     1163            }
     1164
     1165            rc = crVBoxServerSetScreenViewport((int)paParms[0].u.uint32,
     1166                    paParms[1].u.uint32, /* x */
     1167                    paParms[2].u.uint32, /* y */
     1168                    paParms[3].u.uint32, /* w */
     1169                    paParms[4].u.uint32  /* h */);
     1170            if (!RT_SUCCESS(rc))
     1171            {
     1172                LogRel(("SHCRGL_HOST_FN_VIEWPORT_CHANGED: crVBoxServerSetScreenViewport failed, rc %d", rc));
     1173                break;
     1174            }
     1175
    11351176            break;
    11361177        }
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r41380 r41404  
    13891389}
    13901390
     1391static void crVBoxServerUpdateScreenViewportCB(unsigned long key, void *data1, void *data2)
     1392{
     1393    CRMuralInfo *mural = (CRMuralInfo*) data1;
     1394    int *sIndex = (int*) data2;
     1395
     1396    if (mural->screenId != sIndex)
     1397        return;
     1398
     1399    if (!mural->width || !mural->height)
     1400        return;
     1401
     1402    crServerCheckMuralGeometry(mural);
     1403}
     1404
     1405
     1406DECLEXPORT(int32_t) crVBoxServerSetScreenViewport(int sIndex, int32_t x, int32_t y, uint32_t w, uint32_t h)
     1407{
     1408    CRScreenViewportInfo *pVieport;
     1409    GLboolean fPosChanged, fSizeChanged;
     1410
     1411    crDebug("crVBoxServerSetScreenViewport(%i)", sIndex);
     1412
     1413    if (sIndex<0 || sIndex>=cr_server.screenCount)
     1414    {
     1415        crWarning("crVBoxServerSetScreenViewport: invalid screen id %d", sIndex);
     1416        return VERR_INVALID_PARAMETER;
     1417    }
     1418
     1419    pVieport = &cr_server.screenVieport[sIndex];
     1420    fPosChanged = (pVieport->x != x || pVieport->y != y);
     1421    fSizeChanged = (pVieport->w != w || pVieport->h != h);
     1422
     1423    if (!fPosChanged && !fSizeChanged)
     1424    {
     1425        crDebug("crVBoxServerSetScreenViewport: no changes");
     1426        return;
     1427    }
     1428
     1429    if (fPosChanged)
     1430    {
     1431        pVieport->x = x;
     1432        pVieport->y = y;
     1433
     1434        crHashtableWalk(cr_server.muralTable, crVBoxServerUpdateScreenViewportCB, NULL);
     1435    }
     1436
     1437    if (fSizeChanged)
     1438    {
     1439        pVieport->w = w;
     1440        pVieport->h = h;
     1441
     1442        /* no need to do anything here actually */
     1443    }
     1444    return VINF_SUCCESS;
     1445}
     1446
    13911447
    13921448#ifdef VBOX_WITH_CRHGSMI
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c

    r41258 r41404  
    103103    if (cr_server.screenCount<2 && !cr_server.bForceOffscreenRendering)
    104104    {
     105        CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId];
    105106        CRASSERT(cr_server.screenCount>0);
    106107
     
    108109        mural->hY = mural->gY-cr_server.screen[0].y;
    109110
    110         cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX, mural->hY);
     111        cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX - pVieport->x, mural->hY - pVieport->y);
    111112
    112113        return;
     
    157158    if (overlappingScreenCount<2 && !cr_server.bForceOffscreenRendering)
    158159    {
     160        CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId];
     161
    159162        if (mural->bUseFBO)
    160163        {
     
    163166        }
    164167
    165         cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX, mural->hY);
     168        cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX - pVieport->x, mural->hY - pVieport->y);
    166169    }
    167170    else
     
    193196        if (!mural->bUseFBO)
    194197        {
    195             cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX, mural->hY);
     198            CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId];
     199
     200            cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX - pVieport->x, mural->hY - pVieport->y);
    196201        }
    197202    }
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r41137 r41404  
    1258212582  <interface
    1258312583    name="IDisplay" extends="$unknown"
    12584     uuid="09EED313-CD56-4D06-BD56-FAC0F716B5DD"
     12584    uuid="4b75c45c-e22e-4b75-b7cd-7ce9a83bb36e"
    1258512585    wsmap="managed"
    1258612586    >
     
    1284412844    </method>
    1284512845
     12846    <method name="viewportChanged">
     12847      <desc>
     12848        Signals that framebuffer window viewport has changed.
     12849
     12850      <result name="E_INVALIDARG">
     12851        The specified viewport data is invalid.
     12852      </result>
     12853
     12854      </desc>
     12855
     12856      <param name="screenId" type="unsigned long" dir="in">
     12857        <desc>
     12858          Monitor to take the screenshot from.
     12859        </desc>
     12860      </param>
     12861      <param name="x" type="unsigned long" dir="in">
     12862        <desc>
     12863          Framebuffer x offset.
     12864        </desc>
     12865      </param>
     12866      <param name="y" type="unsigned long" dir="in">
     12867        <desc>
     12868          Framebuffer y offset.
     12869        </desc>
     12870      </param>
     12871      <param name="width" type="unsigned long" dir="in">
     12872        <desc>
     12873          Viewport width.
     12874        </desc>
     12875      </param>
     12876      <param name="height" type="unsigned long" dir="in">
     12877        <desc>
     12878          Viewport height.
     12879        </desc>
     12880      </param>
     12881    </method>
    1284612882  </interface>
    1284712883
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r39603 r41404  
    172172    STDMETHOD(CompleteVHWACommand)(BYTE *pCommand);
    173173
     174    STDMETHOD(ViewportChanged)(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
     175
    174176    static const PDMDRVREG  DrvReg;
    175177
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r41240 r41404  
    28632863    return E_NOTIMPL;
    28642864#endif
     2865}
     2866
     2867STDMETHODIMP Display::ViewportChanged(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height)
     2868{
     2869#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     2870    BOOL is3denabled;
     2871    mParent->machine()->COMGETTER(Accelerate3DEnabled)(&is3denabled);
     2872
     2873    if (is3denabled)
     2874    {
     2875        VBOXHGCMSVCPARM aParms[5];
     2876
     2877        aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT;
     2878        aParms[0].u.uint32 = aScreenId;
     2879
     2880        aParms[1].type = VBOX_HGCM_SVC_PARM_32BIT;
     2881        aParms[1].u.uint32 = x;
     2882
     2883        aParms[2].type = VBOX_HGCM_SVC_PARM_32BIT;
     2884        aParms[2].u.uint32 = y;
     2885
     2886
     2887        aParms[3].type = VBOX_HGCM_SVC_PARM_32BIT;
     2888        aParms[3].u.uint32 = width;
     2889
     2890        aParms[4].type = VBOX_HGCM_SVC_PARM_32BIT;
     2891        aParms[4].u.uint32 = height;
     2892
     2893        VMMDev *pVMMDev = mParent->getVMMDev();
     2894
     2895        if (pVMMDev)
     2896            pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_VIEWPORT_CHANGED, SHCRGL_CPARMS_VIEWPORT_CHANGED, aParms);
     2897    }
     2898#endif /* VBOX_WITH_CROGL && VBOX_WITH_HGCM */
     2899    return S_OK;
    28652900}
    28662901
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