VirtualBox

Changeset 9811 in vbox for trunk/src/VBox/Additions/x11


Ignore:
Timestamp:
Jun 19, 2008 9:29:12 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
32186
Message:

Additions/x11: use the guest/host registry to save the last resolution on machine shutdown and to restore it at startup

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

Legend:

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

    r9252 r9811  
    10021002Bool
    10031003vboxGetDisplayChangeRequest(ScrnInfoPtr pScrn, uint32_t *pcx, uint32_t *pcy,
    1004                             uint32_t *pcBits, uint32_t *piDisplay,
    1005                             VBOXPtr pVBox)
    1006 {
     1004                            uint32_t *pcBits, uint32_t *piDisplay)
     1005{
     1006    VBOXPtr pVBox = pScrn->driverPrivate;
    10071007    TRACE_ENTRY();
    10081008    if (!pVBox->useDevice)
     
    10251025 */
    10261026Bool
    1027 vboxHostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits)
    1028 {
    1029     TRACE_ENTRY();
     1027vboxHostLikesVideoMode(ScrnInfoPtr pScrn, uint32_t cx, uint32_t cy, uint32_t cBits)
     1028{
     1029    VBOXPtr pVBox = pScrn->driverPrivate;
     1030    TRACE_ENTRY();
     1031    if (!pVBox->useDevice)
     1032        return TRUE;  /* If we can't ask the host then we like everything. */
    10301033    return VbglR3HostLikesVideoMode(cx, cy, cBits);
    10311034}
     1035
     1036/**
     1037 * Save video mode parameters to the registry.
     1038 *
     1039 * @returns iprt status value
     1040 * @param   pszName the name to save the mode parameters under
     1041 * @param   cx      mode width
     1042 * @param   cy      mode height
     1043 * @param   cBits   bits per pixel for the mode
     1044 */
     1045Bool
     1046vboxSaveVideoMode(ScrnInfoPtr pScrn, uint32_t cx, uint32_t cy, uint32_t cBits)
     1047{
     1048    VBOXPtr pVBox = pScrn->driverPrivate;
     1049    TRACE_ENTRY();
     1050    if (!pVBox->useDevice)
     1051        return FALSE;
     1052    return RT_SUCCESS(VbglR3SaveVideoMode("SavedMode", cx, cy, cBits));
     1053}
     1054
     1055/**
     1056 * Retrieve video mode parameters from the registry.
     1057 *
     1058 * @returns iprt status value
     1059 * @param   pszName the name under which the mode parameters are saved
     1060 * @param   pcx     where to store the mode width
     1061 * @param   pcy     where to store the mode height
     1062 * @param   pcBits  where to store the bits per pixel for the mode
     1063 */
     1064Bool
     1065vboxRetrieveVideoMode(ScrnInfoPtr pScrn, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits)
     1066{
     1067    VBOXPtr pVBox = pScrn->driverPrivate;
     1068    TRACE_ENTRY();
     1069    if (!pVBox->useDevice)
     1070        return FALSE;
     1071    int rc = VbglR3RetrieveVideoMode("SavedMode", pcx, pcy, pcBits);
     1072    if (RT_SUCCESS(rc))
     1073        TRACE_LOG("Retrieved a video mode of %dx%dx%d\n", *pcx, *pcy, *pcBits);
     1074    else
     1075        TRACE_LOG("Failed to retrieve video mode, error %d\n", rc);
     1076    return (RT_SUCCESS(rc));
     1077}
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo.h

    r9252 r9811  
    189189extern Bool vboxGetDisplayChangeRequest(ScrnInfoPtr pScrn, uint32_t *pcx,
    190190                                        uint32_t *pcy, uint32_t *pcBits,
    191                                         uint32_t *piDisplay, VBOXPtr pVBox);
     191                                        uint32_t *piDisplay);
    192192
    193 extern Bool vboxHostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits);
     193extern Bool vboxHostLikesVideoMode(ScrnInfoPtr pScrn, uint32_t cx, uint32_t cy, uint32_t cBits);
     194extern Bool vboxSaveVideoMode(ScrnInfoPtr pScrn, uint32_t cx, uint32_t cy, uint32_t cBits);
     195extern Bool vboxRetrieveVideoMode(ScrnInfoPtr pScrn, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits);
    194196
    195197#endif /* _VBOXVIDEO_H_ */
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_13.c

    r9018 r9811  
    5252 */
    5353
    54 /* #define DEBUG_VIDEO 1 */
     54#ifdef DEBUG_michael
     55# define DEBUG_VIDEO 1
     56#endif
    5557#ifdef DEBUG_VIDEO
    5658
     
    300302    VBOXSetMode(crtc->scrn, adjusted_mode);
    301303    VBOXAdjustFrame(crtc->scrn->scrnIndex, x, y, 0);
     304    vboxSaveVideoMode(crtc->scrn, adjusted_mode->HDisplay,
     305                      adjusted_mode->VDisplay, crtc->scrn->bitsPerPixel);
    302306}
    303307
     
    345349vbox_output_mode_valid (xf86OutputPtr output, DisplayModePtr mode)
    346350{
     351    ScrnInfoPtr pScrn = output->scrn;
    347352    int rc = MODE_OK;
    348353    TRACE3("HDisplay=%d, VDisplay=%d\n", mode->HDisplay, mode->VDisplay);
    349     if (   vbox_device_available(VBOXGetRec(output->scrn))
    350         && !vboxHostLikesVideoMode(mode->HDisplay, mode->VDisplay,
    351                                    output->scrn->bitsPerPixel)
     354    if (   vbox_device_available(VBOXGetRec(pScrn))
     355        && !vboxHostLikesVideoMode(pScrn, mode->HDisplay,
     356                                   mode->VDisplay, pScrn->bitsPerPixel)
    352357       )
    353358        rc = MODE_BAD;
     
    413418    if (vbox_device_available(pVBox))
    414419    {
    415         rc = vboxGetDisplayChangeRequest(pScrn, &x, &y, &bpp, &display, pVBox);
    416         /* @todo - check the display number once we support multiple displays. */
     420        rc = vboxGetDisplayChangeRequest(pScrn, &x, &y, &bpp, &display);
     421        /** @todo - check the display number once we support multiple displays. */
     422        /* If we don't find a display request, see if we have a saved hint
     423         * from a previous session. */
     424        if (rc)
     425            TRACE3("Got a display change request for %dx%d\n", x, y);
     426        if (!rc || (0 == x) || (0 == y))
     427        {
     428            rc = vboxRetrieveVideoMode(pScrn, &x, &y, &bpp);
     429            if (rc)
     430                TRACE3("Retrieved a video mode of %dx%d\n", x, y);
     431        }
    417432        if (rc && (0 != x) && (0 != y)) {
    418433            /* We prefer a slightly smaller size to a slightly larger one */
     
    720735            /* We only support 16 and 24 bits depth (i.e. 16 and 32bpp) */
    721736            if (   vboxGetDisplayChangeRequest(pScrn, &cx, &cy, &cBits,
    722                                                &iDisplay, pVBox)
     737                                               &iDisplay)
    723738                && (cBits != 16)
    724739               )
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_15.c

    r9252 r9811  
    117117static const OptionInfoRec * VBOXAvailableOptions(int chipid, int busid);
    118118static void VBOXIdentify(int flags);
     119#ifndef PCIACCESS
    119120static Bool VBOXProbe(DriverPtr drv, int flags);
    120 #ifdef PCIACCESS
     121#else
    121122static Bool VBOXPciProbe(DriverPtr drv, int entity_num,
    122123     struct pci_device *dev, intptr_t match_data);
     
    334335    VBOXSetMode(crtc->scrn, adjusted_mode);
    335336    VBOXAdjustFrame(crtc->scrn->scrnIndex, x, y, 0);
     337    vboxSaveVideoMode(crtc->scrn, adjusted_mode->HDisplay,
     338                      adjusted_mode->VDisplay, crtc->scrn->bitsPerPixel);
    336339}
    337340
     
    379382vbox_output_mode_valid (xf86OutputPtr output, DisplayModePtr mode)
    380383{
     384    ScrnInfoPtr pScrn = output->scrn;
    381385    int rc = MODE_OK;
    382386    TRACE3("HDisplay=%d, VDisplay=%d\n", mode->HDisplay, mode->VDisplay);
    383     if (   vbox_device_available(VBOXGetRec(output->scrn))
    384         && !vboxHostLikesVideoMode(mode->HDisplay, mode->VDisplay,
    385                                    output->scrn->bitsPerPixel)
     387    if (   vbox_device_available(VBOXGetRec(pScrn))
     388        && !vboxHostLikesVideoMode(pScrn, mode->HDisplay, mode->VDisplay,
     389                                   pScrn->bitsPerPixel)
    386390       )
    387391        rc = MODE_BAD;
     
    447451    if (vbox_device_available(pVBox))
    448452    {
    449         rc = vboxGetDisplayChangeRequest(pScrn, &x, &y, &bpp, &display, pVBox);
     453        rc = vboxGetDisplayChangeRequest(pScrn, &x, &y, &bpp, &display);
    450454        /* @todo - check the display number once we support multiple displays. */
     455        /* If we don't find a display request, see if we have a saved hint
     456         * from a previous session. */
     457        if (!rc || (0 == x) || (0 == y))
     458            rc = vboxRetrieveVideoMode(pScrn, &x, &y, &bpp);
    451459        if (rc && (0 != x) && (0 != y)) {
    452460            /* We prefer a slightly smaller size to a slightly larger one */
     
    636644#endif
    637645
     646#ifndef PCIACCESS
    638647static Bool
    639648VBOXProbe(DriverPtr drv, int flags)
     
    651660        return (FALSE);
    652661
    653 #ifndef PCIACCESS
    654662    /* PCI BUS */
    655663    if (xf86GetPciVideoInfo()) {
     
    690698        }
    691699    }
     700
     701    xfree(devSections);
     702
     703    return (foundScreen);
     704}
    692705#endif
    693 
    694     xfree(devSections);
    695 
    696     return (foundScreen);
    697 }
    698706
    699707/*
     
    804812            /* We only support 16 and 24 bits depth (i.e. 16 and 32bpp) */
    805813            if (   vboxGetDisplayChangeRequest(pScrn, &cx, &cy, &cBits,
    806                                                &iDisplay, pVBox)
     814                                               &iDisplay)
    807815                && (cBits != 16)
    808816               )
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_70.c

    r8472 r9811  
    470470        uint32_t cx = 0, cy = 0, iDisplay = 0, cBits = 24;
    471471
    472         if (vboxGetDisplayChangeRequest(pScrn, &cx, &cy, &cBits, &iDisplay,
    473                                         pVBox))
     472        if (vboxGetDisplayChangeRequest(pScrn, &cx, &cy, &cBits, &iDisplay))
    474473        {
    475474            /* We only support 16 and 24 bits depth (i.e. 16 and 32bpp) */
     
    515514        ++i;
    516515    }
    517     if (vboxHostLikesVideoMode(1024, 768, pScrn->bitsPerPixel))
     516    if (vboxHostLikesVideoMode(pScrn, 1024, 768, pScrn->bitsPerPixel))
    518517    {
    519518        pScrn->display->modes[i] = "1024x768";
    520519        ++i;
    521520    }
    522     if (vboxHostLikesVideoMode(800, 600, pScrn->bitsPerPixel))
     521    if (vboxHostLikesVideoMode(pScrn, 800, 600, pScrn->bitsPerPixel))
    523522    {
    524523        pScrn->display->modes[i] = "800x600";
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