1 | /* $Id: Display.h 99890 2023-05-22 10:40:30Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox frontends: Basic Frontend (BFE):
|
---|
4 | * Declaration of Display class
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2023 Oracle and/or its affiliates.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox base platform packages, as
|
---|
11 | * available from https://www.virtualbox.org.
|
---|
12 | *
|
---|
13 | * This program is free software; you can redistribute it and/or
|
---|
14 | * modify it under the terms of the GNU General Public License
|
---|
15 | * as published by the Free Software Foundation, in version 3 of the
|
---|
16 | * License.
|
---|
17 | *
|
---|
18 | * This program is distributed in the hope that it will be useful, but
|
---|
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | * General Public License for more details.
|
---|
22 | *
|
---|
23 | * You should have received a copy of the GNU General Public License
|
---|
24 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
25 | *
|
---|
26 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
27 | */
|
---|
28 |
|
---|
29 | #ifndef VBOX_INCLUDED_SRC_VBoxBFE_Display_h
|
---|
30 | #define VBOX_INCLUDED_SRC_VBoxBFE_Display_h
|
---|
31 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
32 | # pragma once
|
---|
33 | #endif
|
---|
34 |
|
---|
35 | #include <iprt/semaphore.h>
|
---|
36 | #include <VBox/vmm/pdm.h>
|
---|
37 |
|
---|
38 | #include <VBox/com/defs.h>
|
---|
39 | #include "Framebuffer.h"
|
---|
40 |
|
---|
41 | class Display
|
---|
42 | {
|
---|
43 |
|
---|
44 | public:
|
---|
45 |
|
---|
46 | Display();
|
---|
47 | ~Display();
|
---|
48 |
|
---|
49 | // public methods only for internal purposes
|
---|
50 | static const PDMDRVREG DrvReg;
|
---|
51 |
|
---|
52 | uint32_t getWidth();
|
---|
53 | uint32_t getHeight();
|
---|
54 | uint32_t getBitsPerPixel();
|
---|
55 |
|
---|
56 | int SetFramebuffer(unsigned iScreenID, Framebuffer *pFramebuffer);
|
---|
57 | void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2,
|
---|
58 | int32_t *py2);
|
---|
59 |
|
---|
60 | void resetFramebuffer();
|
---|
61 |
|
---|
62 | void setRunning(void) { mfMachineRunning = true; };
|
---|
63 |
|
---|
64 | int i_handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM,
|
---|
65 | uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags,
|
---|
66 | int32_t xOrigin, int32_t yOrigin, bool fVGAResize);
|
---|
67 | void i_handleDisplayUpdate (int x, int y, int w, int h);
|
---|
68 |
|
---|
69 | void i_invalidateAndUpdateScreen(uint32_t aScreenId);
|
---|
70 |
|
---|
71 |
|
---|
72 | private:
|
---|
73 |
|
---|
74 | void updateDisplayData();
|
---|
75 |
|
---|
76 | static DECLCALLBACK(void*) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
|
---|
77 | static DECLCALLBACK(int) i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
|
---|
78 | static DECLCALLBACK(void) i_drvDestruct(PPDMDRVINS pDrvIns);
|
---|
79 | static DECLCALLBACK(void) i_drvPowerOff(PPDMDRVINS pDrvIns);
|
---|
80 | static DECLCALLBACK(int) i_displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
|
---|
81 | static DECLCALLBACK(void) i_displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
|
---|
82 | uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
|
---|
83 | static DECLCALLBACK(void) i_displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
|
---|
84 | static DECLCALLBACK(void) i_displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
|
---|
85 | static DECLCALLBACK(void) i_displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
|
---|
86 | static DECLCALLBACK(void) i_displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize);
|
---|
87 | static DECLCALLBACK(void) i_displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId);
|
---|
88 |
|
---|
89 | static DECLCALLBACK(void) i_doInvalidateAndUpdate(struct DRVMAINDISPLAY *mpDrv);
|
---|
90 | /** Pointer to the associated display driver. */
|
---|
91 | struct DRVMAINDISPLAY *mpDrv;
|
---|
92 |
|
---|
93 | Framebuffer *m_pFramebuffer;
|
---|
94 | bool mFramebufferOpened;
|
---|
95 |
|
---|
96 | bool mfMachineRunning;
|
---|
97 | volatile bool fVGAResizing;
|
---|
98 |
|
---|
99 | void handleResizeCompletedEMT (void);
|
---|
100 | volatile uint32_t mu32ResizeStatus;
|
---|
101 |
|
---|
102 | enum {
|
---|
103 | ResizeStatus_Void,
|
---|
104 | ResizeStatus_InProgress,
|
---|
105 | ResizeStatus_UpdateDisplayData
|
---|
106 | };
|
---|
107 | };
|
---|
108 |
|
---|
109 | #define DISPLAY_OID "e2ff0c7b-c02b-46d0-aa90-b9caf0f60561"
|
---|
110 |
|
---|
111 | #endif /* !VBOX_INCLUDED_SRC_VBoxBFE_Display_h */
|
---|