setmode.c revision 81b61357ada6821d8257b3d147a4d4309fcb2fa7
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * Linux Additions X11 graphics driver, mode setting
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * Copyright (C) 2006-2013 Oracle Corporation
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * available from http://www.virtualbox.org. This file is free software;
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * General Public License (GPL) as published by the Free Software
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
546cd3313d635980a2cc168a79a58b4f0858d784vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
546cd3313d635980a2cc168a79a58b4f0858d784vboxsync * --------------------------------------------------------------------
546cd3313d635980a2cc168a79a58b4f0858d784vboxsync * This code is based on:
546cd3313d635980a2cc168a79a58b4f0858d784vboxsync * X11 VESA driver
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * Permission is hereby granted, free of charge, to any person obtaining a
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * copy of this software and associated documentation files (the "Software"),
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * to deal in the Software without restriction, including without limitation
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * and/or sell copies of the Software, and to permit persons to whom the
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * Software is furnished to do so, subject to the following conditions:
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * The above copyright notice and this permission notice shall be included in
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * all copies or substantial portions of the Software.
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
395d92a7732aad3c0b9baecedfabba5113b84485vboxsync * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
395d92a7732aad3c0b9baecedfabba5113b84485vboxsync * SOFTWARE.
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * Except as contained in this notice, the name of Conectiva Linux shall
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * not be used in advertising or otherwise to promote the sale, use or other
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * dealings in this Software without prior written authorization from
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * Conectiva Linux.
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync/* We include <unistd.h> for Solaris below, and the ANSI C emulation layer
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * interferes with that. */
#include "version-generated.h"
#include "product-generated.h"
#include "xf86.h"
#include "vgaHW.h"
#ifdef RT_OS_SOLARIS
# include <errno.h>
# include <fcntl.h>
# include <unistd.h>
("cbOldSize=%llu cbNewSize=%llu, max=%u.\n", (unsigned long long)cbOldSize, (unsigned long long)cbNewSize,
cbOldFB = 0;
cbNewFB = 0;
void vbvxSetMode(ScrnInfoPtr pScrn, unsigned cDisplay, unsigned cWidth, unsigned cHeight, int x, int y, bool fEnabled,
int rc;
bool fEnabledAndVisible = fEnabled && x + cWidth <= pFrameBuffer->cWidth && y + cHeight <= pFrameBuffer->cHeight;
TRACE_LOG("cDisplay=%u, cWidth=%u, cHeight=%u, x=%d, y=%d, fEnabled=%d, fConnected=%d, pFrameBuffer: { x0=%d, y0=%d, cWidth=%u, cHeight=%u, cBPP=%u }\n",
cDisplay, cWidth, cHeight, x, y, fEnabled, fConnected, pFrameBuffer->x0, pFrameBuffer->y0, pFrameBuffer->cWidth,
VBoxHGSMIProcessDisplayInfo(&pVBox->guestCtx, cDisplay, x - pFrameBuffer->x0, y - pFrameBuffer->y0, offStart,
rc = VBoxHGSMIUpdateInputMapping(&pVBox->guestCtx, 0 - pFrameBuffer->x0, 0 - pFrameBuffer->y0, pFrameBuffer->cWidth,
unsigned cHeight, int x, int y)
bool fEnabled;
int rc;
return FALSE;
return FALSE;
if (cDisplay == 0)
if (cDisplay == 0)
return TRUE;
int rc;
return TRUE;
if (!pPixmap) {
return FALSE;
"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",
return FALSE;
#ifdef VBOX_DRI_OLD
#ifdef VBOXVIDEO_13
return TRUE;
#ifdef RT_OS_SOLARIS
int rc;
if (hMouse >= 0)