2 * ReactOS Generic Framebuffer display driver
4 * Copyright (C) 2004 Filip Navara
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.
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.
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.
21 #include "framebufacc.h"
23 static DRVFN DrvFunctionTable
[] =
25 {INDEX_DrvEnablePDEV
, (PFN
)DrvEnablePDEV
},
26 {INDEX_DrvCompletePDEV
, (PFN
)DrvCompletePDEV
},
27 {INDEX_DrvDisablePDEV
, (PFN
)DrvDisablePDEV
},
28 {INDEX_DrvEnableSurface
, (PFN
)DrvEnableSurface
},
29 {INDEX_DrvDisableSurface
, (PFN
)DrvDisableSurface
},
30 {INDEX_DrvAssertMode
, (PFN
)DrvAssertMode
},
31 {INDEX_DrvGetModes
, (PFN
)DrvGetModes
},
32 {INDEX_DrvSetPalette
, (PFN
)DrvSetPalette
},
33 {INDEX_DrvSetPointerShape
, (PFN
)DrvSetPointerShape
},
34 {INDEX_DrvMovePointer
, (PFN
)DrvMovePointer
}
41 * Initial driver entry point exported by the driver DLL. It fills in a
42 * DRVENABLEDATA structure with the driver's DDI version number and the
43 * calling addresses of all DDI functions supported by the driver.
55 if (cj
>= sizeof(DRVENABLEDATA
))
57 pded
->c
= sizeof(DrvFunctionTable
) / sizeof(DRVFN
);
58 pded
->pdrvfn
= DrvFunctionTable
;
59 pded
->iDriverVersion
= DDI_DRIVER_VERSION_NT5
;
71 * Returns a description of the physical device's characteristics to GDI.
80 IN LPWSTR pwszLogAddress
,
82 OUT HSURF
*phsurfPatterns
,
88 IN LPWSTR pwszDeviceName
,
94 ULONG returnedDataLength
= 0;
96 ppdev
= EngAllocMem(FL_ZERO_MEMORY
, sizeof(PDEV
), ALLOC_TAG
);
102 ppdev
->hDriver
= hDriver
;
104 if (!IntInitScreenInfo(ppdev
, pdm
, &GdiInfo
, &DevInfo
))
110 /* hw mouse pointer */
112 ppdev
->pPointerAttributes
= NULL
;
113 ppdev
->PointerAttributesSize
= 0;
115 /* Test see if the driver support hw mouse or not */
116 if (!EngDeviceIoControl(ppdev
->hDriver
,
117 IOCTL_VIDEO_QUERY_POINTER_CAPABILITIES
,
120 &ppdev
->PointerCapabilities
,
121 sizeof(VIDEO_POINTER_CAPABILITIES
),
122 &returnedDataLength
))
124 /* Test see if we got a hw mouse or not */
125 if ( (ppdev
->PointerCapabilities
.Flags
& VIDEO_MODE_MONO_POINTER
) ||
126 (ppdev
->PointerCapabilities
.Flags
& VIDEO_MODE_COLOR_POINTER
) )
128 /* determent the hw mouse mode */
129 if (!(ppdev
->PointerCapabilities
.Flags
& VIDEO_MODE_ASYNC_POINTER
))
131 DevInfo
.flGraphicsCaps
&= ~GCAPS_ASYNCMOVE
;
135 DevInfo
.flGraphicsCaps
|= GCAPS_ASYNCMOVE
;
141 if (!IntInitDefaultPalette(ppdev
, &DevInfo
))
147 memcpy(pdi
, &DevInfo
, min(sizeof(DEVINFO
), cjDevInfo
));
148 memcpy(pdevcaps
, &GdiInfo
, min(sizeof(GDIINFO
), cjCaps
));
150 return (DHPDEV
)ppdev
;
156 * Stores the GDI handle (hdev) of the physical device in dhpdev. The driver
157 * should retain this handle for use when calling GDI services.
168 ((PPDEV
)dhpdev
)->hDevEng
= hdev
;
174 * Release the resources allocated in DrvEnablePDEV. If a surface has been
175 * enabled DrvDisableSurface will have already been called.
185 if (((PPDEV
)dhpdev
)->DefaultPalette
)
187 EngDeletePalette(((PPDEV
)dhpdev
)->DefaultPalette
);
190 if (((PPDEV
)dhpdev
)->PaletteEntries
!= NULL
)
192 EngFreeMem(((PPDEV
)dhpdev
)->PaletteEntries
);