VBoxMPInternal.cpp revision a93d9183b51b28dcb967fedb4c78e73898eaa03c
/* $Id$ */
/** @file
* VBox XPDM Miniport internal functions
*/
/*
* Copyright (C) 2011 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 "VBoxMPInternal.h"
#include <VBox/VBoxVideo.h>
#include <VBox/VBoxGuestLib.h>
typedef struct _VBVAMINIPORT_CHANNELCONTEXT
{
void *pvChannelHandler;
typedef struct _VBVADISP_CHANNELCONTEXT
{
/** The generic command handler builds up a list of commands - in reverse
* order! - here */
bool bValid;
typedef struct _VBVA_CHANNELCONTEXTS
{
/* Computes the size of a framebuffer. DualView has a few framebuffers of the computed size. */
{
/* Size of a framebuffer. */
/* Align down to 4096 bytes. */
ulSize &= ~0xFFF;
LOG(("cbVRAM = 0x%08X, cDisplays = %d, ulSize = 0x%08X, ulSize * cDisplays = 0x%08X, slack = 0x%08X",
/* Update the primary info. */
/* Update the per extension info. */
ULONG ulFrameBufferOffset = 0;
while (pExt)
{
/* That is assigned when a video mode is set. */
pExt->ulFrameBufferSize = 0;
}
}
{
unsigned i;
{
/* How much VRAM should be reserved for the guest drivers to use VBVA. */
p[i].u32ViewSize - cbReservedVRAM:
0;
}
{
return VINF_SUCCESS;
}
AssertFailed ();
return VERR_INTERNAL_ERROR;
}
{
LOGF_ENTER();
{
{
{
/* If VIDEO_DUALVIEW_REMOVABLE is passed as the 3rd parameter, then
* the guest does not allow to choose the primary screen.
*/
{
break;
}
pSExt->ulFrameBufferOffset = 0;
pSExt->ulFrameBufferSize = 0;
/* Update the list pointers */
/* Take the successfully created display into account. */
}
}
else
{
/* Even though VM could be configured to have multiply monitors,
* we can't support it on this windows version.
*/
}
}
/* Now when the number of monitors is known and extensions are created,
* calculate the layout of framebuffers.
*/
/*Report our screen configuration to host*/
{
int rc;
rc = VBoxHGSMISendViewInfo(&pCommon->guestCtx, pCommon->cDisplays, VBoxVbvaInitInfoDisplayCB, (void *) pExt);
if (RT_FAILURE (rc))
{
}
}
LOGF_LEAVE();
}
{
LOGF_ENTER();
if (pPrimary)
{
if (req)
{
if (RT_FAILURE(rc))
{
}
}
}
LOGF_LEAVE();
}
{
int rc = VINF_SUCCESS;
LOGF_ENTER();
if (RT_FAILURE(rc))
{
LOGF_LEAVE();
return rc;
}
{
{
}
else
{
}
LOGF_LEAVE();
return rc;
}
/* Allocate the memory block for VMMDevReq_VideoAccelFlush request. */
{
rc = VbglGRAlloc((VMMDevRequestHeader **)&req, sizeof(VMMDevVideoAccelFlush), VMMDevReq_VideoAccelFlush);
if (RT_SUCCESS(rc))
{
}
else
{
LOGF_LEAVE();
return rc;
}
}
rc = VbglGRAlloc((VMMDevRequestHeader **)&req, sizeof(VMMDevVideoAccelEnable), VMMDevReq_VideoAccelEnable);
if (RT_SUCCESS(rc))
{
req->fu32Status = 0;
if (RT_SUCCESS(rc))
{
{
LOG(("accepted"));
/* Initialize the result information and VBVA memory. */
{
ulEnabled = 1;
}
else
{
}
}
else
{
LOG(("rejected"));
/* Disable VBVA for old hosts. */
req->fu32Status = 0;
}
}
else
{
}
}
else
{
}
LOGF_LEAVE();
return rc;
}
{
if (iId < 0)
{
return NULL;
}
{
}
return NULL;
}
/* Reverses a NULL-terminated linked list of VBVAHOSTCMD structures. */
{
while (pList)
{
}
return pFirst;
}
{
}
DECLCALLBACK(int)
VBoxMPHGSMIHostCmdRequestCB(HVBOXVIDEOHGSMI hHGSMI, uint8_t u8Channel, uint32_t iDisplay, struct VBVAHOSTCMD **ppCmd)
{
LOGF_ENTER();
if (!ppCmd)
{
LOGF_LEAVE();
return VERR_INVALID_PARAMETER;
}
/* pick up the host commands */
if(pChannel)
{
if(pDispContext)
{
do
{
LOGF_LEAVE();
return VINF_SUCCESS;
}
else
{
}
}
LOGF_LEAVE();
return VERR_INVALID_PARAMETER;
}
#define MEM_TAG 'HVBV'
{
return pExt->u.primary.VideoPortProcs.pfnAllocatePool(pExt, (VBOXVP_POOL_TYPE)VpNonPagedPool, size, Tag);
}
{
}
{
if (pContext)
{
return VINF_SUCCESS;
}
return VERR_GENERAL_FAILURE;
}
{
return VINF_SUCCESS;
}
{
}
static DECLCALLBACK(int)
VBoxVbvaChannelGenericHandlerCB(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer)
{
LOGF_ENTER();
if (cbBuffer > VBVAHOSTCMD_HDRSIZE)
{
{
{
while (pCur)
{
/*@todo: */
switch (u16ChannelInfo)
{
case VBVAHG_DISPLAY_CUSTOM:
{
#if 0 /* Never taken */
if(pLast)
{
}
else
#endif
{
}
#if 0 /* Who is supposed to set pNext? */
//TODO: use offset here
#else
#endif
break;
}
case VBVAHG_EVENT:
{
}
default:
{
#if 0 /* pLast has been asserted to be NULL, and who should set pNext? */
//TODO: use offset here
if(pLast)
#else
#endif
#if 0 /* pNext is NULL, and the other things have already been asserted */
#else
#endif
}
}
}
/* we do not support lists currently */
if(pLast)
{
}
if(pFirst)
{
do
{
}
}
else
{
}
LOGF_LEAVE();
return VINF_SUCCESS;
}
}
else
{
/*@todo*/
}
}
LOGF_LEAVE();
/* no handlers were found, need to complete the command here */
return VINF_SUCCESS;
}
/* Note: negative iDisplay would mean this is a miniport handler */
{
static HGSMICHANNELHANDLER s_OldHandler;
LOGF_ENTER();
if (!pChannel)
{
if (RT_FAILURE(rc))
{
LOGF_LEAVE();
return rc;
}
}
else
{
}
if (!pDispContext)
{
WARN(("!pDispContext"));
LOGF_LEAVE();
return VERR_GENERAL_FAILURE;
}
#ifdef DEBUGVHWASTRICT
#endif
if (!pDispContext->bValid)
{
pDispContext->bValid = true;
int rc = VINF_SUCCESS;
if (!pChannel)
{
"VGA Miniport HGSMI channel", VBoxVbvaChannelGenericHandlerCB,
}
if (RT_SUCCESS(rc))
{
LOGF_LEAVE();
return VINF_SUCCESS;
}
else
{
}
}
if(!pChannel)
{
}
LOGF_LEAVE();
return VERR_GENERAL_FAILURE;
}