VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h@ 76535

Last change on this file since 76535 was 76535, checked in by vboxsync, 6 years ago

Additions/x11: scm --fix-header-guards. bugref:9344

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 KB
Line 
1/* $Id: vboxvideo.h 76535 2018-12-30 06:17:14Z vboxsync $ */
2/** @file
3 * VirtualBox X11 Additions graphics driver
4 */
5
6/*
7 * Copyright (C) 2006-2017 Oracle Corporation
8 *
9 * This file is based on the X11 VESA driver:
10 *
11 * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included in
21 * all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
26 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
27 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
28 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
29 * USE OR OTHER DEALINGS IN THE SOFTWARE.
30 *
31 * Except as contained in this notice, the name of Conectiva Linux shall
32 * not be used in advertising or otherwise to promote the sale, use or other
33 * dealings in this Software without prior written authorization from
34 * Conectiva Linux.
35 *
36 * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
37 * Michael Thayer <michael.thayer@oracle.com>
38 */
39
40#ifndef _VBOXVIDEO_H_
41#define _VBOXVIDEO_H_
42#ifndef RT_WITHOUT_PRAGMA_ONCE
43# pragma once
44#endif
45
46#include <VBoxVideoGuest.h>
47#include <VBoxVideo.h>
48#include "version-generated.h"
49
50#define VBOX_VENDORID 0x80EE
51#define VBOX_DEVICEID 0xBEEF
52
53#ifndef VBVA_SCREEN_F_BLANK
54# define VBVA_SCREEN_F_BLANK 0x0004
55#endif
56
57#include <VBoxVideoVBE.h>
58
59#include "xf86.h"
60#include "xf86str.h"
61#include "xf86Cursor.h"
62
63#ifdef DEBUG
64
65#define TRACE_ENTRY() do { xf86ErrorF("%s: entering\n", __func__); } while(0)
66#define TRACE_EXIT() do { xf86ErrorF("%s: leaving\n", __func__); } while(0)
67#define TRACE_LINE() \
68 do { xf86ErrorF("%s: line\n", __func__, __LINE__); } while(0)
69#define TRACE_LOG(...) \
70do { \
71 xf86ErrorF("%s: ", __func__); \
72 xf86ErrorF(__VA_ARGS__); \
73} while(0)
74
75#else /* !DEBUG */
76
77#define TRACE_ENTRY() do { } while (0)
78#define TRACE_EXIT() do { } while (0)
79#define TRACE_LOG(...) do { } while (0)
80
81#endif /* !DEBUG */
82
83#define VBOX_VERSION VBOX_VERSION_MAJOR * 10000 \
84 + VBOX_VERSION_MINOR * 100
85#define VBOX_NAME "VBoxVideo"
86#define VBOX_DRIVER_NAME "vboxvideo"
87
88#define VBOX_VIDEO_MAJOR VBOX_VERSION_MAJOR
89#define VBOX_VIDEO_MINOR VBOX_VERSION_MINOR
90
91#define VBOX_VIDEO_MIN_SIZE 64
92#define VBOX_VIDEO_MAX_VIRTUAL (INT16_MAX - 1)
93
94#define VBOXPTR(p) ((VBOXPtr)((p)->driverPrivate))
95
96/** Helper to work round different ways of getting the root window in different
97 * server versions. */
98#if defined(XORG_VERSION_CURRENT) && XORG_VERSION_CURRENT < 70000000 \
99 && XORG_VERSION_CURRENT >= 10900000
100# define ROOT_WINDOW(pScrn) screenInfo.screens[(pScrn)->scrnIndex]->root
101#else
102# define ROOT_WINDOW(pScrn) WindowTable[(pScrn)->scrnIndex]
103#endif
104
105/** ChangeWindowProperty for X.Org Server 1.19 and later */
106#if defined(XORG_VERSION_CURRENT) && XORG_VERSION_CURRENT < 70000000 \
107 && XORG_VERSION_CURRENT >= 11900000
108# define ChangeWindowProperty(pWin, property, type, format, mode, \
109 len, value, sendevent) \
110 dixChangeWindowProperty(serverClient, pWin, property, type, format, \
111 mode, len, value, sendevent)
112#endif
113
114/** Structure containing all virtual monitor-specific information. */
115struct VBoxScreen
116{
117 /** Position information for each virtual screen for the purposes of
118 * sending dirty rectangle information to the right one. */
119 RTRECT2 aScreenLocation;
120 /** Is this CRTC enabled or in DPMS off state? */
121 Bool fPowerOn;
122#ifdef VBOXVIDEO_13
123 /** The virtual crtcs. */
124 struct _xf86Crtc *paCrtcs;
125 /** The virtual outputs, logically not distinct from crtcs. */
126 struct _xf86Output *paOutputs;
127#endif
128 /** Offsets of VBVA buffers in video RAM */
129 uint32_t aoffVBVABuffer;
130 /** Context information about the VBVA buffers for each screen */
131 struct VBVABUFFERCONTEXT aVbvaCtx;
132 /** The current preferred resolution for the screen */
133 RTRECTSIZE aPreferredSize;
134 /** The current preferred location for the screen. */
135 RTPOINT aPreferredLocation;
136 /** Has this screen been enabled by the host? */
137 Bool afConnected;
138 /** Does this screen have a preferred location? */
139 Bool afHaveLocation;
140};
141
142typedef struct VBOXRec
143{
144 EntityInfoPtr pEnt;
145#ifdef PCIACCESS
146 struct pci_device *pciInfo;
147#else
148 pciVideoPtr pciInfo;
149 PCITAG pciTag;
150#endif
151 void *base;
152 /** The amount of VRAM available for use as a framebuffer */
153 unsigned long cbFBMax;
154 /** The size of the framebuffer and the VBVA buffers at the end of it. */
155 unsigned long cbView;
156 /** Whether the pre-X-server mode was a VBE mode */
157 Bool fSavedVBEMode;
158 /** Paramters of the saved pre-X-server VBE mode, invalid if there is none
159 */
160 uint16_t cSavedWidth, cSavedHeight, cSavedPitch, cSavedBPP, fSavedFlags;
161 CloseScreenProcPtr CloseScreen;
162 /** Default X server procedure for enabling and disabling framebuffer access */
163 xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
164 OptionInfoPtr Options;
165 /** @todo we never actually free this */
166 xf86CursorInfoPtr pCurs;
167 /** Do we currently want to use the host cursor? */
168 Bool fUseHardwareCursor;
169 /** Number of screens attached */
170 uint32_t cScreens;
171 /** Information about each virtual screen. */
172 struct VBoxScreen *pScreens;
173 /** Can we get mode hint and cursor integration information from HGSMI? */
174 Bool fHaveHGSMIModeHints;
175 /** Does the host support the screen blanking flag? */
176 Bool fHostHasScreenBlankingFlag;
177 /** Array of structures for receiving mode hints. */
178 VBVAMODEHINT *paVBVAModeHints;
179#ifdef VBOXVIDEO_13
180# ifdef RT_OS_LINUX
181 /** Input device file descriptor for getting ACPI hot-plug events. */
182 int fdACPIDevices;
183 /** Input handler handle for ACPI hot-plug listener. */
184 void *hACPIEventHandler;
185# endif
186#endif
187 /** HGSMI guest heap context */
188 HGSMIGUESTCOMMANDCONTEXT guestCtx;
189 /** Unrestricted horizontal resolution flag. */
190 Bool fAnyX;
191} VBOXRec, *VBOXPtr;
192
193#define VBOXGetRec(pScrn) ((VBOXPtr)(pScrn)->driverPrivate)
194
195/* setmode.c */
196
197/** Structure describing the virtual frame buffer. It starts at the beginning
198 * of the video RAM. */
199struct vbvxFrameBuffer {
200 /** X offset of first screen in frame buffer. */
201 int x0;
202 /** Y offset of first screen in frame buffer. */
203 int y0;
204 /** Frame buffer virtual width. */
205 unsigned cWidth;
206 /** Frame buffer virtual height. */
207 unsigned cHeight;
208 /** Bits per pixel. */
209 unsigned cBPP;
210};
211
212extern void vbvxClearVRAM(ScrnInfoPtr pScrn, size_t cbOldSize, size_t cbNewSize);
213extern void vbvxSetMode(ScrnInfoPtr pScrn, unsigned cDisplay, unsigned cWidth, unsigned cHeight, int x, int y, Bool fEnabled,
214 Bool fConnected, struct vbvxFrameBuffer *pFrameBuffer);
215extern void vbvxSetSolarisMouseRange(int width, int height);
216
217/* pointer.h */
218extern Bool vbvxCursorInit(ScreenPtr pScreen);
219extern void vbvxCursorTerm(VBOXPtr pVBox);
220
221/* vbva.c */
222extern void vbvxHandleDirtyRect(ScrnInfoPtr pScrn, int iRects, BoxPtr aRects);
223extern void vbvxSetUpHGSMIHeapInGuest(VBOXPtr pVBox, uint32_t cbVRAM);
224extern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
225extern void vboxDisableVbva(ScrnInfoPtr pScrn);
226
227/* getmode.c */
228extern void vboxAddModes(ScrnInfoPtr pScrn);
229extern void VBoxInitialiseSizeHints(ScrnInfoPtr pScrn);
230extern void vbvxReadSizesAndCursorIntegrationFromProperties(ScrnInfoPtr pScrn, Bool *pfNeedUpdate);
231extern void vbvxReadSizesAndCursorIntegrationFromHGSMI(ScrnInfoPtr pScrn, Bool *pfNeedUpdate);
232extern void vbvxSetUpLinuxACPI(ScreenPtr pScreen);
233extern void vbvxCleanUpLinuxACPI(ScreenPtr pScreen);
234
235/* EDID generation */
236#ifdef VBOXVIDEO_13
237extern Bool VBOXEDIDSet(struct _xf86Output *output, DisplayModePtr pmode);
238#endif
239
240#endif /* !_VBOXVIDEO_H_ */
241
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette