ReactOS 0.4.15-dev-6694-g4ba8af9
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)
 
BOOL PDEVOBJ_bEnableDirectDraw (_Inout_ PPDEVOBJ ppdev)
 
VOID PDEVOBJ_vResumeDirectDraw (_Inout_ PPDEVOBJ ppdev)
 
VOID PDEVOBJ_vSuspendDirectDraw (_Inout_ PPDEVOBJ ppdev)
 
VOID PDEVOBJ_vSwitchDirectDraw (_Inout_ PPDEVOBJ ppdev, _Inout_ PPDEVOBJ ppdev2)
 
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 1283 of file pdevobj.c.

1289{
1290 PDC pdc;
1291 DEVCAPS devcaps;
1292 BOOL bResult = TRUE;
1293
1294 /* Lock the given DC */
1295 pdc = DC_LockDc(hDC);
1296 if (!pdc)
1297 {
1299 return FALSE;
1300 }
1301
1302 /* Get the data */
1303 PDEVOBJ_vGetDeviceCaps(pdc->ppdev, &devcaps);
1304
1305 /* Unlock the DC */
1306 DC_UnlockDc(pdc);
1307
1308 /* Copy data to caller */
1309 _SEH2_TRY
1310 {
1311 ProbeForWrite(pDevCaps, sizeof(DEVCAPS), 1);
1312 RtlCopyMemory(pDevCaps, &devcaps, sizeof(DEVCAPS));
1313 }
1315 {
1317 bResult = FALSE;
1318 }
1319 _SEH2_END;
1320
1321 return bResult;
1322}
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:1037
#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(NTSTATUS Status)
Definition: error.c:37
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( EngPDev  )

◆ EngGetDriverName()

_Must_inspect_result_ _Ret_z_ LPWSTR APIENTRY EngGetDriverName ( _In_ HDEV  hdev)

Definition at line 1122 of file pdevobj.c.

1123{
1124 PPDEVOBJ ppdev = (PPDEVOBJ)hdev;
1125
1126 ASSERT(ppdev);
1127 ASSERT(ppdev->pldev);
1128 ASSERT(ppdev->pldev->pGdiDriverInfo);
1129 ASSERT(ppdev->pldev->pGdiDriverInfo->DriverName.Buffer);
1130
1131 return ppdev->pldev->pGdiDriverInfo->DriverName.Buffer;
1132}
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 799 of file pdevobj.c.

801{
802 UNICODE_STRING ustrCurrent;
803 PPDEVOBJ ppdev = NULL;
804 PGRAPHICS_DEVICE pGraphicsDevice;
805 ULONG i;
806
807 /* Acquire PDEV lock */
809
810 /* Did the caller pass a device name? */
811 if (pustrDeviceName)
812 {
813 /* Loop all present PDEVs */
814 for (i = 0; i < gpmdev->cDev; i++)
815 {
816 /* Get a pointer to the GRAPHICS_DEVICE */
817 pGraphicsDevice = gpmdev->dev[i].ppdev->pGraphicsDevice;
818
819 /* Compare the name */
820 RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName);
821 if (RtlEqualUnicodeString(pustrDeviceName, &ustrCurrent, FALSE))
822 {
823 /* Found! */
824 ppdev = gpmdev->dev[i].ppdev;
825 break;
826 }
827 }
828 }
829 else if (gpmdev)
830 {
831 /* Otherwise use the primary PDEV */
832 ppdev = gpmdev->ppdevGlobal;
833 }
834
835 /* Did we find one? */
836 if (ppdev)
837 {
838 /* Yes, reference the PDEV */
839 PDEVOBJ_vReference(ppdev);
840 }
841
842 /* Release PDEV lock */
844
845 return ppdev;
846}
#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 1096 of file pdevobj.c.

1103{
1104 PPDEVOBJ ppdev = (PPDEVOBJ)hdev;
1105
1106 if (devAttr != QDA_ACCELERATION_LEVEL)
1107 return FALSE;
1108
1109 if (cjOutSize >= sizeof(DWORD))
1110 {
1111 /* Set all Accelerations Level Key to enabled Full 0 to 5 turned off. */
1112 *(DWORD*)pvOut = ppdev->dwAccelerationLevel;
1113 return TRUE;
1114 }
1115
1116 return FALSE;
1117}
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 1137 of file pdevobj.c.

1140{
1141 PDC pdc;
1142 DEVCAPS devcaps;
1143
1144 /* Lock the given DC */
1145 pdc = DC_LockDc(hdc);
1146 if (!pdc)
1147 {
1149 return 0;
1150 }
1151
1152 /* Get the data */
1153 PDEVOBJ_vGetDeviceCaps(pdc->ppdev, &devcaps);
1154
1155 /* Unlock the DC */
1156 DC_UnlockDc(pdc);
1157
1158 /* Return capability */
1159 switch (Index)
1160 {
1161 case DRIVERVERSION:
1162 return devcaps.ulVersion;
1163
1164 case TECHNOLOGY:
1165 return devcaps.ulTechnology;
1166
1167 case HORZSIZE:
1168 return devcaps.ulHorzSize;
1169
1170 case VERTSIZE:
1171 return devcaps.ulVertSize;
1172
1173 case HORZRES:
1174 return devcaps.ulHorzRes;
1175
1176 case VERTRES:
1177 return devcaps.ulVertRes;
1178
1179 case LOGPIXELSX:
1180 return devcaps.ulLogPixelsX;
1181
1182 case LOGPIXELSY:
1183 return devcaps.ulLogPixelsY;
1184
1185 case BITSPIXEL:
1186 return devcaps.ulBitsPixel;
1187
1188 case PLANES:
1189 return devcaps.ulPlanes;
1190
1191 case NUMBRUSHES:
1192 return -1;
1193
1194 case NUMPENS:
1195 return devcaps.ulNumPens;
1196
1197 case NUMFONTS:
1198 return devcaps.ulNumFonts;
1199
1200 case NUMCOLORS:
1201 return devcaps.ulNumColors;
1202
1203 case ASPECTX:
1204 return devcaps.ulAspectX;
1205
1206 case ASPECTY:
1207 return devcaps.ulAspectY;
1208
1209 case ASPECTXY:
1210 return devcaps.ulAspectXY;
1211
1212 case CLIPCAPS:
1213 return CP_RECTANGLE;
1214
1215 case SIZEPALETTE:
1216 return devcaps.ulSizePalette;
1217
1218 case NUMRESERVED:
1219 return 20;
1220
1221 case COLORRES:
1222 return devcaps.ulColorRes;
1223
1224 case DESKTOPVERTRES:
1225 return devcaps.ulVertRes;
1226
1227 case DESKTOPHORZRES:
1228 return devcaps.ulHorzRes;
1229
1230 case BLTALIGNMENT:
1231 return devcaps.ulBltAlignment;
1232
1233 case SHADEBLENDCAPS:
1234 return devcaps.ulShadeBlend;
1235
1236 case COLORMGMTCAPS:
1237 return devcaps.ulColorMgmtCaps;
1238
1239 case PHYSICALWIDTH:
1240 return devcaps.ulPhysicalWidth;
1241
1242 case PHYSICALHEIGHT:
1243 return devcaps.ulPhysicalHeight;
1244
1245 case PHYSICALOFFSETX:
1246 return devcaps.ulPhysicalOffsetX;
1247
1248 case PHYSICALOFFSETY:
1249 return devcaps.ulPhysicalOffsetY;
1250
1251 case VREFRESH:
1252 return devcaps.ulVRefresh;
1253
1254 case RASTERCAPS:
1255 return devcaps.ulRasterCaps;
1256
1257 case CURVECAPS:
1258 return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
1260
1261 case LINECAPS:
1264
1265 case POLYGONALCAPS:
1268
1269 case TEXTCAPS:
1270 return devcaps.ulTextCaps;
1271
1272 case CAPS1:
1273 case PDEVICESIZE:
1274 case SCALINGFACTORX:
1275 case SCALINGFACTORY:
1276 default:
1277 return 0;
1278 }
1279
1280 return 0;
1281}
#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 1326 of file pdevobj.c.

1328{
1329 PPDEVOBJ ppdev;
1330 DHPDEV dhpdev = NULL;
1331
1332 /* Check parameter */
1334 return NULL;
1335
1336 /* Lock PDEV list */
1337 EngAcquireSemaphoreShared(ghsemPDEV);
1338
1339 /* Walk through the list of PDEVs */
1340 for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext)
1341 {
1342 /* Compare with the given HDEV */
1343 if (ppdev == (PPDEVOBJ)hdev)
1344 {
1345 /* Found the PDEV! Get it's dhpdev and break */
1346 dhpdev = ppdev->dhpdev;
1347 break;
1348 }
1349 }
1350
1351 /* Unlock PDEV list */
1353
1354 return dhpdev;
1355}
#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 410 of file pdevobj.c.

412{
413 BOOL assertVal;
414
415 if (ppdev->flFlags & PDEV_DISABLED)
416 return TRUE;
417
419
420 TRACE("DrvAssertMode(dhpdev %p, FALSE)\n", ppdev->dhpdev);
421 assertVal = ppdev->pfn.AssertMode(ppdev->dhpdev, FALSE);
422 TRACE("DrvAssertMode(dhpdev %p, FALSE) => %d\n", ppdev->dhpdev, assertVal);
423
424 if (assertVal)
425 ppdev->flFlags |= PDEV_DISABLED;
426
427 return assertVal;
428}
VOID PDEVOBJ_vSuspendDirectDraw(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:367
@ 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 645 of file pdevobj.c.

648{
649 union
650 {
652 GDIINFO gdiinfo;
653 DEVINFO devinfo;
654 DWORD StateFlags;
655 } temp;
656
657 /* Exchange driver functions */
658 temp.pfn = ppdev->pfn;
659 ppdev->pfn = ppdev2->pfn;
660 ppdev2->pfn = temp.pfn;
661
662 /* Exchange LDEVs */
663 SwitchPointer(&ppdev->pldev, &ppdev2->pldev);
664
665 /* Exchange DHPDEV */
666 SwitchPointer(&ppdev->dhpdev, &ppdev2->dhpdev);
667
668 /* Exchange surfaces and associate them with their new PDEV */
669 SwitchPointer(&ppdev->pSurface, &ppdev2->pSurface);
670 ppdev->pSurface->SurfObj.hdev = (HDEV)ppdev;
671 ppdev2->pSurface->SurfObj.hdev = (HDEV)ppdev2;
672
673 /* Exchange devinfo */
674 temp.devinfo = ppdev->devinfo;
675 ppdev->devinfo = ppdev2->devinfo;
676 ppdev2->devinfo = temp.devinfo;
677
678 /* Exchange gdiinfo */
679 temp.gdiinfo = ppdev->gdiinfo;
680 ppdev->gdiinfo = ppdev2->gdiinfo;
681 ppdev2->gdiinfo = temp.gdiinfo;
682
683 /* Exchange DEVMODE */
684 SwitchPointer(&ppdev->pdmwDev, &ppdev2->pdmwDev);
685
686 /* Exchange state flags */
687 temp.StateFlags = ppdev->pGraphicsDevice->StateFlags;
689 ppdev2->pGraphicsDevice->StateFlags = temp.StateFlags;
690
691 /* Notify each driver instance of its new HDEV association */
692 ppdev->pfn.CompletePDEV(ppdev->dhpdev, (HDEV)ppdev);
693 ppdev2->pfn.CompletePDEV(ppdev2->dhpdev, (HDEV)ppdev2);
694
695 /* Switch DirectDraw mode */
696 PDEVOBJ_vSwitchDirectDraw(ppdev, ppdev2);
697
698 return TRUE;
699}
VOID PDEVOBJ_vSwitchDirectDraw(_Inout_ PPDEVOBJ ppdev, _Inout_ PPDEVOBJ ppdev2)
Definition: pdevobj.c:378
FORCEINLINE VOID SwitchPointer(_Inout_ PVOID pvPointer1, _Inout_ PVOID pvPointer2)
Definition: pdevobj.c:630
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_bEnableDirectDraw()

BOOL PDEVOBJ_bEnableDirectDraw ( _Inout_ PPDEVOBJ  ppdev)

Definition at line 341 of file pdevobj.c.

343{
346
347 /* Enable DirectDraw */
348 TRACE("DxDdEnableDirectDraw(ppdev %p)\n", ppdev);
349 Success = pfnDdEnableDirectDraw((HDEV)ppdev, TRUE);
350 TRACE("DxDdEnableDirectDraw(ppdev %p) => %d\n", ppdev, Success);
351
352 return Success;
353}
BOOLEAN(NTAPI * PGD_DXDDENABLEDIRECTDRAW)(PVOID, BOOLEAN)
Definition: dxg.h:199
#define DXG_INDEX_DxDdEnableDirectDraw
Definition: dxg.h:107
@ Success
Definition: eventcreate.c:712
DRVFN gpDxFuncs[DXG_INDEX_DxDdIoctl+1]
Definition: ddraw.c:23

Referenced by PDEVOBJ_Create().

◆ 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 704 of file pdevobj.c.

707{
708 PPDEVOBJ ppdevTmp;
710 BOOL retval = FALSE;
711
712 /* Lock the PDEV */
714
715 /* And everything else */
717
718 DPRINT1("PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
719
720 // Lookup the GraphicsDevice + select DEVMODE
721 // pdm = LDEVOBJ_bProbeAndCaptureDevmode(ppdev, pdm);
722
723 /* 1. Temporarily disable the current PDEV and reset video to its default mode */
724 if (!PDEVOBJ_bDisableDisplay(ppdev))
725 {
726 DPRINT1("PDEVOBJ_bDisableDisplay() failed\n");
727 /* Resume DirectDraw in case of failure */
729 goto leave;
730 }
731
732 /* 2. Create new PDEV */
733 ppdevTmp = PDEVOBJ_Create(ppdev->pGraphicsDevice, pdm, 0, LDEV_DEVICE_DISPLAY);
734 if (!ppdevTmp)
735 {
736 DPRINT1("Failed to create a new PDEV\n");
737 goto leave2;
738 }
739
740 /* 3. Create a new surface */
741 pSurface = PDEVOBJ_pSurface(ppdevTmp);
742 if (!pSurface)
743 {
744 DPRINT1("PDEVOBJ_pSurface failed\n");
745 PDEVOBJ_vRelease(ppdevTmp);
746 goto leave2;
747 }
748
749 /* 4. Temporarily suspend DirectDraw for mode change */
752
753 /* 5. Switch the PDEVs */
754 if (!PDEVOBJ_bDynamicModeChange(ppdev, ppdevTmp))
755 {
756 DPRINT1("PDEVOBJ_bDynamicModeChange() failed\n");
757 PDEVOBJ_vRelease(ppdevTmp);
758 goto leave2;
759 }
760
761 /* 6. Resume DirectDraw */
764
765 /* Release temp PDEV */
766 PDEVOBJ_vRelease(ppdevTmp);
767
768 /* Re-initialize DirectDraw data */
769 ppdev->pEDDgpl->hDev = (HDEV)ppdev;
770 ppdev->pEDDgpl->dhpdev = ppdev->dhpdev;
771
772 /* Update primary display capabilities */
773 if (ppdev == gpmdev->ppdevGlobal)
774 {
775 PDEVOBJ_vGetDeviceCaps(ppdev, &GdiHandleTable->DevCaps);
776 }
777
778 /* Success! */
779 retval = TRUE;
780
781leave2:
782 /* Set the new video mode, or restore the original one in case of failure */
784
785leave:
786 /* Unlock everything else */
788 /* Unlock the PDEV */
790
791 DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
792
793 return retval;
794}
#define DPRINT1
Definition: precomp.h:8
#define leave
Definition: btrfs_drv.h:138
@ LDEV_DEVICE_DISPLAY
Definition: ldevobj.h:8
VOID PDEVOBJ_vResumeDirectDraw(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:356
BOOL PDEVOBJ_bDisableDisplay(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:410
PPDEVOBJ PDEVOBJ_Create(_In_opt_ PGRAPHICS_DEVICE pGraphicsDevice, _In_opt_ PDEVMODEW pdm, _In_ ULONG dwAccelerationLevel, _In_ ULONG ldevtype)
Definition: pdevobj.c:463
BOOL NTAPI PDEVOBJ_bDynamicModeChange(PPDEVOBJ ppdev, PPDEVOBJ ppdev2)
Definition: pdevobj.c:645
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:390
#define GdiHandleTable
Definition: win32nt.h:35
_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 463 of file pdevobj.c.

468{
469 PPDEVOBJ ppdev, ppdevMatch = NULL;
470 PLDEVOBJ pldev;
472
473 TRACE("PDEVOBJ_Create(%p %p %d)\n", pGraphicsDevice, pdm, ldevtype);
474
475 if (ldevtype != LDEV_DEVICE_META)
476 {
477 ASSERT(pGraphicsDevice);
478 ASSERT(pdm);
479 /* Search if we already have a PPDEV with the required characteristics.
480 * We will compare the graphics device, the devmode and the desktop
481 */
482 for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext)
483 {
484 if (ppdev->pGraphicsDevice == pGraphicsDevice)
485 {
486 PDEVOBJ_vReference(ppdev);
487
488 if (RtlEqualMemory(pdm, ppdev->pdmwDev, sizeof(DEVMODEW)) &&
489 ppdev->dwAccelerationLevel == dwAccelerationLevel)
490 {
491 PDEVOBJ_vReference(ppdev);
492 ppdevMatch = ppdev;
493 }
494 else
495 {
497 }
498
499 PDEVOBJ_vRelease(ppdev);
500 }
501 }
502
503 if (ppdevMatch)
504 {
505 PDEVOBJ_vEnableDisplay(ppdevMatch);
506
507 return ppdevMatch;
508 }
509 }
510
511 /* Try to get a display driver */
512 if (ldevtype == LDEV_DEVICE_META)
513 pldev = LDEVOBJ_pLoadInternal(MultiEnableDriver, ldevtype);
514 else
515 pldev = LDEVOBJ_pLoadDriver(pdm->dmDeviceName, ldevtype);
516 if (!pldev)
517 {
518 ERR("Could not load display driver '%S'\n",
519 (ldevtype == LDEV_DEVICE_META) ? L"" : pdm->dmDeviceName);
520 return NULL;
521 }
522
523 /* Allocate a new PDEVOBJ */
524 ppdev = PDEVOBJ_AllocPDEV();
525 if (!ppdev)
526 {
527 ERR("failed to allocate a PDEV\n");
528 return NULL;
529 }
530
531 if (ldevtype != LDEV_DEVICE_META)
532 {
533 ppdev->pGraphicsDevice = pGraphicsDevice;
534
535 // DxEngGetHdevData asks for Graphics DeviceObject in hSpooler field
536 ppdev->hSpooler = ppdev->pGraphicsDevice->DeviceObject;
537
538 /* Keep selected resolution */
539 if (ppdev->pdmwDev)
541 ppdev->pdmwDev = ExAllocatePoolWithTag(PagedPool, pdm->dmSize + pdm->dmDriverExtra, GDITAG_DEVMODE);
542 if (ppdev->pdmwDev)
543 {
544 RtlCopyMemory(ppdev->pdmwDev, pdm, pdm->dmSize + pdm->dmDriverExtra);
545 /* FIXME: this must be done in a better way */
547 }
548 }
549
550 /* FIXME! */
551 ppdev->flFlags = PDEV_DISPLAY;
552
553 /* HACK: Don't use the pointer */
554 ppdev->Pointer.Exclude.right = -1;
555
556 /* Initialize PDEV */
557 ppdev->pldev = pldev;
558 ppdev->dwAccelerationLevel = dwAccelerationLevel;
559
560 /* Copy the function table */
561 if ((ldevtype == LDEV_DEVICE_DISPLAY && dwAccelerationLevel >= 5) ||
562 pdm->dmFields & (DM_PANNINGWIDTH | DM_PANNINGHEIGHT))
563 {
564 ULONG i;
565
566 /* Initialize missing fields */
567 if (!(pdm->dmFields & DM_PANNINGWIDTH))
568 pdm->dmPanningWidth = pdm->dmPelsWidth;
569 if (!(pdm->dmFields & DM_PANNINGHEIGHT))
570 pdm->dmPanningHeight = pdm->dmPelsHeight;
571
572 /* Replace vtable by panning vtable */
573 for (i = 0; i < gPanDispDrvCount; i++)
575 }
576 else
577 {
578 ppdev->pfn = ppdev->pldev->pfn;
579 }
580
581 /* Call the driver to enable the PDEV */
582 if (!PDEVOBJ_bEnablePDEV(ppdev, pdm, NULL))
583 {
584 ERR("Failed to enable PDEV!\n");
585 PDEVOBJ_vRelease(ppdev);
586 EngUnloadImage(pldev);
587 return NULL;
588 }
589
590 /* Tell the driver that the PDEV is ready */
592
593 /* Create the initial surface */
594 pSurface = PDEVOBJ_pSurface(ppdev);
595 if (!pSurface)
596 {
597 ERR("Failed to create surface\n");
598 PDEVOBJ_vRelease(ppdev);
599 EngUnloadImage(pldev);
600 return NULL;
601 }
602
603 /* Enable DirectDraw */
604 if (!PDEVOBJ_bEnableDirectDraw(ppdev))
605 {
606 ERR("Failed to enable DirectDraw\n");
607 PDEVOBJ_vRelease(ppdev);
608 EngUnloadImage(pldev);
609 return NULL;
610 }
611
612 /* Remove some acceleration capabilities from driver */
614
615 /* Set MovePointer function */
616 ppdev->pfnMovePointer = ppdev->pfn.MovePointer;
617 if (!ppdev->pfnMovePointer)
619
620 /* Insert the PDEV into the list */
621 ppdev->ppdevNext = gppdevList;
622 gppdevList = ppdev;
623
624 /* Return the PDEV */
625 return ppdev;
626}
#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
BOOL PDEVOBJ_bEnableDirectDraw(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:341
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 1016 of file pdevobj.c.

1017{
1018 INT ret = CM_NONE;
1019
1020 if (ppdev->flFlags & PDEV_DISPLAY)
1021 {
1022 if (ppdev->devinfo.iDitherFormat == BMF_8BPP ||
1024 ret = CM_GAMMA_RAMP;
1025 }
1026
1028 ret |= CM_CMYK_COLOR;
1029 if (ppdev->devinfo.flGraphicsCaps & GCAPS_ICM)
1030 ret |= CM_DEVICE_ICM;
1031
1032 return ret;
1033}
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 849 of file pdevobj.c.

855{
856 PGRAPHICS_DEVICE pGraphicsDevice = NULL;
857 PMDEVOBJ pmdev = NULL;
858 PDEVMODEW pdm = NULL;
860 ULONG i, j;
861
862 TRACE("PDEVOBJ_lChangeDisplaySettings('%wZ' '%dx%dx%d (%d Hz)' %p %p)\n",
863 pustrDeviceName,
864 RequestedMode ? RequestedMode->dmPelsWidth : 0,
865 RequestedMode ? RequestedMode->dmPelsHeight : 0,
866 RequestedMode ? RequestedMode->dmBitsPerPel : 0,
867 RequestedMode ? RequestedMode->dmDisplayFrequency : 0,
868 pmdevOld, ppmdevNew);
869
870 if (pustrDeviceName)
871 {
872 pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0);
873 if (!pGraphicsDevice)
874 {
875 ERR("Wrong device name provided: '%wZ'\n", pustrDeviceName);
877 goto cleanup;
878 }
879 }
880 else if (RequestedMode)
881 {
882 pGraphicsDevice = gpPrimaryGraphicsDevice;
883 if (!pGraphicsDevice)
884 {
885 ERR("Wrong device'\n");
887 goto cleanup;
888 }
889 }
890
891 if (pGraphicsDevice)
892 {
893 if (!LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, RequestedMode, &pdm, bSearchClosestMode))
894 {
895 ERR("DrvProbeAndCaptureDevmode() failed\n");
896 lRet = DISP_CHANGE_BADMODE;
897 goto cleanup;
898 }
899 }
900
901 /* Here, we know that input parameters were correct */
902
903 {
904 /* Create new MDEV. Note that if we provide a device name,
905 * MDEV will only contain one device.
906 * */
907
908 if (pmdevOld)
909 {
910 /* Disable old MDEV */
911 if (MDEVOBJ_bDisable(pmdevOld))
912 {
913 /* Create new MDEV. On failure, reenable old MDEV */
914 pmdev = MDEVOBJ_Create(pustrDeviceName, pdm);
915 if (!pmdev)
916 MDEVOBJ_vEnable(pmdevOld);
917 }
918 }
919 else
920 {
921 pmdev = MDEVOBJ_Create(pustrDeviceName, pdm);
922 }
923
924 if (!pmdev)
925 {
926 ERR("Failed to create new MDEV\n");
927 lRet = DISP_CHANGE_FAILED;
928 goto cleanup;
929 }
930
932 *ppmdevNew = pmdev;
933
934 /* We now have to do the mode switch */
935
936 if (pustrDeviceName && pmdevOld)
937 {
938 /* We changed settings of one device. Add other devices which were already present */
939 for (i = 0; i < pmdevOld->cDev; i++)
940 {
941 for (j = 0; j < pmdev->cDev; j++)
942 {
943 if (pmdev->dev[j].ppdev->pGraphicsDevice == pmdevOld->dev[i].ppdev->pGraphicsDevice)
944 {
945 if (PDEVOBJ_bDynamicModeChange(pmdevOld->dev[i].ppdev, pmdev->dev[j].ppdev))
946 {
947 PPDEVOBJ tmp = pmdevOld->dev[i].ppdev;
948 pmdevOld->dev[i].ppdev = pmdev->dev[j].ppdev;
949 pmdev->dev[j].ppdev = tmp;
950 }
951 else
952 {
953 ERR("Failed to apply new settings\n");
955 ASSERT(FALSE);
956 }
957 break;
958 }
959 }
960 if (j == pmdev->cDev)
961 {
962 PDEVOBJ_vReference(pmdevOld->dev[i].ppdev);
963 pmdev->dev[pmdev->cDev].ppdev = pmdevOld->dev[i].ppdev;
964 pmdev->cDev++;
965 }
966 }
967 }
968
969 if (pmdev->cDev == 1)
970 {
971 pmdev->ppdevGlobal = pmdev->dev[0].ppdev;
972 }
973 else
974 {
975 /* Enable MultiDriver */
977 if (!pmdev->ppdevGlobal)
978 {
979 WARN("Failed to create meta-device. Using only first display\n");
980 PDEVOBJ_vReference(pmdev->dev[0].ppdev);
981 pmdev->ppdevGlobal = pmdev->dev[0].ppdev;
982 }
983 }
984
985 if (pmdevOld)
986 {
987 /* Search PDEVs which were in pmdevOld, but are not anymore in pmdev, and disable them */
988 for (i = 0; i < pmdevOld->cDev; i++)
989 {
990 for (j = 0; j < pmdev->cDev; j++)
991 {
992 if (pmdev->dev[j].ppdev->pGraphicsDevice == pmdevOld->dev[i].ppdev->pGraphicsDevice)
993 break;
994 }
995 if (j == pmdev->cDev)
996 PDEVOBJ_bDisableDisplay(pmdevOld->dev[i].ppdev);
997 }
998 }
999 }
1000
1001cleanup:
1002 if (lRet != DISP_CHANGE_SUCCESSFUL)
1003 {
1004 *ppmdevNew = NULL;
1005 if (pmdev)
1006 MDEVOBJ_vDestroy(pmdev);
1007 if (pdm && pdm != RequestedMode)
1009 }
1010
1011 return lRet;
1012}
#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 1359 of file pdevobj.c.

1360{
1361 if (ppdev->flFlags & PDEV_META_DEVICE)
1362 {
1363 *psizl = ppdev->szlMetaRes;
1364 }
1365 else
1366 {
1367 psizl->cx = ppdev->gdiinfo.ulHorzRes;
1368 psizl->cy = ppdev->gdiinfo.ulVertRes;
1369 }
1370 return psizl;
1371}
@ 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 390 of file pdevobj.c.

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

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 1037 of file pdevobj.c.

1040{
1041 PGDIINFO pGdiInfo = &ppdev->gdiinfo;
1042
1043 pDevCaps->ulVersion = pGdiInfo->ulVersion;
1044 pDevCaps->ulTechnology = pGdiInfo->ulTechnology;
1045 pDevCaps->ulHorzSizeM = (pGdiInfo->ulHorzSize + 500) / 1000;
1046 pDevCaps->ulVertSizeM = (pGdiInfo->ulVertSize + 500) / 1000;
1047 pDevCaps->ulHorzSize = pGdiInfo->ulHorzSize;
1048 pDevCaps->ulVertSize = pGdiInfo->ulVertSize;
1049 pDevCaps->ulHorzRes = pGdiInfo->ulHorzRes;
1050 pDevCaps->ulVertRes = pGdiInfo->ulVertRes;
1051 pDevCaps->ulBitsPixel = pGdiInfo->cBitsPixel;
1052 if (pDevCaps->ulBitsPixel == 15) pDevCaps->ulBitsPixel = 16;
1053 pDevCaps->ulPlanes = pGdiInfo->cPlanes;
1054 pDevCaps->ulNumPens = pGdiInfo->ulNumColors;
1055 if (pDevCaps->ulNumPens != -1) pDevCaps->ulNumPens *= 5;
1056 pDevCaps->ulNumFonts = 0; // PDEVOBJ_cFonts(ppdev);
1057 pDevCaps->ulNumColors = pGdiInfo->ulNumColors;
1058 pDevCaps->ulRasterCaps = pGdiInfo->flRaster;
1059 pDevCaps->ulAspectX = pGdiInfo->ulAspectX;
1060 pDevCaps->ulAspectY = pGdiInfo->ulAspectY;
1061 pDevCaps->ulAspectXY = pGdiInfo->ulAspectXY;
1062 pDevCaps->ulLogPixelsX = pGdiInfo->ulLogPixelsX;
1063 pDevCaps->ulLogPixelsY = pGdiInfo->ulLogPixelsY;
1064 pDevCaps->ulSizePalette = pGdiInfo->ulNumPalReg;
1065 pDevCaps->ulColorRes = pGdiInfo->ulDACRed +
1066 pGdiInfo->ulDACGreen +
1067 pGdiInfo->ulDACBlue;
1072 pDevCaps->ulTextCaps = pGdiInfo->flTextCaps;
1074 if (pGdiInfo->ulTechnology != DT_PLOTTER)
1076 pDevCaps->ulVRefresh = pGdiInfo->ulVRefresh;
1077 pDevCaps->ulDesktopHorzRes = pGdiInfo->ulHorzRes;
1078 pDevCaps->ulDesktopVertRes = pGdiInfo->ulVertRes;
1084 pDevCaps->ulShadeBlend = pGdiInfo->flShadeBlend;
1086}
INT NTAPI PDEVOBJ_iGetColorManagementCaps(PPDEVOBJ ppdev)
Definition: pdevobj.c:1016
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 432 of file pdevobj.c.

434{
435 PGRAPHICS_DEVICE pGraphicsDevice;
436 PDEVMODEINFO pdminfo, pdmiNext;
437
438 /* Lock the PDEV */
440
441 pGraphicsDevice = ppdev->pGraphicsDevice;
442
443 /* Clear out the modes */
444 for (pdminfo = pGraphicsDevice->pdevmodeInfo;
445 pdminfo;
446 pdminfo = pdmiNext)
447 {
448 pdmiNext = pdminfo->pdmiNext;
450 }
451 pGraphicsDevice->pdevmodeInfo = NULL;
453 pGraphicsDevice->pDevModeList = NULL;
454
455 /* Update available display mode list */
456 LDEVOBJ_bBuildDevmodeList(pGraphicsDevice);
457
458 /* Unlock PDEV */
460}
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().

◆ PDEVOBJ_vResumeDirectDraw()

VOID PDEVOBJ_vResumeDirectDraw ( _Inout_ PPDEVOBJ  ppdev)

Definition at line 356 of file pdevobj.c.

358{
360
361 /* Resume DirectDraw after mode change */
362 TRACE("DxDdResumeDirectDraw(ppdev %p)\n", ppdev);
363 pfnDdResumeDirectDraw((HDEV)ppdev, 0);
364}
#define DXG_INDEX_DxDdResumeDirectDraw
Definition: dxg.h:110
VOID(APIENTRY * PGD_DXDDRESUMEDIRECTDRAW)(HDEV, ULONG_PTR)
Definition: intddraw.h:112

Referenced by PDEVOBJ_bSwitchMode().

◆ PDEVOBJ_vSuspendDirectDraw()

VOID PDEVOBJ_vSuspendDirectDraw ( _Inout_ PPDEVOBJ  ppdev)

Definition at line 367 of file pdevobj.c.

369{
371
372 /* Suspend DirectDraw for mode change */
373 TRACE("DxDdSuspendDirectDraw(ppdev %p)\n", ppdev);
374 pfnDdSuspendDirectDraw((HDEV)ppdev, 0);
375}
#define DXG_INDEX_DxDdSuspendDirectDraw
Definition: dxg.h:109
VOID(APIENTRY * PGD_DXDDSUSPENDDIRECTDRAW)(HDEV, ULONG_PTR)
Definition: intddraw.h:113

Referenced by PDEVOBJ_bDisableDisplay(), and PDEVOBJ_bSwitchMode().

◆ PDEVOBJ_vSwitchDirectDraw()

VOID PDEVOBJ_vSwitchDirectDraw ( _Inout_ PPDEVOBJ  ppdev,
_Inout_ PPDEVOBJ  ppdev2 
)

Definition at line 378 of file pdevobj.c.

381{
383
384 /* Switch DirectDraw instances between the PDEVs */
385 TRACE("DxDdDynamicModeChange(ppdev %p, ppdev2 %p)\n", ppdev, ppdev2);
386 pfnDdDynamicModeChange((HDEV)ppdev, (HDEV)ppdev2, 0);
387}
#define DXG_INDEX_DxDdDynamicModeChange
Definition: dxg.h:111
VOID(APIENTRY * PGD_DXDDDYNAMICMODECHANGE)(HDEV, HDEV, ULONG_PTR)
Definition: intddraw.h:111

Referenced by PDEVOBJ_bDynamicModeChange().

◆ SwitchPointer()

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

Definition at line 630 of file pdevobj.c.

633{
634 PVOID *ppvPointer1 = pvPointer1;
635 PVOID *ppvPointer2 = pvPointer2;
636 PVOID pvTemp;
637
638 pvTemp = *ppvPointer1;
639 *ppvPointer1 = *ppvPointer2;
640 *ppvPointer2 = pvTemp;
641}

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().