vrdpbmp.c revision 4d98012b3229f47c9fb4eb767563359484284077
/** @file
*
* VBoxGuest -- VirtualBox Win 2000/XP guest display driver
*
* VRDP bitmap cache.
*
*/
/*
* Copyright (C) 2006-2007 Oracle Corporation
*
* 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 (GPL) 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.
*/
#include "driver.h"
#include "vrdpbmp.h"
#include <VBox/VRDPOrders.h>
/*
* Cache has a fixed number of preallocated entries. Entries are linked in the MRU
* list. The list contains both used and free entries. Free entries are at the end.
* The most recently used entry is in the head.
*
* The purpose of the cache is to answer whether the bitmap was already encountered
* before.
*
* No serialization because the code is executed under vboxHwBuffer* semaphore.
*/
{
while (h > 0)
{
h--;
}
return u64CRC;
} /* Hash function end. */
{
if (bytesPerPixel == 0)
{
return FALSE;
}
return TRUE;
}
/* Meves an entry to the head of MRU list. */
{
{
/* The entry is not yet in the head. Exclude from list. */
{
}
else
{
}
/* Insert the entry at the head of MRU list. */
}
}
/* Returns TRUE if the hash already presents in the cache.
* Moves the found entry to the head of MRU list.
*/
{
/* Search the MRU list. */
{
{
/* Found the entry. Move it to the head of MRU list. */
return TRUE;
}
}
return FALSE;
}
/* Returns TRUE is a entry was also deleted to nake room for new entry. */
{
/* Get the free entry to be used. Try tail, that should be */
{
return bRc;
}
{
/* The cache is full. Remove the tail. */
}
return bRc;
}
/*
* Public functions.
*/
/* Find out whether the surface already in the cache.
* Insert in the cache if not.
*/
int vrdpbmpCacheSurface (VRDPBC *pCache, const SURFOBJ *pso, VRDPBCHASH *phash, VRDPBCHASH *phashDeleted)
{
int rc;
if (!bResult)
{
return VRDPBMP_RC_NOT_CACHED;
}
if (bResult)
{
return VRDPBMP_RC_ALREADY_CACHED;
}
if (bResult)
{
}
return rc;
}
/* Setup the initial state of the cache. */
{
int i;
/* Reinitialize the cache structure. */
{
{
}
{
}
}
}