1 | /* $Id: VBoxDisp.h 43467 2012-09-28 14:53:20Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox XPDM Display driver
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2011 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef VBOXDISP_H
|
---|
20 | #define VBOXDISP_H
|
---|
21 |
|
---|
22 | #include "VBoxDispInternal.h"
|
---|
23 | #include "VBoxDispVrdpBmp.h"
|
---|
24 |
|
---|
25 | /* VirtualBox display driver version, could be seen in Control Panel */
|
---|
26 | #define VBOXDISPDRIVERVERSION 0x01UL
|
---|
27 |
|
---|
28 | #if (VBOXDISPDRIVERVERSION & (~0xFFUL))
|
---|
29 | #error VBOXDISPDRIVERVERSION can't be more than 0xFF
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #define VBOXDISP_DEVICE_NAME L"VBoxDisp"
|
---|
33 |
|
---|
34 | /* Current mode info */
|
---|
35 | typedef struct _VBOXDISPCURRENTMODE
|
---|
36 | {
|
---|
37 | ULONG ulIndex; /* miniport's video mode index */
|
---|
38 | ULONG ulWidth, ulHeight; /* visible screen width and height */
|
---|
39 | ULONG ulBitsPerPel; /* number of bits per pel */
|
---|
40 | LONG lScanlineStride; /* distance between scanlines */
|
---|
41 | FLONG flMaskR, flMaskG, flMaskB; /* RGB mask */
|
---|
42 | ULONG ulPaletteShift; /* number of bits we have to shift 888 palette to match device palette */
|
---|
43 | } VBOXDISPCURRENTMODE, *PVBOXDISPCURRENTMODE;
|
---|
44 |
|
---|
45 | /* Pointer related info */
|
---|
46 | typedef struct _VBOXDISPPOINTERINFO
|
---|
47 | {
|
---|
48 | VIDEO_POINTER_CAPABILITIES caps; /* Pointer capabilities */
|
---|
49 | PVIDEO_POINTER_ATTRIBUTES pAttrs; /* Preallocated buffer to pass pointer shape to miniport driver */
|
---|
50 | DWORD cbAttrs; /* Size of pAttrs buffer */
|
---|
51 | POINTL orgHotSpot; /* Hot spot origin */
|
---|
52 | } VBOXDISPPOINTERINFO, *PVBOXDISPPOINTERINFO;
|
---|
53 |
|
---|
54 | /* Surface info */
|
---|
55 | typedef struct _VBOXDISPSURF
|
---|
56 | {
|
---|
57 | HBITMAP hBitmap; /* GDI's handle to framebuffer bitmap */
|
---|
58 | SURFOBJ* psoBitmap; /* lock pointer to framebuffer bitmap */
|
---|
59 | HSURF hSurface; /* GDI's handle to framebuffer device-managed surface */
|
---|
60 | ULONG ulFormat; /* Bitmap format, one of BMF_XXBPP */
|
---|
61 | } VBOXDISPSURF, *PVBOXDISPSURF;
|
---|
62 |
|
---|
63 | /* VRAM Layout */
|
---|
64 | typedef struct _VBOXDISPVRAMLAYOUT
|
---|
65 | {
|
---|
66 | ULONG cbVRAM;
|
---|
67 |
|
---|
68 | ULONG offFramebuffer, cbFramebuffer;
|
---|
69 | ULONG offDDrawHeap, cbDDrawHeap;
|
---|
70 | ULONG offVBVABuffer, cbVBVABuffer;
|
---|
71 | ULONG offDisplayInfo, cbDisplayInfo;
|
---|
72 | } VBOXDISPVRAMLAYOUT;
|
---|
73 |
|
---|
74 | /* HGSMI info */
|
---|
75 | typedef struct _VBOXDISPHGSMIINFO
|
---|
76 | {
|
---|
77 | BOOL bSupported; /* HGSMI is supported and enabled */
|
---|
78 |
|
---|
79 | HGSMIQUERYCALLBACKS mp; /* HGSMI miniport's callbacks and context */
|
---|
80 | HGSMIGUESTCOMMANDCONTEXT ctx; /* HGSMI guest context */
|
---|
81 | } VBOXDISPHGSMIINFO;
|
---|
82 |
|
---|
83 | /* Saved screen bits information. */
|
---|
84 | typedef struct _SSB
|
---|
85 | {
|
---|
86 | ULONG ident; /* 1 based index in the stack = the handle returned by VBoxDispDrvSaveScreenBits (SS_SAVE) */
|
---|
87 | BYTE *pBuffer; /* Buffer where screen bits are saved. */
|
---|
88 | } SSB;
|
---|
89 |
|
---|
90 | #ifdef VBOX_WITH_DDRAW
|
---|
91 | /* DirectDraw surface lock information */
|
---|
92 | typedef struct _VBOXDDLOCKINFO
|
---|
93 | {
|
---|
94 | BOOL bLocked;
|
---|
95 | RECTL rect;
|
---|
96 | } VBOXDDLOCKINFO;
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | /* Structure holding driver private device info. */
|
---|
100 | typedef struct _VBOXDISPDEV
|
---|
101 | {
|
---|
102 | HANDLE hDriver; /* Display device handle which was passed to VBoxDispDrvEnablePDEV */
|
---|
103 | HDEV hDevGDI; /* GDI's handle for PDEV created in VBoxDispDrvEnablePDEV */
|
---|
104 |
|
---|
105 | VBOXDISPCURRENTMODE mode; /* Current device mode */
|
---|
106 | ULONG iDevice; /* Miniport's device index */
|
---|
107 | POINTL orgDev; /* Device origin for DualView (0,0 is primary) */
|
---|
108 | POINTL orgDisp; /* Display origin in virtual desktop, NT4 only */
|
---|
109 |
|
---|
110 | VBOXDISPPOINTERINFO pointer; /* Pointer info */
|
---|
111 |
|
---|
112 | HPALETTE hDefaultPalette; /* Default palette handle */
|
---|
113 | PALETTEENTRY *pPalette; /* Palette entries for device managed palette */
|
---|
114 |
|
---|
115 | VBOXDISPSURF surface; /* Device surface */
|
---|
116 | FLONG flDrawingHooks; /* Enabled drawing hooks */
|
---|
117 |
|
---|
118 | VIDEO_MEMORY_INFORMATION memInfo; /* Mapped Framebuffer/vram info */
|
---|
119 | VBOXDISPVRAMLAYOUT layout; /* VRAM layout information */
|
---|
120 |
|
---|
121 | VBOXDISPHGSMIINFO hgsmi; /* HGSMI Info */
|
---|
122 | HGSMIQUERYCPORTPROCS vpAPI; /* Video Port API callbacks and miniport's context */
|
---|
123 |
|
---|
124 | VBVABUFFERCONTEXT vbvaCtx; /* VBVA context */
|
---|
125 | VRDPBC vrdpCache; /* VRDP bitmap cache */
|
---|
126 |
|
---|
127 | ULONG cSSB; /* Number of active saved screen bits records in the following array. */
|
---|
128 | SSB aSSB[4]; /* LIFO type stack for saved screen areas. */
|
---|
129 |
|
---|
130 | #ifdef VBOX_WITH_DDRAW
|
---|
131 | VBOXDDLOCKINFO ddpsLock; /* Primary surface DirectDraw lock information */
|
---|
132 | #endif
|
---|
133 |
|
---|
134 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
135 | VBOXDISPVHWAINFO vhwa; /* VHWA Info */
|
---|
136 | #endif
|
---|
137 | } VBOXDISPDEV, *PVBOXDISPDEV;
|
---|
138 |
|
---|
139 | /* -------------------- Driver callbacks -------------------- */
|
---|
140 | RT_C_DECLS_BEGIN
|
---|
141 | ULONG APIENTRY DriverEntry(IN PVOID Context1, IN PVOID Context2);
|
---|
142 | RT_C_DECLS_END
|
---|
143 |
|
---|
144 | DHPDEV APIENTRY VBoxDispDrvEnablePDEV(DEVMODEW *pdm, LPWSTR pwszLogAddress,
|
---|
145 | ULONG cPat, HSURF *phsurfPatterns,
|
---|
146 | ULONG cjCaps, ULONG *pdevcaps,
|
---|
147 | ULONG cjDevInfo, DEVINFO *pdi,
|
---|
148 | HDEV hdev, PWSTR pwszDeviceName, HANDLE hDriver);
|
---|
149 | VOID APIENTRY VBoxDispDrvCompletePDEV(DHPDEV dhpdev, HDEV hdev);
|
---|
150 | VOID APIENTRY VBoxDispDrvDisablePDEV(DHPDEV dhpdev);
|
---|
151 | HSURF APIENTRY VBoxDispDrvEnableSurface(DHPDEV dhpdev);
|
---|
152 | VOID APIENTRY VBoxDispDrvDisableSurface(DHPDEV dhpdev);
|
---|
153 |
|
---|
154 | BOOL APIENTRY VBoxDispDrvLineTo(SURFOBJ *pso, CLIPOBJ *pco, BRUSHOBJ *pbo,
|
---|
155 | LONG x1, LONG y1, LONG x2, LONG y2, RECTL *prclBounds, MIX mix);
|
---|
156 | BOOL APIENTRY VBoxDispDrvStrokePath(SURFOBJ *pso, PATHOBJ *ppo, CLIPOBJ *pco, XFORMOBJ *pxo,
|
---|
157 | BRUSHOBJ *pbo, POINTL *pptlBrushOrg, LINEATTRS *plineattrs, MIX mix);
|
---|
158 |
|
---|
159 | BOOL APIENTRY VBoxDispDrvFillPath(SURFOBJ *pso, PATHOBJ *ppo, CLIPOBJ *pco, BRUSHOBJ *pbo, POINTL *pptlBrushOrg,
|
---|
160 | MIX mix, FLONG flOptions);
|
---|
161 | BOOL APIENTRY VBoxDispDrvPaint(SURFOBJ *pso, CLIPOBJ *pco, BRUSHOBJ *pbo, POINTL *pptlBrushOrg, MIX mix);
|
---|
162 |
|
---|
163 | BOOL APIENTRY VBoxDispDrvRealizeBrush(BRUSHOBJ *pbo, SURFOBJ *psoTarget, SURFOBJ *psoPattern, SURFOBJ *psoMask,
|
---|
164 | XLATEOBJ *pxlo, ULONG iHatch);
|
---|
165 | ULONG APIENTRY VBoxDispDrvDitherColor(DHPDEV dhpdev, ULONG iMode, ULONG rgb, ULONG *pul);
|
---|
166 |
|
---|
167 | BOOL APIENTRY VBoxDispDrvBitBlt(SURFOBJ *psoTrg, SURFOBJ *psoSrc, SURFOBJ *psoMask, CLIPOBJ *pco, XLATEOBJ *pxlo,
|
---|
168 | RECTL *prclTrg, POINTL *pptlSrc, POINTL *pptlMask, BRUSHOBJ *pbo, POINTL *pptlBrush,
|
---|
169 | ROP4 rop4);
|
---|
170 | BOOL APIENTRY VBoxDispDrvStretchBlt(SURFOBJ *psoDest, SURFOBJ *psoSrc, SURFOBJ *psoMask, CLIPOBJ *pco, XLATEOBJ *pxlo,
|
---|
171 | COLORADJUSTMENT *pca, POINTL *pptlHTOrg, RECTL *prclDest, RECTL *prclSrc,
|
---|
172 | POINTL *pptlMask, ULONG iMode);
|
---|
173 | BOOL APIENTRY VBoxDispDrvCopyBits(SURFOBJ *psoDest, SURFOBJ *psoSrc, CLIPOBJ *pco, XLATEOBJ *pxlo,
|
---|
174 | RECTL *prclDest, POINTL *pptlSrc);
|
---|
175 |
|
---|
176 | ULONG APIENTRY VBoxDispDrvSetPointerShape(SURFOBJ *pso, SURFOBJ *psoMask, SURFOBJ *psoColor, XLATEOBJ *pxlo,
|
---|
177 | LONG xHot, LONG yHot, LONG x, LONG y, RECTL *prcl, FLONG fl);
|
---|
178 | VOID APIENTRY VBoxDispDrvMovePointer(SURFOBJ *pso, LONG x, LONG y, RECTL *prcl);
|
---|
179 |
|
---|
180 | BOOL APIENTRY VBoxDispDrvAssertMode(DHPDEV dhpdev, BOOL bEnable);
|
---|
181 | VOID APIENTRY VBoxDispDrvDisableDriver();
|
---|
182 | BOOL APIENTRY VBoxDispDrvTextOut(SURFOBJ *pso, STROBJ *pstro, FONTOBJ *pfo, CLIPOBJ *pco,
|
---|
183 | RECTL *prclExtra, RECTL *prclOpaque, BRUSHOBJ *pboFore,
|
---|
184 | BRUSHOBJ *pboOpaque, POINTL *pptlOrg, MIX mix);
|
---|
185 | BOOL APIENTRY VBoxDispDrvSetPalette(DHPDEV dhpdev, PALOBJ *ppalo, FLONG fl, ULONG iStart, ULONG cColors);
|
---|
186 | ULONG APIENTRY VBoxDispDrvEscape(SURFOBJ *pso, ULONG iEsc, ULONG cjIn, PVOID pvIn, ULONG cjOut, PVOID pvOut);
|
---|
187 | ULONG_PTR APIENTRY VBoxDispDrvSaveScreenBits(SURFOBJ *pso, ULONG iMode, ULONG_PTR ident, RECTL *prcl);
|
---|
188 | ULONG APIENTRY VBoxDispDrvGetModes(HANDLE hDriver, ULONG cjSize, DEVMODEW *pdm);
|
---|
189 | BOOL APIENTRY VBoxDispDrvOffset(SURFOBJ* pso, LONG x, LONG y, FLONG flReserved);
|
---|
190 |
|
---|
191 | VOID APIENTRY VBoxDispDrvNotify(SURFOBJ *pso, ULONG iType, PVOID pvData);
|
---|
192 |
|
---|
193 | #ifdef VBOX_WITH_DDRAW
|
---|
194 | BOOL APIENTRY VBoxDispDrvGetDirectDrawInfo(DHPDEV dhpdev, DD_HALINFO *pHalInfo, DWORD *pdwNumHeaps,
|
---|
195 | VIDEOMEMORY *pvmList, DWORD *pdwNumFourCCCodes, DWORD *pdwFourCC);
|
---|
196 | BOOL APIENTRY VBoxDispDrvEnableDirectDraw(DHPDEV dhpdev, DD_CALLBACKS *pCallBacks,
|
---|
197 | DD_SURFACECALLBACKS *pSurfaceCallBacks,
|
---|
198 | DD_PALETTECALLBACKS *pPaletteCallBacks);
|
---|
199 | VOID APIENTRY VBoxDispDrvDisableDirectDraw(DHPDEV dhpdev);
|
---|
200 | HBITMAP APIENTRY VBoxDispDrvDeriveSurface(DD_DIRECTDRAW_GLOBAL *pDirectDraw, DD_SURFACE_LOCAL *pSurface);
|
---|
201 | #endif /*#ifdef VBOX_WITH_DDRAW*/
|
---|
202 |
|
---|
203 | /* -------------------- Internal helpers -------------------- */
|
---|
204 | DECLINLINE(SURFOBJ) *getSurfObj(SURFOBJ *pso)
|
---|
205 | {
|
---|
206 | if (pso)
|
---|
207 | {
|
---|
208 | PVBOXDISPDEV pDev = (PVBOXDISPDEV)pso->dhpdev;
|
---|
209 |
|
---|
210 | if (pDev && pDev->surface.psoBitmap && pso->hsurf == pDev->surface.hSurface)
|
---|
211 | {
|
---|
212 | /* Convert the device PSO to the bitmap PSO which can be passed to Eng*. */
|
---|
213 | pso = pDev->surface.psoBitmap;
|
---|
214 | }
|
---|
215 | }
|
---|
216 |
|
---|
217 | return pso;
|
---|
218 | }
|
---|
219 |
|
---|
220 | #endif /*VBOXDISP_H*/
|
---|