7
7
*/
8
8
9
9
#include <win32k.h>
10
- #define NDEBUG
11
- #include <debug.h>
10
+ DBG_DEFAULT_CHANNEL (EngPDev );
12
11
13
12
PPDEVOBJ gppdevPrimary = NULL ;
14
13
@@ -104,8 +103,7 @@ PDEVOBJ_bEnablePDEV(
104
103
PWSTR pwszLogAddress )
105
104
{
106
105
PFN_DrvEnablePDEV pfnEnablePDEV ;
107
-
108
- DPRINT ("PDEVOBJ_bEnablePDEV()\n" );
106
+ TRACE ("PDEVOBJ_bEnablePDEV()\n" );
109
107
110
108
/* Get the DrvEnablePDEV function */
111
109
pfnEnablePDEV = ppdev -> pldev -> pfn .EnablePDEV ;
@@ -136,8 +134,7 @@ PDEVOBJ_bEnablePDEV(
136
134
/* Setup Palette */
137
135
ppdev -> ppalSurf = PALETTE_ShareLockPalette (ppdev -> devinfo .hpalDefault );
138
136
139
- DPRINT ("PDEVOBJ_bEnablePDEV - dhpdev = %p\n" , ppdev -> dhpdev );
140
-
137
+ TRACE ("PDEVOBJ_bEnablePDEV - dhpdev = %p\n" , ppdev -> dhpdev );
141
138
return TRUE;
142
139
}
143
140
@@ -153,16 +150,18 @@ PDEVOBJ_vCompletePDEV(
153
150
PPDEVOBJ
154
151
NTAPI
155
152
PDEVOBJ_CreatePDEV (
156
- PLDEVOBJ pldev )
153
+ PLDEVOBJ pldev ,
154
+ PGRAPHICS_DEVICE pGraphicsDevice ,
155
+ PDEVMODEW pdevmode ,
156
+ PWSTR pwszLogAddress )
157
157
{
158
158
PPDEVOBJ ppdev ;
159
- LDEVTYPE ldevtype ;
160
159
161
160
/* Allocate a new PDEVOBJ */
162
161
ppdev = ExAllocatePoolWithTag (PagedPool , sizeof (PDEVOBJ ), GDITAG_PDEV );
163
162
if (!ppdev )
164
163
{
165
- DPRINT1 ("failed to allocate a PDEV\n" );
164
+ ERR ("failed to allocate a PDEV\n" );
166
165
return FALSE;
167
166
}
168
167
@@ -177,37 +176,61 @@ PDEVOBJ_CreatePDEV(
177
176
/* Copy the function table from the LDEVOBJ */
178
177
ppdev -> pfn = ppdev -> pldev -> pfn ;
179
178
179
+ /* Set the graphics device */
180
+ ppdev -> pGraphicsDevice = pGraphicsDevice ;
181
+
180
182
/* Allocate the device lock semaphore */
181
183
ppdev -> hsemDevLock = EngCreateSemaphore ();
182
184
if (!ppdev -> hsemDevLock )
183
185
{
184
- DPRINT1 ("Failed to create semaphore\n" );
186
+ ERR ("Failed to create semaphore\n" );
185
187
ExFreePoolWithTag (ppdev , GDITAG_PDEV );
186
188
return FALSE;
187
189
}
188
190
189
191
/* Call the drivers DrvEnablePDEV function */
190
- if (!PDEVOBJ_bEnablePDEV (ppdev , NULL , NULL ))
192
+ if (!PDEVOBJ_bEnablePDEV (ppdev , pdevmode , NULL ))
191
193
{
192
- DPRINT1 ("Failed to enable PDEV\n" );
194
+ ERR ("Failed to enable PDEV\n" );
193
195
EngDeleteSemaphore (ppdev -> hsemDevLock );
194
196
ExFreePoolWithTag (ppdev , GDITAG_PDEV );
195
197
return FALSE;
196
198
}
197
199
198
- /* Set flags based on the LDEV type */
199
- ldevtype = pldev -> ldevtype ;
200
- if (ldevtype == LDEV_DEVICE_MIRROR ) ppdev -> flFlags |= PDEV_CLONE_DEVICE ;
201
- else if (ldevtype == LDEV_DEVICE_DISPLAY ) ppdev -> flFlags |= PDEV_DISPLAY ;
202
- else if (ldevtype == LDEV_DEVICE_PRINTER ) ppdev -> flFlags |= PDEV_PRINTER ;
203
- else if (ldevtype == LDEV_DEVICE_META ) ppdev -> flFlags |= PDEV_META_DEVICE ;
204
- else if (ldevtype == LDEV_FONT ) ppdev -> flFlags |= PDEV_FONTDRIVER ;
200
+ /* Check what type of driver this is */
201
+ if (pldev -> ldevtype == LDEV_DEVICE_DISPLAY )
202
+ {
203
+ /* This is a display device */
204
+ ppdev -> flFlags |= PDEV_DISPLAY ;
205
+
206
+ /* Check if the driver supports a hardware pointer */
207
+ if (ppdev -> pfn .SetPointerShape && ppdev -> pfn .MovePointer )
208
+ {
209
+ ppdev -> flFlags |= PDEV_HARDWARE_POINTER ;
210
+ //ppdev->pfnDrvSetPointerShape = ppdev->pfn.SetPointerShape;
211
+ ppdev -> pfnMovePointer = ppdev -> pfn .MovePointer ;
212
+ }
213
+ else
214
+ {
215
+ ppdev -> flFlags |= PDEV_SOFTWARE_POINTER ;
216
+ //ppdev->pfnDrvSetPointerShape = EngSetPointerShape;
217
+ ppdev -> pfnMovePointer = EngMovePointer ;
218
+ }
219
+
220
+ }
221
+ else if (pldev -> ldevtype == LDEV_DEVICE_MIRROR )
222
+ ppdev -> flFlags |= PDEV_CLONE_DEVICE ;
223
+ else if (pldev -> ldevtype == LDEV_DEVICE_PRINTER )
224
+ ppdev -> flFlags |= PDEV_PRINTER ;
225
+ else if (pldev -> ldevtype == LDEV_DEVICE_META )
226
+ ppdev -> flFlags |= PDEV_META_DEVICE ;
227
+ else if (pldev -> ldevtype == LDEV_FONT )
228
+ ppdev -> flFlags |= PDEV_FONTDRIVER ;
205
229
206
230
/* Check if the driver supports fonts */
207
231
if (ppdev -> devinfo .cFonts != 0 ) ppdev -> flFlags |= PDEV_GOTFONTS ;
208
232
209
- if (ppdev -> pfn .MovePointer ) ppdev -> flFlags |= PDEV_HARDWARE_POINTER ;
210
-
233
+ /* Check for a gamma ramp table */
211
234
if (ppdev -> pvGammaRamp ) ppdev -> flFlags |= PDEV_GAMMARAMP_TABLE ;
212
235
213
236
/* Call the drivers DrvCompletePDEV function */
@@ -238,7 +261,7 @@ PDEVOBJ_pSurface(
238
261
ppdev -> pSurface = SURFACE_ShareLockSurface (hsurf );
239
262
}
240
263
241
- DPRINT ("PDEVOBJ_pSurface() returning %p\n" , ppdev -> pSurface );
264
+ TRACE ("PDEVOBJ_pSurface() returning %p\n" , ppdev -> pSurface );
242
265
return ppdev -> pSurface ;
243
266
}
244
267
@@ -290,16 +313,16 @@ EngCreateDisplayPDEV(
290
313
PGRAPHICS_DEVICE pGraphicsDevice ;
291
314
PLDEVOBJ pldev ;
292
315
PPDEVOBJ ppdev ;
293
- DPRINT ("EngCreateDisplayPDEV(%wZ, %p)\n" , pustrDeviceName , pdm );
316
+ TRACE ("EngCreateDisplayPDEV(%wZ, %p)\n" , pustrDeviceName , pdm );
294
317
295
318
/* Try to find the GRAPHICS_DEVICE */
296
319
if (pustrDeviceName )
297
320
{
298
321
pGraphicsDevice = EngpFindGraphicsDevice (pustrDeviceName , 0 , 0 );
299
322
if (!pGraphicsDevice )
300
323
{
301
- DPRINT1 ("No GRAPHICS_DEVICE found for %ls!\n" ,
302
- pustrDeviceName ? pustrDeviceName -> Buffer : 0 );
324
+ ERR ("No GRAPHICS_DEVICE found for %ls!\n" ,
325
+ pustrDeviceName ? pustrDeviceName -> Buffer : 0 );
303
326
return NULL ;
304
327
}
305
328
}
@@ -313,34 +336,27 @@ EngCreateDisplayPDEV(
313
336
{
314
337
/* ... use the device's default one */
315
338
pdm = pGraphicsDevice -> pDevModeList [pGraphicsDevice -> iDefaultMode ].pdm ;
316
- DPRINT ("Using iDefaultMode = %ld\n" , pGraphicsDevice -> iDefaultMode );
339
+ TRACE ("Using iDefaultMode = %ld\n" , pGraphicsDevice -> iDefaultMode );
317
340
}
318
341
319
342
/* Try to get a diplay driver */
320
343
pldev = EngLoadImageEx (pdm -> dmDeviceName , LDEV_DEVICE_DISPLAY );
321
344
if (!pldev )
322
345
{
323
- DPRINT1 ("Could not load display driver '%ls', '%s'\n" ,
324
- pGraphicsDevice -> pDiplayDrivers ,
325
- pdm -> dmDeviceName );
346
+ ERR ("Could not load display driver '%ls', '%s'\n" ,
347
+ pGraphicsDevice -> pDiplayDrivers , pdm -> dmDeviceName );
326
348
return NULL ;
327
349
}
328
350
329
351
/* Create a new PDEVOBJ */
330
- ppdev = PDEVOBJ_CreatePDEV (pldev );
352
+ ppdev = PDEVOBJ_CreatePDEV (pldev , pGraphicsDevice , pdm , NULL );
331
353
if (!ppdev )
332
354
{
333
- DPRINT1 ("failed to allocate a PDEV\n" );
355
+ ERR ("failed to create a PDEV\n" );
334
356
EngUnloadImage (pldev );
335
357
return FALSE;
336
358
}
337
359
338
- /* Set MovePointer function */
339
- ppdev -> pfnMovePointer = ppdev -> pfn .MovePointer ;
340
- if (!ppdev -> pfnMovePointer )
341
- ppdev -> pfnMovePointer = EngMovePointer ;
342
-
343
- ppdev -> pGraphicsDevice = pGraphicsDevice ;
344
360
// Should we change the ative mode of pGraphicsDevice ?
345
361
ppdev -> pdmwDev = PDEVOBJ_pdmMatchDevMode (ppdev , pdm ) ;
346
362
@@ -417,21 +433,21 @@ PDEVOBJ_bSwitchMode(
417
433
PPDEVOBJ ppdevTmp ;
418
434
PSURFACE pSurface ;
419
435
BOOL retval = FALSE;
436
+ TRACE ("PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n" , ppdev , ppdev -> pSurface );
420
437
421
438
/* Lock the PDEV */
422
439
EngAcquireSemaphore (ppdev -> hsemDevLock );
440
+
423
441
/* And everything else */
424
442
EngAcquireSemaphore (ghsemPDEV );
425
443
426
- DPRINT1 ("PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n" , ppdev , ppdev -> pSurface );
427
-
428
444
// Lookup the GraphicsDevice + select DEVMODE
429
445
// pdm = PDEVOBJ_pdmMatchDevMode(ppdev, pdm);
430
446
431
447
/* 1. Temporarily disable the current PDEV */
432
448
if (!ppdev -> pfn .AssertMode (ppdev -> dhpdev , FALSE))
433
449
{
434
- DPRINT1 ("DrvAssertMode failed\n" );
450
+ ERR ("DrvAssertMode failed\n" );
435
451
goto leave ;
436
452
}
437
453
@@ -440,15 +456,15 @@ PDEVOBJ_bSwitchMode(
440
456
ppdevTmp = EngCreateDisplayPDEV (& ustrDevice , pdm );
441
457
if (!ppdevTmp )
442
458
{
443
- DPRINT1 ("Failed to create a new PDEV\n" );
459
+ ERR ("Failed to create a new PDEV\n" );
444
460
goto leave ;
445
461
}
446
462
447
463
/* 3. Create a new surface */
448
464
pSurface = PDEVOBJ_pSurface (ppdevTmp );
449
465
if (!pSurface )
450
466
{
451
- DPRINT1 ("DrvEnableSurface failed\n" );
467
+ ERR ("DrvEnableSurface failed\n" );
452
468
goto leave ;
453
469
}
454
470
@@ -476,8 +492,7 @@ PDEVOBJ_bSwitchMode(
476
492
EngReleaseSemaphore (ppdev -> hsemDevLock );
477
493
EngReleaseSemaphore (ghsemPDEV );
478
494
479
- DPRINT1 ("leave, ppdev = %p, pSurface = %p\n" , ppdev , ppdev -> pSurface );
480
-
495
+ TRACE ("leave, ppdev = %p, pSurface = %p\n" , ppdev , ppdev -> pSurface );
481
496
return retval ;
482
497
}
483
498
0 commit comments