VirtualBox

Ignore:
Timestamp:
Dec 20, 2010 9:07:52 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
69115
Message:

Additions/x11/vboxvideo: recreate communication structures in guest VRAM after a VT switch, as VRAM contents are undefined at this point

Location:
trunk/src/VBox/Additions/x11/vboxvideo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxutils.c

    r35208 r35267  
    195195
    196196    pVBox = pScrn->driverPrivate;
    197     if (pVBox->fHaveHGSMI == FALSE)
     197    if (pVBox->fHaveHGSMI == FALSE || pVBox->vtSwitch)
    198198        return;
    199199
     
    259259    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
    260260    int rc = VINF_SUCCESS;
    261     unsigned i;
    262     uint32_t offVRAMBaseMapping, offGuestHeapMemory, cbGuestHeapMemory,
    263              cScreens;
    264     void *pvGuestHeapMemory;
    265261
    266262    pVBox->cScreens = 1;
     
    270266        return FALSE;
    271267    }
     268
     269    /* Set up the dirty rectangle handler.  It will be added into a function
     270     * chain and gets removed when the screen is cleaned up. */
     271    if (ShadowFBInit2(pScreen, NULL, vboxHandleDirtyRect) != TRUE)
     272    {
     273        xf86DrvMsg(scrnIndex, X_ERROR,
     274                   "Unable to install dirty rectangle handler for VirtualBox graphics acceleration.\n");
     275        return FALSE;
     276    }
     277    return TRUE;
     278}
     279
     280/**
     281 * Initialise VirtualBox's accelerated video extensions.
     282 *
     283 * @returns TRUE on success, FALSE on failure
     284 */
     285static Bool
     286vboxSetupVRAMVbva(ScrnInfoPtr pScrn, VBOXPtr pVBox)
     287{
     288    int rc = VINF_SUCCESS;
     289    unsigned i;
     290    uint32_t offVRAMBaseMapping, offGuestHeapMemory, cbGuestHeapMemory;
     291    void *pvGuestHeapMemory;
     292
     293    if (!pVBox->fHaveHGSMI)
     294        return FALSE;
    272295    VBoxHGSMIGetBaseMappingInfo(pScrn->videoRam * 1024, &offVRAMBaseMapping,
    273296                                NULL, &offGuestHeapMemory, &cbGuestHeapMemory,
     
    283306    if (RT_FAILURE(rc))
    284307    {
    285         xf86DrvMsg(scrnIndex, X_ERROR, "Failed to set up the guest-to-host communication context, rc=%d\n", rc);
     308        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set up the guest-to-host communication context, rc=%d\n", rc);
    286309        return FALSE;
    287310    }
    288311    pVBox->cbView = pVBox->cbFramebuffer = offVRAMBaseMapping;
    289312    pVBox->cScreens = VBoxHGSMIGetMonitorCount(&pVBox->guestCtx);
    290     xf86DrvMsg(scrnIndex, X_INFO, "Requested monitor count: %u\n",
     313    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Requested monitor count: %u\n",
    291314               pVBox->cScreens);
    292315    for (i = 0; i < pVBox->cScreens; ++i)
     
    305328    rc = VBoxHGSMISendViewInfo(&pVBox->guestCtx, pVBox->cScreens,
    306329                               vboxFillViewInfo, (void *)pVBox);
    307 
    308     /* Set up the dirty rectangle handler.  It will be added into a function
    309      * chain and gets removed when the screen is cleaned up. */
    310     if (ShadowFBInit2(pScreen, NULL, vboxHandleDirtyRect) != TRUE)
    311     {
    312         xf86DrvMsg(scrnIndex, X_ERROR,
    313                    "Unable to install dirty rectangle handler for VirtualBox graphics acceleration.\n");
     330    if (RT_FAILURE(rc))
     331    {
     332        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to send the view information to the host, rc=%d\n", rc);
    314333        return FALSE;
    315334    }
     
    767786
    768787    TRACE_ENTRY();
    769     if (!pVBox->fHaveHGSMI)
     788    if (!vboxSetupVRAMVbva(pScrn, pVBox))
    770789        return FALSE;
    771790    for (i = 0; i < pVBox->cScreens; ++i)
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c

    r35266 r35267  
    11591159
    11601160    TRACE_ENTRY();
     1161    if (pVBox->fHaveHGSMI)
     1162        vboxEnableVbva(pScrn);
    11611163    pVBox->vtSwitch = FALSE;
    11621164#ifdef VBOX_DRI
     
    11731175        return FALSE;
    11741176#endif
    1175     if (pVBox->fHaveHGSMI)
    1176         vboxEnableVbva(pScrn);
    11771177    return TRUE;
    11781178}
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