DisplayImpl.cpp revision cba6719bd64ec749967bbe931230452664109857
59190ecd61435d19ba3515b876272aee7bd12298vboxsync * VBox frontends: Basic Frontend (BFE):
59190ecd61435d19ba3515b876272aee7bd12298vboxsync * Implementation of VMDisplay class
59190ecd61435d19ba3515b876272aee7bd12298vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
c55c68b6a3324172e9dc207926215845880b0f90vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
c55c68b6a3324172e9dc207926215845880b0f90vboxsync * available from http://www.virtualbox.org. This file is free software;
c55c68b6a3324172e9dc207926215845880b0f90vboxsync * you can redistribute it and/or modify it under the terms of the GNU
c55c68b6a3324172e9dc207926215845880b0f90vboxsync * General Public License (GPL) as published by the Free Software
c55c68b6a3324172e9dc207926215845880b0f90vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
c55c68b6a3324172e9dc207926215845880b0f90vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
59190ecd61435d19ba3515b876272aee7bd12298vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
59190ecd61435d19ba3515b876272aee7bd12298vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
772269936494ffaddd0750ba9e28e805ba81398cvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
59190ecd61435d19ba3515b876272aee7bd12298vboxsync * additional information or have any questions.
59190ecd61435d19ba3515b876272aee7bd12298vboxsync/*******************************************************************************
59190ecd61435d19ba3515b876272aee7bd12298vboxsync* Structures and Typedefs *
59190ecd61435d19ba3515b876272aee7bd12298vboxsync*******************************************************************************/
59190ecd61435d19ba3515b876272aee7bd12298vboxsync * VMDisplay driver instance data.
59190ecd61435d19ba3515b876272aee7bd12298vboxsync /** Pointer to the display object. */
59190ecd61435d19ba3515b876272aee7bd12298vboxsync /** Pointer to the driver instance structure. */
59190ecd61435d19ba3515b876272aee7bd12298vboxsync /** Pointer to the keyboard port interface of the driver/device above us. */
59190ecd61435d19ba3515b876272aee7bd12298vboxsync /** Our display connector interface. */
59190ecd61435d19ba3515b876272aee7bd12298vboxsync/** Converts PDMIDISPLAYCONNECTOR pointer to a DRVMAINDISPLAY pointer. */
772269936494ffaddd0750ba9e28e805ba81398cvboxsync#define PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface) ( (PDRVMAINDISPLAY) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINDISPLAY, Connector)) )
mfVideoAccelEnabled = false;
mfPendingVideoAccelEnable = false;
mfMachineRunning = false;
mcbVbvaPartial = 0;
mFramebufferOpened = false;
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)
switch (enmInterface)
case PDMINTERFACE_BASE:
return NULL;
DECLCALLBACK(int) VMDisplay::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
pData->pUpPort = (PPDMIDISPLAYPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_DISPLAY_PORT);
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,