VirtualBox

Changeset 7464 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Mar 14, 2008 5:05:33 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28903
Message:

Additions/x11: use the VideoModeSupported guest request to check whether the host likes resolutions

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp

    r7428 r7464  
    2323#include <iprt/mem.h>
    2424#include <iprt/assert.h>
     25#include <VBox/log.h>
    2526
    2627#include "VBGLR3Internal.h"
     
    201202    return rc;
    202203}
     204
     205/**
     206 * Query the host as to whether it likes a specific video mode.
     207 *
     208 * @returns the result of the query
     209 * @param   cx     the width of the mode being queried
     210 * @param   cy     the height of the mode being queried
     211 * @param   cBits  the bpp of the mode being queried
     212 */
     213VBGLR3DECL(bool) VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy,
     214                                          uint32_t cBits)
     215{
     216    bool brc = false;
     217    int rc = VINF_SUCCESS;
     218    VMMDevVideoModeSupportedRequest req;
     219
     220    vmmdevInitRequest(&req.header, VMMDevReq_VideoModeSupported);
     221    req.width      = cx;
     222    req.height     = cy;
     223    req.bpp        = cBits;
     224    req.fSupported = false;
     225    rc = vbglR3GRPerform(&req.header);
     226    if (RT_SUCCESS(rc) && RT_SUCCESS(req.header.rc))
     227        brc = req.fSupported;
     228    else
     229        LogRelFunc(("error querying video mode supported status from VMMDev."
     230                    "rc = %Vrc, VMMDev rc = %Vrc\n", rc, req.header.rc));
     231    return brc;
     232}
  • trunk/src/VBox/Additions/x11/xgraphics/vboxutils.c

    r7443 r7464  
    882882    return FALSE;
    883883}
     884
     885
     886/**
     887 * Query the host as to whether it likes a specific video mode.
     888 *
     889 * @returns the result of the query
     890 * @param   cx     the width of the mode being queried
     891 * @param   cy     the height of the mode being queried
     892 * @param   cBits  the bpp of the mode being queried
     893 */
     894Bool
     895vboxHostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits)
     896{
     897    return VbglR3HostLikesVideoMode(cx, cy, cBits);
     898}
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo.h

    r7443 r7464  
    171171                                        uint32_t *piDisplay, VBOXPtr pVBox);
    172172
     173extern Bool vboxHostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits);
     174
    173175#endif /* _VBOXVIDEO_H_ */
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_13.c

    r7443 r7464  
    346346vbox_output_mode_valid (xf86OutputPtr output, DisplayModePtr mode)
    347347{
    348     (void) output; (void) mode;
    349     return MODE_OK;
     348    if (vboxHostLikesVideoMode(mode->HDisplay, mode->VDisplay,
     349                               output->scrn->bitsPerPixel))
     350        return MODE_OK;
     351    else
     352        return MODE_BAD;
    350353}
    351354
     
    410413        vbox_output_add_mode(&pModes, NULL, x, y, TRUE);
    411414    }
    412     vbox_output_add_mode(&pModes, NULL, 1024, 768, FALSE);
    413     vbox_output_add_mode(&pModes, NULL, 800, 600, FALSE);
    414     vbox_output_add_mode(&pModes, NULL, 640, 480, FALSE);
    415415    TRACE2;
    416416    return pModes;
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_70.c

    r7443 r7464  
    504504       all invalid. */
    505505    if (pcHostModeName != NULL)
     506    {
    506507        pScrn->display->modes[i] = pcHostModeName;
    507     else
    508         --i;
    509     pScrn->display->modes[i+1] = "1024x768";
    510     pScrn->display->modes[i+2] = "800x600";
    511     pScrn->display->modes[i+3] = "640x480";
    512     pScrn->display->modes[i+4] = NULL;
     508        ++i;
     509    }
     510    if (vboxHostLikesVideoMode(1024, 768, pScrn->bitsPerPixel))
     511    {
     512        pScrn->display->modes[i] = "1024x768";
     513        ++i;
     514    }
     515    if (vboxHostLikesVideoMode(800, 600, pScrn->bitsPerPixel))
     516    {
     517        pScrn->display->modes[i] = "800x600";
     518        ++i;
     519    }
     520    /* A mode of last resort */
     521    pScrn->display->modes[i] = "640x480";
     522    ++i;
     523    pScrn->display->modes[i] = NULL;
    513524
    514525    /* Create a builtin mode for every specified mode. This allows to specify arbitrary
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