VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/xpdm/VBoxDisp.h@ 93115

Last change on this file since 93115 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

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