VirtualBox

Changeset 8531 in vbox


Ignore:
Timestamp:
May 2, 2008 3:20:27 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
30435
Message:

Additions/x11: disable framebuffer access during mode switches and don't touch the video hardware if xrandr is called while we are in text mode

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo.h

    r8425 r8531  
    147147    int nDGAMode;
    148148    CloseScreenProcPtr CloseScreen;
     149    /** Default X server procedure for enabling and disabling framebuffer access */
     150    xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
     151    /** Is access to the framebuffer currently allowed? */
     152    Bool accessEnabled;
    149153    OptionInfoPtr Options;
    150154    IOADDRESS ioBase;
     
    155159    Bool pointerOffscreen;
    156160    Bool useDevice;
     161    /** Are we currently switched to a virtual terminal?  If so, it is not
     162     * safe to touch the hardware. */
     163    Bool vtSwitch;
    157164    Bool useVbva;
    158165    VMMDevMemory *pVMMDevMemory;
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_13.c

    r8521 r8531  
    803803}
    804804
     805/**
     806 * This function hooks into the chain that is called when framebuffer access
     807 * is allowed or disallowed by a call to EnableDisableFBAccess in the server.
     808 * In other words, it observes when the server wishes access to the
     809 * framebuffer to be enabled and when it should be disabled.  We need to know
     810 * this because we disable access ourselves during mode switches (presumably
     811 * the server should do this but it doesn't) and want to know whether to
     812 * restore it or not afterwards.
     813 */
     814static void
     815vboxEnableDisableFBAccess(int scrnIndex, Bool enable)
     816{
     817    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     818    VBOXPtr pVBox = VBOXGetRec(pScrn);
     819
     820    pVBox->accessEnabled = enable;
     821    pVBox->EnableDisableFBAccess(scrnIndex, enable);
     822}
     823
    805824/*
    806825 * QUOTE from the XFree86 DESIGN document:
     
    887906    xf86SetBackingStore(pScreen);
    888907
     908    /* We need to keep track of whether we are currently switched to a virtual
     909     * terminal to know whether a mode set operation is currently safe to do.
     910     */
     911    pVBox->vtSwitch = FALSE;
    889912    /* Initialise DGA.  The cast is unfortunately correct - it gets cast back
    890913       to (unsigned char *) later. */
     
    916939        VBOXLoadPalette, NULL, flags))
    917940        return (FALSE);
     941
     942    /* Hook our observer function ito the chain which is called when
     943     * framebuffer access is enabled or disabled in the server, and
     944     * assume an initial state of enabled. */
     945    pVBox->accessEnabled = TRUE;
     946    pVBox->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
     947    pScrn->EnableDisableFBAccess = vboxEnableDisableFBAccess;
    918948
    919949    pVBox->CloseScreen = pScreen->CloseScreen;
     
    946976{
    947977    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
    948 
     978    VBOXPtr pVBox = VBOXGetRec(pScrn);
     979
     980    pVBox->vtSwitch = FALSE;
    949981    return xf86SetDesiredModes(pScrn);
    950982}
     
    960992        vboxDisableVbva(pScrn);
    961993    vboxDisableGraphicsCap(pVBox);
     994    pVBox->vtSwitch = TRUE;
    962995}
    963996
     
    9801013    pScrn->vtSema = FALSE;
    9811014
     1015    /* Remove our observer functions from the X server call chains. */
     1016    pScrn->EnableDisableFBAccess = pVBox->EnableDisableFBAccess;
    9821017    pScreen->CloseScreen = pVBox->CloseScreen;
    9831018    return pScreen->CloseScreen(scrnIndex, pScreen);
     
    10471082{
    10481083    ScrnInfoPtr pScrn;
     1084    VBOXPtr pVBox;
     1085    Bool rc;
    10491086
    10501087    pScrn = xf86Screens[scrnIndex];  /* Why does X have three ways of refering to the screen? */
    1051     return xf86SetSingleMode(pScrn, pMode, 0);
     1088    pVBox = VBOXGetRec(pScrn);
     1089    /* We want to disable access to the framebuffer before switching mode.
     1090     * After doing the switch, we allow access if it was allowed before. */
     1091    if (pVBox->accessEnabled)
     1092        pVBox->EnableDisableFBAccess(scrnIndex, FALSE);
     1093    rc = xf86SetSingleMode(pScrn, pMode, 0);
     1094    if (pVBox->accessEnabled)
     1095        pVBox->EnableDisableFBAccess(scrnIndex, TRUE);
     1096    return rc;
    10521097}
    10531098
     
    10601105    int bpp = pScrn->depth == 24 ? 32 : 16;
    10611106    pVBox = VBOXGetRec(pScrn);
     1107    /* Don't fiddle with the hardware if we are switched
     1108     * to a virtual terminal. */
     1109    if (pVBox->vtSwitch == TRUE)
     1110        return TRUE;
    10621111    if (pVBox->useVbva == TRUE)
    10631112        if (vboxDisableVbva(pScrn) != TRUE)  /* This would be bad. */
     
    10981147    VBOXPtr pVBox = VBOXGetRec(xf86Screens[scrnIndex]);
    10991148
     1149    /* Don't fiddle with the hardware if we are switched
     1150     * to a virtual terminal. */
     1151    if (pVBox->vtSwitch == TRUE)
     1152        return;
    11001153    VBESetDisplayStart(pVBox->pVbe, x, y, TRUE);
    11011154}
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