setmode.c revision a5d4a2a6365cbfa15e179bc79d291133c4a0ff1e
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync/* $Id$ */
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync/** @file
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync *
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * Linux Additions X11 graphics driver, mode setting
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync */
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync/*
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2006-2013 Oracle Corporation
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync *
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * available from http://www.virtualbox.org. This file is free software;
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * General Public License (GPL) as published by the Free Software
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * --------------------------------------------------------------------
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync *
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * This code is based on:
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync *
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * X11 VESA driver
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync *
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync *
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * Permission is hereby granted, free of charge, to any person obtaining a
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * copy of this software and associated documentation files (the "Software"),
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * to deal in the Software without restriction, including without limitation
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * and/or sell copies of the Software, and to permit persons to whom the
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * Software is furnished to do so, subject to the following conditions:
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync *
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * The above copyright notice and this permission notice shall be included in
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * all copies or substantial portions of the Software.
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync *
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * SOFTWARE.
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync *
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * Except as contained in this notice, the name of Conectiva Linux shall
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * not be used in advertising or otherwise to promote the sale, use or other
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * dealings in this Software without prior written authorization from
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * Conectiva Linux.
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync *
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync */
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync#ifdef XORG_7X
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync/* We include <unistd.h> for Solaris below, and the ANSI C emulation layer
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync * interferes with that. */
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync# define _XF86_ANSIC_H
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync# define XF86_LIBC_H
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync# include <string.h>
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync#endif
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync#include "vboxvideo.h"
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync#include "version-generated.h"
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync#include "product-generated.h"
ae5fc6ddd3d2ccdb941b1aacd23f6791fecc3354vboxsync#include "xf86.h"
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync/* VGA hardware functions for setting and restoring text mode */
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync#include "vgaHW.h"
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync#ifdef RT_OS_SOLARIS
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync# include <sys/vuid_event.h>
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync# include <sys/msio.h>
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync# include <errno.h>
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync# include <fcntl.h>
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync# include <unistd.h>
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync#endif
d9b086bc8f68cd04745f397f8db45fca87c14365vboxsync
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync/** Clear the virtual framebuffer in VRAM. Optionally also clear up to the
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * size of a new framebuffer. Framebuffer sizes larger than available VRAM
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync * be treated as zero and passed over. */
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsyncvoid vboxClearVRAM(ScrnInfoPtr pScrn, int32_t cNewX, int32_t cNewY)
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync{
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync VBOXPtr pVBox = VBOXGetRec(pScrn);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync uint64_t cbOldFB, cbNewFB;
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync cbOldFB = pVBox->cbLine * pScrn->virtualX;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync cbNewFB = vboxLineLength(pScrn, cNewX) * cNewY;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if (cbOldFB > (uint64_t)pVBox->cbFBMax)
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync cbOldFB = 0;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if (cbNewFB > (uint64_t)pVBox->cbFBMax)
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync cbNewFB = 0;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync memset(pVBox->base, 0, max(cbOldFB, cbNewFB));
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync}
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync/** Set a graphics mode. Poke any required values into registers, do an HGSMI
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync * mode set and tell the host we support advanced graphics functions. This
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync * procedure is complicated by the fact that X.Org can implicitly disable a
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync * screen by resizing the virtual framebuffer so that the screen is no longer
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync * inside it. We have to spot and handle this.
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync */
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsyncBool VBOXSetMode(ScrnInfoPtr pScrn, unsigned cDisplay, unsigned cWidth,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync unsigned cHeight, int x, int y)
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync{
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync VBOXPtr pVBox = VBOXGetRec(pScrn);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync uint32_t offStart, cwReal = cWidth;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync bool fEnabled;
6dc780c3e9adb5f3a0ef93c8f34ba38ac2213776vboxsync uint16_t fFlags;
c87c6e10b608762972b76bfc734daaec9070b50bvboxsync int rc;
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync TRACE_LOG("cDisplay=%u, cWidth=%u, cHeight=%u, x=%d, y=%d, displayWidth=%d\n",
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync cDisplay, cWidth, cHeight, x, y, pScrn->displayWidth);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync offStart = y * pVBox->cbLine + x * vboxBPP(pScrn) / 8;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync /* Deactivate the screen if the mode - specifically the virtual width - is
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync * too large for VRAM as we sometimes have to do this - see comments in
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync * VBOXPreInit. */
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if ( offStart + pVBox->cbLine * cHeight > pVBox->cbFBMax
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync || pVBox->cbLine * pScrn->virtualY > pVBox->cbFBMax)
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync return FALSE;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync /* Deactivate the screen if it is outside of the virtual framebuffer and
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync * clamp it to lie inside if it is partly outside. */
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if (x >= pScrn->displayWidth || x + (int) cWidth <= 0)
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync return FALSE;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync else
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync cwReal = RT_MIN((int) cWidth, pScrn->displayWidth - x);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync TRACE_LOG("pVBox->pScreens[%u].fCrtcEnabled=%d, fOutputEnabled=%d\n",
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync cDisplay, (int)pVBox->pScreens[cDisplay].fCrtcEnabled,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync (int)pVBox->pScreens[cDisplay].fOutputEnabled);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if (cDisplay == 0)
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync VBoxVideoSetModeRegisters(cwReal, cHeight, pScrn->displayWidth,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync vboxBPP(pScrn), 0, x, y);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync fEnabled = pVBox->pScreens[cDisplay].fCrtcEnabled
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync && pVBox->pScreens[cDisplay].fOutputEnabled;
6dc780c3e9adb5f3a0ef93c8f34ba38ac2213776vboxsync fFlags = VBVA_SCREEN_F_ACTIVE;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync fFlags |= (pVBox->pScreens[cDisplay].afConnected ? 0
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync : VBVA_SCREEN_F_DISABLED);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync VBoxHGSMIProcessDisplayInfo(&pVBox->guestCtx, cDisplay, x, y,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync offStart, pVBox->cbLine, cwReal, cHeight,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync fEnabled ? vboxBPP(pScrn) : 0, fFlags);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if (cDisplay == 0)
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync {
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync rc = VBoxHGSMIUpdateInputMapping(&pVBox->guestCtx, 0 - pVBox->pScreens[0].aScreenLocation.x,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync 0 - pVBox->pScreens[0].aScreenLocation.y, pScrn->virtualX, pScrn->virtualY);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if (RT_FAILURE(rc))
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync FatalError("Failed to update the input mapping.\n");
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync }
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync return TRUE;
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync}
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync/** Resize the virtual framebuffer. After resizing we reset all modes
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync * (X.Org 1.3+) to adjust them to the new framebuffer.
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync */
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsyncBool VBOXAdjustScreenPixmap(ScrnInfoPtr pScrn, int width, int height)
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync{
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync ScreenPtr pScreen = pScrn->pScreen;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync PixmapPtr pPixmap = pScreen->GetScreenPixmap(pScreen);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync VBOXPtr pVBox = VBOXGetRec(pScrn);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync uint64_t cbLine = vboxLineLength(pScrn, width);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync int displayWidth = vboxDisplayPitch(pScrn, cbLine);
c87c6e10b608762972b76bfc734daaec9070b50bvboxsync int rc;
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync TRACE_LOG("width=%d, height=%d\n", width, height);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if ( width == pScrn->virtualX
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync && height == pScrn->virtualY
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync && displayWidth == pScrn->displayWidth)
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync return TRUE;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if (!pPixmap) {
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync "Failed to get the screen pixmap.\n");
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync return FALSE;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync }
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if (cbLine > UINT32_MAX || cbLine * height >= pVBox->cbFBMax)
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync {
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync "Unable to set up a virtual screen size of %dx%d with %lu of %d Kb of video memory available. Please increase the video memory size.\n",
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync width, height, pVBox->cbFBMax / 1024, pScrn->videoRam);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync return FALSE;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync }
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync pScreen->ModifyPixmapHeader(pPixmap, width, height,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync pScrn->depth, vboxBPP(pScrn), cbLine,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync pVBox->base);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync vboxClearVRAM(pScrn, width, height);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync pScrn->virtualX = width;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync pScrn->virtualY = height;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync pScrn->displayWidth = displayWidth;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync pVBox->cbLine = cbLine;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync#ifdef VBOX_DRI_OLD
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if (pVBox->useDRI)
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync VBOXDRIUpdateStride(pScrn, pVBox);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync#endif
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync#ifdef VBOXVIDEO_13
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync /* Write the new values to the hardware */
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync /** @todo why is this only for VBOXVIDEO_13? */
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync {
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync unsigned i;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync for (i = 0; i < pVBox->cScreens; ++i)
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync VBOXSetMode(pScrn, i, pVBox->pScreens[i].aScreenLocation.cx,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync pVBox->pScreens[i].aScreenLocation.cy,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync pVBox->pScreens[i].aScreenLocation.x,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync pVBox->pScreens[i].aScreenLocation.y);
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync }
c87c6e10b608762972b76bfc734daaec9070b50bvboxsync#else
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync rc = VBoxHGSMIUpdateInputMapping(&pVBox->guestCtx, 0 - pVBox->pScreens[0].aScreenLocation.x,
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync 0 - pVBox->pScreens[0].aScreenLocation.y, pScrn->virtualX, pScrn->virtualY);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if (RT_FAILURE(rc))
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync FatalError("Failed to update the input mapping.\n");
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync#endif
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync#ifdef RT_OS_SOLARIS
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync /* Tell the virtual mouse device about the new virtual desktop size. */
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync {
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync int rc;
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync int hMouse = open("/dev/mouse", O_RDWR);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync if (hMouse >= 0)
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync {
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync do {
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync Ms_screen_resolution Res = { height, width };
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync rc = ioctl(hMouse, MSIOSRESOLUTION, &Res);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync } while ((rc != 0) && (errno == EINTR));
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync close(hMouse);
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync }
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync }
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync#endif
a5d4a2a6365cbfa15e179bc79d291133c4a0ff1evboxsync return TRUE;
957e0fcedf2079feefdb1aa2d0da65e39cd8479cvboxsync}