~ubuntu-branches/ubuntu/vivid/virtualbox-ose/vivid

« back to all changes in this revision

Viewing changes to src/VBox/Additions/x11/vboxvideo/vboxutils_68.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2010-03-11 17:16:37 UTC
  • mfrom: (0.3.4 upstream) (0.4.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100311171637-43z64ia3ccpj8vqn
Tags: 3.1.4-dfsg-2ubuntu1
* Merge from Debian unstable (LP: #528561), remaining changes:
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
  - Replace *-source packages with transitional packages for *-dkms
* Fix crash in vboxvideo_drm with kernel 2.6.33 / backported drm code
  (LP: #535297)
* Add a list of linux-headers packages to the apport hook
* Update debian/patches/u02-lp-integration.dpatch with a
  DEP-3 compliant header
* Add ${misc:Depends} to virtualbox-ose-source and virtualbox-ose-guest-source
  Depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
944
944
    return TRUE;
945
945
}
946
946
 
947
 
 
948
947
/**
949
948
 * Query the last display change request.
950
949
 *
951
 
 * @returns iprt status value
952
 
 * @param xres     where to store the horizontal pixel resolution requested
953
 
 *                 (0 = do not change)
954
 
 * @param yres     where to store the vertical pixel resolution requested
955
 
 *                 (0 = do not change)
956
 
 * @param bpp      where to store the bits per pixel requeste
957
 
 *                 (0 = do not change)
958
 
 * @param  display Where to store the display number the request was for -
959
 
 *                 0 for the primary display, 1 for the first secondary, etc.
 
950
 * @returns boolean success indicator.
 
951
 * @param   pScrn       Pointer to the X screen info structure.
 
952
 * @param   pcx         Where to store the horizontal pixel resolution (0 = do not change).
 
953
 * @param   pcy         Where to store the vertical pixel resolution (0 = do not change).
 
954
 * @param   pcBits      Where to store the bits per pixel (0 = do not change).
 
955
 * @param   fEventAck   Flag that the request is an acknowlegement for the
 
956
 *                      VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
 
957
 *                      Values:
 
958
 *                          0                                   - just querying,
 
959
 *                          VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
 
960
 * @param   iDisplay    0 for primary display, 1 for the first secondary, etc.
960
961
 */
961
962
Bool
962
 
vboxGetDisplayChangeRequest(ScrnInfoPtr pScrn, uint32_t *px, uint32_t *py,
963
 
                            uint32_t *pbpp, uint32_t *display)
 
963
vboxGetDisplayChangeRequest(ScrnInfoPtr pScrn, uint32_t *pcx, uint32_t *pcy,
 
964
                                    uint32_t *pcBits, uint32_t fEventAck, uint32_t iDisplay)
964
965
{
965
 
    int rc, scrnIndex = pScrn->scrnIndex;
966
 
    VBOXPtr pVBox = pScrn->driverPrivate;
967
 
 
968
 
    VMMDevDisplayChangeRequest2 Req = { { 0 } };
969
 
    vmmdevInitRequest(&Req.header, VMMDevReq_GetDisplayChangeRequest2);
970
 
    rc = vbox_vmmcall(pScrn, pVBox, &Req.header);
971
 
    if (RT_SUCCESS(rc))
972
 
    {
973
 
        *px = Req.xres;
974
 
        *py = Req.yres;
975
 
        *pbpp = Req.bpp;
976
 
        *display = Req.display;
977
 
        return TRUE;
978
 
    }
979
 
    xf86DrvMsg(scrnIndex, X_ERROR,
980
 
               "Failed to request the last resolution requested from the guest, rc=%d.\n",
981
 
               rc);
982
 
    return FALSE;
 
966
    VMMDevDisplayChangeRequest2 req;
 
967
    int rc;
 
968
    int fd;
 
969
 
 
970
    req.eventAck = fEventAck;
 
971
    req.display  = iDisplay;
 
972
 
 
973
    rc = vmmdevInitRequest ((VMMDevRequestHeader*)&req, VMMDevReq_GetDisplayChangeRequest2);
 
974
    if (VBOX_FAILURE (rc))
 
975
        return FALSE;
 
976
 
 
977
    /* open VBOXGUEST_DEVICE_NAME temporarily as we didn't call vbox_open yet when we enter
 
978
     * this function */
 
979
    fd = open (VBOXGUEST_DEVICE_NAME, O_RDWR, 0);
 
980
    if (fd < 0)
 
981
        return FALSE;
 
982
    if (ioctl(fd, VBOXGUEST_IOCTL_VMMREQUEST(sizeof(req)), (void*)&req) < 0)
 
983
        return FALSE;
 
984
    close (fd);
 
985
 
 
986
    rc = req.header.rc;
 
987
    if (RT_FAILURE(rc))
 
988
        return FALSE;
 
989
 
 
990
    *pcx    = req.xres;
 
991
    *pcy    = req.yres;
 
992
    *pcBits = req.bpp;
 
993
    return TRUE;
983
994
}