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
@@ -134,7 +133,7 @@ PDEVOBJ_bEnablePDEV(
134
133
PFN_DrvEnablePDEV pfnEnablePDEV ;
135
134
ULONG i ;
136
135
137
- DPRINT ("PDEVOBJ_bEnablePDEV()\n" );
136
+ TRACE ("PDEVOBJ_bEnablePDEV()\n" );
138
137
139
138
/* Get the DrvEnablePDEV function */
140
139
pfnEnablePDEV = ppdev -> pldev -> pfn .EnablePDEV ;
@@ -186,7 +185,7 @@ PDEVOBJ_bEnablePDEV(
186
185
ppdev -> ahsurf [i ] = gahsurfHatch [i ];
187
186
}
188
187
189
- DPRINT ("PDEVOBJ_bEnablePDEV - dhpdev = %p\n" , ppdev -> dhpdev );
188
+ TRACE ("PDEVOBJ_bEnablePDEV - dhpdev = %p\n" , ppdev -> dhpdev );
190
189
191
190
return TRUE;
192
191
}
@@ -203,16 +202,18 @@ PDEVOBJ_vCompletePDEV(
203
202
PPDEVOBJ
204
203
NTAPI
205
204
PDEVOBJ_CreatePDEV (
206
- PLDEVOBJ pldev )
205
+ PLDEVOBJ pldev ,
206
+ PGRAPHICS_DEVICE pGraphicsDevice ,
207
+ PDEVMODEW pdevmode ,
208
+ PWSTR pwszLogAddress )
207
209
{
208
210
PPDEVOBJ ppdev ;
209
- LDEVTYPE ldevtype ;
210
211
211
212
/* Allocate a new PDEVOBJ */
212
213
ppdev = ExAllocatePoolWithTag (PagedPool , sizeof (PDEVOBJ ), GDITAG_PDEV );
213
214
if (!ppdev )
214
215
{
215
- DPRINT1 ("failed to allocate a PDEV\n" );
216
+ ERR ("failed to allocate a PDEV\n" );
216
217
return FALSE;
217
218
}
218
219
@@ -227,11 +228,14 @@ PDEVOBJ_CreatePDEV(
227
228
/* Copy the function table from the LDEVOBJ */
228
229
ppdev -> pfn = ppdev -> pldev -> pfn ;
229
230
231
+ /* Set the graphics device */
232
+ ppdev -> pGraphicsDevice = pGraphicsDevice ;
233
+
230
234
/* Allocate the device lock semaphore */
231
235
ppdev -> hsemDevLock = EngCreateSemaphore ();
232
236
if (!ppdev -> hsemDevLock )
233
237
{
234
- DPRINT1 ("Failed to create semaphore\n" );
238
+ ERR ("Failed to create semaphore\n" );
235
239
ExFreePoolWithTag (ppdev , GDITAG_PDEV );
236
240
return FALSE;
237
241
}
@@ -242,27 +246,48 @@ PDEVOBJ_CreatePDEV(
242
246
RtlZeroMemory (ppdev -> pEDDgpl , sizeof (EDD_DIRECTDRAW_GLOBAL ));
243
247
244
248
/* Call the drivers DrvEnablePDEV function */
245
- if (!PDEVOBJ_bEnablePDEV (ppdev , NULL , NULL ))
249
+ if (!PDEVOBJ_bEnablePDEV (ppdev , pdevmode , NULL ))
246
250
{
247
- DPRINT1 ("Failed to enable PDEV\n" );
251
+ ERR ("Failed to enable PDEV\n" );
248
252
EngDeleteSemaphore (ppdev -> hsemDevLock );
249
253
ExFreePoolWithTag (ppdev , GDITAG_PDEV );
250
254
return FALSE;
251
255
}
252
256
253
- /* Set flags based on the LDEV type */
254
- ldevtype = pldev -> ldevtype ;
255
- if (ldevtype == LDEV_DEVICE_MIRROR ) ppdev -> flFlags |= PDEV_CLONE_DEVICE ;
256
- else if (ldevtype == LDEV_DEVICE_DISPLAY ) ppdev -> flFlags |= PDEV_DISPLAY ;
257
- else if (ldevtype == LDEV_DEVICE_PRINTER ) ppdev -> flFlags |= PDEV_PRINTER ;
258
- else if (ldevtype == LDEV_DEVICE_META ) ppdev -> flFlags |= PDEV_META_DEVICE ;
259
- else if (ldevtype == LDEV_FONT ) ppdev -> flFlags |= PDEV_FONTDRIVER ;
257
+ /* Check what type of driver this is */
258
+ if (pldev -> ldevtype == LDEV_DEVICE_DISPLAY )
259
+ {
260
+ /* This is a display device */
261
+ ppdev -> flFlags |= PDEV_DISPLAY ;
262
+
263
+ /* Check if the driver supports a hardware pointer */
264
+ if (ppdev -> pfn .SetPointerShape && ppdev -> pfn .MovePointer )
265
+ {
266
+ ppdev -> flFlags |= PDEV_HARDWARE_POINTER ;
267
+ //ppdev->pfnDrvSetPointerShape = ppdev->pfn.SetPointerShape;
268
+ ppdev -> pfnMovePointer = ppdev -> pfn .MovePointer ;
269
+ }
270
+ else
271
+ {
272
+ ppdev -> flFlags |= PDEV_SOFTWARE_POINTER ;
273
+ //ppdev->pfnDrvSetPointerShape = EngSetPointerShape;
274
+ ppdev -> pfnMovePointer = EngMovePointer ;
275
+ }
276
+
277
+ }
278
+ else if (pldev -> ldevtype == LDEV_DEVICE_MIRROR )
279
+ ppdev -> flFlags |= PDEV_CLONE_DEVICE ;
280
+ else if (pldev -> ldevtype == LDEV_DEVICE_PRINTER )
281
+ ppdev -> flFlags |= PDEV_PRINTER ;
282
+ else if (pldev -> ldevtype == LDEV_DEVICE_META )
283
+ ppdev -> flFlags |= PDEV_META_DEVICE ;
284
+ else if (pldev -> ldevtype == LDEV_FONT )
285
+ ppdev -> flFlags |= PDEV_FONTDRIVER ;
260
286
261
287
/* Check if the driver supports fonts */
262
288
if (ppdev -> devinfo .cFonts != 0 ) ppdev -> flFlags |= PDEV_GOTFONTS ;
263
289
264
- if (ppdev -> pfn .MovePointer ) ppdev -> flFlags |= PDEV_HARDWARE_POINTER ;
265
-
290
+ /* Check for a gamma ramp table */
266
291
if (ppdev -> pvGammaRamp ) ppdev -> flFlags |= PDEV_GAMMARAMP_TABLE ;
267
292
268
293
/* Call the drivers DrvCompletePDEV function */
@@ -297,7 +322,7 @@ PDEVOBJ_pSurface(
297
322
/* Increment reference count */
298
323
GDIOBJ_vReferenceObjectByPointer (& ppdev -> pSurface -> BaseObject );
299
324
300
- DPRINT ("PDEVOBJ_pSurface() returning %p\n" , ppdev -> pSurface );
325
+ TRACE ("PDEVOBJ_pSurface() returning %p\n" , ppdev -> pSurface );
301
326
return ppdev -> pSurface ;
302
327
}
303
328
@@ -390,16 +415,16 @@ EngCreateDisplayPDEV(
390
415
PGRAPHICS_DEVICE pGraphicsDevice ;
391
416
PLDEVOBJ pldev ;
392
417
PPDEVOBJ ppdev ;
393
- DPRINT ("EngCreateDisplayPDEV(%wZ, %p)\n" , pustrDeviceName , pdm );
418
+ TRACE ("EngCreateDisplayPDEV(%wZ, %p)\n" , pustrDeviceName , pdm );
394
419
395
420
/* Try to find the GRAPHICS_DEVICE */
396
421
if (pustrDeviceName )
397
422
{
398
423
pGraphicsDevice = EngpFindGraphicsDevice (pustrDeviceName , 0 , 0 );
399
424
if (!pGraphicsDevice )
400
425
{
401
- DPRINT1 ("No GRAPHICS_DEVICE found for %ls!\n" ,
402
- pustrDeviceName ? pustrDeviceName -> Buffer : 0 );
426
+ ERR ("No GRAPHICS_DEVICE found for %ls!\n" ,
427
+ pustrDeviceName ? pustrDeviceName -> Buffer : 0 );
403
428
return NULL ;
404
429
}
405
430
}
@@ -413,34 +438,27 @@ EngCreateDisplayPDEV(
413
438
{
414
439
/* ... use the device's default one */
415
440
pdm = pGraphicsDevice -> pDevModeList [pGraphicsDevice -> iDefaultMode ].pdm ;
416
- DPRINT ("Using iDefaultMode = %lu\n" , pGraphicsDevice -> iDefaultMode );
441
+ TRACE ("Using iDefaultMode = %lu\n" , pGraphicsDevice -> iDefaultMode );
417
442
}
418
443
419
444
/* Try to get a diplay driver */
420
445
pldev = EngLoadImageEx (pdm -> dmDeviceName , LDEV_DEVICE_DISPLAY );
421
446
if (!pldev )
422
447
{
423
- DPRINT1 ("Could not load display driver '%ls', '%ls'\n" ,
424
- pGraphicsDevice -> pDiplayDrivers ,
425
- pdm -> dmDeviceName );
448
+ ERR ("Could not load display driver '%ls', '%ls'\n" ,
449
+ pGraphicsDevice -> pDiplayDrivers , pdm -> dmDeviceName );
426
450
return NULL ;
427
451
}
428
452
429
453
/* Create a new PDEVOBJ */
430
- ppdev = PDEVOBJ_CreatePDEV (pldev );
454
+ ppdev = PDEVOBJ_CreatePDEV (pldev , pGraphicsDevice , pdm , NULL );
431
455
if (!ppdev )
432
456
{
433
- DPRINT1 ("failed to allocate a PDEV\n" );
457
+ ERR ("failed to create a PDEV\n" );
434
458
EngUnloadImage (pldev );
435
459
return FALSE;
436
460
}
437
461
438
- /* Set MovePointer function */
439
- ppdev -> pfnMovePointer = ppdev -> pfn .MovePointer ;
440
- if (!ppdev -> pfnMovePointer )
441
- ppdev -> pfnMovePointer = EngMovePointer ;
442
-
443
- ppdev -> pGraphicsDevice = pGraphicsDevice ;
444
462
445
463
// DxEngGetHdevData asks for Graphics DeviceObject in hSpooler field
446
464
ppdev -> hSpooler = ppdev -> pGraphicsDevice -> DeviceObject ;
@@ -537,22 +555,21 @@ PDEVOBJ_bSwitchMode(
537
555
PPDEVOBJ ppdevTmp ;
538
556
PSURFACE pSurface ;
539
557
BOOL retval = FALSE;
558
+ TRACE ("PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n" , ppdev , ppdev -> pSurface );
540
559
541
560
/* Lock the PDEV */
542
561
EngAcquireSemaphore (ppdev -> hsemDevLock );
543
562
544
563
/* And everything else */
545
564
EngAcquireSemaphore (ghsemPDEV );
546
565
547
- DPRINT1 ("PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n" , ppdev , ppdev -> pSurface );
548
-
549
566
// Lookup the GraphicsDevice + select DEVMODE
550
567
// pdm = PDEVOBJ_pdmMatchDevMode(ppdev, pdm);
551
568
552
569
/* 1. Temporarily disable the current PDEV */
553
570
if (!ppdev -> pfn .AssertMode (ppdev -> dhpdev , FALSE))
554
571
{
555
- DPRINT1 ("DrvAssertMode failed\n" );
572
+ ERR ("DrvAssertMode failed\n" );
556
573
goto leave ;
557
574
}
558
575
@@ -561,15 +578,15 @@ PDEVOBJ_bSwitchMode(
561
578
ppdevTmp = EngCreateDisplayPDEV (& ustrDevice , pdm );
562
579
if (!ppdevTmp )
563
580
{
564
- DPRINT1 ("Failed to create a new PDEV\n" );
581
+ ERR ("Failed to create a new PDEV\n" );
565
582
goto leave ;
566
583
}
567
584
568
585
/* 3. Create a new surface */
569
586
pSurface = PDEVOBJ_pSurface (ppdevTmp );
570
587
if (!pSurface )
571
588
{
572
- DPRINT1 ("PDEVOBJ_pSurface failed\n" );
589
+ ERR ("PDEVOBJ_pSurface failed\n" );
573
590
goto leave ;
574
591
}
575
592
@@ -597,8 +614,7 @@ PDEVOBJ_bSwitchMode(
597
614
EngReleaseSemaphore (ppdev -> hsemDevLock );
598
615
EngReleaseSemaphore (ghsemPDEV );
599
616
600
- DPRINT1 ("leave, ppdev = %p, pSurface = %p\n" , ppdev , ppdev -> pSurface );
601
-
617
+ TRACE ("leave, ppdev = %p, pSurface = %p\n" , ppdev , ppdev -> pSurface );
602
618
return retval ;
603
619
}
604
620
0 commit comments