DisplayImpl.cpp revision e74eef731a813e4e06680c587a6759b9974b29c9
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * VBox frontends: Basic Frontend (BFE):
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * Implementation of VMDisplay class
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * This file is part of VirtualBox Open Source Edition (OSE), as
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * available from http://www.virtualbox.org. This file is free software;
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * you can redistribute it and/or modify it under the terms of the GNU
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * General Public License (GPL) as published by the Free Software
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * Foundation, in version 2 as it comes in the "COPYING" file of the
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * Clara, CA 95054 USA or visit http://www.sun.com if you need
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * additional information or have any questions.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin/*******************************************************************************
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin* Structures and Typedefs *
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin*******************************************************************************/
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * VMDisplay driver instance data.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin /** Pointer to the display object. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin /** Pointer to the driver instance structure. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin /** Pointer to the keyboard port interface of the driver/device above us. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin /** Our display connector interface. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin/** Converts PDMIDISPLAYCONNECTOR pointer to a DRVMAINDISPLAY pointer. */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface) ( (PDRVMAINDISPLAY) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINDISPLAY, Connector)) )
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz// constructor / destructor
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz/////////////////////////////////////////////////////////////////////////////
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin // by default, we have an internal Framebuffer which is
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin // NULL, i.e. a black hole for no display output
mFramebuffer = 0;
return VINF_SUCCESS;
if (!finished)
return VINF_VGA_RESIZE_IN_PROGRESS;
f = ASMAtomicCmpXchgU32 (&mu32ResizeStatus, ResizeStatus_UpdateDisplayData, ResizeStatus_InProgress);
return VINF_SUCCESS;
if (mFramebuffer)
bool f = ASMAtomicCmpXchgU32 (&mu32ResizeStatus, ResizeStatus_Void, ResizeStatus_UpdateDisplayData);
if (!mFramebuffer)
return E_FAIL;
bool f = ASMAtomicCmpXchgU32 (&mu32ResizeStatus, ResizeStatus_UpdateDisplayData, ResizeStatus_InProgress);
return S_OK;
if (*px < 0)
*px = 0;
if (*py < 0)
*py = 0;
void VMDisplay::updatePointerShape(bool fVisible, bool fAlpha, uint32_t xHot, uint32_t yHot, uint32_t width, uint32_t height, void *pShape)
if (!Framebuffer)
return E_POINTER;
mFramebuffer = 0;
return S_OK;
/* pdm.h says that this has to be called from the EMT thread */
return rc;
while(!mFramebuffer)
#if RT_OS_L4
if (mpDrv)
if (!mFramebuffer)
if (mpDrv)
DECLCALLBACK(int) VMDisplay::displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy)
#ifdef DEBUG_sunlover
#ifdef DEBUG_sunlover
DECLCALLBACK(void) VMDisplay::displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled)
DECLCALLBACK(void) VMDisplay::displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize)
DECLCALLBACK(void) VMDisplay::displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId)
typedef struct _VBVADIRTYREGION
LogFlow(("vbvaRgnDirtyRect: x = %d, y = %d, w = %d, h = %d\n", phdr->x, phdr->y, phdr->w, phdr->h));
static void vbvaSetMemoryFlags (VBVAMEMORY *pVbvaMemory, bool fVideoAccelEnabled, bool fVideoAccelVRDP)
if (pVbvaMemory)
if (fVideoAccelEnabled)
if (fVideoAccelVRDP)
if (!VideoAccelAllowed ())
return VERR_NOT_SUPPORTED;
if (!mfMachineRunning)
if (fEnable)
return rc;
return rc;
if (mfVideoAccelEnabled)
VideoAccelFlush ();
mfVideoAccelEnabled = false;
if (pVMMDevPort)
if (fEnable)
mfVideoAccelEnabled = true;
return rc;
AssertFailed ();
if (i32Diff <= 0)
if (pVMMDevPort)
static bool vbvaPartialRead (uint8_t **ppu8, uint32_t *pcb, uint32_t cbRecord, VBVAMEMORY *pVbvaMemory)
if (*ppu8)
if (!pu8New)
cbRecord));
if (*ppu8)
*pcb = 0;
#ifdef DEBUG_sunlover
#ifdef DEBUG_sunlover
if (mcbVbvaPartial)
LogFlow(("MAIN::DisplayImpl::vbvaFetchCmd: continue partial record mcbVbvaPartial = %d cbRecord 0x%08X, first = %d, free = %d\n",
mcbVbvaPartial = 0;
#ifdef DEBUG_sunlover
LogFlow(("MAIN::DisplayImpl::vbvaFetchCmd: started partial record mcbVbvaPartial = 0x%08X cbRecord 0x%08X, first = %d, free = %d\n",
if (!dst)
#ifdef DEBUG_sunlover
#ifdef DEBUG_sunlover
#ifdef DEBUG_sunlover
mcbVbvaPartial = 0;
#ifdef DEBUG_sunlover
if (!mfVideoAccelEnabled)
#ifdef DEBUG_sunlover
LogFlow(("Display::VideoAccelFlush: indexRecordFirst = %d, indexRecordFree = %d, off32Data = %d, off32Free = %d\n",
mpVbvaMemory->indexRecordFirst, mpVbvaMemory->indexRecordFree, mpVbvaMemory->off32Data, mpVbvaMemory->off32Free));
if (!fFramebufferIsNull)
Log(("Display::VideoAccelFlush: unable to fetch command. off32Data = %d, off32Free = %d. Disabling VBVA!!!\n",
if (!cbCmd)
if (!fFramebufferIsNull)
#ifdef DEBUG_sunlover
LogFlow(("MAIN::DisplayImpl::VideoAccelFlush: hdr: cbCmd = %d, x=%d, y=%d, w=%d, h=%d\n", cbCmd, phdr->x, phdr->y, phdr->w, phdr->h));
if (!fFramebufferIsNull)
return NULL;
DECLCALLBACK(int) VMDisplay::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
return VERR_PDM_MISSING_INTERFACE_ABOVE;
void *pv;
return rc;
return VINF_SUCCESS;
sizeof(DRVMAINDISPLAY),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,