VBoxVideoGuest.h revision 32b1164f35483be483177be7b5235002a4a5afbe
/** @file
*
* VBox Host Guest Shared Memory Interface (HGSMI).
* OS-independent guest structures.
*/
/*
* Copyright (C) 2006-2012 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.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef __HGSMI_GUEST_h__
#define __HGSMI_GUEST_h__
#ifdef VBOX_XPDM_MINIPORT
# include "miniport.h"
# include "ntddvdeo.h"
# include <Video.h>
#elif defined VBOX_GUESTR3XORGMOD
# include <compiler.h>
#else
# include <iprt/asm-amd64-x86.h>
#endif
#ifdef VBOX_WDDM_MINIPORT
# include "wddm/VBoxMPShgsmi.h"
typedef VBOXSHGSMI HGSMIGUESTCMDHEAP;
#else
typedef HGSMIHEAP HGSMIGUESTCMDHEAP;
#endif
/**
* Structure grouping the context needed for submitting commands to the host
* via HGSMI
*/
typedef struct HGSMIGUESTCOMMANDCONTEXT
{
/** Information about the memory heap located in VRAM from which data
* structures to be sent to the host are allocated. */
/** The I/O port used for submitting commands to the host by writing their
* offsets into the heap. */
/**
* Structure grouping the context needed for receiving commands from the host
* via HGSMI
*/
typedef struct HGSMIHOSTCOMMANDCONTEXT
{
/** Information about the memory area located in VRAM in which the host
* places data structures to be read by the guest. */
/** Convenience structure used for matching host commands to handlers. */
/** @todo handlers are registered individually in code rather than just
* passing a static structure in order to gain extra flexibility. There is
* currently no expected usage case for this though. Is the additional
* complexity really justified? */
/** Flag to indicate that one thread is currently processing the command
* queue. */
volatile bool fHostCmdProcessing;
/* Pointer to the VRAM location where the HGSMI host flags are kept. */
volatile HGSMIHOSTFLAGS *pfHostFlags;
/** The I/O port used for receiving commands from the host as offsets into
* the memory area and sending back confirmations (command completion,
* IRQ acknowlegement). */
/**
* Structure grouping the context needed for sending graphics acceleration
* information to the host via VBVA. Each screen has its own VBVA buffer.
*/
typedef struct VBVABUFFERCONTEXT
{
/** Offset of the buffer in the VRAM section for the screen */
/** Length of the buffer in bytes */
/** This flag is set if we wrote to the buffer faster than the host could
* read it. */
bool fHwBufferOverflow;
/** The VBVA record that we are currently preparing for the host, NULL if
* none. */
struct VBVARECORD *pRecord;
/** Pointer to the VBVA buffer mapped into the current address space. Will
* be NULL if VBVA is not enabled. */
struct VBVABUFFER *pVBVA;
/** @name Helper functions
* @{ */
/** Write an 8-bit value to an I/O port. */
{
#ifdef VBOX_XPDM_MINIPORT
#elif defined VBOX_GUESTR3XORGMOD
#else /** @todo make these explicit */
#endif
}
/** Write a 16-bit value to an I/O port. */
{
#ifdef VBOX_XPDM_MINIPORT
#elif defined VBOX_GUESTR3XORGMOD
#else
#endif
}
/** Write a 32-bit value to an I/O port. */
{
#ifdef VBOX_XPDM_MINIPORT
#elif defined VBOX_GUESTR3XORGMOD
#else
#endif
}
/** Read an 8-bit value from an I/O port. */
{
#ifdef VBOX_XPDM_MINIPORT
#elif defined VBOX_GUESTR3XORGMOD
#else
#endif
}
/** Read a 16-bit value from an I/O port. */
{
#ifdef VBOX_XPDM_MINIPORT
#elif defined VBOX_GUESTR3XORGMOD
#else
#endif
}
/** Read a 32-bit value from an I/O port. */
{
#ifdef VBOX_XPDM_MINIPORT
#elif defined VBOX_GUESTR3XORGMOD
#else
#endif
}
/** @} */
/** @name Base HGSMI APIs
* @{ */
/** Acknowlege an IRQ. */
{
}
void *pvMem);
RTDECL(bool) VBoxHGSMIIsSupported(void);
void *pvBuffer);
void *pvBuffer);
/** @todo we should provide a cleanup function too as part of the API */
void *pvGuestHeapMemory,
void *pvBaseMapping,
void *pvHostAreaMapping,
/** @} */
/** @name VBVA APIs
* @{ */
/** @} */
/** @name Modesetting APIs
* @{ */
RTDECL(bool) VBoxVideoAnyWidthAllowed(void);
struct VBVAINFOVIEW;
/**
* Callback funtion called from @a VBoxHGSMISendViewInfo to initialise
* the @a VBVAINFOVIEW structure for each screen.
*
* @returns iprt status code
* @param pvData context data for the callback, passed to @a
* VBoxHGSMISendViewInfo along with the callback
* @param pInfo array of @a VBVAINFOVIEW structures to be filled in
* @todo explicitly pass the array size
*/
struct VBVAINFOVIEW *pInfo,
/** Pointer to a FNHGSMIFILLVIEWINFO callback */
typedef FNHGSMIFILLVIEWINFO *PFNHGSMIFILLVIEWINFO;
void *pvData);
RTDECL(void) VBoxVideoDisableVBE(void);
/** @} */
#endif /* __HGSMI_GUEST_h__*/