ReactOS  0.4.14-dev-57-g333b8f1
pdevobj.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _GDIPOINTER
 
struct  _DEVMODEINFO
 
struct  _DEVMODEENTRY
 
struct  _GRAPHICS_DEVICE
 
struct  _PDEVOBJ
 

Typedefs

typedef struct _GDIPOINTER GDIPOINTER
 
typedef struct _GDIPOINTERPGDIPOINTER
 
typedef struct _DEVMODEINFO DEVMODEINFO
 
typedef struct _DEVMODEINFOPDEVMODEINFO
 
typedef struct _DEVMODEENTRY DEVMODEENTRY
 
typedef struct _DEVMODEENTRYPDEVMODEENTRY
 
typedef struct _GRAPHICS_DEVICE GRAPHICS_DEVICE
 
typedef struct _GRAPHICS_DEVICEPGRAPHICS_DEVICE
 
typedef struct _PDEVOBJ PDEVOBJ
 
typedef struct _PDEVOBJPPDEVOBJ
 

Enumerations

enum  _PDEVFLAGS {
  PDEV_DISPLAY = 0x00000001, PDEV_HARDWARE_POINTER = 0x00000002, PDEV_SOFTWARE_POINTER = 0x00000004, PDEV_GOTFONTS = 0x00000040,
  PDEV_PRINTER = 0x00000080, PDEV_ALLOCATEDBRUSHES = 0x00000100, PDEV_HTPAL_IS_DEVPAL = 0x00000200, PDEV_DISABLED = 0x00000400,
  PDEV_SYNCHRONIZE_ENABLED = 0x00000800, PDEV_FONTDRIVER = 0x00002000, PDEV_GAMMARAMP_TABLE = 0x00004000, PDEV_UMPD = 0x00008000,
  PDEV_SHARED_DEVLOCK = 0x00010000, PDEV_META_DEVICE = 0x00020000, PDEV_DRIVER_PUNTED_CALL = 0x00040000, PDEV_CLONE_DEVICE = 0x00080000
}
 

Functions

PPDEVOBJ NTAPI EngpGetPDEV (_In_opt_ PUNICODE_STRING pustrDevice)
 
VOID NTAPI PDEVOBJ_vRelease (_Inout_ PPDEVOBJ ppdev)
 
PSURFACE NTAPI PDEVOBJ_pSurface (_In_ PPDEVOBJ ppdev)
 
VOID NTAPI PDEVOBJ_vGetDeviceCaps (_In_ PPDEVOBJ ppdev, _Out_ PDEVCAPS pDevCaps)
 
INIT_FUNCTION NTSTATUS NTAPI InitPDEVImpl (VOID)
 
PSIZEL FASTCALL PDEVOBJ_sizl (_In_ PPDEVOBJ ppdev, _Out_ PSIZEL psizl)
 
BOOL NTAPI PDEVOBJ_bSwitchMode (PPDEVOBJ ppdev, PDEVMODEW pdm)
 
PDEVMODEW NTAPI PDEVOBJ_pdmMatchDevMode (PPDEVOBJ ppdev, PDEVMODEW pdm)
 
FORCEINLINE VOID PDEVOBJ_vReference (PPDEVOBJ ppdev)
 

Variables

PPDEVOBJ gppdevPrimary
 

Typedef Documentation

◆ DEVMODEENTRY

◆ DEVMODEINFO

◆ GDIPOINTER

◆ GRAPHICS_DEVICE

◆ PDEVMODEENTRY

◆ PDEVMODEINFO

◆ PDEVOBJ

◆ PGDIPOINTER

◆ PGRAPHICS_DEVICE

◆ PPDEVOBJ

Enumeration Type Documentation

◆ _PDEVFLAGS

Enumerator
PDEV_DISPLAY 
PDEV_HARDWARE_POINTER 
PDEV_SOFTWARE_POINTER 
PDEV_GOTFONTS 
PDEV_PRINTER 
PDEV_ALLOCATEDBRUSHES 
PDEV_HTPAL_IS_DEVPAL 
PDEV_DISABLED 
PDEV_SYNCHRONIZE_ENABLED 
PDEV_FONTDRIVER 
PDEV_GAMMARAMP_TABLE 
PDEV_UMPD 
PDEV_SHARED_DEVLOCK 
PDEV_META_DEVICE 
PDEV_DRIVER_PUNTED_CALL 
PDEV_CLONE_DEVICE 

Definition at line 5 of file pdevobj.h.

6 {
7  PDEV_DISPLAY = 0x00000001, /* Display device */
8  PDEV_HARDWARE_POINTER = 0x00000002, /* Supports hardware cursor */
9  PDEV_SOFTWARE_POINTER = 0x00000004,
10  PDEV_GOTFONTS = 0x00000040, /* Has font driver */
11  PDEV_PRINTER = 0x00000080,
12  PDEV_ALLOCATEDBRUSHES = 0x00000100,
13  PDEV_HTPAL_IS_DEVPAL = 0x00000200,
14  PDEV_DISABLED = 0x00000400,
15  PDEV_SYNCHRONIZE_ENABLED = 0x00000800,
16  PDEV_FONTDRIVER = 0x00002000, /* Font device */
17  PDEV_GAMMARAMP_TABLE = 0x00004000,
18  PDEV_UMPD = 0x00008000,
19  PDEV_SHARED_DEVLOCK = 0x00010000,
20  PDEV_META_DEVICE = 0x00020000,
21  PDEV_DRIVER_PUNTED_CALL = 0x00040000, /* Driver calls back to GDI engine */
22  PDEV_CLONE_DEVICE = 0x00080000
23 };

Function Documentation

◆ EngpGetPDEV()

PPDEVOBJ NTAPI EngpGetPDEV ( _In_opt_ PUNICODE_STRING  pustrDevice)

Definition at line 593 of file pdevobj.c.

595 {
596  UNICODE_STRING ustrCurrent;
597  PPDEVOBJ ppdev;
598  PGRAPHICS_DEVICE pGraphicsDevice;
599 
600  /* Acquire PDEV lock */
602 
603  /* Did the caller pass a device name? */
604  if (pustrDeviceName)
605  {
606  /* Loop all present PDEVs */
607  for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext)
608  {
609  /* Get a pointer to the GRAPHICS_DEVICE */
610  pGraphicsDevice = ppdev->pGraphicsDevice;
611 
612  /* Compare the name */
613  RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName);
614  if (RtlEqualUnicodeString(pustrDeviceName, &ustrCurrent, FALSE))
615  {
616  /* Found! */
617  break;
618  }
619  }
620  }
621  else
622  {
623  /* Otherwise use the primary PDEV */
624  ppdev = gppdevPrimary;
625  }
626 
627  /* Did we find one? */
628  if (ppdev)
629  {
630  /* Yes, reference the PDEV */
632  }
633  else
634  {
635  /* No, create a new PDEV for the given device */
636  ppdev = EngpCreatePDEV(pustrDeviceName, NULL);
637  if (ppdev)
638  {
639  /* Insert the PDEV into the list */
640  ppdev->ppdevNext = gppdevList;
641  gppdevList = ppdev;
642 
643  /* Set as primary PDEV, if we don't have one yet */
644  if (!gppdevPrimary)
645  {
646  gppdevPrimary = ppdev;
648  }
649  }
650  }
651 
652  /* Release PDEV lock */
654 
655  return ppdev;
656 }
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
LONG cPdevRefs
Definition: pdevobj.h:86
WCHAR szWinDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:60
PPDEVOBJ gppdevPrimary
Definition: pdevobj.c:13
DWORD StateFlags
Definition: pdevobj.h:66
static PPDEVOBJ EngpCreatePDEV(PUNICODE_STRING pustrDeviceName, PDEVMODEW pdm)
Definition: pdevobj.c:345
struct _PDEVOBJ * ppdevNext
Definition: pdevobj.h:85
static HSEMAPHORE ghsemPDEV
Definition: pdevobj.c:16
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
smooth NULL
Definition: ftsmooth.c:416
#define DISPLAY_DEVICE_PRIMARY_DEVICE
Definition: wingdi.h:1397
static PPDEVOBJ gppdevList
Definition: pdevobj.c:15
#define InterlockedIncrement
Definition: armddk.h:53
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
PGRAPHICS_DEVICE pGraphicsDevice
Definition: pdevobj.h:128
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)

Referenced by GreCreateCompatibleDC(), GreOpenDCW(), NtGdiExtEscape(), UserChangeDisplaySettings(), UserEnumCurrentDisplaySettings(), and UserEnumDisplaySettings().

◆ InitPDEVImpl()

INIT_FUNCTION NTSTATUS NTAPI InitPDEVImpl ( VOID  )

Definition at line 21 of file pdevobj.c.

22 {
25  return STATUS_SUCCESS;
26 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
static HSEMAPHORE ghsemPDEV
Definition: pdevobj.c:16
HSEMAPHORE WINAPI EngCreateSemaphore(VOID)
Definition: eng.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by DriverEntry().

◆ PDEVOBJ_bSwitchMode()

BOOL NTAPI PDEVOBJ_bSwitchMode ( PPDEVOBJ  ppdev,
PDEVMODEW  pdm 
)

Definition at line 507 of file pdevobj.c.

510 {
511  UNICODE_STRING ustrDevice;
512  PPDEVOBJ ppdevTmp;
514  BOOL retval = FALSE;
515 
516  /* Lock the PDEV */
518 
519  /* And everything else */
521 
522  DPRINT1("PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
523 
524  // Lookup the GraphicsDevice + select DEVMODE
525  // pdm = PDEVOBJ_pdmMatchDevMode(ppdev, pdm);
526 
527  /* 1. Temporarily disable the current PDEV and reset video to its default mode */
528  if (!ppdev->pfn.AssertMode(ppdev->dhpdev, FALSE))
529  {
530  DPRINT1("DrvAssertMode(FALSE) failed\n");
531  goto leave;
532  }
533 
534  /* 2. Create new PDEV */
536  ppdevTmp = EngpCreatePDEV(&ustrDevice, pdm);
537  if (!ppdevTmp)
538  {
539  DPRINT1("Failed to create a new PDEV\n");
540  goto leave2;
541  }
542 
543  /* 3. Create a new surface */
544  pSurface = PDEVOBJ_pSurface(ppdevTmp);
545  if (!pSurface)
546  {
547  DPRINT1("PDEVOBJ_pSurface failed\n");
548  PDEVOBJ_vRelease(ppdevTmp);
549  goto leave2;
550  }
551 
552  /* 4. Get DirectDraw information */
553  /* 5. Enable DirectDraw Not traced */
554  /* 6. Copy old PDEV state to new PDEV instance */
555 
556  /* 7. Switch the PDEVs */
557  PDEVOBJ_vSwitchPdev(ppdev, ppdevTmp);
558 
559  /* 8. Disable DirectDraw */
560 
561  PDEVOBJ_vRelease(ppdevTmp);
562 
563  /* Update primary display capabilities */
564  if(ppdev == gppdevPrimary)
565  {
566  PDEVOBJ_vGetDeviceCaps(ppdev, &GdiHandleTable->DevCaps);
567  }
568 
569  /* Success! */
570  retval = TRUE;
571 
572 leave2:
573  /* Set the new video mode, or restore the original one in case of failure */
574  if (!ppdev->pfn.AssertMode(ppdev->dhpdev, TRUE))
575  {
576  DPRINT1("DrvAssertMode(TRUE) failed\n");
577  }
578 
579 leave:
580  /* Unlock everything else */
582  /* Unlock the PDEV */
584 
585  DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
586 
587  return retval;
588 }
DHPDEV dhpdev
Definition: pdevobj.h:121
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
#define TRUE
Definition: types.h:120
WCHAR szWinDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:60
PSURFACE NTAPI PDEVOBJ_pSurface(PPDEVOBJ ppdev)
Definition: pdevobj.c:233
PPDEVOBJ gppdevPrimary
Definition: pdevobj.c:13
static PPDEVOBJ EngpCreatePDEV(PUNICODE_STRING pustrDeviceName, PDEVMODEW pdm)
Definition: pdevobj.c:345
unsigned int BOOL
Definition: ntddk_ex.h:94
static HSEMAPHORE ghsemPDEV
Definition: pdevobj.c:16
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
HSEMAPHORE hsemDevLock
Definition: pdevobj.h:91
DRIVER_FUNCTIONS pfn
Definition: pdevobj.h:139
VOID NTAPI PDEVOBJ_vGetDeviceCaps(IN PPDEVOBJ ppdev, OUT PDEVCAPS pDevCaps)
Definition: pdevobj.c:681
#define GdiHandleTable
Definition: win32nt.h:35
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
VOID NTAPI PDEVOBJ_vSwitchPdev(PPDEVOBJ ppdev, PPDEVOBJ ppdev2)
Definition: pdevobj.c:453
PFN_DrvAssertMode AssertMode
Definition: ntgdityp.h:573
PSURFACE pSurface
Definition: pdevobj.h:125
#define DPRINT1
Definition: precomp.h:8
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
PGRAPHICS_DEVICE pGraphicsDevice
Definition: pdevobj.h:128
VOID NTAPI PDEVOBJ_vRelease(PPDEVOBJ ppdev)
Definition: pdevobj.c:93

Referenced by UserChangeDisplaySettings().

◆ PDEVOBJ_pdmMatchDevMode()

PDEVMODEW NTAPI PDEVOBJ_pdmMatchDevMode ( PPDEVOBJ  ppdev,
PDEVMODEW  pdm 
)

Definition at line 306 of file pdevobj.c.

309 {
310  PGRAPHICS_DEVICE pGraphicsDevice;
311  PDEVMODEW pdmCurrent;
312  ULONG i;
313  DWORD dwFields;
314 
315  pGraphicsDevice = ppdev->pGraphicsDevice;
316 
317  for (i = 0; i < pGraphicsDevice->cDevModes; i++)
318  {
319  pdmCurrent = pGraphicsDevice->pDevModeList[i].pdm;
320 
321  /* Compare asked DEVMODE fields
322  * Only compare those that are valid in both DEVMODE structs */
323  dwFields = pdmCurrent->dmFields & pdm->dmFields ;
324 
325  /* For now, we only need those */
326  if ((dwFields & DM_BITSPERPEL) &&
327  (pdmCurrent->dmBitsPerPel != pdm->dmBitsPerPel)) continue;
328  if ((dwFields & DM_PELSWIDTH) &&
329  (pdmCurrent->dmPelsWidth != pdm->dmPelsWidth)) continue;
330  if ((dwFields & DM_PELSHEIGHT) &&
331  (pdmCurrent->dmPelsHeight != pdm->dmPelsHeight)) continue;
332  if ((dwFields & DM_DISPLAYFREQUENCY) &&
333  (pdmCurrent->dmDisplayFrequency != pdm->dmDisplayFrequency)) continue;
334 
335  /* Match! Return the DEVMODE */
336  return pdmCurrent;
337  }
338 
339  /* Nothing found */
340  return NULL;
341 }
DWORD dmFields
Definition: wingdi.h:1617
PDEVMODEENTRY pDevModeList
Definition: pdevobj.h:70
DWORD dmBitsPerPel
Definition: wingdi.h:1642
PDEVMODEW pdm
Definition: pdevobj.h:53
#define DM_PELSWIDTH
Definition: wingdi.h:1268
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
ULONG cDevModes
Definition: pdevobj.h:69
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dmPelsWidth
Definition: wingdi.h:1643
#define DM_DISPLAYFREQUENCY
Definition: wingdi.h:1271
DWORD dmDisplayFrequency
Definition: wingdi.h:1649
#define DM_PELSHEIGHT
Definition: wingdi.h:1269
DWORD dmPelsHeight
Definition: wingdi.h:1644
unsigned int ULONG
Definition: retypes.h:1
#define DM_BITSPERPEL
Definition: wingdi.h:1267
PGRAPHICS_DEVICE pGraphicsDevice
Definition: pdevobj.h:128

Referenced by EngpCreatePDEV(), PDEVOBJ_vRefreshModeList(), and UserChangeDisplaySettings().

◆ PDEVOBJ_pSurface()

PSURFACE NTAPI PDEVOBJ_pSurface ( _In_ PPDEVOBJ  ppdev)

◆ PDEVOBJ_sizl()

PSIZEL FASTCALL PDEVOBJ_sizl ( _In_ PPDEVOBJ  ppdev,
_Out_ PSIZEL  psizl 
)

◆ PDEVOBJ_vGetDeviceCaps()

VOID NTAPI PDEVOBJ_vGetDeviceCaps ( _In_ PPDEVOBJ  ppdev,
_Out_ PDEVCAPS  pDevCaps 
)

◆ PDEVOBJ_vReference()

FORCEINLINE VOID PDEVOBJ_vReference ( PPDEVOBJ  ppdev)

Definition at line 206 of file pdevobj.h.

207 {
209 }
LONG cPdevRefs
Definition: pdevobj.h:86
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by NtGdiExtEscape().

◆ PDEVOBJ_vRelease()

VOID NTAPI PDEVOBJ_vRelease ( _Inout_ PPDEVOBJ  ppdev)

Variable Documentation

◆ gppdevPrimary