VBoxGuestR3LibVideo.cpp revision b83d9b1072dd8491c7ffe37830e8fd10f2dba561
/* $Id$ */
/** @file
* VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Video.
*/
/*
* Copyright (C) 2007 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "VBGLR3Internal.h"
/**
* Enable or disable video acceleration.
*
* @returns VBox status code.
*
* @param fEnable Pass zero to disable, any other value to enable.
*/
{
Req.fu32Status = 0;
}
/**
* Flush the video buffer.
*
* @returns VBox status code.
*/
VBGLR3DECL(int) VbglR3VideoAccelFlush(void)
{
}
/**
* Send mouse pointer shape information to the host.
*
* @returns VBox status code.
*
* @param fFlags Mouse pointer flags.
* @param xHot X coordinate of hot spot.
* @param yHot Y coordinate of hot spot.
* @param cx Pointer width.
* @param cy Pointer height.
* @param pvImg Pointer to the image data (can be NULL).
* @param cbImg Size of the image data pointed to by pvImg.
*/
VBGLR3DECL(int) VbglR3SetPointerShape(uint32_t fFlags, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, const void *pvImg, size_t cbImg)
{
int rc = vbglR3GRAlloc((VMMDevRequestHeader **)&pReq, RT_OFFSETOF(VMMDevReqMousePointer, pointerData) + cbImg, VMMDevReq_SetPointerShape);
if (RT_SUCCESS(rc))
{
if (pvImg)
if (RT_SUCCESS(rc))
}
return rc;
}
/**
* Send mouse pointer shape information to the host.
* This version of the function accepts a request for clients that
* already allocate and manipulate the request structure directly.
*
* @returns VBox status code.
*
* @param pReq Pointer to the VMMDevReqMousePointer structure.
*/
{
if (RT_SUCCESS(rc))
return rc;
}
/**
* Query the last display change request.
*
* @returns iprt status value
* @param pcx Where to store the horizontal pixel resolution (0 = do not change).
* @param pcy Where to store the vertical pixel resolution (0 = do not change).
* @param pcBits Where to store the bits per pixel (0 = do not change).
* @param iDisplay Where to store the display number the request was for - 0 for the
* primary display, 1 for the first secondary, etc.
*/
VBGLR3DECL(int) VbglR3GetLastDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay)
{
VMMDevDisplayChangeRequest2 Req = { { 0 } };
#ifndef VBOX_VBGLR3_XFREE86
#endif
if (RT_SUCCESS(rc))
if (RT_SUCCESS(rc))
{
}
return rc;
}
/**
* Wait for a display change request event from the host. These events must have been
* activated previously using VbglR3CtlFilterMask.
*
* @returns IPRT status value
* @param pcx On success, where to return the requested display width.
* 0 means no change.
* @param pcy On success, where to return the requested display height.
* 0 means no change.
* @param pcBits On success, where to return the requested bits per pixel.
* 0 means no change.
* @param piDisplay On success, where to return the index of the display to be changed.
*/
VBGLR3DECL(int) VbglR3DisplayChangeWaitEvent(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay)
{
int rc;
#ifndef VBOX_VBGLR3_XFREE86
#endif
if (RT_SUCCESS(rc))
{
/* did we get the right event? */
{
VMMDevDisplayChangeRequest2 Req = { { 0 } };
if (RT_SUCCESS(rc))
if (RT_SUCCESS(rc))
{
}
}
else
rc = VERR_TRY_AGAIN;
}
return rc;
}
/**
* Query the host as to whether it likes a specific video mode.
*
* @returns the result of the query
* @param cx the width of the mode being queried
* @param cy the height of the mode being queried
* @param cBits the bpp of the mode being queried
*/
{
bool fRc = false;
int rc;
req.fSupported = false;
else
LogRelFunc(("error querying video mode supported status from VMMDev."
return fRc;
}
/**
* Save video mode parameters to the registry.
*
* @returns iprt status value
* @param pszName the name to save the mode parameters under
* @param cx mode width
* @param cy mode height
* @param cBits bits per pixel for the mode
*/
{
#ifdef VBOX_WITH_INFO_SVC
using namespace svcInfo;
char szModeName[KEY_MAX_LEN];
char szModeParms[KEY_MAX_VALUE_LEN];
uint32_t u32ClientId = 0;
if (RT_SUCCESS(rc))
if (u32ClientId != 0)
return rc;
#else /* VBOX_WITH_INFO_SVC not defined */
return VERR_NOT_IMPLEMENTED;
#endif /* VBOX_WITH_INFO_SVC not defined */
}
/**
* Retrieve video mode parameters from the registry.
*
* @returns iprt status value
* @param pszName the name under which the mode parameters are saved
* @param pcx where to store the mode width
* @param pcy where to store the mode height
* @param pcBits where to store the bits per pixel for the mode
*/
VBGLR3DECL(int) VbglR3RetrieveVideoMode(const char *pszName, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits)
{
#ifdef VBOX_WITH_INFO_SVC
using namespace svcInfo;
char szModeParms[KEY_MAX_VALUE_LEN];
char *pszNext;
uint32_t u32ClientId = 0;
if (RT_SUCCESS(rc))
{
char szModeName[KEY_MAX_LEN];
sizeof(szModeParms), NULL); /** @todo add a VbglR3InfoSvcReadKeyF/FV that does the RTStrPrintf for you. */
}
if (RT_SUCCESS(rc))
/* Extract the width from the string */
if (RT_SUCCESS(rc))
{
++pszNext;
}
if (RT_SUCCESS(rc))
{
++pszNext;
}
if (rc != VINF_SUCCESS)
if (u32ClientId != 0)
if (RT_SUCCESS(rc))
{
}
return rc;
#else /* VBOX_WITH_INFO_SVC not defined */
return VERR_NOT_IMPLEMENTED;
#endif /* VBOX_WITH_INFO_SVC not defined */
}