1 /*
2  * ReactOS Generic Framebuffer display driver
3  *
4  * Copyright (C) 2004 Filip Navara
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #include <stdarg.h>
22 #include <windef.h>
23 #include <guiddef.h>
24 #include <wingdi.h>
25 #include <winddi.h>
26 #include <winioctl.h>
27 #include <ntddvdeo.h>
28 
29 //#define EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
30 
31 typedef struct _PDEV
32 {
33    HANDLE hDriver;
34    HDEV hDevEng;
35    HSURF hSurfEng;
36    ULONG ModeIndex;
37    ULONG ScreenWidth;
38    ULONG ScreenHeight;
39    ULONG ScreenDelta;
40    BYTE BitsPerPixel;
41    ULONG RedMask;
42    ULONG GreenMask;
43    ULONG BlueMask;
44    BYTE PaletteShift;
45    PVOID ScreenPtr;
46    HPALETTE DefaultPalette;
47    PALETTEENTRY *PaletteEntries;
48 
49 #ifdef EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
50    VIDEO_POINTER_ATTRIBUTES PointerAttributes;
51    XLATEOBJ *PointerXlateObject;
52    HSURF PointerColorSurface;
53    HSURF PointerMaskSurface;
54    HSURF PointerSaveSurface;
55    POINTL PointerHotSpot;
56 #endif
57 
58    /* DirectX Support */
59    DWORD iDitherFormat;
60    ULONG MemHeight;
61    ULONG MemWidth;
62    DWORD dwHeap;
63    VIDEOMEMORY* pvmList;
64    BOOL bDDInitialized;
65    DDPIXELFORMAT ddpfDisplay;
66 } PDEV, *PPDEV;
67 
68 #define DEVICE_NAME	L"framebuf"
69 #define ALLOC_TAG	'FUBF'
70 
71 
72 DHPDEV APIENTRY
73 DrvEnablePDEV(
74    IN DEVMODEW *pdm,
75    IN LPWSTR pwszLogAddress,
76    IN ULONG cPat,
77    OUT HSURF *phsurfPatterns,
78    IN ULONG cjCaps,
79    OUT ULONG *pdevcaps,
80    IN ULONG cjDevInfo,
81    OUT DEVINFO *pdi,
82    IN HDEV hdev,
83    IN LPWSTR pwszDeviceName,
84    IN HANDLE hDriver);
85 
86 VOID APIENTRY
87 DrvCompletePDEV(
88    IN DHPDEV dhpdev,
89    IN HDEV hdev);
90 
91 VOID APIENTRY
92 DrvDisablePDEV(
93    IN DHPDEV dhpdev);
94 
95 HSURF APIENTRY
96 DrvEnableSurface(
97    IN DHPDEV dhpdev);
98 
99 VOID APIENTRY
100 DrvDisableSurface(
101    IN DHPDEV dhpdev);
102 
103 BOOL APIENTRY
104 DrvAssertMode(
105    IN DHPDEV dhpdev,
106    IN BOOL bEnable);
107 
108 ULONG APIENTRY
109 DrvGetModes(
110    IN HANDLE hDriver,
111    IN ULONG cjSize,
112    OUT DEVMODEW *pdm);
113 
114 BOOL APIENTRY
115 DrvSetPalette(
116    IN DHPDEV dhpdev,
117    IN PALOBJ *ppalo,
118    IN FLONG fl,
119    IN ULONG iStart,
120    IN ULONG cColors);
121 
122 ULONG APIENTRY
123 DrvSetPointerShape(
124    IN SURFOBJ *pso,
125    IN SURFOBJ *psoMask,
126    IN SURFOBJ *psoColor,
127    IN XLATEOBJ *pxlo,
128    IN LONG xHot,
129    IN LONG yHot,
130    IN LONG x,
131    IN LONG y,
132    IN RECTL *prcl,
133    IN FLONG fl);
134 
135 VOID APIENTRY
136 DrvMovePointer(
137    IN SURFOBJ *pso,
138    IN LONG x,
139    IN LONG y,
140    IN RECTL *prcl);
141 
142 BOOL
143 IntInitScreenInfo(
144    PPDEV ppdev,
145    LPDEVMODEW pDevMode,
146    PGDIINFO pGdiInfo,
147    PDEVINFO pDevInfo);
148 
149 BOOL
150 IntInitDefaultPalette(
151    PPDEV ppdev,
152    PDEVINFO pDevInfo);
153 
154 BOOL APIENTRY
155 IntSetPalette(
156    IN DHPDEV dhpdev,
157    IN PPALETTEENTRY ppalent,
158    IN ULONG iStart,
159    IN ULONG cColors);
160