vbox.c revision aa20c297a3aedc70fb5008a8558f3cc1d486d95e
/** @file
*
* VBoxGuest -- VirtualBox Win 2000/XP guest display driver
*
* VBox support functions.
*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*
*/
#include "driver.h"
#include <VBox/VBoxGuest.h>
/*
* There is a hardware ring buffer in the VBox VMMDev PCI memory space.
* All graphics commands go there serialized by vboxHwBufferBeginUpdate.
* and vboxHwBufferEndUpdate.
*
* off32Free is writing position. off32Data is reading position.
* off32Free == off32Data means buffer is empty.
* There must be always gap between off32Data and off32Free when data
* are in the buffer.
* Guest only changes off32Free, host changes off32Data.
*/
/* Forward declarations of internal functions. */
/*
* Public hardware buffer methods.
*/
{
if (!ghsemHwBuffer)
{
return FALSE;
}
&ulEnable,
sizeof (ulEnable),
&returnedDataLength) == 0)
{
{
/* All have been initialized. */
}
}
if (!bRc)
{
}
return bRc;
}
{
return;
}
{
DISPDBG((1, "VBoxDisp::vboxHwBufferBeginUpdate called flags = 0x%08X\n", pVbvaMemory? pVbvaMemory->fu32ModeFlags: -1));
if ( pVbvaMemory
{
{
/* All slots in the records queue are used. */
}
{
/* Even after flush there is no place. Fail the request. */
DISPDBG((1, "VBoxDisp::vboxHwBufferBeginUpdate no space in the queue of records!!! first %d, last %d\n",
}
else
{
/* Initialize the record. */
/* Remember which record we are using. */
}
}
return bRc;
}
{
/* Mark the record completed. */
return;
}
/*
* Private operations.
*/
{
}
{
return;
}
{
if (i32Diff <= 0)
{
/* Chunk will not cross buffer boundary. */
}
else
{
/* Chunk crosses buffer boundary. */
}
return;
}
{
if (ppdev->fHwBufferOverflow)
{
return FALSE;
}
while (cb > 0)
{
// DISPDBG((1, "VBoxDisp::vboxHwBufferWrite pVbvaMemory->off32Free %d, pRecord->cbRecord 0x%08X, cbHwBufferAvail %d, cb %d, cbWritten %d\n", pVbvaMemory->off32Free, pRecord->cbRecord, cbHwBufferAvail, cb, cbWritten));
if (cbChunk >= cbHwBufferAvail)
{
if (cbChunk >= cbHwBufferAvail)
{
DISPDBG((1, "VBoxDisp::vboxHwBufferWrite: no place for %d bytes. Only %d bytes available after flush. Going to partial writes.\n", cb, cbHwBufferAvail));
{
return FALSE;
}
}
}
}
return TRUE;
}
/*
* Public writer to hardware buffer.
*/
{
}
{
{
/* Order masking enabled. */
{
return TRUE;
}
}
return FALSE;
}
{
NULL,
0,
NULL,
0,
}