VirtualBox

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

最後變更 在這個檔案從69474是 69346,由 vboxsync 提交於 7 年 前

vboxvideo: scm updates (mit license formatting, 'this file is based on' instead of 'this code is based on').

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 8.3 KB
 
1/* $Id: vboxvideo.h 69346 2017-10-26 13:36:28Z 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 <[email protected]>
37 * Michael Thayer <[email protected]>
38 */
39
40#ifndef _VBOXVIDEO_H_
41#define _VBOXVIDEO_H_
42
43#include <VBoxVideoGuest.h>
44#include <VBoxVideo.h>
45#include "version-generated.h"
46
47#define VBOX_VENDORID 0x80EE
48#define VBOX_DEVICEID 0xBEEF
49
50#ifndef VBVA_SCREEN_F_BLANK
51# define VBVA_SCREEN_F_BLANK 0x0004
52#endif
53
54#include <VBoxVideoVBE.h>
55
56#include "xf86.h"
57#include "xf86str.h"
58#include "xf86Cursor.h"
59
60#ifdef DEBUG
61
62#define TRACE_ENTRY() do { xf86ErrorF("%s: entering\n", __func__); } while(0)
63#define TRACE_EXIT() do { xf86ErrorF("%s: leaving\n", __func__); } while(0)
64#define TRACE_LINE() \
65 do { xf86ErrorF("%s: line\n", __func__, __LINE__); } while(0)
66#define TRACE_LOG(...) \
67do { \
68 xf86ErrorF("%s: ", __func__); \
69 xf86ErrorF(__VA_ARGS__); \
70} while(0)
71
72#else /* !DEBUG */
73
74#define TRACE_ENTRY() do { } while (0)
75#define TRACE_EXIT() do { } while (0)
76#define TRACE_LOG(...) do { } while (0)
77
78#endif /* !DEBUG */
79
80#define VBOX_VERSION VBOX_VERSION_MAJOR * 10000 \
81 + VBOX_VERSION_MINOR * 100
82#define VBOX_NAME "VBoxVideo"
83#define VBOX_DRIVER_NAME "vboxvideo"
84
85#define VBOX_VIDEO_MAJOR VBOX_VERSION_MAJOR
86#define VBOX_VIDEO_MINOR VBOX_VERSION_MINOR
87
88#define VBOX_VIDEO_MIN_SIZE 64
89#define VBOX_VIDEO_MAX_VIRTUAL (INT16_MAX - 1)
90
91#define VBOXPTR(p) ((VBOXPtr)((p)->driverPrivate))
92
93/** Helper to work round different ways of getting the root window in different
94 * server versions. */
95#if defined(XORG_VERSION_CURRENT) && XORG_VERSION_CURRENT < 70000000 \
96 && XORG_VERSION_CURRENT >= 10900000
97# define ROOT_WINDOW(pScrn) screenInfo.screens[(pScrn)->scrnIndex]->root
98#else
99# define ROOT_WINDOW(pScrn) WindowTable[(pScrn)->scrnIndex]
100#endif
101
102/** ChangeWindowProperty for X.Org Server 1.19 and later */
103#if defined(XORG_VERSION_CURRENT) && XORG_VERSION_CURRENT < 70000000 \
104 && XORG_VERSION_CURRENT >= 11900000
105# define ChangeWindowProperty(pWin, property, type, format, mode, \
106 len, value, sendevent) \
107 dixChangeWindowProperty(serverClient, pWin, property, type, format, \
108 mode, len, value, sendevent)
109#endif
110
111/** Structure containing all virtual monitor-specific information. */
112struct VBoxScreen
113{
114 /** Position information for each virtual screen for the purposes of
115 * sending dirty rectangle information to the right one. */
116 RTRECT2 aScreenLocation;
117 /** Is this CRTC enabled or in DPMS off state? */
118 Bool fPowerOn;
119#ifdef VBOXVIDEO_13
120 /** The virtual crtcs. */
121 struct _xf86Crtc *paCrtcs;
122 /** The virtual outputs, logically not distinct from crtcs. */
123 struct _xf86Output *paOutputs;
124#endif
125 /** Offsets of VBVA buffers in video RAM */
126 uint32_t aoffVBVABuffer;
127 /** Context information about the VBVA buffers for each screen */
128 struct VBVABUFFERCONTEXT aVbvaCtx;
129 /** The current preferred resolution for the screen */
130 RTRECTSIZE aPreferredSize;
131 /** The current preferred location for the screen. */
132 RTPOINT aPreferredLocation;
133 /** Has this screen been enabled by the host? */
134 Bool afConnected;
135 /** Does this screen have a preferred location? */
136 Bool afHaveLocation;
137};
138
139typedef struct VBOXRec
140{
141 EntityInfoPtr pEnt;
142#ifdef PCIACCESS
143 struct pci_device *pciInfo;
144#else
145 pciVideoPtr pciInfo;
146 PCITAG pciTag;
147#endif
148 void *base;
149 /** The amount of VRAM available for use as a framebuffer */
150 unsigned long cbFBMax;
151 /** The size of the framebuffer and the VBVA buffers at the end of it. */
152 unsigned long cbView;
153 /** Whether the pre-X-server mode was a VBE mode */
154 Bool fSavedVBEMode;
155 /** Paramters of the saved pre-X-server VBE mode, invalid if there is none
156 */
157 uint16_t cSavedWidth, cSavedHeight, cSavedPitch, cSavedBPP, fSavedFlags;
158 CloseScreenProcPtr CloseScreen;
159 /** Default X server procedure for enabling and disabling framebuffer access */
160 xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
161 OptionInfoPtr Options;
162 /** @todo we never actually free this */
163 xf86CursorInfoPtr pCurs;
164 /** Do we currently want to use the host cursor? */
165 Bool fUseHardwareCursor;
166 /** Number of screens attached */
167 uint32_t cScreens;
168 /** Information about each virtual screen. */
169 struct VBoxScreen *pScreens;
170 /** Can we get mode hint and cursor integration information from HGSMI? */
171 Bool fHaveHGSMIModeHints;
172 /** Does the host support the screen blanking flag? */
173 Bool fHostHasScreenBlankingFlag;
174 /** Array of structures for receiving mode hints. */
175 VBVAMODEHINT *paVBVAModeHints;
176#ifdef VBOXVIDEO_13
177# ifdef RT_OS_LINUX
178 /** Input device file descriptor for getting ACPI hot-plug events. */
179 int fdACPIDevices;
180 /** Input handler handle for ACPI hot-plug listener. */
181 void *hACPIEventHandler;
182# endif
183#endif
184 /** HGSMI guest heap context */
185 HGSMIGUESTCOMMANDCONTEXT guestCtx;
186 /** Unrestricted horizontal resolution flag. */
187 Bool fAnyX;
188} VBOXRec, *VBOXPtr;
189
190#define VBOXGetRec(pScrn) ((VBOXPtr)(pScrn)->driverPrivate)
191
192/* setmode.c */
193
194/** Structure describing the virtual frame buffer. It starts at the beginning
195 * of the video RAM. */
196struct vbvxFrameBuffer {
197 /** X offset of first screen in frame buffer. */
198 int x0;
199 /** Y offset of first screen in frame buffer. */
200 int y0;
201 /** Frame buffer virtual width. */
202 unsigned cWidth;
203 /** Frame buffer virtual height. */
204 unsigned cHeight;
205 /** Bits per pixel. */
206 unsigned cBPP;
207};
208
209extern void vbvxClearVRAM(ScrnInfoPtr pScrn, size_t cbOldSize, size_t cbNewSize);
210extern void vbvxSetMode(ScrnInfoPtr pScrn, unsigned cDisplay, unsigned cWidth, unsigned cHeight, int x, int y, Bool fEnabled,
211 Bool fConnected, struct vbvxFrameBuffer *pFrameBuffer);
212extern void vbvxSetSolarisMouseRange(int width, int height);
213
214/* pointer.h */
215extern Bool vbvxCursorInit(ScreenPtr pScreen);
216extern void vbvxCursorTerm(VBOXPtr pVBox);
217
218/* vbva.c */
219extern void vbvxHandleDirtyRect(ScrnInfoPtr pScrn, int iRects, BoxPtr aRects);
220extern void vbvxSetUpHGSMIHeapInGuest(VBOXPtr pVBox, uint32_t cbVRAM);
221extern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
222extern void vboxDisableVbva(ScrnInfoPtr pScrn);
223
224/* getmode.c */
225extern void vboxAddModes(ScrnInfoPtr pScrn);
226extern void VBoxInitialiseSizeHints(ScrnInfoPtr pScrn);
227extern void vbvxReadSizesAndCursorIntegrationFromProperties(ScrnInfoPtr pScrn, Bool *pfNeedUpdate);
228extern void vbvxReadSizesAndCursorIntegrationFromHGSMI(ScrnInfoPtr pScrn, Bool *pfNeedUpdate);
229extern void vbvxSetUpLinuxACPI(ScreenPtr pScreen);
230extern void vbvxCleanUpLinuxACPI(ScreenPtr pScreen);
231
232/* EDID generation */
233#ifdef VBOXVIDEO_13
234extern Bool VBOXEDIDSet(struct _xf86Output *output, DisplayModePtr pmode);
235#endif
236
237#endif /* !_VBOXVIDEO_H_ */
238
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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