VirtualBox

Ignore:
Timestamp:
Apr 14, 2015 10:16:43 AM (10 years ago)
Author:
vboxsync
Message:

Additions/x11/vboxvideo: cleaner vbvxClearVRAM() function.

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

Legend:

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

    r55204 r55237  
    7171# include <unistd.h>
    7272#endif
     73
     74/** Clear the virtual framebuffer in VRAM.  Optionally also clear up to the
     75 * size of a new framebuffer.  Framebuffer sizes larger than available VRAM
     76 * be treated as zero and passed over. */
     77void vbvxClearVRAM(ScrnInfoPtr pScrn, size_t cbOldSize, size_t cbNewSize)
     78{
     79    VBOXPtr pVBox = VBOXGetRec(pScrn);
     80
     81    /* Assume 32BPP - this is just a sanity test. */
     82    VBVXASSERT(   cbOldSize / 4 <= VBOX_VIDEO_MAX_VIRTUAL * VBOX_VIDEO_MAX_VIRTUAL
     83               && cbNewSize / 4 <= VBOX_VIDEO_MAX_VIRTUAL * VBOX_VIDEO_MAX_VIRTUAL,
     84               ("cbOldSize=%llu cbNewSize=%llu, max=%u.\n", (unsigned long long)cbOldSize, (unsigned long long)cbNewSize,
     85                VBOX_VIDEO_MAX_VIRTUAL * VBOX_VIDEO_MAX_VIRTUAL));
     86    if (cbOldSize > (size_t)pVBox->cbFBMax)
     87        cbOldSize = pVBox->cbFBMax;
     88    if (cbNewSize > (size_t)pVBox->cbFBMax)
     89        cbNewSize = pVBox->cbFBMax;
     90    memset(pVBox->base, 0, max(cbOldSize, cbNewSize));
     91}
    7392
    7493/** Clear the virtual framebuffer in VRAM.  Optionally also clear up to the
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h

    r55236 r55237  
    257257
    258258/* setmode.c */
     259extern void vbvxClearVRAM(ScrnInfoPtr pScrn, size_t cbOldSize, size_t cbNewSize);
    259260extern void vbvxSetSolarisMouseRange(int width, int height);
    260261
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