DisplayImpl.h revision 936fcb1f7dbf79c2567a06dfa11eeb87443475f0
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/* $Id$ */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/** @file
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * VirtualBox COM class implementation
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/*
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * Copyright (C) 2006-2008 Oracle Corporation
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync *
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * available from http://www.virtualbox.org. This file is free software;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * you can redistribute it and/or modify it under the terms of the GNU
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * General Public License (GPL) as published by the Free Software
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef ____H_DISPLAYIMPL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#define ____H_DISPLAYIMPL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include "VirtualBoxBase.h"
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include "SchemaDefs.h"
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include <iprt/semaphore.h>
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include <VBox/pdmdrv.h>
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include <VBox/VMMDev.h>
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include <VBox/VBoxVideo.h>
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncclass Console;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncenum {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ResizeStatus_Void,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ResizeStatus_InProgress,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ResizeStatus_UpdateDisplayData
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync};
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsynctypedef struct _DISPLAYFBINFO
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t u32Offset;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t u32MaxFramebufferSize;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t u32InformationSize;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ComPtr<IFramebuffer> pFramebuffer;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LONG xOrigin;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LONG yOrigin;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ULONG w;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ULONG h;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint16_t u16BitsPerPixel;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint8_t *pu8FramebufferVRAM;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t u32LineSize;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync VBOXVIDEOINFOHOSTEVENTS *pHostEvents;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync volatile uint32_t u32ResizeStatus;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* The Framebuffer has default format and must be updates immediately. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync bool fDefaultFormat;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync struct {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* The rectangle that includes all dirty rectangles. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int32_t xLeft;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int32_t xRight;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int32_t yTop;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int32_t yBottom;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync } dirtyRect;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync struct {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync bool fPending;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ULONG pixelFormat;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void *pvVRAM;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t bpp;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t cbLine;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int w;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int h;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync } pendingResize;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifdef VBOX_WITH_HGSMI
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync bool fVBVAEnabled;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t cVBVASkipUpdate;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync struct {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int32_t xLeft;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int32_t yTop;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int32_t xRight;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int32_t yBottom;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync } vbvaSkippedRect;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync PVBVAHOSTFLAGS pVBVAHostFlags;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_HGSMI */
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync} DISPLAYFBINFO;
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync
87c5113417e917cdf64545d4f8e0a27047cea783vboxsyncclass ATL_NO_VTABLE Display :
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync public VirtualBoxBase,
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync VBOX_SCRIPTABLE_IMPL(IEventListener),
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync VBOX_SCRIPTABLE_IMPL(IDisplay)
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncpublic:
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Display, IDisplay)
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync DECLARE_NOT_AGGREGATABLE(Display)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync DECLARE_PROTECT_FINAL_CONSTRUCT()
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync BEGIN_COM_MAP(Display)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync COM_INTERFACE_ENTRY(ISupportErrorInfo)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync COM_INTERFACE_ENTRY(IDisplay)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync COM_INTERFACE_ENTRY2(IDispatch,IDisplay)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync COM_INTERFACE_ENTRY(IEventListener)
476493afbafe452ee52b3b3b2bb77e07e5e56285vboxsync END_COM_MAP()
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync DECLARE_EMPTY_CTOR_DTOR (Display)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync HRESULT FinalConstruct();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void FinalRelease();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
dc45a8f3e936581748c248e00ce572cfe3ea331evboxsync // public initializer/uninitializer for internal purposes only
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync HRESULT init (Console *aParent);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void uninit();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int registerSSM(PVM pVM);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync // public methods only for internal purposes
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int handleDisplayResize (unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine, int w, int h);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void handleDisplayUpdateLegacy (int x, int y, int cx, int cy);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void handleDisplayUpdate (unsigned uScreenId, int x, int y, int w, int h);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void handleVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifdef VBOX_WITH_CRHGSMI
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void handleCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void handleCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync IFramebuffer *getFramebuffer()
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifdef MMSEAMLESS
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync int handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync int VideoAccelEnable (bool fEnable, VBVAMEMORY *pVbvaMemory);
476493afbafe452ee52b3b3b2bb77e07e5e56285vboxsync void VideoAccelFlush (void);
81c6115ff3bb02e166ee8f762d30c4ba5e3db08avboxsync
81c6115ff3bb02e166ee8f762d30c4ba5e3db08avboxsync bool VideoAccelAllowed (void);
81c6115ff3bb02e166ee8f762d30c4ba5e3db08avboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync void VideoAccelVRDP (bool fEnable);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync // IEventListener methods
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync STDMETHOD(HandleEvent)(IEvent * aEvent);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync // IDisplay methods
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync STDMETHOD(SetFramebuffer)(ULONG aScreenId, IFramebuffer *aFramebuffer);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync STDMETHOD(GetFramebuffer)(ULONG aScreenId, IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync STDMETHOD(SetVideoModeHint)(ULONG width, ULONG height, ULONG bitsPerPixel, ULONG display);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync STDMETHOD(TakeScreenShot)(ULONG aScreenId, BYTE *address, ULONG width, ULONG height);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync STDMETHOD(TakeScreenShotToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync STDMETHOD(TakeScreenShotPNGToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync STDMETHOD(DrawToScreen)(ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync STDMETHOD(InvalidateAndUpdate)();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync STDMETHOD(ResizeCompleted)(ULONG aScreenId);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync STDMETHOD(SetSeamlessMode)(BOOL enabled);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync STDMETHOD(CompleteVHWACommand)(BYTE *pCommand);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static const PDMDRVREG DrvReg;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncprivate:
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync void updateDisplayData(void);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifdef VBOX_WITH_CRHGSMI
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync void setupCrHgsmiData(void);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync void destructCrHgsmiData(void);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(int) changeFramebuffer(Display *that, IFramebuffer *aFB, unsigned uScreenId);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(int) displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(void) displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(void) displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(void) displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(void) displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(void) displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(void) displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync static DECLCALLBACK(void) displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifdef VBOX_WITH_CRHGSMI
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(void) displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(void) displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(void) displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(void) displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifdef VBOX_WITH_HGSMI
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(int) displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(void) displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(void) displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(void) displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, const PVBVACMDHDR pCmd, size_t cbCmd);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(void) displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y, uint32_t cx, uint32_t cy);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(int) displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(int) displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, const void *pvShape);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(void) displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(int) displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(void) displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static DECLCALLBACK(int) displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync Console * const mParent;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** Pointer to the associated display driver. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync struct DRVMAINDISPLAY *mpDrv;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** Pointer to the device instance for the VMM Device. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync PPDMDEVINS mpVMMDev;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** Set after the first attempt to find the VMM Device. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync bool mfVMMDevInited;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync unsigned mcMonitors;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync bool mFramebufferOpened;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* arguments of the last handleDisplayResize() call */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void *mLastAddress;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t mLastBytesPerLine;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t mLastBitsPerPixel;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int mLastWidth;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int mLastHeight;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync VBVAMEMORY *mpVbvaMemory;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync bool mfVideoAccelEnabled;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync bool mfVideoAccelVRDP;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t mfu32SupportedOrders;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int32_t volatile mcVideoAccelVRDPRefs;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync VBVAMEMORY *mpPendingVbvaMemory;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync bool mfPendingVideoAccelEnable;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync bool mfMachineRunning;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint8_t *mpu8VbvaPartial;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t mcbVbvaPartial;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifdef VBOX_WITH_CRHGSMI
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* for fast host hgcm calls */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync HGCMCVSHANDLE mhCrOglSvc;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync bool vbvaFetchCmd (VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void vbvaReleaseCmd (VBVACMDHDR *pHdr, int32_t cbCmd);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void handleResizeCompletedEMT (void);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifdef VBOX_WITH_OLD_VBVA_LOCK
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync RTCRITSECT mVBVALock;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync volatile uint32_t mfu32PendingVideoAccelDisable;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int vbvaLock(void);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void vbvaUnlock(void);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncpublic:
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncprivate:
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static void InvalidateAndUpdateEMT(Display *pDisplay);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int videoAccelRefreshProcess(void);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* Functions run under VBVA lock. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int videoAccelEnable (bool fEnable, VBVAMEMORY *pVbvaMemory);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync void videoAccelFlush (void);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_OLD_VBVA_LOCK */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifdef VBOX_WITH_HGSMI
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync volatile uint32_t mu32UpdateVBVAFlags;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync};
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncvoid gdImageCopyResampled (uint8_t *dst, uint8_t *src,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int dstX, int dstY,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int srcX, int srcY,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int dstW, int dstH, int srcW, int srcH);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncvoid BitmapScale32 (uint8_t *dst,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int dstW, int dstH,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync const uint8_t *src,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int iDeltaLine,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int srcW, int srcH);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncint DisplayMakePNG(uint8_t *pu8Data, uint32_t cx, uint32_t cy,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint8_t fLimitSize);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif // ____H_DISPLAYIMPL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/* vi: set tabstop=4 shiftwidth=4 expandtab: */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync