VirtualBox

Changeset 35268 in vbox


Ignore:
Timestamp:
Dec 20, 2010 11:30:58 PM (14 years ago)
Author:
vboxsync
Message:

Additions/x11/vboxvideo: blank the screen on server termination and VT switches too

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

Legend:

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

    r35267 r35268  
    244244        pViews[i].u32ViewOffset = 0;
    245245        pViews[i].u32ViewSize = pVBox->cbView;
    246         pViews[i].u32MaxScreenSize = pVBox->cbFramebuffer;
     246        pViews[i].u32MaxScreenSize = pVBox->cbFBMax;
    247247    }
    248248    return VINF_SUCCESS;
     
    309309        return FALSE;
    310310    }
    311     pVBox->cbView = pVBox->cbFramebuffer = offVRAMBaseMapping;
     311    pVBox->cbView = pVBox->cbFBMax = offVRAMBaseMapping;
    312312    pVBox->cScreens = VBoxHGSMIGetMonitorCount(&pVBox->guestCtx);
    313313    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Requested monitor count: %u\n",
     
    315315    for (i = 0; i < pVBox->cScreens; ++i)
    316316    {
    317         pVBox->cbFramebuffer -= VBVA_MIN_BUFFER_SIZE;
    318         pVBox->aoffVBVABuffer[i] = pVBox->cbFramebuffer;
     317        pVBox->cbFBMax -= VBVA_MIN_BUFFER_SIZE;
     318        pVBox->aoffVBVABuffer[i] = pVBox->cbFBMax;
    319319        TRACE_LOG("VBVA buffer offset for screen %u: 0x%lx\n", i,
    320                   (unsigned long) pVBox->cbFramebuffer);
     320                  (unsigned long) pVBox->cbFBMax);
    321321        VBoxVBVASetupBufferContext(&pVBox->aVbvaCtx[i],
    322322                                   pVBox->aoffVBVABuffer[i],
     
    324324    }
    325325    TRACE_LOG("Maximum framebuffer size: %lu (0x%lx)\n",
    326               (unsigned long) pVBox->cbFramebuffer,
    327               (unsigned long) pVBox->cbFramebuffer);
     326              (unsigned long) pVBox->cbFBMax,
     327              (unsigned long) pVBox->cbFBMax);
    328328    rc = VBoxHGSMISendViewInfo(&pVBox->guestCtx, pVBox->cScreens,
    329329                               vboxFillViewInfo, (void *)pVBox);
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c

    r35267 r35268  
    837837    /* Using the PCI information caused problems with non-powers-of-two
    838838       sized video RAM configurations */
    839     pVBox->cbFramebuffer = inl(VBE_DISPI_IOPORT_DATA);
    840     pScrn->videoRam = pVBox->cbFramebuffer / 1024;
     839    pVBox->cbFBMax = inl(VBE_DISPI_IOPORT_DATA);
     840    pScrn->videoRam = pVBox->cbFBMax / 1024;
    841841
    842842    /* Check if the chip restricts horizontal resolution or not. */
     
    11521152}
    11531153
     1154/** Clear the virtual framebuffer in VRAM.  Optionally also clear up to the
     1155 * size of a new framebuffer.  Framebuffer sizes larger than available VRAM
     1156 * be treated as zero and passed over. */
     1157static void
     1158vboxClearVRAM(ScrnInfoPtr pScrn, int32_t cNewX, int32_t cNewY)
     1159{
     1160    VBOXPtr pVBox = VBOXGetRec(pScrn);
     1161    int64_t cbOldFB, cbNewFB;
     1162
     1163    cbOldFB = pVBox->cbLine * pScrn->virtualX;
     1164    cbNewFB = vboxLineLength(pScrn, cNewX) * cNewY;
     1165    if (cbOldFB > pVBox->cbFBMax)
     1166        cbOldFB = 0;
     1167    if (cbNewFB > pVBox->cbFBMax)
     1168        cbNewFB = 0;
     1169    memset(pVBox->base, 0, max(cbOldFB, cbNewFB));
     1170}
     1171
    11541172static Bool
    11551173VBOXEnterVT(int scrnIndex, int flags)
     
    11591177
    11601178    TRACE_ENTRY();
     1179    vboxClearVRAM(pScrn, 0, 0);
    11611180    if (pVBox->fHaveHGSMI)
    11621181        vboxEnableVbva(pScrn);
     
    11861205    TRACE_ENTRY();
    11871206    pVBox->vtSwitch = TRUE;
    1188     VBOXSaveRestore(pScrn, MODE_RESTORE);
    11891207    if (pVBox->fHaveHGSMI)
    11901208        vboxDisableVbva(pScrn);
     1209    vboxClearVRAM(pScrn, 0, 0);
     1210    VBOXSaveRestore(pScrn, MODE_RESTORE);
    11911211    vboxDisableGraphicsCap(pVBox);
    11921212#ifdef VBOX_DRI
     
    12031223    VBOXPtr pVBox = VBOXGetRec(pScrn);
    12041224
     1225    if (pVBox->fHaveHGSMI)
     1226        vboxDisableVbva(pScrn);
     1227    vboxDisableGraphicsCap(pVBox);
     1228    vboxClearVRAM(pScrn, 0, 0);
    12051229#ifdef VBOX_DRI
    12061230    if (pVBox->useDRI)
     
    12091233#endif
    12101234
    1211     if (pVBox->fHaveHGSMI)
    1212         vboxDisableVbva(pScrn);
    1213     vboxDisableGraphicsCap(pVBox);
    12141235    if (pScrn->vtSema) {
    12151236        VBOXSaveRestore(xf86Screens[scrnIndex], MODE_RESTORE);
     
    12891310     * too large for VRAM as we sometimes have to do this - see comments in
    12901311     * VBOXPreInit. */
    1291     if (   offStart + pVBox->cbLine * cHeight > pVBox->cbFramebuffer
    1292         || pVBox->cbLine * pScrn->virtualY > pVBox->cbFramebuffer)
     1312    if (   offStart + pVBox->cbLine * cHeight > pVBox->cbFBMax
     1313        || pVBox->cbLine * pScrn->virtualY > pVBox->cbFBMax)
    12931314        fActive = FALSE;
    12941315    /* Deactivate the screen if it is outside of the virtual framebuffer and
     
    13291350    VBOXPtr pVBox = VBOXGetRec(pScrn);
    13301351    uint64_t cbLine = vboxLineLength(pScrn, width);
    1331     uint32_t cbOldPixmap;
    13321352
    13331353    TRACE_LOG("width=%d, height=%d\n", width, height);
     
    13371357        return FALSE;
    13381358    }
    1339     if (cbLine > UINT32_MAX || cbLine * height >= pVBox->cbFramebuffer)
     1359    if (cbLine > UINT32_MAX || cbLine * height >= pVBox->cbFBMax)
    13401360    {
    13411361        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
    13421362                   "Unable to set up a virtual screen size of %dx%d with %lu of %d Kb of video memory available.  Please increase the video memory size.\n",
    1343                    width, height, pVBox->cbFramebuffer / 1024, pScrn->videoRam);
     1363                   width, height, pVBox->cbFBMax / 1024, pScrn->videoRam);
    13441364        return FALSE;
    13451365    }
     
    13471367                                pScrn->depth, vboxBPP(pScrn), cbLine,
    13481368                                pVBox->base);
    1349     cbOldPixmap = pVBox->cbLine * pScrn->virtualY;
    1350     if (cbOldPixmap > pVBox->cbFramebuffer)
    1351         cbOldPixmap = 0;
     1369    vboxClearVRAM(pScrn, width, height);
    13521370    pScrn->virtualX = width;
    13531371    pScrn->virtualY = height;
    13541372    pScrn->displayWidth = vboxDisplayPitch(pScrn, cbLine);
    13551373    pVBox->cbLine = cbLine;
    1356     /* Clear video RAM for esthetic reasons */
    1357     memset(pVBox->base, 0, max(cbLine * height, cbOldPixmap));
    13581374#ifdef VBOX_DRI
    13591375    if (pVBox->useDRI)
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h

    r35207 r35268  
    184184    void *base;
    185185    /** The amount of VRAM available for use as a framebuffer */
    186     unsigned long cbFramebuffer;
     186    unsigned long cbFBMax;
    187187    /** The size of the framebuffer and the VBVA buffers at the end of it. */
    188188    unsigned long cbView;
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_dri.c

    r34715 r35268  
    175175        || (pVBox->pciInfo == NULL)
    176176        || (pVBox->base == NULL)
    177         || (pVBox->cbFramebuffer == 0))
     177        || (pVBox->cbFBMax == 0))
    178178    {
    179179        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: preconditions failed\n",
     
    256256        pDRIInfo->maxDrawableTableEntry = VBOX_MAX_DRAWABLES;
    257257        pDRIInfo->frameBufferPhysicalAddress = (pointer)pScrn->memPhysBase;
    258         pDRIInfo->frameBufferSize = pVBox->cbFramebuffer;
     258        pDRIInfo->frameBufferSize = pVBox->cbFBMax;
    259259        pDRIInfo->frameBufferStride =   pScrn->displayWidth
    260260                                      * pScrn->bitsPerPixel / 8;
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