ReactOS 0.4.15-dev-7918-g2a2556c
pdevobj.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for pdevobj.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 DBG_DEFAULT_CHANNEL (EngPDev)
 
BOOL APIENTRY MultiEnableDriver (_In_ ULONG iEngineVersion, _In_ ULONG cj, _Inout_bytecount_(cj) PDRVENABLEDATA pded)
 
NTSTATUS NTAPI InitPDEVImpl (VOID)
 
PPDEVOBJ PDEVOBJ_AllocPDEV (VOID)
 
static VOID PDEVOBJ_vDeletePDEV (PPDEVOBJ ppdev)
 
VOID NTAPI PDEVOBJ_vRelease (_Inout_ PPDEVOBJ ppdev)
 
BOOL NTAPI PDEVOBJ_bEnablePDEV (_In_ PPDEVOBJ ppdev, _In_ PDEVMODEW pdevmode, _In_ PWSTR pwszLogAddress)
 
VOID NTAPI PDEVOBJ_vCompletePDEV (PPDEVOBJ ppdev)
 
static VOID PDEVOBJ_vFilterDriverHooks (_In_ PPDEVOBJ ppdev)
 
PSURFACE NTAPI PDEVOBJ_pSurface (PPDEVOBJ ppdev)
 
VOID PDEVOBJ_vEnableDisplay (_Inout_ PPDEVOBJ ppdev)
 
BOOL PDEVOBJ_bDisableDisplay (_Inout_ PPDEVOBJ ppdev)
 
VOID NTAPI PDEVOBJ_vRefreshModeList (PPDEVOBJ ppdev)
 
PPDEVOBJ PDEVOBJ_Create (_In_opt_ PGRAPHICS_DEVICE pGraphicsDevice, _In_opt_ PDEVMODEW pdm, _In_ ULONG dwAccelerationLevel, _In_ ULONG ldevtype)
 
FORCEINLINE VOID SwitchPointer (_Inout_ PVOID pvPointer1, _Inout_ PVOID pvPointer2)
 
BOOL NTAPI PDEVOBJ_bDynamicModeChange (PPDEVOBJ ppdev, PPDEVOBJ ppdev2)
 
BOOL NTAPI PDEVOBJ_bSwitchMode (PPDEVOBJ ppdev, PDEVMODEW pdm)
 
PPDEVOBJ NTAPI EngpGetPDEV (_In_opt_ PUNICODE_STRING pustrDeviceName)
 
LONG PDEVOBJ_lChangeDisplaySettings (_In_opt_ PUNICODE_STRING pustrDeviceName, _In_opt_ PDEVMODEW RequestedMode, _In_opt_ PMDEVOBJ pmdevOld, _Out_ PMDEVOBJ *ppmdevNew, _In_ BOOL bSearchClosestMode)
 
INT NTAPI PDEVOBJ_iGetColorManagementCaps (PPDEVOBJ ppdev)
 
VOID NTAPI PDEVOBJ_vGetDeviceCaps (IN PPDEVOBJ ppdev, OUT PDEVCAPS pDevCaps)
 
BOOL APIENTRY EngQueryDeviceAttribute (_In_ HDEV hdev, _In_ ENG_DEVICE_ATTRIBUTE devAttr, _In_reads_bytes_(cjInSize) PVOID pvIn, _In_ ULONG cjInSize, _Out_writes_bytes_(cjOutSize) PVOID pvOut, _In_ ULONG cjOutSize)
 
_Must_inspect_result_ _Ret_z_ LPWSTR APIENTRY EngGetDriverName (_In_ HDEV hdev)
 
INT APIENTRY NtGdiGetDeviceCaps (HDC hdc, INT Index)
 
 _Success_ (return!=FALSE)
 
DHPDEV APIENTRY NtGdiGetDhpdev (IN HDEV hdev)
 
PSIZEL FASTCALL PDEVOBJ_sizl (PPDEVOBJ ppdev, PSIZEL psizl)
 

Variables

static PPDEVOBJ gppdevList = NULL
 
static HSEMAPHORE ghsemPDEV
 
DRVFN gPanDispDrvFn []
 
ULONG gPanDispDrvCount
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file pdevobj.c.

Function Documentation

◆ _Success_()

_Success_ ( return!  = FALSE)

Definition at line 1299 of file pdevobj.c.

1305{
1306 PDC pdc;
1307 DEVCAPS devcaps;
1308 BOOL bResult = TRUE;
1309
1310 /* Lock the given DC */
1311 pdc = DC_LockDc(hDC);
1312 if (!pdc)
1313 {
1315 return FALSE;
1316 }
1317
1318 /* Get the data */
1319 PDEVOBJ_vGetDeviceCaps(pdc->ppdev, &devcaps);
1320
1321 /* Unlock the DC */
1322 DC_UnlockDc(pdc);
1323
1324 /* Copy data to caller */
1325 _SEH2_TRY
1326 {
1327 ProbeForWrite(pDevCaps, sizeof(DEVCAPS), 1);
1328 RtlCopyMemory(pDevCaps, &devcaps, sizeof(DEVCAPS));
1329 }
1331 {
1333 bResult = FALSE;
1334 }
1335 _SEH2_END;
1336
1337 return bResult;
1338}
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_Out_ PDEVCAPS pDevCaps
Definition: ntgdi.h:2664
VOID NTAPI PDEVOBJ_vGetDeviceCaps(IN PPDEVOBJ ppdev, OUT PDEVCAPS pDevCaps)
Definition: pdevobj.c:1053
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
Definition: polytest.cpp:41
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( EngPDev  )

◆ EngGetDriverName()

_Must_inspect_result_ _Ret_z_ LPWSTR APIENTRY EngGetDriverName ( _In_ HDEV  hdev)

Definition at line 1138 of file pdevobj.c.

1139{
1140 PPDEVOBJ ppdev = (PPDEVOBJ)hdev;
1141
1142 ASSERT(ppdev);
1143 ASSERT(ppdev->pldev);
1144 ASSERT(ppdev->pldev->pGdiDriverInfo);
1145 ASSERT(ppdev->pldev->pGdiDriverInfo->DriverName.Buffer);
1146
1147 return ppdev->pldev->pGdiDriverInfo->DriverName.Buffer;
1148}
struct _PDEVOBJ * PPDEVOBJ
Definition: mdevobj.h:6
#define ASSERT(a)
Definition: mode.c:44
struct _LDEVOBJ * pldev
Definition: pdevobj.h:119
_In_ HDEV hdev
Definition: winddi.h:3449

◆ EngpGetPDEV()

PPDEVOBJ NTAPI EngpGetPDEV ( _In_opt_ PUNICODE_STRING  pustrDeviceName)

Definition at line 815 of file pdevobj.c.

817{
818 UNICODE_STRING ustrCurrent;
819 PPDEVOBJ ppdev = NULL;
820 PGRAPHICS_DEVICE pGraphicsDevice;
821 ULONG i;
822
823 /* Acquire PDEV lock */
825
826 /* Did the caller pass a device name? */
827 if (pustrDeviceName)
828 {
829 /* Loop all present PDEVs */
830 for (i = 0; i < gpmdev->cDev; i++)
831 {
832 /* Get a pointer to the GRAPHICS_DEVICE */
833 pGraphicsDevice = gpmdev->dev[i].ppdev->pGraphicsDevice;
834
835 /* Compare the name */
836 RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName);
837 if (RtlEqualUnicodeString(pustrDeviceName, &ustrCurrent, FALSE))
838 {
839 /* Found! */
840 ppdev = gpmdev->dev[i].ppdev;
841 break;
842 }
843 }
844 }
845 else if (gpmdev)
846 {
847 /* Otherwise use the primary PDEV */
848 ppdev = gpmdev->ppdevGlobal;
849 }
850
851 /* Did we find one? */
852 if (ppdev)
853 {
854 /* Yes, reference the PDEV */
855 PDEVOBJ_vReference(ppdev);
856 }
857
858 /* Release PDEV lock */
860
861 return ppdev;
862}
#define NULL
Definition: types.h:112
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
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
PMDEVOBJ gpmdev
Definition: mdevobj.c:14
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
static HSEMAPHORE ghsemPDEV
Definition: pdevobj.c:16
FORCEINLINE VOID PDEVOBJ_vReference(_In_ PPDEVOBJ ppdev)
Definition: pdevobj.h:160
WCHAR szWinDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:60
PPDEVOBJ ppdev
Definition: mdevobj.h:10
PPDEVOBJ ppdevGlobal
Definition: mdevobj.h:16
ULONG cDev
Definition: mdevobj.h:15
MDEVDISPLAY dev[0]
Definition: mdevobj.h:17
PGRAPHICS_DEVICE pGraphicsDevice
Definition: pdevobj.h:127
uint32_t ULONG
Definition: typedefs.h:59
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)

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

◆ EngQueryDeviceAttribute()

BOOL APIENTRY EngQueryDeviceAttribute ( _In_ HDEV  hdev,
_In_ ENG_DEVICE_ATTRIBUTE  devAttr,
_In_reads_bytes_(cjInSize) PVOID  pvIn,
_In_ ULONG  cjInSize,
_Out_writes_bytes_(cjOutSize) PVOID  pvOut,
_In_ ULONG  cjOutSize 
)

Exported functions

Definition at line 1112 of file pdevobj.c.

1119{
1120 PPDEVOBJ ppdev = (PPDEVOBJ)hdev;
1121
1122 if (devAttr != QDA_ACCELERATION_LEVEL)
1123 return FALSE;
1124
1125 if (cjOutSize >= sizeof(DWORD))
1126 {
1127 /* Set all Accelerations Level Key to enabled Full 0 to 5 turned off. */
1128 *(DWORD*)pvOut = ppdev->dwAccelerationLevel;
1129 return TRUE;
1130 }
1131
1132 return FALSE;
1133}
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwAccelerationLevel
Definition: pdevobj.h:132
@ QDA_ACCELERATION_LEVEL
Definition: winddi.h:2231

◆ InitPDEVImpl()

NTSTATUS NTAPI InitPDEVImpl ( VOID  )

Definition at line 31 of file pdevobj.c.

32{
35 return STATUS_SUCCESS;
36}
HSEMAPHORE WINAPI EngCreateSemaphore(VOID)
Definition: eng.c:75
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

Referenced by DriverEntry().

◆ MultiEnableDriver()

BOOL APIENTRY MultiEnableDriver ( _In_ ULONG  iEngineVersion,
_In_ ULONG  cj,
_Inout_bytecount_(cj) PDRVENABLEDATA  pded 
)

Definition at line 17 of file multidisp.c.

21{
23 return FALSE;
24}
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by PDEVOBJ_Create().

◆ NtGdiGetDeviceCaps()

INT APIENTRY NtGdiGetDeviceCaps ( HDC  hdc,
INT  Index 
)

Definition at line 1153 of file pdevobj.c.

1156{
1157 PDC pdc;
1158 DEVCAPS devcaps;
1159
1160 /* Lock the given DC */
1161 pdc = DC_LockDc(hdc);
1162 if (!pdc)
1163 {
1165 return 0;
1166 }
1167
1168 /* Get the data */
1169 PDEVOBJ_vGetDeviceCaps(pdc->ppdev, &devcaps);
1170
1171 /* Unlock the DC */
1172 DC_UnlockDc(pdc);
1173
1174 /* Return capability */
1175 switch (Index)
1176 {
1177 case DRIVERVERSION:
1178 return devcaps.ulVersion;
1179
1180 case TECHNOLOGY:
1181 return devcaps.ulTechnology;
1182
1183 case HORZSIZE:
1184 return devcaps.ulHorzSize;
1185
1186 case VERTSIZE:
1187 return devcaps.ulVertSize;
1188
1189 case HORZRES:
1190 return devcaps.ulHorzRes;
1191
1192 case VERTRES:
1193 return devcaps.ulVertRes;
1194
1195 case LOGPIXELSX:
1196 return devcaps.ulLogPixelsX;
1197
1198 case LOGPIXELSY:
1199 return devcaps.ulLogPixelsY;
1200
1201 case BITSPIXEL:
1202 return devcaps.ulBitsPixel;
1203
1204 case PLANES:
1205 return devcaps.ulPlanes;
1206
1207 case NUMBRUSHES:
1208 return -1;
1209
1210 case NUMPENS:
1211 return devcaps.ulNumPens;
1212
1213 case NUMFONTS:
1214 return devcaps.ulNumFonts;
1215
1216 case NUMCOLORS:
1217 return devcaps.ulNumColors;
1218
1219 case ASPECTX:
1220 return devcaps.ulAspectX;
1221
1222 case ASPECTY:
1223 return devcaps.ulAspectY;
1224
1225 case ASPECTXY:
1226 return devcaps.ulAspectXY;
1227
1228 case CLIPCAPS:
1229 return CP_RECTANGLE;
1230
1231 case SIZEPALETTE:
1232 return devcaps.ulSizePalette;
1233
1234 case NUMRESERVED:
1235 return 20;
1236
1237 case COLORRES:
1238 return devcaps.ulColorRes;
1239
1240 case DESKTOPVERTRES:
1241 return devcaps.ulVertRes;
1242
1243 case DESKTOPHORZRES:
1244 return devcaps.ulHorzRes;
1245
1246 case BLTALIGNMENT:
1247 return devcaps.ulBltAlignment;
1248
1249 case SHADEBLENDCAPS:
1250 return devcaps.ulShadeBlend;
1251
1252 case COLORMGMTCAPS:
1253 return devcaps.ulColorMgmtCaps;
1254
1255 case PHYSICALWIDTH:
1256 return devcaps.ulPhysicalWidth;
1257
1258 case PHYSICALHEIGHT:
1259 return devcaps.ulPhysicalHeight;
1260
1261 case PHYSICALOFFSETX:
1262 return devcaps.ulPhysicalOffsetX;
1263
1264 case PHYSICALOFFSETY:
1265 return devcaps.ulPhysicalOffsetY;
1266
1267 case VREFRESH:
1268 return devcaps.ulVRefresh;
1269
1270 case RASTERCAPS:
1271 return devcaps.ulRasterCaps;
1272
1273 case CURVECAPS:
1274 return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
1276
1277 case LINECAPS:
1280
1281 case POLYGONALCAPS:
1284
1285 case TEXTCAPS:
1286 return devcaps.ulTextCaps;
1287
1288 case CAPS1:
1289 case PDEVICESIZE:
1290 case SCALINGFACTORX:
1291 case SCALINGFACTORY:
1292 default:
1293 return 0;
1294 }
1295
1296 return 0;
1297}
#define CAPS1
Definition: mmsystem.h:934
HDC hdc
Definition: main.c:9
ULONG ulVertSize
Definition: ntgdityp.h:303
ULONG ulPhysicalOffsetX
Definition: ntgdityp.h:321
ULONG ulNumFonts
Definition: ntgdityp.h:309
ULONG ulTechnology
Definition: ntgdityp.h:299
ULONG ulTextCaps
Definition: ntgdityp.h:323
ULONG ulAspectY
Definition: ntgdityp.h:313
ULONG ulLogPixelsX
Definition: ntgdityp.h:315
ULONG ulLogPixelsY
Definition: ntgdityp.h:316
ULONG ulVersion
Definition: ntgdityp.h:298
ULONG ulAspectX
Definition: ntgdityp.h:312
ULONG ulHorzSize
Definition: ntgdityp.h:302
ULONG ulBltAlignment
Definition: ntgdityp.h:327
ULONG ulSizePalette
Definition: ntgdityp.h:317
ULONG ulBitsPixel
Definition: ntgdityp.h:306
ULONG ulColorMgmtCaps
Definition: ntgdityp.h:333
ULONG ulHorzRes
Definition: ntgdityp.h:304
ULONG ulPhysicalHeight
Definition: ntgdityp.h:320
ULONG ulColorRes
Definition: ntgdityp.h:318
ULONG ulNumPens
Definition: ntgdityp.h:308
ULONG ulPhysicalOffsetY
Definition: ntgdityp.h:322
ULONG ulPhysicalWidth
Definition: ntgdityp.h:319
ULONG ulVertRes
Definition: ntgdityp.h:305
ULONG ulRasterCaps
Definition: ntgdityp.h:311
ULONG ulNumColors
Definition: ntgdityp.h:310
ULONG ulShadeBlend
Definition: ntgdityp.h:332
ULONG ulAspectXY
Definition: ntgdityp.h:314
ULONG ulPlanes
Definition: ntgdityp.h:307
ULONG ulVRefresh
Definition: ntgdityp.h:324
_In_ WDFCOLLECTION _In_ ULONG Index
#define NUMRESERVED
Definition: wingdi.h:733
#define PHYSICALOFFSETY
Definition: wingdi.h:738
#define NUMBRUSHES
Definition: wingdi.h:722
#define LC_WIDESTYLED
Definition: wingdi.h:777
#define RASTERCAPS
Definition: wingdi.h:745
#define CC_CIRCLES
Definition: wingdi.h:761
#define HORZRES
Definition: wingdi.h:716
#define CC_WIDESTYLED
Definition: wingdi.h:767
#define ASPECTX
Definition: wingdi.h:727
#define PC_RECTANGLE
Definition: wingdi.h:797
#define CC_WIDE
Definition: wingdi.h:765
#define CC_INTERIORS
Definition: wingdi.h:768
#define PHYSICALHEIGHT
Definition: wingdi.h:736
#define CP_RECTANGLE
Definition: wingdi.h:826
#define COLORRES
Definition: wingdi.h:734
#define SCALINGFACTORX
Definition: wingdi.h:739
#define BLTALIGNMENT
Definition: wingdi.h:744
#define LC_STYLED
Definition: wingdi.h:776
#define PC_SCANLINE
Definition: wingdi.h:799
#define VERTSIZE
Definition: wingdi.h:715
#define LOGPIXELSY
Definition: wingdi.h:719
#define PHYSICALOFFSETX
Definition: wingdi.h:737
#define SIZEPALETTE
Definition: wingdi.h:732
#define DRIVERVERSION
Definition: wingdi.h:705
#define NUMCOLORS
Definition: wingdi.h:725
#define POLYGONALCAPS
Definition: wingdi.h:779
#define CC_ELLIPSES
Definition: wingdi.h:764
#define LC_POLYMARKER
Definition: wingdi.h:774
#define HORZSIZE
Definition: wingdi.h:714
#define PDEVICESIZE
Definition: wingdi.h:730
#define TEXTCAPS
Definition: wingdi.h:806
#define SCALINGFACTORY
Definition: wingdi.h:740
#define VREFRESH
Definition: wingdi.h:741
#define VERTRES
Definition: wingdi.h:717
#define LC_POLYLINE
Definition: wingdi.h:772
#define CC_ROUNDRECT
Definition: wingdi.h:769
#define PC_WINDPOLYGON
Definition: wingdi.h:798
#define CURVECAPS
Definition: wingdi.h:759
#define PHYSICALWIDTH
Definition: wingdi.h:735
#define PC_WIDE
Definition: wingdi.h:801
#define LC_WIDE
Definition: wingdi.h:775
#define PLANES
Definition: wingdi.h:721
#define DESKTOPHORZRES
Definition: wingdi.h:742
#define CC_PIE
Definition: wingdi.h:762
#define LOGPIXELSX
Definition: wingdi.h:718
#define CC_STYLED
Definition: wingdi.h:766
#define BITSPIXEL
Definition: wingdi.h:720
#define PC_STYLED
Definition: wingdi.h:802
#define CC_CHORD
Definition: wingdi.h:763
#define NUMFONTS
Definition: wingdi.h:724
#define PC_INTERIORS
Definition: wingdi.h:804
#define LC_INTERIORS
Definition: wingdi.h:778
#define PC_POLYGON
Definition: wingdi.h:794
#define LINECAPS
Definition: wingdi.h:770
#define ASPECTY
Definition: wingdi.h:728
#define NUMPENS
Definition: wingdi.h:723
#define LC_MARKER
Definition: wingdi.h:773
#define DESKTOPVERTRES
Definition: wingdi.h:743
#define CLIPCAPS
Definition: wingdi.h:731
#define ASPECTXY
Definition: wingdi.h:729
#define TECHNOLOGY
Definition: wingdi.h:706
#define PC_WIDESTYLED
Definition: wingdi.h:803

◆ NtGdiGetDhpdev()

DHPDEV APIENTRY NtGdiGetDhpdev ( IN HDEV  hdev)

Definition at line 1342 of file pdevobj.c.

1344{
1345 PPDEVOBJ ppdev;
1346 DHPDEV dhpdev = NULL;
1347
1348 /* Check parameter */
1350 return NULL;
1351
1352 /* Lock PDEV list */
1353 EngAcquireSemaphoreShared(ghsemPDEV);
1354
1355 /* Walk through the list of PDEVs */
1356 for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext)
1357 {
1358 /* Compare with the given HDEV */
1359 if (ppdev == (PPDEVOBJ)hdev)
1360 {
1361 /* Found the PDEV! Get it's dhpdev and break */
1362 dhpdev = ppdev->dhpdev;
1363 break;
1364 }
1365 }
1366
1367 /* Unlock PDEV list */
1369
1370 return dhpdev;
1371}
#define MmSystemRangeStart
Definition: mm.h:32
static PPDEVOBJ gppdevList
Definition: pdevobj.c:15
struct _PDEVOBJ * ppdevNext
Definition: pdevobj.h:83
DHPDEV dhpdev
Definition: pdevobj.h:120
char * PCHAR
Definition: typedefs.h:51
typedef DHPDEV(APIENTRY FN_DrvEnablePDEV)(_In_ DEVMODEW *pdm

◆ PDEVOBJ_AllocPDEV()

PPDEVOBJ PDEVOBJ_AllocPDEV ( VOID  )

Definition at line 63 of file pdevobj.c.

64{
65 PPDEVOBJ ppdev;
66
68 if (!ppdev)
69 return NULL;
70
71 RtlZeroMemory(ppdev, sizeof(PDEVOBJ));
72
74 if (ppdev->hsemDevLock == NULL)
75 {
77 return NULL;
78 }
79
80 /* Allocate EDD_DIRECTDRAW_GLOBAL for our ReactX driver */
82 if (ppdev->pEDDgpl)
84
85 ppdev->cPdevRefs = 1;
86
87 return ppdev;
88}
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
struct _EDD_DIRECTDRAW_GLOBAL * pEDDgpl
Definition: pdevobj.h:148
LONG cPdevRefs
Definition: pdevobj.h:84
HSEMAPHORE hsemDevLock
Definition: pdevobj.h:89
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define GDITAG_PDEV
Definition: tags.h:75

Referenced by PDEVOBJ_Create().

◆ PDEVOBJ_bDisableDisplay()

BOOL PDEVOBJ_bDisableDisplay ( _Inout_ PPDEVOBJ  ppdev)

Definition at line 412 of file pdevobj.c.

414{
415 BOOL assertVal;
416
417 if (ppdev->flFlags & PDEV_DISABLED)
418 return TRUE;
419
420#ifdef NATIVE_REACTX
421 PDEVOBJ_vSuspendDirectDraw(ppdev);
422#endif
423
424 TRACE("DrvAssertMode(dhpdev %p, FALSE)\n", ppdev->dhpdev);
425 assertVal = ppdev->pfn.AssertMode(ppdev->dhpdev, FALSE);
426 TRACE("DrvAssertMode(dhpdev %p, FALSE) => %d\n", ppdev->dhpdev, assertVal);
427
428 if (assertVal)
429 ppdev->flFlags |= PDEV_DISABLED;
430
431 return assertVal;
432}
@ PDEV_DISABLED
Definition: pdevobj.h:14
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by MDEVOBJ_bDisable(), PDEVOBJ_bSwitchMode(), PDEVOBJ_Create(), and PDEVOBJ_lChangeDisplaySettings().

◆ PDEVOBJ_bDynamicModeChange()

BOOL NTAPI PDEVOBJ_bDynamicModeChange ( PPDEVOBJ  ppdev,
PPDEVOBJ  ppdev2 
)

Definition at line 651 of file pdevobj.c.

654{
655 union
656 {
658 GDIINFO gdiinfo;
659 DEVINFO devinfo;
660 DWORD StateFlags;
661 } temp;
662
663 /* Exchange driver functions */
664 temp.pfn = ppdev->pfn;
665 ppdev->pfn = ppdev2->pfn;
666 ppdev2->pfn = temp.pfn;
667
668 /* Exchange LDEVs */
669 SwitchPointer(&ppdev->pldev, &ppdev2->pldev);
670
671 /* Exchange DHPDEV */
672 SwitchPointer(&ppdev->dhpdev, &ppdev2->dhpdev);
673
674 /* Exchange surfaces and associate them with their new PDEV */
675 SwitchPointer(&ppdev->pSurface, &ppdev2->pSurface);
676 ppdev->pSurface->SurfObj.hdev = (HDEV)ppdev;
677 ppdev2->pSurface->SurfObj.hdev = (HDEV)ppdev2;
678
679 /* Exchange devinfo */
680 temp.devinfo = ppdev->devinfo;
681 ppdev->devinfo = ppdev2->devinfo;
682 ppdev2->devinfo = temp.devinfo;
683
684 /* Exchange gdiinfo */
685 temp.gdiinfo = ppdev->gdiinfo;
686 ppdev->gdiinfo = ppdev2->gdiinfo;
687 ppdev2->gdiinfo = temp.gdiinfo;
688
689 /* Exchange DEVMODE */
690 SwitchPointer(&ppdev->pdmwDev, &ppdev2->pdmwDev);
691
692 /* Exchange state flags */
693 temp.StateFlags = ppdev->pGraphicsDevice->StateFlags;
695 ppdev2->pGraphicsDevice->StateFlags = temp.StateFlags;
696
697 /* Notify each driver instance of its new HDEV association */
698 ppdev->pfn.CompletePDEV(ppdev->dhpdev, (HDEV)ppdev);
699 ppdev2->pfn.CompletePDEV(ppdev2->dhpdev, (HDEV)ppdev2);
700
701#ifdef NATIVE_REACTX
702 /* Switch DirectDraw mode */
703 PDEVOBJ_vSwitchDirectDraw(ppdev, ppdev2);
704#endif
705
706 return TRUE;
707}
FORCEINLINE VOID SwitchPointer(_Inout_ PVOID pvPointer1, _Inout_ PVOID pvPointer2)
Definition: pdevobj.c:636
static calc_node_t temp
Definition: rpn_ieee.c:38
PFN_DrvCompletePDEV CompletePDEV
Definition: ntgdityp.h:570
DWORD StateFlags
Definition: pdevobj.h:66
DRIVER_FUNCTIONS pfn
Definition: pdevobj.h:138
PSURFACE pSurface
Definition: pdevobj.h:124
GDIINFO gdiinfo
Definition: pdevobj.h:123
PDEVMODEW pdmwDev
Definition: pdevobj.h:129
DEVINFO devinfo
Definition: pdevobj.h:122
SURFOBJ SurfObj
Definition: surface.h:8
HDEV hdev
Definition: winddi.h:1208

Referenced by PDEVOBJ_bSwitchMode(), and PDEVOBJ_lChangeDisplaySettings().

◆ PDEVOBJ_bEnablePDEV()

BOOL NTAPI PDEVOBJ_bEnablePDEV ( _In_ PPDEVOBJ  ppdev,
_In_ PDEVMODEW  pdevmode,
_In_ PWSTR  pwszLogAddress 
)

Definition at line 174 of file pdevobj.c.

178{
179 PFN_DrvEnablePDEV pfnEnablePDEV;
180 ULONG i;
181
182 /* Get the DrvEnablePDEV function */
183 pfnEnablePDEV = ppdev->pfn.EnablePDEV;
184
185 /* Call the drivers DrvEnablePDEV function */
186 TRACE("DrvEnablePDEV(pdevmode %p (%dx%dx%d %d Hz) hdev %p (%S))\n",
187 pdevmode,
188 ppdev->pGraphicsDevice ? pdevmode->dmPelsWidth : 0,
189 ppdev->pGraphicsDevice ? pdevmode->dmPelsHeight : 0,
190 ppdev->pGraphicsDevice ? pdevmode->dmBitsPerPel : 0,
191 ppdev->pGraphicsDevice ? pdevmode->dmDisplayFrequency : 0,
192 ppdev,
193 ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->szNtDeviceName : L"");
194 ppdev->dhpdev = pfnEnablePDEV(pdevmode,
197 ppdev->ahsurf,
198 sizeof(GDIINFO),
199 (PULONG)&ppdev->gdiinfo,
200 sizeof(DEVINFO),
201 &ppdev->devinfo,
202 (HDEV)ppdev,
203 ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->pwszDescription : NULL,
204 ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->DeviceObject : NULL);
205 TRACE("DrvEnablePDEV(pdevmode %p hdev %p) => dhpdev %p\n", pdevmode, ppdev, ppdev->dhpdev);
206 if (ppdev->dhpdev == NULL)
207 {
208 ERR("Failed to enable PDEV\n");
209 return FALSE;
210 }
211
212 /* Fix up some values */
213 if (ppdev->gdiinfo.ulLogPixelsX == 0)
214 ppdev->gdiinfo.ulLogPixelsX = 96;
215
216 if (ppdev->gdiinfo.ulLogPixelsY == 0)
217 ppdev->gdiinfo.ulLogPixelsY = 96;
218
219 /* Set raster caps */
220 ppdev->gdiinfo.flRaster = RC_OP_DX_OUTPUT | RC_GDI20_OUTPUT | RC_BIGFONT;
221 if ((ppdev->gdiinfo.ulTechnology != DT_PLOTTER) && (ppdev->gdiinfo.ulTechnology != DT_CHARSTREAM))
222 ppdev->gdiinfo.flRaster |= RC_STRETCHDIB | RC_STRETCHBLT | RC_DIBTODEV | RC_DI_BITMAP | RC_BITMAP64 | RC_BITBLT;
223 if (ppdev->gdiinfo.ulTechnology == DT_RASDISPLAY)
224 ppdev->gdiinfo.flRaster |= RC_FLOODFILL;
225 if (ppdev->devinfo.flGraphicsCaps & GCAPS_PALMANAGED)
226 ppdev->gdiinfo.flRaster |= RC_PALETTE;
227
228 /* Setup Palette */
229 ppdev->ppalSurf = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
230
231 /* Setup hatch brushes */
232 for (i = 0; i < HS_DDI_MAX; i++)
233 {
234 if (ppdev->ahsurf[i] == NULL)
235 ppdev->ahsurf[i] = gahsurfHatch[i];
236 }
237
238 TRACE("PDEVOBJ_bEnablePDEV - dhpdev = %p\n", ppdev->dhpdev);
239
240 return TRUE;
241}
#define ERR(fmt,...)
Definition: debug.h:110
HSURF gahsurfHatch[HS_DDI_MAX]
Definition: engbrush.c:24
#define L(x)
Definition: ntvdm.h:50
uint32_t * PULONG
Definition: typedefs.h:59
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
_In_ LPWSTR pwszLogAddress
Definition: winddi.h:3548
#define HS_DDI_MAX
Definition: winddi.h:3954
FN_DrvEnablePDEV * PFN_DrvEnablePDEV
Definition: winddi.h:3558
#define GCAPS_PALMANAGED
Definition: winddi.h:341
#define RC_GDI20_OUTPUT
Definition: wingdi.h:786
#define DT_CHARSTREAM
Definition: wingdi.h:711
#define RC_STRETCHDIB
Definition: wingdi.h:756
#define DT_RASDISPLAY
Definition: wingdi.h:708
#define RC_BITMAP64
Definition: wingdi.h:783
#define RC_BIGFONT
Definition: wingdi.h:781
#define RC_OP_DX_OUTPUT
Definition: wingdi.h:789
#define RC_DIBTODEV
Definition: wingdi.h:750
#define DT_PLOTTER
Definition: wingdi.h:707
#define RC_STRETCHBLT
Definition: wingdi.h:755
#define RC_DI_BITMAP
Definition: wingdi.h:785
#define RC_BITBLT
Definition: wingdi.h:782
#define RC_FLOODFILL
Definition: wingdi.h:751
#define RC_PALETTE
Definition: wingdi.h:790

Referenced by PDEVOBJ_Create().

◆ PDEVOBJ_bSwitchMode()

BOOL NTAPI PDEVOBJ_bSwitchMode ( PPDEVOBJ  ppdev,
PDEVMODEW  pdm 
)

Definition at line 712 of file pdevobj.c.

715{
716 PPDEVOBJ ppdevTmp;
718 BOOL retval = FALSE;
719
720 /* Lock the PDEV */
722
723 /* And everything else */
725
726 DPRINT1("PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
727
728 // Lookup the GraphicsDevice + select DEVMODE
729 // pdm = LDEVOBJ_bProbeAndCaptureDevmode(ppdev, pdm);
730
731 /* 1. Temporarily disable the current PDEV and reset video to its default mode */
732 if (!PDEVOBJ_bDisableDisplay(ppdev))
733 {
734 DPRINT1("PDEVOBJ_bDisableDisplay() failed\n");
735#ifdef NATIVE_REACTX
736 /* Resume DirectDraw in case of failure */
737 PDEVOBJ_vResumeDirectDraw(ppdev);
738#endif
739 goto leave;
740 }
741
742 /* 2. Create new PDEV */
743 ppdevTmp = PDEVOBJ_Create(ppdev->pGraphicsDevice, pdm, 0, LDEV_DEVICE_DISPLAY);
744 if (!ppdevTmp)
745 {
746 DPRINT1("Failed to create a new PDEV\n");
747 goto leave2;
748 }
749
750 /* 3. Create a new surface */
751 pSurface = PDEVOBJ_pSurface(ppdevTmp);
752 if (!pSurface)
753 {
754 DPRINT1("PDEVOBJ_pSurface failed\n");
755 PDEVOBJ_vRelease(ppdevTmp);
756 goto leave2;
757 }
758
759#ifdef NATIVE_REACTX
760 /* 4. Temporarily suspend DirectDraw for mode change */
761 PDEVOBJ_vSuspendDirectDraw(ppdev);
762 PDEVOBJ_vSuspendDirectDraw(ppdevTmp);
763#endif
764
765 /* 5. Switch the PDEVs */
766 if (!PDEVOBJ_bDynamicModeChange(ppdev, ppdevTmp))
767 {
768 DPRINT1("PDEVOBJ_bDynamicModeChange() failed\n");
769 PDEVOBJ_vRelease(ppdevTmp);
770 goto leave2;
771 }
772
773#ifdef NATIVE_REACTX
774 /* 6. Resume DirectDraw */
775 PDEVOBJ_vResumeDirectDraw(ppdev);
776 PDEVOBJ_vResumeDirectDraw(ppdevTmp);
777#endif
778
779 /* Release temp PDEV */
780 PDEVOBJ_vRelease(ppdevTmp);
781
782#ifdef NATIVE_REACTX
783 /* Re-initialize DirectDraw data */
784 ppdev->pEDDgpl->hDev = (HDEV)ppdev;
785 ppdev->pEDDgpl->dhpdev = ppdev->dhpdev;
786#endif
787
788 /* Update primary display capabilities */
789 if (ppdev == gpmdev->ppdevGlobal)
790 {
791 PDEVOBJ_vGetDeviceCaps(ppdev, &GdiHandleTable->DevCaps);
792 }
793
794 /* Success! */
795 retval = TRUE;
796
797leave2:
798 /* Set the new video mode, or restore the original one in case of failure */
800
801leave:
802 /* Unlock everything else */
804 /* Unlock the PDEV */
806
807 DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
808
809 return retval;
810}
#define DPRINT1
Definition: precomp.h:8
#define leave
Definition: btrfs_drv.h:138
@ LDEV_DEVICE_DISPLAY
Definition: ldevobj.h:8
BOOL PDEVOBJ_bDisableDisplay(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:412
PPDEVOBJ PDEVOBJ_Create(_In_opt_ PGRAPHICS_DEVICE pGraphicsDevice, _In_opt_ PDEVMODEW pdm, _In_ ULONG dwAccelerationLevel, _In_ ULONG ldevtype)
Definition: pdevobj.c:467
BOOL NTAPI PDEVOBJ_bDynamicModeChange(PPDEVOBJ ppdev, PPDEVOBJ ppdev2)
Definition: pdevobj.c:651
VOID NTAPI PDEVOBJ_vRelease(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:105
PSURFACE NTAPI PDEVOBJ_pSurface(PPDEVOBJ ppdev)
Definition: pdevobj.c:311
VOID PDEVOBJ_vEnableDisplay(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:392
#define GdiHandleTable
Definition: win32nt.h:37
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481

Referenced by UserChangeDisplaySettings(), and UserRefreshDisplay().

◆ PDEVOBJ_Create()

PPDEVOBJ PDEVOBJ_Create ( _In_opt_ PGRAPHICS_DEVICE  pGraphicsDevice,
_In_opt_ PDEVMODEW  pdm,
_In_ ULONG  dwAccelerationLevel,
_In_ ULONG  ldevtype 
)

Definition at line 467 of file pdevobj.c.

472{
473 PPDEVOBJ ppdev, ppdevMatch = NULL;
474 PLDEVOBJ pldev;
476
477 TRACE("PDEVOBJ_Create(%p %p %d)\n", pGraphicsDevice, pdm, ldevtype);
478
479 if (ldevtype != LDEV_DEVICE_META)
480 {
481 ASSERT(pGraphicsDevice);
482 ASSERT(pdm);
483 /* Search if we already have a PPDEV with the required characteristics.
484 * We will compare the graphics device, the devmode and the desktop
485 */
486 for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext)
487 {
488 if (ppdev->pGraphicsDevice == pGraphicsDevice)
489 {
490 PDEVOBJ_vReference(ppdev);
491
492 if (RtlEqualMemory(pdm, ppdev->pdmwDev, sizeof(DEVMODEW)) &&
493 ppdev->dwAccelerationLevel == dwAccelerationLevel)
494 {
495 PDEVOBJ_vReference(ppdev);
496 ppdevMatch = ppdev;
497 }
498 else
499 {
501 }
502
503 PDEVOBJ_vRelease(ppdev);
504 }
505 }
506
507 if (ppdevMatch)
508 {
509 PDEVOBJ_vEnableDisplay(ppdevMatch);
510
511 return ppdevMatch;
512 }
513 }
514
515 /* Try to get a display driver */
516 if (ldevtype == LDEV_DEVICE_META)
517 pldev = LDEVOBJ_pLoadInternal(MultiEnableDriver, ldevtype);
518 else
519 pldev = LDEVOBJ_pLoadDriver(pdm->dmDeviceName, ldevtype);
520 if (!pldev)
521 {
522 ERR("Could not load display driver '%S'\n",
523 (ldevtype == LDEV_DEVICE_META) ? L"" : pdm->dmDeviceName);
524 return NULL;
525 }
526
527 /* Allocate a new PDEVOBJ */
528 ppdev = PDEVOBJ_AllocPDEV();
529 if (!ppdev)
530 {
531 ERR("failed to allocate a PDEV\n");
532 return NULL;
533 }
534
535 if (ldevtype != LDEV_DEVICE_META)
536 {
537 ppdev->pGraphicsDevice = pGraphicsDevice;
538
539 // DxEngGetHdevData asks for Graphics DeviceObject in hSpooler field
540 ppdev->hSpooler = ppdev->pGraphicsDevice->DeviceObject;
541
542 /* Keep selected resolution */
543 if (ppdev->pdmwDev)
545 ppdev->pdmwDev = ExAllocatePoolWithTag(PagedPool, pdm->dmSize + pdm->dmDriverExtra, GDITAG_DEVMODE);
546 if (ppdev->pdmwDev)
547 {
548 RtlCopyMemory(ppdev->pdmwDev, pdm, pdm->dmSize + pdm->dmDriverExtra);
549 /* FIXME: this must be done in a better way */
551 }
552 }
553
554 /* FIXME! */
555 ppdev->flFlags = PDEV_DISPLAY;
556
557 /* HACK: Don't use the pointer */
558 ppdev->Pointer.Exclude.right = -1;
559
560 /* Initialize PDEV */
561 ppdev->pldev = pldev;
562 ppdev->dwAccelerationLevel = dwAccelerationLevel;
563
564 /* Copy the function table */
565 if ((ldevtype == LDEV_DEVICE_DISPLAY && dwAccelerationLevel >= 5) ||
566 pdm->dmFields & (DM_PANNINGWIDTH | DM_PANNINGHEIGHT))
567 {
568 ULONG i;
569
570 /* Initialize missing fields */
571 if (!(pdm->dmFields & DM_PANNINGWIDTH))
572 pdm->dmPanningWidth = pdm->dmPelsWidth;
573 if (!(pdm->dmFields & DM_PANNINGHEIGHT))
574 pdm->dmPanningHeight = pdm->dmPelsHeight;
575
576 /* Replace vtable by panning vtable */
577 for (i = 0; i < gPanDispDrvCount; i++)
579 }
580 else
581 {
582 ppdev->pfn = ppdev->pldev->pfn;
583 }
584
585 /* Call the driver to enable the PDEV */
586 if (!PDEVOBJ_bEnablePDEV(ppdev, pdm, NULL))
587 {
588 ERR("Failed to enable PDEV!\n");
589 PDEVOBJ_vRelease(ppdev);
590 EngUnloadImage(pldev);
591 return NULL;
592 }
593
594 /* Tell the driver that the PDEV is ready */
596
597 /* Create the initial surface */
598 pSurface = PDEVOBJ_pSurface(ppdev);
599 if (!pSurface)
600 {
601 ERR("Failed to create surface\n");
602 PDEVOBJ_vRelease(ppdev);
603 EngUnloadImage(pldev);
604 return NULL;
605 }
606
607#ifdef NATIVE_REACTX
608 /* Enable DirectDraw */
609 if (!PDEVOBJ_bEnableDirectDraw(ppdev))
610 {
611 ERR("Failed to enable DirectDraw\n");
612 PDEVOBJ_vRelease(ppdev);
613 EngUnloadImage(pldev);
614 return NULL;
615 }
616#endif
617
618 /* Remove some acceleration capabilities from driver */
620
621 /* Set MovePointer function */
622 ppdev->pfnMovePointer = ppdev->pfn.MovePointer;
623 if (!ppdev->pfnMovePointer)
625
626 /* Insert the PDEV into the list */
627 ppdev->ppdevNext = gppdevList;
628 gppdevList = ppdev;
629
630 /* Return the PDEV */
631 return ppdev;
632}
#define RtlEqualMemory(a, b, c)
Definition: kdvm.h:18
PLDEVOBJ NTAPI LDEVOBJ_pLoadDriver(_In_z_ LPWSTR pwszDriverName, _In_ ULONG ldevtype)
Definition: ldevobj.c:347
PLDEVOBJ LDEVOBJ_pLoadInternal(_In_ PFN_DrvEnableDriver pfnEnableDriver, _In_ ULONG ldevtype)
Definition: ldevobj.c:303
@ LDEV_DEVICE_META
Definition: ldevobj.h:10
BOOL NTAPI PDEVOBJ_bEnablePDEV(_In_ PPDEVOBJ ppdev, _In_ PDEVMODEW pdevmode, _In_ PWSTR pwszLogAddress)
Definition: pdevobj.c:174
BOOL APIENTRY MultiEnableDriver(_In_ ULONG iEngineVersion, _In_ ULONG cj, _Inout_bytecount_(cj) PDRVENABLEDATA pded)
Definition: multidisp.c:17
static VOID PDEVOBJ_vFilterDriverHooks(_In_ PPDEVOBJ ppdev)
Definition: pdevobj.c:255
DRVFN gPanDispDrvFn[]
Definition: pandisp.c:477
PPDEVOBJ PDEVOBJ_AllocPDEV(VOID)
Definition: pdevobj.c:63
ULONG gPanDispDrvCount
Definition: pandisp.c:501
VOID NTAPI PDEVOBJ_vCompletePDEV(PPDEVOBJ ppdev)
Definition: pdevobj.c:245
@ PDEV_DISPLAY
Definition: pdevobj.h:7
long right
Definition: polytest.cpp:53
PFN_DrvMovePointer MovePointer
Definition: ntgdityp.h:599
PFN pfn
Definition: winddi.h:531
ULONG iFunc
Definition: winddi.h:530
RECTL Exclude
Definition: pdevobj.h:39
PDEVICE_OBJECT DeviceObject
Definition: pdevobj.h:63
GDIPOINTER Pointer
Definition: pdevobj.h:143
FLONG flFlags
Definition: pdevobj.h:87
HANDLE hSpooler
Definition: pdevobj.h:125
PFN_DrvMovePointer pfnMovePointer
Definition: pdevobj.h:113
PVOID apfn[INDEX_LAST]
Definition: pdevobj.h:139
WORD dmSize
Definition: wingdi.h:1620
#define GDITAG_DEVMODE
Definition: tags.h:73
ENGAPI VOID APIENTRY EngMovePointer(_In_ SURFOBJ *pso, _In_ LONG x, _In_ LONG y, _In_ RECTL *prcl)
Definition: mouse.c:575
ENGAPI VOID APIENTRY EngUnloadImage(_In_ HANDLE hModule)
Definition: ldevobj.c:913
#define DM_PANNINGHEIGHT
Definition: wingdi.h:1278
#define DISPLAY_DEVICE_PRIMARY_DEVICE
Definition: wingdi.h:1398
#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
Definition: wingdi.h:1396
#define DM_PANNINGWIDTH
Definition: wingdi.h:1277

Referenced by MDEVOBJ_Create(), PDEVOBJ_bSwitchMode(), and PDEVOBJ_lChangeDisplaySettings().

◆ PDEVOBJ_iGetColorManagementCaps()

INT NTAPI PDEVOBJ_iGetColorManagementCaps ( PPDEVOBJ  ppdev)

Definition at line 1032 of file pdevobj.c.

1033{
1034 INT ret = CM_NONE;
1035
1036 if (ppdev->flFlags & PDEV_DISPLAY)
1037 {
1038 if (ppdev->devinfo.iDitherFormat == BMF_8BPP ||
1040 ret = CM_GAMMA_RAMP;
1041 }
1042
1044 ret |= CM_CMYK_COLOR;
1045 if (ppdev->devinfo.flGraphicsCaps & GCAPS_ICM)
1046 ret |= CM_DEVICE_ICM;
1047
1048 return ret;
1049}
FLONG flGraphicsCaps
Definition: winddi.h:390
ULONG iDitherFormat
Definition: winddi.h:395
FLONG flGraphicsCaps2
Definition: winddi.h:399
int32_t INT
Definition: typedefs.h:58
int ret
#define GCAPS2_CHANGEGAMMARAMP
Definition: winddi.h:370
#define BMF_8BPP
Definition: winddi.h:357
#define GCAPS_ICM
Definition: winddi.h:346
#define GCAPS_CMYKCOLOR
Definition: winddi.h:347

Referenced by PDEVOBJ_vGetDeviceCaps().

◆ PDEVOBJ_lChangeDisplaySettings()

LONG PDEVOBJ_lChangeDisplaySettings ( _In_opt_ PUNICODE_STRING  pustrDeviceName,
_In_opt_ PDEVMODEW  RequestedMode,
_In_opt_ PMDEVOBJ  pmdevOld,
_Out_ PMDEVOBJ ppmdevNew,
_In_ BOOL  bSearchClosestMode 
)

Definition at line 865 of file pdevobj.c.

871{
872 PGRAPHICS_DEVICE pGraphicsDevice = NULL;
873 PMDEVOBJ pmdev = NULL;
874 PDEVMODEW pdm = NULL;
876 ULONG i, j;
877
878 TRACE("PDEVOBJ_lChangeDisplaySettings('%wZ' '%dx%dx%d (%d Hz)' %p %p)\n",
879 pustrDeviceName,
880 RequestedMode ? RequestedMode->dmPelsWidth : 0,
881 RequestedMode ? RequestedMode->dmPelsHeight : 0,
882 RequestedMode ? RequestedMode->dmBitsPerPel : 0,
883 RequestedMode ? RequestedMode->dmDisplayFrequency : 0,
884 pmdevOld, ppmdevNew);
885
886 if (pustrDeviceName)
887 {
888 pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0);
889 if (!pGraphicsDevice)
890 {
891 ERR("Wrong device name provided: '%wZ'\n", pustrDeviceName);
893 goto cleanup;
894 }
895 }
896 else if (RequestedMode)
897 {
898 pGraphicsDevice = gpPrimaryGraphicsDevice;
899 if (!pGraphicsDevice)
900 {
901 ERR("Wrong device'\n");
903 goto cleanup;
904 }
905 }
906
907 if (pGraphicsDevice)
908 {
909 if (!LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, RequestedMode, &pdm, bSearchClosestMode))
910 {
911 ERR("DrvProbeAndCaptureDevmode() failed\n");
912 lRet = DISP_CHANGE_BADMODE;
913 goto cleanup;
914 }
915 }
916
917 /* Here, we know that input parameters were correct */
918
919 {
920 /* Create new MDEV. Note that if we provide a device name,
921 * MDEV will only contain one device.
922 * */
923
924 if (pmdevOld)
925 {
926 /* Disable old MDEV */
927 if (MDEVOBJ_bDisable(pmdevOld))
928 {
929 /* Create new MDEV. On failure, reenable old MDEV */
930 pmdev = MDEVOBJ_Create(pustrDeviceName, pdm);
931 if (!pmdev)
932 MDEVOBJ_vEnable(pmdevOld);
933 }
934 }
935 else
936 {
937 pmdev = MDEVOBJ_Create(pustrDeviceName, pdm);
938 }
939
940 if (!pmdev)
941 {
942 ERR("Failed to create new MDEV\n");
943 lRet = DISP_CHANGE_FAILED;
944 goto cleanup;
945 }
946
948 *ppmdevNew = pmdev;
949
950 /* We now have to do the mode switch */
951
952 if (pustrDeviceName && pmdevOld)
953 {
954 /* We changed settings of one device. Add other devices which were already present */
955 for (i = 0; i < pmdevOld->cDev; i++)
956 {
957 for (j = 0; j < pmdev->cDev; j++)
958 {
959 if (pmdev->dev[j].ppdev->pGraphicsDevice == pmdevOld->dev[i].ppdev->pGraphicsDevice)
960 {
961 if (PDEVOBJ_bDynamicModeChange(pmdevOld->dev[i].ppdev, pmdev->dev[j].ppdev))
962 {
963 PPDEVOBJ tmp = pmdevOld->dev[i].ppdev;
964 pmdevOld->dev[i].ppdev = pmdev->dev[j].ppdev;
965 pmdev->dev[j].ppdev = tmp;
966 }
967 else
968 {
969 ERR("Failed to apply new settings\n");
971 ASSERT(FALSE);
972 }
973 break;
974 }
975 }
976 if (j == pmdev->cDev)
977 {
978 PDEVOBJ_vReference(pmdevOld->dev[i].ppdev);
979 pmdev->dev[pmdev->cDev].ppdev = pmdevOld->dev[i].ppdev;
980 pmdev->cDev++;
981 }
982 }
983 }
984
985 if (pmdev->cDev == 1)
986 {
987 pmdev->ppdevGlobal = pmdev->dev[0].ppdev;
988 }
989 else
990 {
991 /* Enable MultiDriver */
993 if (!pmdev->ppdevGlobal)
994 {
995 WARN("Failed to create meta-device. Using only first display\n");
996 PDEVOBJ_vReference(pmdev->dev[0].ppdev);
997 pmdev->ppdevGlobal = pmdev->dev[0].ppdev;
998 }
999 }
1000
1001 if (pmdevOld)
1002 {
1003 /* Search PDEVs which were in pmdevOld, but are not anymore in pmdev, and disable them */
1004 for (i = 0; i < pmdevOld->cDev; i++)
1005 {
1006 for (j = 0; j < pmdev->cDev; j++)
1007 {
1008 if (pmdev->dev[j].ppdev->pGraphicsDevice == pmdevOld->dev[i].ppdev->pGraphicsDevice)
1009 break;
1010 }
1011 if (j == pmdev->cDev)
1012 PDEVOBJ_bDisableDisplay(pmdevOld->dev[i].ppdev);
1013 }
1014 }
1015 }
1016
1017cleanup:
1018 if (lRet != DISP_CHANGE_SUCCESSFUL)
1019 {
1020 *ppmdevNew = NULL;
1021 if (pmdev)
1022 MDEVOBJ_vDestroy(pmdev);
1023 if (pdm && pdm != RequestedMode)
1025 }
1026
1027 return lRet;
1028}
#define WARN(fmt,...)
Definition: debug.h:112
static void cleanup(void)
Definition: main.c:1335
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 GLint GLint j
Definition: glfuncs.h:250
BOOL LDEVOBJ_bProbeAndCaptureDevmode(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice, _In_ PDEVMODEW RequestedMode, _Out_ PDEVMODEW *pSelectedMode, _In_ BOOL bSearchClosestMode)
Definition: ldevobj.c:737
VOID MDEVOBJ_vDestroy(_Inout_ PMDEVOBJ pmdev)
Definition: mdevobj.c:164
PMDEVOBJ MDEVOBJ_Create(_In_opt_ PUNICODE_STRING pustrDeviceName, _In_opt_ PDEVMODEW pdm)
Definition: mdevobj.c:57
BOOL MDEVOBJ_bDisable(_Inout_ PMDEVOBJ pmdev)
Definition: mdevobj.c:29
VOID MDEVOBJ_vEnable(_Inout_ PMDEVOBJ pmdev)
Definition: mdevobj.c:17
PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice(_In_opt_ PUNICODE_STRING pustrDevice, _In_ ULONG iDevNum)
Definition: device.c:641
PGRAPHICS_DEVICE gpPrimaryGraphicsDevice
Definition: device.c:15
#define DISP_CHANGE_BADMODE
Definition: winuser.h:195
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
#define DISP_CHANGE_BADPARAM
Definition: winuser.h:193
#define DISP_CHANGE_FAILED
Definition: winuser.h:194

Referenced by co_IntInitializeDesktopGraphics().

◆ PDEVOBJ_pSurface()

PSURFACE NTAPI PDEVOBJ_pSurface ( PPDEVOBJ  ppdev)

Definition at line 311 of file pdevobj.c.

313{
314 HSURF hsurf;
315
316 /* Check if there is no surface for this PDEV yet */
317 if (ppdev->pSurface == NULL)
318 {
319 /* Call the drivers DrvEnableSurface */
320 TRACE("DrvEnableSurface(dhpdev %p)\n", ppdev->dhpdev);
321 hsurf = ppdev->pfn.EnableSurface(ppdev->dhpdev);
322 TRACE("DrvEnableSurface(dhpdev %p) => hsurf %p\n", ppdev->dhpdev, hsurf);
323 if (hsurf== NULL)
324 {
325 ERR("Failed to create PDEV surface!\n");
326 return NULL;
327 }
328
329 /* Get a reference to the surface */
330 ppdev->pSurface = SURFACE_ShareLockSurface(hsurf);
331 NT_ASSERT(ppdev->pSurface != NULL);
332 }
333
334 /* Increment reference count */
336
337 return ppdev->pSurface;
338}
PFN_DrvEnableSurface EnableSurface
Definition: ntgdityp.h:572
BASEOBJECT BaseObject
Definition: surface.h:6
#define SURFACE_ShareLockSurface(hBMObj)
Definition: surface.h:91
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:734
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Referenced by DC_vInitDc(), DC_vUpdateDC(), IntCreatePrimarySurface(), PDEVOBJ_bSwitchMode(), and PDEVOBJ_Create().

◆ PDEVOBJ_sizl()

PSIZEL FASTCALL PDEVOBJ_sizl ( PPDEVOBJ  ppdev,
PSIZEL  psizl 
)

Definition at line 1375 of file pdevobj.c.

1376{
1377 if (ppdev->flFlags & PDEV_META_DEVICE)
1378 {
1379 *psizl = ppdev->szlMetaRes;
1380 }
1381 else
1382 {
1383 psizl->cx = ppdev->gdiinfo.ulHorzRes;
1384 psizl->cy = ppdev->gdiinfo.ulVertRes;
1385 }
1386 return psizl;
1387}
@ PDEV_META_DEVICE
Definition: pdevobj.h:20
ULONG ulVertRes
Definition: winddi.h:883
ULONG ulHorzRes
Definition: winddi.h:882
SIZEL szlMetaRes
Definition: pdevobj.h:108
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28

Referenced by DC_vUpdateDC(), MakeInfoDC(), and UserUpdateMonitorSize().

◆ PDEVOBJ_vCompletePDEV()

VOID NTAPI PDEVOBJ_vCompletePDEV ( PPDEVOBJ  ppdev)

Definition at line 245 of file pdevobj.c.

247{
248 /* Call the drivers DrvCompletePDEV function */
249 TRACE("DrvCompletePDEV(dhpdev %p hdev %p)\n", ppdev->dhpdev, ppdev);
250 ppdev->pfn.CompletePDEV(ppdev->dhpdev, (HDEV)ppdev);
251}

Referenced by PDEVOBJ_Create().

◆ PDEVOBJ_vDeletePDEV()

static VOID PDEVOBJ_vDeletePDEV ( PPDEVOBJ  ppdev)
static

Definition at line 92 of file pdevobj.c.

94{
96 if (ppdev->pdmwDev)
98 if (ppdev->pEDDgpl)
101}
_Requires_lock_not_held_ hsem ENGAPI VOID APIENTRY EngDeleteSemaphore(_Inout_ __drv_freesMem(Mem) HSEMAPHORE hsem)
Definition: semaphor.c:106

Referenced by PDEVOBJ_vRelease().

◆ PDEVOBJ_vEnableDisplay()

VOID PDEVOBJ_vEnableDisplay ( _Inout_ PPDEVOBJ  ppdev)

Definition at line 392 of file pdevobj.c.

394{
395 BOOL assertVal;
396
397 if (!(ppdev->flFlags & PDEV_DISABLED))
398 return;
399
400 /* Try to enable display until success */
401 do
402 {
403 TRACE("DrvAssertMode(dhpdev %p, TRUE)\n", ppdev->dhpdev);
404 assertVal = ppdev->pfn.AssertMode(ppdev->dhpdev, TRUE);
405 TRACE("DrvAssertMode(dhpdev %p, TRUE) => %d\n", ppdev->dhpdev, assertVal);
406 } while (!assertVal);
407
408 ppdev->flFlags &= ~PDEV_DISABLED;
409}

Referenced by MDEVOBJ_bDisable(), MDEVOBJ_vEnable(), PDEVOBJ_bSwitchMode(), and PDEVOBJ_Create().

◆ PDEVOBJ_vFilterDriverHooks()

static VOID PDEVOBJ_vFilterDriverHooks ( _In_ PPDEVOBJ  ppdev)
static

Definition at line 255 of file pdevobj.c.

257{
258 PLDEVOBJ pldev = ppdev->pldev;
259 ULONG dwAccelerationLevel = ppdev->dwAccelerationLevel;
260
261 if (!pldev->pGdiDriverInfo)
262 return;
263 if (pldev->ldevtype != LDEV_DEVICE_DISPLAY)
264 return;
265
266 if (dwAccelerationLevel >= 1)
267 {
269 ppdev->apfn[INDEX_DrvCreateDeviceBitmap] = NULL;
270 }
271
272 if (dwAccelerationLevel >= 2)
273 {
274 /* Remove sophisticated display accelerations */
275 ppdev->pSurface->flags &= ~(HOOK_STRETCHBLT |
281 }
282
283 if (dwAccelerationLevel >= 3)
284 {
285 /* Disable DirectDraw and Direct3D accelerations */
286 /* FIXME: need to call DxDdSetAccelLevel */
288 }
289
290 if (dwAccelerationLevel >= 4)
291 {
292 /* Remove almost all display accelerations */
293 ppdev->pSurface->flags &= ~HOOK_FLAGS |
299
300 }
301
302 if (dwAccelerationLevel >= 5)
303 {
304 /* Disable all display accelerations */
305 /* (nothing to do. Already handled in PDEVOBJ_Create) */
306 }
307}
SYSTEM_GDI_DRIVER_INFORMATION * pGdiDriverInfo
Definition: ldevobj.h:19
LDEVTYPE ldevtype
Definition: ldevobj.h:20
PVOID apfn[INDEX_LAST]
Definition: ldevobj.h:26
#define INDEX_DrvSetPointerShape
Definition: winddi.h:445
#define HOOK_TRANSPARENTBLT
Definition: winddi.h:1434
#define HOOK_STRETCHBLT
Definition: winddi.h:1421
#define HOOK_TEXTOUT
Definition: winddi.h:1423
#define HOOK_GRADIENTFILL
Definition: winddi.h:1436
#define HOOK_BITBLT
Definition: winddi.h:1420
#define HOOK_FILLPATH
Definition: winddi.h:1426
#define INDEX_DrvCreateDeviceBitmap
Definition: winddi.h:426
#define HOOK_ALPHABLEND
Definition: winddi.h:1435
#define HOOK_SYNCHRONIZE
Definition: winddi.h:1431
#define HOOK_COPYBITS
Definition: winddi.h:1429
#define HOOK_LINETO
Definition: winddi.h:1428
#define HOOK_STROKEPATH
Definition: winddi.h:1425

Referenced by PDEVOBJ_Create().

◆ PDEVOBJ_vGetDeviceCaps()

VOID NTAPI PDEVOBJ_vGetDeviceCaps ( IN PPDEVOBJ  ppdev,
OUT PDEVCAPS  pDevCaps 
)

Definition at line 1053 of file pdevobj.c.

1056{
1057 PGDIINFO pGdiInfo = &ppdev->gdiinfo;
1058
1059 pDevCaps->ulVersion = pGdiInfo->ulVersion;
1060 pDevCaps->ulTechnology = pGdiInfo->ulTechnology;
1061 pDevCaps->ulHorzSizeM = (pGdiInfo->ulHorzSize + 500) / 1000;
1062 pDevCaps->ulVertSizeM = (pGdiInfo->ulVertSize + 500) / 1000;
1063 pDevCaps->ulHorzSize = pGdiInfo->ulHorzSize;
1064 pDevCaps->ulVertSize = pGdiInfo->ulVertSize;
1065 pDevCaps->ulHorzRes = pGdiInfo->ulHorzRes;
1066 pDevCaps->ulVertRes = pGdiInfo->ulVertRes;
1067 pDevCaps->ulBitsPixel = pGdiInfo->cBitsPixel;
1068 if (pDevCaps->ulBitsPixel == 15) pDevCaps->ulBitsPixel = 16;
1069 pDevCaps->ulPlanes = pGdiInfo->cPlanes;
1070 pDevCaps->ulNumPens = pGdiInfo->ulNumColors;
1071 if (pDevCaps->ulNumPens != -1) pDevCaps->ulNumPens *= 5;
1072 pDevCaps->ulNumFonts = 0; // PDEVOBJ_cFonts(ppdev);
1073 pDevCaps->ulNumColors = pGdiInfo->ulNumColors;
1074 pDevCaps->ulRasterCaps = pGdiInfo->flRaster;
1075 pDevCaps->ulAspectX = pGdiInfo->ulAspectX;
1076 pDevCaps->ulAspectY = pGdiInfo->ulAspectY;
1077 pDevCaps->ulAspectXY = pGdiInfo->ulAspectXY;
1078 pDevCaps->ulLogPixelsX = pGdiInfo->ulLogPixelsX;
1079 pDevCaps->ulLogPixelsY = pGdiInfo->ulLogPixelsY;
1080 pDevCaps->ulSizePalette = pGdiInfo->ulNumPalReg;
1081 pDevCaps->ulColorRes = pGdiInfo->ulDACRed +
1082 pGdiInfo->ulDACGreen +
1083 pGdiInfo->ulDACBlue;
1088 pDevCaps->ulTextCaps = pGdiInfo->flTextCaps;
1090 if (pGdiInfo->ulTechnology != DT_PLOTTER)
1092 pDevCaps->ulVRefresh = pGdiInfo->ulVRefresh;
1093 pDevCaps->ulDesktopHorzRes = pGdiInfo->ulHorzRes;
1094 pDevCaps->ulDesktopVertRes = pGdiInfo->ulVertRes;
1100 pDevCaps->ulShadeBlend = pGdiInfo->flShadeBlend;
1102}
INT NTAPI PDEVOBJ_iGetColorManagementCaps(PPDEVOBJ ppdev)
Definition: pdevobj.c:1032
ULONG ulDesktopVertRes
Definition: ntgdityp.h:326
ULONG yPanningAlignment
Definition: ntgdityp.h:331
ULONG ulDesktopHorzRes
Definition: ntgdityp.h:325
ULONG xPanningAlignment
Definition: ntgdityp.h:330
ULONG ulPanningHorzRes
Definition: ntgdityp.h:328
ULONG ulHorzSizeM
Definition: ntgdityp.h:300
ULONG ulVertSizeM
Definition: ntgdityp.h:301
ULONG ulPanningVertRes
Definition: ntgdityp.h:329
ULONG ulVertSize
Definition: winddi.h:881
ULONG ulLogPixelsY
Definition: winddi.h:889
ULONG ulDACGreen
Definition: winddi.h:892
ULONG ulPanningHorzRes
Definition: winddi.h:911
ULONG ulPanningVertRes
Definition: winddi.h:912
ULONG ulLogPixelsX
Definition: winddi.h:888
ULONG ulAspectY
Definition: winddi.h:895
ULONG ulTechnology
Definition: winddi.h:879
ULONG ulNumColors
Definition: winddi.h:886
ULONG ulAspectX
Definition: winddi.h:894
ULONG flShadeBlend
Definition: winddi.h:920
ULONG cBitsPixel
Definition: winddi.h:884
ULONG yPanningAlignment
Definition: winddi.h:914
POINTL ptlPhysOffset
Definition: winddi.h:900
ULONG xPanningAlignment
Definition: winddi.h:913
ULONG ulBltAlignment
Definition: winddi.h:910
SIZEL szlPhysSize
Definition: winddi.h:901
ULONG ulHorzSize
Definition: winddi.h:880
ULONG flRaster
Definition: winddi.h:887
ULONG ulDACBlue
Definition: winddi.h:893
ULONG ulVersion
Definition: winddi.h:878
ULONG ulAspectXY
Definition: winddi.h:896
ULONG ulNumPalReg
Definition: winddi.h:902
ULONG flTextCaps
Definition: winddi.h:890
ULONG cPlanes
Definition: winddi.h:885
ULONG ulDACRed
Definition: winddi.h:891
ULONG ulVRefresh
Definition: winddi.h:909
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
#define TC_SO_ABLE
Definition: wingdi.h:819
#define TC_CP_STROKE
Definition: wingdi.h:809
#define TC_OP_CHARACTER
Definition: wingdi.h:807
#define TC_VA_ABLE
Definition: wingdi.h:821
#define TC_UA_ABLE
Definition: wingdi.h:818
#define TC_OP_STROKE
Definition: wingdi.h:808

Referenced by _Success_(), IntCreatePrimarySurface(), NtGdiGetDeviceCaps(), and PDEVOBJ_bSwitchMode().

◆ PDEVOBJ_vRefreshModeList()

VOID NTAPI PDEVOBJ_vRefreshModeList ( PPDEVOBJ  ppdev)

Definition at line 436 of file pdevobj.c.

438{
439 PGRAPHICS_DEVICE pGraphicsDevice;
440 PDEVMODEINFO pdminfo, pdmiNext;
441
442 /* Lock the PDEV */
444
445 pGraphicsDevice = ppdev->pGraphicsDevice;
446
447 /* Clear out the modes */
448 for (pdminfo = pGraphicsDevice->pdevmodeInfo;
449 pdminfo;
450 pdminfo = pdmiNext)
451 {
452 pdmiNext = pdminfo->pdmiNext;
454 }
455 pGraphicsDevice->pdevmodeInfo = NULL;
457 pGraphicsDevice->pDevModeList = NULL;
458
459 /* Update available display mode list */
460 LDEVOBJ_bBuildDevmodeList(pGraphicsDevice);
461
462 /* Unlock PDEV */
464}
BOOL LDEVOBJ_bBuildDevmodeList(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice)
Definition: ldevobj.c:565
struct _DEVMODEINFO * pdmiNext
Definition: pdevobj.h:44
PDEVMODEENTRY pDevModeList
Definition: pdevobj.h:70
PDEVMODEINFO pdevmodeInfo
Definition: pdevobj.h:68
#define GDITAG_GDEVICE
Definition: tags.h:99

Referenced by UserEnumDisplaySettings().

◆ PDEVOBJ_vRelease()

VOID NTAPI PDEVOBJ_vRelease ( _Inout_ PPDEVOBJ  ppdev)

Definition at line 105 of file pdevobj.c.

107{
108 /* Lock loader */
110
111 /* Decrease reference count */
112 InterlockedDecrement(&ppdev->cPdevRefs);
113 ASSERT(ppdev->cPdevRefs >= 0);
114
115 /* Check if references are left */
116 if (ppdev->cPdevRefs == 0)
117 {
118 /* Do we have a surface? */
119 if (ppdev->pSurface)
120 {
121 /* Release the surface and let the driver free it */
122 SURFACE_ShareUnlockSurface(ppdev->pSurface);
123 TRACE("DrvDisableSurface(dhpdev %p)\n", ppdev->dhpdev);
124 ppdev->pfn.DisableSurface(ppdev->dhpdev);
125 }
126
127 /* Do we have a palette? */
128 if (ppdev->ppalSurf)
129 {
130 PALETTE_ShareUnlockPalette(ppdev->ppalSurf);
131 }
132
133 /* Check if the PDEV was enabled */
134 if (ppdev->dhpdev != NULL)
135 {
136 /* Disable the PDEV */
137 TRACE("DrvDisablePDEV(dhpdev %p)\n", ppdev->dhpdev);
138 ppdev->pfn.DisablePDEV(ppdev->dhpdev);
139 }
140
141 /* Remove it from list */
142 if (ppdev == gppdevList)
143 {
144 gppdevList = ppdev->ppdevNext;
145 }
146 else if (gppdevList)
147 {
148 PPDEVOBJ ppdevCurrent = gppdevList;
149 BOOL found = FALSE;
150 while (!found && ppdevCurrent->ppdevNext)
151 {
152 if (ppdevCurrent->ppdevNext == ppdev)
153 found = TRUE;
154 else
155 ppdevCurrent = ppdevCurrent->ppdevNext;
156 }
157 if (found)
158 ppdevCurrent->ppdevNext = ppdev->ppdevNext;
159 }
160
161 /* Unload display driver */
162 EngUnloadImage(ppdev->pldev);
163
164 /* Free it */
165 PDEVOBJ_vDeletePDEV(ppdev);
166 }
167
168 /* Unlock loader */
170}
#define InterlockedDecrement
Definition: armddk.h:52
static VOID PDEVOBJ_vDeletePDEV(PPDEVOBJ ppdev)
Definition: pdevobj.c:92
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:102
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59

Referenced by DC_vCleanup(), DxEngUnreferenceHdev(), GreCreateCompatibleDC(), GreOpenDCW(), MDEVOBJ_vDestroy(), NtGdiExtEscape(), PDEVOBJ_bSwitchMode(), PDEVOBJ_Create(), UserChangeDisplaySettings(), UserEnumCurrentDisplaySettings(), UserEnumDisplaySettings(), and UserRefreshDisplay().

◆ SwitchPointer()

FORCEINLINE VOID SwitchPointer ( _Inout_ PVOID  pvPointer1,
_Inout_ PVOID  pvPointer2 
)

Definition at line 636 of file pdevobj.c.

639{
640 PVOID *ppvPointer1 = pvPointer1;
641 PVOID *ppvPointer2 = pvPointer2;
642 PVOID pvTemp;
643
644 pvTemp = *ppvPointer1;
645 *ppvPointer1 = *ppvPointer2;
646 *ppvPointer2 = pvTemp;
647}

Referenced by PDEVOBJ_bDynamicModeChange().

Variable Documentation

◆ ghsemPDEV

HSEMAPHORE ghsemPDEV
static

◆ gPanDispDrvCount

ULONG gPanDispDrvCount
extern

Definition at line 501 of file pandisp.c.

Referenced by PDEVOBJ_Create().

◆ gPanDispDrvFn

DRVFN gPanDispDrvFn[]
extern

Definition at line 477 of file pandisp.c.

Referenced by PDEVOBJ_Create().

◆ gppdevList

PPDEVOBJ gppdevList = NULL
static

Definition at line 15 of file pdevobj.c.

Referenced by NtGdiGetDhpdev(), PDEVOBJ_Create(), and PDEVOBJ_vRelease().