ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
April 2022
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
22 participants
157 discussions
Start a n
N
ew thread
[reactos] 15/18: [WIN32SS] Remove now unused code
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=494de7c2dff1197fe4dff…
commit 494de7c2dff1197fe4dfffa8f2b53a72581a1964 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Mar 20 17:56:23 2022 +0100 Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com> CommitDate: Fri Apr 15 23:09:16 2022 +0200 [WIN32SS] Remove now unused code Initialization of device mode list will be done later, just before switching to graphics mode. If no graphic display is available, we will now fail when starting first GUI application in co_IntGraphicsCheck(). Add a bugcheck here to prevent frozen screen. --- win32ss/gdi/eng/device.c | 54 ++----------------------------------------- win32ss/gdi/eng/device.h | 8 +------ win32ss/gdi/eng/pdevobj.h | 2 -- win32ss/user/ntuser/display.c | 7 +----- win32ss/user/ntuser/windc.c | 3 ++- 5 files changed, 6 insertions(+), 68 deletions(-) diff --git a/win32ss/gdi/eng/device.c b/win32ss/gdi/eng/device.c index d6c38b4c6d4..037b0261a47 100644 --- a/win32ss/gdi/eng/device.c +++ b/win32ss/gdi/eng/device.c @@ -124,48 +124,6 @@ EngpUpdateGraphicsDeviceList(VOID) return STATUS_SUCCESS; } -BOOLEAN -EngpPopulateDeviceModeList( - _Inout_ PGRAPHICS_DEVICE pGraphicsDevice, - _In_ PDEVMODEW pdmDefault) -{ - PDEVMODEINFO pdminfo; - PDEVMODEW pdm, pdmSelected; - ULONG i; - - ASSERT(pGraphicsDevice->pdevmodeInfo == NULL); - ASSERT(pGraphicsDevice->pDevModeList == NULL); - - if (!LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, pdmDefault, &pdmSelected, TRUE)) - { - ERR("LDEVOBJ_bProbeAndCaptureDevmode() failed\n"); - return FALSE; - } - - /* Loop through all DEVMODEINFOs */ - for (pdminfo = pGraphicsDevice->pdevmodeInfo, i = 0; - pdminfo; - pdminfo = pdminfo->pdmiNext) - { - /* Loop through the DEVMODEs */ - for (i = 0; i < pGraphicsDevice->cDevModes; i++) - { - pdm = pGraphicsDevice->pDevModeList[i].pdm; - - /* Compare with the selected entry */ - if (pdm->dmSize == pdmSelected->dmSize && - RtlCompareMemory(pdm, pdmSelected, pdm->dmSize) == pdm->dmSize) - { - pGraphicsDevice->iDefaultMode = i; - pGraphicsDevice->iCurrentMode = i; - TRACE("Found default entry: %lu '%ls'\n", i, pdm->dmDeviceName); - break; - } - } - } - return TRUE; -} - extern VOID UserRefreshDisplay(IN PPDEVOBJ ppdev); @@ -235,8 +193,7 @@ NTAPI EngpRegisterGraphicsDevice( _In_ PUNICODE_STRING pustrDeviceName, _In_ PUNICODE_STRING pustrDiplayDrivers, - _In_ PUNICODE_STRING pustrDescription, - _In_ PDEVMODEW pdmDefault) + _In_ PUNICODE_STRING pustrDescription) { PGRAPHICS_DEVICE pGraphicsDevice; PDEVICE_OBJECT pDeviceObject; @@ -335,21 +292,14 @@ EngpRegisterGraphicsDevice( pustrDescription->Length); pGraphicsDevice->pwszDescription[pustrDescription->Length/sizeof(WCHAR)] = 0; - /* Initialize the pdevmodeInfo list and default index */ + /* Initialize the pdevmodeInfo list */ pGraphicsDevice->pdevmodeInfo = NULL; - pGraphicsDevice->iDefaultMode = 0; - pGraphicsDevice->iCurrentMode = 0; // FIXME: initialize state flags pGraphicsDevice->StateFlags = 0; /* Create the mode list */ pGraphicsDevice->pDevModeList = NULL; - if (!EngpPopulateDeviceModeList(pGraphicsDevice, pdmDefault)) - { - ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE); - return NULL; - } /* Lock loader */ EngAcquireSemaphore(ghsemGraphicsDeviceList); diff --git a/win32ss/gdi/eng/device.h b/win32ss/gdi/eng/device.h index 43a0dd6ebb3..cb211d4c055 100644 --- a/win32ss/gdi/eng/device.h +++ b/win32ss/gdi/eng/device.h @@ -30,13 +30,7 @@ NTAPI EngpRegisterGraphicsDevice( _In_ PUNICODE_STRING pustrDeviceName, _In_ PUNICODE_STRING pustrDiplayDrivers, - _In_ PUNICODE_STRING pustrDescription, - _In_ PDEVMODEW pdmDefault); - -BOOLEAN -EngpPopulateDeviceModeList( - _Inout_ PGRAPHICS_DEVICE pGraphicsDevice, - _In_ PDEVMODEW pdmDefault); + _In_ PUNICODE_STRING pustrDescription); NTSTATUS EngpUpdateGraphicsDeviceList(VOID); diff --git a/win32ss/gdi/eng/pdevobj.h b/win32ss/gdi/eng/pdevobj.h index c5b63b56e7d..c39717db0bf 100644 --- a/win32ss/gdi/eng/pdevobj.h +++ b/win32ss/gdi/eng/pdevobj.h @@ -74,8 +74,6 @@ typedef struct _GRAPHICS_DEVICE PVOID pUnknown; PFILE_OBJECT FileObject; DWORD ProtocolType; - ULONG iDefaultMode; - ULONG iCurrentMode; } GRAPHICS_DEVICE, *PGRAPHICS_DEVICE; typedef struct _PDEVOBJ diff --git a/win32ss/user/ntuser/display.c b/win32ss/user/ntuser/display.c index eb3365f0d33..8f15a68e1bf 100644 --- a/win32ss/user/ntuser/display.c +++ b/win32ss/user/ntuser/display.c @@ -73,7 +73,6 @@ InitDisplayDriver( WCHAR awcBuffer[128]; ULONG cbSize; HKEY hkey; - DEVMODEW dmDefault; DWORD dwVga; TRACE("InitDisplayDriver(%S, %S);\n", @@ -126,9 +125,6 @@ InitDisplayDriver( RtlInitUnicodeString(&ustrDescription, L"<unknown>"); } - /* Query the default settings */ - RegReadDisplaySettings(hkey, &dmDefault); - /* Query if this is a VGA compatible driver */ cbSize = sizeof(DWORD); Status = RegQueryValue(hkey, L"VgaCompatible", REG_DWORD, &dwVga, &cbSize); @@ -141,8 +137,7 @@ InitDisplayDriver( RtlInitUnicodeString(&ustrDeviceName, pwszDeviceName); pGraphicsDevice = EngpRegisterGraphicsDevice(&ustrDeviceName, &ustrDisplayDrivers, - &ustrDescription, - &dmDefault); + &ustrDescription); if (pGraphicsDevice && dwVga) { pGraphicsDevice->StateFlags |= DISPLAY_DEVICE_VGA_COMPATIBLE; diff --git a/win32ss/user/ntuser/windc.c b/win32ss/user/ntuser/windc.c index 8b865dcb908..7f677b89c1f 100644 --- a/win32ss/user/ntuser/windc.c +++ b/win32ss/user/ntuser/windc.c @@ -41,7 +41,8 @@ DceCreateDisplayDC(VOID) { UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY"); - co_IntGraphicsCheck(TRUE); + if (!co_IntGraphicsCheck(TRUE)) + KeBugCheckEx(VIDEO_DRIVER_INIT_FAILURE, 0, 0, 0, USER_VERSION); return IntGdiCreateDC(&DriverName, NULL, NULL, NULL, FALSE); }
2 years, 8 months
1
0
0
0
[reactos] 14/18: [WIN32SS] Implement PDEVOBJ_lChangeDisplaySettings to create initial MDEV
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2d2824f1b98b772eb36e4…
commit 2d2824f1b98b772eb36e4e2b75185b48cbeed618 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Mar 20 17:38:16 2022 +0100 Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com> CommitDate: Fri Apr 15 23:09:16 2022 +0200 [WIN32SS] Implement PDEVOBJ_lChangeDisplaySettings to create initial MDEV This function can create a MDEV for the whole display (maybe containing multiple PDEVs), or update settings of a specific PDEV. - call PDEVOBJ_lChangeDisplaySettings when switching to graphics mode. - modify EngpGetPDEV to search requested PDEV only in current MDEV --- win32ss/gdi/eng/pdevobj.c | 181 ++++++++++++++++++++++++++++++++++++++----- win32ss/gdi/eng/pdevobj.h | 16 ++++ win32ss/user/ntuser/winsta.c | 5 +- 3 files changed, 180 insertions(+), 22 deletions(-) diff --git a/win32ss/gdi/eng/pdevobj.c b/win32ss/gdi/eng/pdevobj.c index a24a8c05dee..1642b94763e 100644 --- a/win32ss/gdi/eng/pdevobj.c +++ b/win32ss/gdi/eng/pdevobj.c @@ -643,8 +643,9 @@ EngpGetPDEV( _In_opt_ PUNICODE_STRING pustrDeviceName) { UNICODE_STRING ustrCurrent; - PPDEVOBJ ppdev; + PPDEVOBJ ppdev = NULL; PGRAPHICS_DEVICE pGraphicsDevice; + ULONG i; /* Acquire PDEV lock */ EngAcquireSemaphore(ghsemPDEV); @@ -653,16 +654,17 @@ EngpGetPDEV( if (pustrDeviceName) { /* Loop all present PDEVs */ - for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext) + for (i = 0; i < gpmdev->cDev; i++) { /* Get a pointer to the GRAPHICS_DEVICE */ - pGraphicsDevice = ppdev->pGraphicsDevice; + pGraphicsDevice = gpmdev->dev[i].ppdev->pGraphicsDevice; /* Compare the name */ RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName); if (RtlEqualUnicodeString(pustrDeviceName, &ustrCurrent, FALSE)) { /* Found! */ + ppdev = gpmdev->dev[i].ppdev; break; } } @@ -679,32 +681,173 @@ EngpGetPDEV( /* Yes, reference the PDEV */ PDEVOBJ_vReference(ppdev); } - else + + /* Release PDEV lock */ + EngReleaseSemaphore(ghsemPDEV); + + return ppdev; +} + +LONG +PDEVOBJ_lChangeDisplaySettings( + _In_opt_ PUNICODE_STRING pustrDeviceName, + _In_opt_ PDEVMODEW RequestedMode, + _In_opt_ PMDEVOBJ pmdevOld, + _Out_ PMDEVOBJ *ppmdevNew, + _In_ BOOL bSearchClosestMode) +{ + PGRAPHICS_DEVICE pGraphicsDevice; + PMDEVOBJ pmdev = NULL; + PDEVMODEW pdm = NULL; + ULONG lRet = DISP_CHANGE_SUCCESSFUL; + ULONG i, j; + + TRACE("PDEVOBJ_lChangeDisplaySettings('%wZ' '%dx%dx%d (%d Hz)' %p %p)\n", + pustrDeviceName, + RequestedMode ? RequestedMode->dmPelsWidth : 0, + RequestedMode ? RequestedMode->dmPelsHeight : 0, + RequestedMode ? RequestedMode->dmBitsPerPel : 0, + RequestedMode ? RequestedMode->dmDisplayFrequency : 0, + pmdevOld, ppmdevNew); + + if (pustrDeviceName) { - if (pustrDeviceName) - pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0); + pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0); if (!pGraphicsDevice) - pGraphicsDevice = gpPrimaryGraphicsDevice; + { + ERR("Wrong device name provided: '%wZ'\n", pustrDeviceName); + lRet = DISP_CHANGE_BADPARAM; + goto cleanup; + } + } + else if (RequestedMode) + { + pGraphicsDevice = gpPrimaryGraphicsDevice; + if (!pGraphicsDevice) + { + ERR("Wrong device'\n"); + lRet = DISP_CHANGE_BADPARAM; + goto cleanup; + } + } + + if (pGraphicsDevice) + { + if (!LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, RequestedMode, &pdm, bSearchClosestMode)) + { + ERR("DrvProbeAndCaptureDevmode() failed\n"); + lRet = DISP_CHANGE_BADMODE; + goto cleanup; + } + } + + /* Here, we know that input parameters were correct */ + + { + /* Create new MDEV. Note that if we provide a device name, + * MDEV will only contain one device. + * */ + + if (pmdevOld) + { + /* Disable old MDEV */ + if (MDEVOBJ_bDisable(pmdevOld)) + { + /* Create new MDEV. On failure, reenable old MDEV */ + pmdev = MDEVOBJ_Create(pustrDeviceName, pdm); + if (!pmdev) + MDEVOBJ_vEnable(pmdevOld); + } + } + else + { + pmdev = MDEVOBJ_Create(pustrDeviceName, pdm); + } - /* No, create a new PDEV for the given device */ - ppdev = PDEVOBJ_Create(pGraphicsDevice, - pGraphicsDevice->pDevModeList[pGraphicsDevice->iDefaultMode].pdm, - LDEV_DEVICE_DISPLAY); - if (ppdev) + if (!pmdev) { - /* Set as primary PDEV, if we don't have one yet */ - if (!gpmdev->ppdevGlobal) + ERR("Failed to create new MDEV\n"); + lRet = DISP_CHANGE_FAILED; + goto cleanup; + } + + lRet = DISP_CHANGE_SUCCESSFUL; + *ppmdevNew = pmdev; + + /* We now have to do the mode switch */ + + if (pustrDeviceName && pmdevOld) + { + /* We changed settings of one device. Add other devices which were already present */ + for (i = 0; i < pmdevOld->cDev; i++) { - gpmdev->ppdevGlobal = ppdev; - ppdev->pGraphicsDevice->StateFlags |= DISPLAY_DEVICE_PRIMARY_DEVICE; + for (j = 0; j < pmdev->cDev; j++) + { + if (pmdev->dev[j].ppdev->pGraphicsDevice == pmdevOld->dev[i].ppdev->pGraphicsDevice) + { + if (PDEVOBJ_bDynamicModeChange(pmdevOld->dev[i].ppdev, pmdev->dev[j].ppdev)) + { + PPDEVOBJ tmp = pmdevOld->dev[i].ppdev; + pmdevOld->dev[i].ppdev = pmdev->dev[j].ppdev; + pmdev->dev[j].ppdev = tmp; + } + else + { + ERR("Failed to apply new settings\n"); + UNIMPLEMENTED; + ASSERT(FALSE); + } + break; + } + } + if (j == pmdev->cDev) + { + PDEVOBJ_vReference(pmdevOld->dev[i].ppdev); + pmdev->dev[pmdev->cDev].ppdev = pmdevOld->dev[i].ppdev; + pmdev->cDev++; + } + } + } + + if (pmdev->cDev == 1) + { + pmdev->ppdevGlobal = pmdev->dev[0].ppdev; + } + else + { + /* FIXME: currently, only use the first display */ + UNIMPLEMENTED; + PDEVOBJ_vReference(pmdev->dev[0].ppdev); + pmdev->ppdevGlobal = pmdev->dev[0].ppdev; + } + + if (pmdevOld) + { + /* Search PDEVs which were in pmdevOld, but are not anymore in pmdev, and disable them */ + for (i = 0; i < pmdevOld->cDev; i++) + { + for (j = 0; j < pmdev->cDev; j++) + { + if (pmdev->dev[j].ppdev->pGraphicsDevice == pmdevOld->dev[i].ppdev->pGraphicsDevice) + break; + } + if (j == pmdev->cDev) + PDEVOBJ_bDisableDisplay(pmdevOld->dev[i].ppdev); } } } - /* Release PDEV lock */ - EngReleaseSemaphore(ghsemPDEV); +cleanup: + if (lRet != DISP_CHANGE_SUCCESSFUL) + { + *ppmdevNew = NULL; + if (pmdev) + MDEVOBJ_vDestroy(pmdev); + if (pdm && pdm != RequestedMode) + ExFreePoolWithTag(pdm, GDITAG_DEVMODE); + } - return ppdev; + return lRet; } INT diff --git a/win32ss/gdi/eng/pdevobj.h b/win32ss/gdi/eng/pdevobj.h index 5590ac9548f..c5b63b56e7d 100644 --- a/win32ss/gdi/eng/pdevobj.h +++ b/win32ss/gdi/eng/pdevobj.h @@ -228,4 +228,20 @@ PDEVOBJ_Create( _In_opt_ PDEVMODEW pdm, _In_ ULONG ldevtype); +/* Change display settings: + * - pustrDeviceName: name of the device to change settings. Can be NULL to specify whole display surface + * - RequestedMode: new parameters for device. Ignored if pstrDeviceName is NULL + * - pmdevOld: old MDEVOBJ. Can be NULL if we are creating the first one + * - ppdevNew: MDEVOBJ created by this function, with the new settings + * - bSearchClosestMode: do we need to search exact requested mode, or a mostly similar one + * Return value: a DISP_CHANGE_* value + */ +LONG +PDEVOBJ_lChangeDisplaySettings( + _In_opt_ PUNICODE_STRING pustrDeviceName, + _In_opt_ PDEVMODEW RequestedMode, + _In_opt_ PMDEVOBJ pmdevOld, + _Out_ PMDEVOBJ *ppmdevNew, + _In_ BOOL bSearchClosestMode); + #endif /* !__WIN32K_PDEVOBJ_H */ diff --git a/win32ss/user/ntuser/winsta.c b/win32ss/user/ntuser/winsta.c index ba1db88a6bd..88266ad5bb0 100644 --- a/win32ss/user/ntuser/winsta.c +++ b/win32ss/user/ntuser/winsta.c @@ -263,10 +263,9 @@ co_IntInitializeDesktopGraphics(VOID) UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY"); PDESKTOP pdesk; - gpmdev = ExAllocatePoolZero(PagedPool, sizeof(MDEVOBJ), GDITAG_MDEV); - if (!gpmdev) + if (PDEVOBJ_lChangeDisplaySettings(NULL, NULL, NULL, &gpmdev, TRUE) != DISP_CHANGE_SUCCESSFUL) { - ERR("Failed to allocate MDEV.\n"); + ERR("PDEVOBJ_lChangeDisplaySettings() failed.\n"); return FALSE; }
2 years, 8 months
1
0
0
0
[reactos] 13/18: [WIN32SS] Add functions related to MDEV (creation, destruction...)
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9db63ad59552fd58d9493…
commit 9db63ad59552fd58d94934ebb158b18177da468a Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Mar 20 15:45:19 2022 +0100 Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com> CommitDate: Fri Apr 15 23:09:16 2022 +0200 [WIN32SS] Add functions related to MDEV (creation, destruction...) --- win32ss/gdi/eng/mdevobj.c | 195 ++++++++++++++++++++++++++++++++++++++++++++++ win32ss/gdi/eng/mdevobj.h | 29 +++++++ 2 files changed, 224 insertions(+) diff --git a/win32ss/gdi/eng/mdevobj.c b/win32ss/gdi/eng/mdevobj.c index 25b85b6e94c..98d835e6c5a 100644 --- a/win32ss/gdi/eng/mdevobj.c +++ b/win32ss/gdi/eng/mdevobj.c @@ -9,5 +9,200 @@ #include <win32k.h> #define NDEBUG #include <debug.h> +DBG_DEFAULT_CHANNEL(EngMDev); PMDEVOBJ gpmdev = NULL; /* FIXME: should be stored in gpDispInfo->pmdev */ + +VOID +MDEVOBJ_vEnable( + _Inout_ PMDEVOBJ pmdev) +{ + ULONG i; + + for (i = 0; i < pmdev->cDev; i++) + { + PDEVOBJ_vEnableDisplay(pmdev->dev[i].ppdev); + } +} + +BOOL +MDEVOBJ_bDisable( + _Inout_ PMDEVOBJ pmdev) +{ + BOOL bSuccess = TRUE; + ULONG i, j; + + for (i = 0; i < pmdev->cDev; i++) + { + if (!PDEVOBJ_bDisableDisplay(pmdev->dev[i].ppdev)) + { + bSuccess = FALSE; + break; + } + } + + if (!bSuccess) + { + /* Failed to disable all PDEVs. Reenable those we have disabled */ + for (j = 0; j < i; j++) + { + PDEVOBJ_vEnableDisplay(pmdev->dev[i].ppdev); + } + } + + return bSuccess; +} + +PMDEVOBJ +MDEVOBJ_Create( + _In_opt_ PUNICODE_STRING pustrDeviceName, + _In_opt_ PDEVMODEW pdm) +{ + PMDEVOBJ pmdev = NULL; + PPDEVOBJ ppdev; + PGRAPHICS_DEVICE pGraphicsDevice; + DEVMODEW dmDefault; + PDEVMODEW localPdm; + ULONG iDevNum = 0; + + TRACE("MDEVOBJ_Create('%wZ' '%dx%dx%d (%d Hz)')\n", + pustrDeviceName, + pdm ? pdm->dmPelsWidth : 0, + pdm ? pdm->dmPelsHeight : 0, + pdm ? pdm->dmBitsPerPel : 0, + pdm ? pdm->dmDisplayFrequency : 0); + + pmdev = ExAllocatePoolZero(PagedPool, sizeof(MDEVOBJ), GDITAG_MDEV); + if (!pmdev) + { + ERR("Failed to allocate memory for MDEV\n"); + return NULL; + } + + pmdev->cDev = 0; + + while (TRUE) + { + /* Get the right graphics devices: either the specified one, or all of them (one after one) */ + if (pustrDeviceName) + pGraphicsDevice = (iDevNum == 0) ? EngpFindGraphicsDevice(pustrDeviceName, 0) : NULL; + else + pGraphicsDevice = EngpFindGraphicsDevice(NULL, iDevNum); + iDevNum++; + + if (!pGraphicsDevice) + { + TRACE("Done enumeration of graphic devices (DeviceName '%wZ' iDevNum %d)\n", pustrDeviceName, iDevNum); + break; + } + + if (!pdm) + { + /* No settings requested. Read default settings from registry to dmDefault */ + HKEY hKey; + WCHAR DeviceKey[128]; + ULONG cbSize; + NTSTATUS Status; + DWORD dwValue; + + RtlZeroMemory(&dmDefault, sizeof(dmDefault)); + dmDefault.dmSize = sizeof(dmDefault); + + Status = RegOpenKey(L"\\Registry\\Machine\\HARDWARE\\DEVICEMAP\\VIDEO", &hKey); + if (!NT_SUCCESS(Status)) + { + /* Ignore this device and continue */ + ERR("Failed to open VIDEO key: status 0x%08x\n", Status); + continue; + } + cbSize = sizeof(DeviceKey); + Status = RegQueryValue(hKey, + pGraphicsDevice->szNtDeviceName, + REG_SZ, + DeviceKey, + &cbSize); + ZwClose(hKey); + if (!NT_SUCCESS(Status)) + { + /* Ignore this device and continue */ + ERR("Failed to open get device key for '%S': status 0x%08x\n", pGraphicsDevice->szNtDeviceName, Status); + continue; + } + Status = RegOpenKey(DeviceKey, &hKey); + if (!NT_SUCCESS(Status)) + { + /* Ignore this device and continue */ + ERR("Failed to open open device key '%S' for '%S': status 0x%08x\n", DeviceKey, pGraphicsDevice->szNtDeviceName, Status); + continue; + } +#define READ(field, str, flag) \ + if (RegReadDWORD(hKey, L##str, &dwValue)) \ + { \ + dmDefault.field = dwValue; \ + dmDefault.dmFields |= flag; \ + } + READ(dmBitsPerPel, "DefaultSettings.BitsPerPel", DM_BITSPERPEL); + READ(dmPelsWidth, "DefaultSettings.XResolution", DM_PELSWIDTH); + READ(dmPelsHeight, "DefaultSettings.YResolution", DM_PELSHEIGHT); + READ(dmDisplayFlags, "DefaultSettings.Flags", DM_DISPLAYFLAGS); + READ(dmDisplayFrequency, "DefaultSettings.VRefresh", DM_DISPLAYFREQUENCY); + READ(dmPanningWidth, "DefaultSettings.XPanning", DM_PANNINGWIDTH); + READ(dmPanningHeight, "DefaultSettings.YPanning", DM_PANNINGHEIGHT); + READ(dmDisplayOrientation, "DefaultSettings.Orientation", DM_DISPLAYORIENTATION); + READ(dmDisplayFixedOutput, "DefaultSettings.FixedOutput", DM_DISPLAYFIXEDOUTPUT); + READ(dmPosition.x, "Attach.RelativeX", DM_POSITION); + READ(dmPosition.y, "Attach.RelativeY", DM_POSITION); + ZwClose(hKey); + } + + /* Get or create a PDEV for these settings */ + if (LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, pdm ? pdm : &dmDefault, &localPdm, !pdm)) + { + ppdev = PDEVOBJ_Create(pGraphicsDevice, localPdm, LDEV_DEVICE_DISPLAY); + } + else + { + ppdev = NULL; + } + + if (ppdev) + { + /* Great. We have a found a matching PDEV. Store it in MDEV */ + TRACE("Adding '%S' to MDEV %p\n", pGraphicsDevice->szWinDeviceName, pmdev); + PDEVOBJ_vReference(ppdev); + pmdev->dev[pmdev->cDev].ppdev = ppdev; + pmdev->cDev++; + } + else + { + WARN("Failed to add '%S' to MDEV %p\n", pGraphicsDevice->szWinDeviceName, pmdev); + } + } + + if (pmdev->cDev == 0) + { + TRACE("Failed to add any device to MDEV. Returning NULL\n"); + MDEVOBJ_vDestroy(pmdev); + return NULL; + } + + TRACE("Returning new MDEV %p with %d devices\n", pmdev, pmdev->cDev); + return pmdev; +} + +VOID +MDEVOBJ_vDestroy( + _Inout_ PMDEVOBJ pmdev) +{ + ULONG i; + + for (i = 0; i < pmdev->cDev; i++) + { + PDEVOBJ_vRelease(pmdev->dev[i].ppdev); + } + + if (pmdev->cDev > 1) + PDEVOBJ_vRelease(pmdev->ppdevGlobal); + + ExFreePoolWithTag(pmdev, GDITAG_MDEV); +} diff --git a/win32ss/gdi/eng/mdevobj.h b/win32ss/gdi/eng/mdevobj.h index 1d687d436a4..6dfb7aea4cf 100644 --- a/win32ss/gdi/eng/mdevobj.h +++ b/win32ss/gdi/eng/mdevobj.h @@ -7,11 +7,40 @@ typedef struct _PDEVOBJ *PPDEVOBJ; typedef struct _MDEVOBJ { + ULONG cDev; PPDEVOBJ ppdevGlobal; + struct + { + PPDEVOBJ ppdev; + } dev[10]; /* FIXME: max number of displays. Needs dynamic allocation */ } MDEVOBJ, *PMDEVOBJ; /* Globals ********************************************************************/ extern PMDEVOBJ gpmdev; /* FIXME: should be stored in gpDispInfo->pmdev */ +/* Function prototypes ********************************************************/ + +VOID +MDEVOBJ_vEnable( + _Inout_ PMDEVOBJ pmdev); + +BOOL +MDEVOBJ_bDisable( + _Inout_ PMDEVOBJ pmdev); + +/* Create a new MDEV: + * - pustrDeviceName: name of the device to put in MDEV. If NULL, will put all graphics devices in MDEV + * - pdm: settings associated to pustrDeviceName. Unused if pustrDeviceName is NULL. + * Return value: the new MDEV (or NULL in case of error) + */ +PMDEVOBJ +MDEVOBJ_Create( + _In_opt_ PUNICODE_STRING pustrDeviceName, + _In_opt_ PDEVMODEW pdm); + +VOID +MDEVOBJ_vDestroy( + _Inout_ PMDEVOBJ pmdev); + #endif /* !__WIN32K_MDEVOBJ_H */
2 years, 8 months
1
0
0
0
[reactos] 12/18: [WIN32SS] Introduce the MDEVOBJ structure
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a0cfdcd4093a2707d4558…
commit a0cfdcd4093a2707d455880d332d402ac21a649d Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Mar 20 15:38:20 2022 +0100 Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com> CommitDate: Fri Apr 15 23:09:16 2022 +0200 [WIN32SS] Introduce the MDEVOBJ structure This will be used (later) to store the list of all enabled display devices. Add a global variable gpmdev (should really be stored in DISPLAYINFO structure) Replace global variable gppdevPrimary by pmdev->ppdevGlobal. --- win32ss/CMakeLists.txt | 1 + win32ss/gdi/eng/device.c | 2 +- win32ss/gdi/eng/engbrush.c | 4 ++-- win32ss/gdi/eng/mdevobj.c | 13 +++++++++++++ win32ss/gdi/eng/mdevobj.h | 17 +++++++++++++++++ win32ss/gdi/eng/pdevobj.c | 16 +++++++--------- win32ss/gdi/eng/pdevobj.h | 5 ----- win32ss/gdi/ntgdi/dclife.c | 2 +- win32ss/gdi/ntgdi/device.c | 10 +++++----- win32ss/gdi/ntgdi/gdidbg.c | 1 + win32ss/user/ntuser/metric.c | 8 ++++---- win32ss/user/ntuser/tags.h | 1 + win32ss/user/ntuser/win32kdebug.h | 1 + win32ss/user/ntuser/winsta.c | 15 +++++++++++---- win32ss/win32kp.h | 1 + 15 files changed, 66 insertions(+), 31 deletions(-) diff --git a/win32ss/CMakeLists.txt b/win32ss/CMakeLists.txt index 51c8ec4c5f4..a786921291c 100644 --- a/win32ss/CMakeLists.txt +++ b/win32ss/CMakeLists.txt @@ -73,6 +73,7 @@ list(APPEND SOURCE gdi/eng/ldevobj.c gdi/eng/mapping.c gdi/eng/math.c + gdi/eng/mdevobj.c gdi/eng/mem.c gdi/eng/engmisc.c gdi/eng/mouse.c diff --git a/win32ss/gdi/eng/device.c b/win32ss/gdi/eng/device.c index af1c57f2652..d6c38b4c6d4 100644 --- a/win32ss/gdi/eng/device.c +++ b/win32ss/gdi/eng/device.c @@ -198,7 +198,7 @@ VideoPortCallout( if (CallbackParams->Param == TRUE) { /* Re-enable the display */ - UserRefreshDisplay(gppdevPrimary); + UserRefreshDisplay(gpmdev->ppdevGlobal); } else { diff --git a/win32ss/gdi/eng/engbrush.c b/win32ss/gdi/eng/engbrush.c index f57bc4778ec..c520d3a7efc 100644 --- a/win32ss/gdi/eng/engbrush.c +++ b/win32ss/gdi/eng/engbrush.c @@ -324,7 +324,7 @@ EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo, BOOL bCallDriver) ppdev = (PPDEVOBJ)pebo->psurfTrg->SurfObj.hdev; if (!ppdev) - ppdev = gppdevPrimary; + ppdev = gpmdev->ppdevGlobal; if (bCallDriver) { @@ -458,7 +458,7 @@ EBRUSHOBJ_psoMask(EBRUSHOBJ *pebo) /* Get the PDEV */ ppdev = (PPDEVOBJ)pebo->psurfTrg->SurfObj.hdev; if (!ppdev) - ppdev = gppdevPrimary; + ppdev = gpmdev->ppdevGlobal; /* Use the hatch bitmap as the mask */ hbmMask = (HBITMAP)ppdev->ahsurf[pebo->pbrush->iHatch]; diff --git a/win32ss/gdi/eng/mdevobj.c b/win32ss/gdi/eng/mdevobj.c new file mode 100644 index 00000000000..25b85b6e94c --- /dev/null +++ b/win32ss/gdi/eng/mdevobj.c @@ -0,0 +1,13 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Support for meta devices + * FILE: win32ss/gdi/eng/mdevobj.c + * PROGRAMER: Hervé Poussineau + */ + +#include <win32k.h> +#define NDEBUG +#include <debug.h> + +PMDEVOBJ gpmdev = NULL; /* FIXME: should be stored in gpDispInfo->pmdev */ diff --git a/win32ss/gdi/eng/mdevobj.h b/win32ss/gdi/eng/mdevobj.h new file mode 100644 index 00000000000..1d687d436a4 --- /dev/null +++ b/win32ss/gdi/eng/mdevobj.h @@ -0,0 +1,17 @@ +#ifndef __WIN32K_MDEVOBJ_H +#define __WIN32K_MDEVOBJ_H + +/* Type definitions ***********************************************************/ + +typedef struct _PDEVOBJ *PPDEVOBJ; + +typedef struct _MDEVOBJ +{ + PPDEVOBJ ppdevGlobal; +} MDEVOBJ, *PMDEVOBJ; + +/* Globals ********************************************************************/ + +extern PMDEVOBJ gpmdev; /* FIXME: should be stored in gpDispInfo->pmdev */ + +#endif /* !__WIN32K_MDEVOBJ_H */ diff --git a/win32ss/gdi/eng/pdevobj.c b/win32ss/gdi/eng/pdevobj.c index 6cc941dabd3..a24a8c05dee 100644 --- a/win32ss/gdi/eng/pdevobj.c +++ b/win32ss/gdi/eng/pdevobj.c @@ -11,8 +11,6 @@ #include <debug.h> DBG_DEFAULT_CHANNEL(EngPDev); -PPDEVOBJ gppdevPrimary = NULL; - static PPDEVOBJ gppdevList = NULL; static HSEMAPHORE ghsemPDEV; @@ -150,8 +148,8 @@ PDEVOBJ_vRelease( } /* Is this the primary one ? */ - if (ppdev == gppdevPrimary) - gppdevPrimary = NULL; + if (ppdev == gpmdev->ppdevGlobal) + gpmdev->ppdevGlobal = NULL; /* Unload display driver */ EngUnloadImage(ppdev->pldev); @@ -615,7 +613,7 @@ PDEVOBJ_bSwitchMode( PDEVOBJ_vRelease(ppdevTmp); /* Update primary display capabilities */ - if (ppdev == gppdevPrimary) + if (ppdev == gpmdev->ppdevGlobal) { PDEVOBJ_vGetDeviceCaps(ppdev, &GdiHandleTable->DevCaps); } @@ -669,10 +667,10 @@ EngpGetPDEV( } } } - else + else if (gpmdev) { /* Otherwise use the primary PDEV */ - ppdev = gppdevPrimary; + ppdev = gpmdev->ppdevGlobal; } /* Did we find one? */ @@ -695,9 +693,9 @@ EngpGetPDEV( if (ppdev) { /* Set as primary PDEV, if we don't have one yet */ - if (!gppdevPrimary) + if (!gpmdev->ppdevGlobal) { - gppdevPrimary = ppdev; + gpmdev->ppdevGlobal = ppdev; ppdev->pGraphicsDevice->StateFlags |= DISPLAY_DEVICE_PRIMARY_DEVICE; } } diff --git a/win32ss/gdi/eng/pdevobj.h b/win32ss/gdi/eng/pdevobj.h index fbd17f4a2cd..5590ac9548f 100644 --- a/win32ss/gdi/eng/pdevobj.h +++ b/win32ss/gdi/eng/pdevobj.h @@ -150,11 +150,6 @@ typedef struct _PDEVOBJ struct _EDD_DIRECTDRAW_GLOBAL * pEDDgpl; } PDEVOBJ, *PPDEVOBJ; -/* Globals ********************************************************************/ - -extern PPDEVOBJ gppdevPrimary; - - /* Function prototypes ********************************************************/ PPDEVOBJ diff --git a/win32ss/gdi/ntgdi/dclife.c b/win32ss/gdi/ntgdi/dclife.c index 2a405ee7a93..caa66eda073 100644 --- a/win32ss/gdi/ntgdi/dclife.c +++ b/win32ss/gdi/ntgdi/dclife.c @@ -144,7 +144,7 @@ DC_vInitDc( pdc->pdcattr = &pdc->dcattr; pdc->dcattr.pvLDC = NULL; pdc->dcattr.ulDirty_ = DIRTY_DEFAULT; - if (ppdev == gppdevPrimary) + if (ppdev == gpmdev->ppdevGlobal) pdc->dcattr.ulDirty_ |= DC_PRIMARY_DISPLAY; /* Setup the DC size */ diff --git a/win32ss/gdi/ntgdi/device.c b/win32ss/gdi/ntgdi/device.c index 9b1ca91bcdb..9a8bf433374 100644 --- a/win32ss/gdi/ntgdi/device.c +++ b/win32ss/gdi/ntgdi/device.c @@ -29,13 +29,13 @@ BOOL FASTCALL IntCreatePrimarySurface(VOID) { /* Create surface */ - PDEVOBJ_pSurface(gppdevPrimary); + PDEVOBJ_pSurface(gpmdev->ppdevGlobal); - DPRINT("IntCreatePrimarySurface, gppdevPrimary=%p, gppdevPrimary->pSurface = %p\n", - gppdevPrimary, gppdevPrimary->pSurface); + DPRINT("IntCreatePrimarySurface, ppdevGlobal=%p, ppdevGlobal->pSurface = %p\n", + gpmdev->ppdevGlobal, gpmdev->ppdevGlobal->pSurface); // Init Primary Displays Device Capabilities. - PDEVOBJ_vGetDeviceCaps(gppdevPrimary, &GdiHandleTable->DevCaps); + PDEVOBJ_vGetDeviceCaps(gpmdev->ppdevGlobal, &GdiHandleTable->DevCaps); return TRUE; } @@ -51,7 +51,7 @@ IntEnumHDev(VOID) { // I guess we will soon have more than one primary surface. // This will do for now. - return gppdevPrimary; + return gpmdev->ppdevGlobal; } diff --git a/win32ss/gdi/ntgdi/gdidbg.c b/win32ss/gdi/ntgdi/gdidbg.c index b75bb01c986..51de52670b8 100644 --- a/win32ss/gdi/ntgdi/gdidbg.c +++ b/win32ss/gdi/ntgdi/gdidbg.c @@ -32,6 +32,7 @@ DBG_CHANNEL DbgChannels[DbgChCount] = { {L"EngLDev", DbgChEngLDev}, {L"EngLine", DbgChEngLine}, {L"EngMapping", DbgChEngMapping}, + {L"EngMDev", DbgChEngMDev}, {L"EngPDev", DbgChEngPDev}, {L"EngSurface", DbgChEngSurface}, {L"EngWnd", DbgChEngWnd}, diff --git a/win32ss/user/ntuser/metric.c b/win32ss/user/ntuser/metric.c index 35f840d5d6a..a50d10df4c8 100644 --- a/win32ss/user/ntuser/metric.c +++ b/win32ss/user/ntuser/metric.c @@ -47,16 +47,16 @@ InitMetrics(VOID) ZwClose(hKey); } - /* FIXME: HACK, due to missing PDEV on first init */ - if (!gppdevPrimary) + /* FIXME: HACK, due to missing MDEV on first init */ + if (!gpmdev) { Width = 640; Height = 480; } else { - Width = gppdevPrimary->gdiinfo.ulHorzRes; - Height = gppdevPrimary->gdiinfo.ulVertRes; + Width = gpmdev->ppdevGlobal->gdiinfo.ulHorzRes; + Height = gpmdev->ppdevGlobal->gdiinfo.ulVertRes; } /* Screen sizes */ diff --git a/win32ss/user/ntuser/tags.h b/win32ss/user/ntuser/tags.h index 0cce9da16ff..f644b930d8c 100644 --- a/win32ss/user/ntuser/tags.h +++ b/win32ss/user/ntuser/tags.h @@ -71,6 +71,7 @@ #define GDITAG_DC_FREELIST 'fcdG' #define GDITAG_DWMSTATE 'scDG' #define GDITAG_DEVMODE 'vedG' +#define GDITAG_MDEV 'vdmG' #define GDITAG_PDEV 'veDG' #define GDITAG_HGLYPH_ARRAY 'mfdG' #define GDITAG_DRVSUP 'srdG' diff --git a/win32ss/user/ntuser/win32kdebug.h b/win32ss/user/ntuser/win32kdebug.h index 1211994a00d..48175854401 100644 --- a/win32ss/user/ntuser/win32kdebug.h +++ b/win32ss/user/ntuser/win32kdebug.h @@ -53,6 +53,7 @@ DbgChEngLDev, DbgChEngLine, DbgChEngMapping, + DbgChEngMDev, DbgChEngPDev, DbgChEngSurface, DbgChEngWnd, diff --git a/win32ss/user/ntuser/winsta.c b/win32ss/user/ntuser/winsta.c index 16e4f3c40b9..ba1db88a6bd 100644 --- a/win32ss/user/ntuser/winsta.c +++ b/win32ss/user/ntuser/winsta.c @@ -263,6 +263,13 @@ co_IntInitializeDesktopGraphics(VOID) UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY"); PDESKTOP pdesk; + gpmdev = ExAllocatePoolZero(PagedPool, sizeof(MDEVOBJ), GDITAG_MDEV); + if (!gpmdev) + { + ERR("Failed to allocate MDEV.\n"); + return FALSE; + } + ScreenDeviceContext = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, FALSE); if (NULL == ScreenDeviceContext) { @@ -285,11 +292,11 @@ co_IntInitializeDesktopGraphics(VOID) InitMetrics(); /* Set new size of the monitor */ - UserUpdateMonitorSize((HDEV)gppdevPrimary); + UserUpdateMonitorSize((HDEV)gpmdev->ppdevGlobal); /* Update the SERVERINFO */ - gpsi->aiSysMet[SM_CXSCREEN] = gppdevPrimary->gdiinfo.ulHorzRes; - gpsi->aiSysMet[SM_CYSCREEN] = gppdevPrimary->gdiinfo.ulVertRes; + gpsi->aiSysMet[SM_CXSCREEN] = gpmdev->ppdevGlobal->gdiinfo.ulHorzRes; + gpsi->aiSysMet[SM_CYSCREEN] = gpmdev->ppdevGlobal->gdiinfo.ulVertRes; gpsi->Planes = NtGdiGetDeviceCaps(ScreenDeviceContext, PLANES); gpsi->BitsPixel = NtGdiGetDeviceCaps(ScreenDeviceContext, BITSPIXEL); gpsi->BitCount = gpsi->Planes * gpsi->BitsPixel; @@ -311,7 +318,7 @@ co_IntInitializeDesktopGraphics(VOID) gpsi->ptCursor.y = gpsi->aiSysMet[SM_CYSCREEN] / 2; /* Attach monitor */ - UserAttachMonitor((HDEV)gppdevPrimary); + UserAttachMonitor((HDEV)gpmdev->ppdevGlobal); /* Setup the cursor */ co_IntLoadDefaultCursors(); diff --git a/win32ss/win32kp.h b/win32ss/win32kp.h index a336c2fe42c..e8f401d35c2 100644 --- a/win32ss/win32kp.h +++ b/win32ss/win32kp.h @@ -23,6 +23,7 @@ typedef struct _DC *PDC; #include "gdi/ntgdi/gdiobj.h" #include "gdi/ntgdi/palette.h" #include "gdi/eng/surface.h" +#include "gdi/eng/mdevobj.h" #include "gdi/eng/pdevobj.h" #include "gdi/eng/ldevobj.h" #include "gdi/eng/device.h"
2 years, 8 months
1
0
0
0
[reactos] 11/18: [WIN32SS] Rewrite EngpCreatePDEV as PDEVOBJ_Create
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0f617ddfbb97846b5525d…
commit 0f617ddfbb97846b5525d473ad59b570bc432855 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Mar 20 15:05:12 2022 +0100 Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com> CommitDate: Fri Apr 15 23:09:16 2022 +0200 [WIN32SS] Rewrite EngpCreatePDEV as PDEVOBJ_Create - change first argument to be a PGRAPHICS_DEVICE instead of a device name - add ldevtype (for now, only LDEV_DEVICE_DISPLAY is allowed) - always pass a devmode if ldevtype is LDEV_DEVICE_DISPLAY - insert the ppdev into gppdevList on success - change callers to adapt them to new rules --- win32ss/gdi/eng/pdevobj.c | 161 +++++++++++++++++++++++++++------------------- win32ss/gdi/eng/pdevobj.h | 6 ++ 2 files changed, 101 insertions(+), 66 deletions(-) diff --git a/win32ss/gdi/eng/pdevobj.c b/win32ss/gdi/eng/pdevobj.c index f6b58b1dd8d..6cc941dabd3 100644 --- a/win32ss/gdi/eng/pdevobj.c +++ b/win32ss/gdi/eng/pdevobj.c @@ -352,83 +352,88 @@ PDEVOBJ_vRefreshModeList( EngReleaseSemaphore(ppdev->hsemDevLock); } -static PPDEVOBJ -EngpCreatePDEV( - PUNICODE_STRING pustrDeviceName, - PDEVMODEW pdm) +PDEVOBJ_Create( + _In_opt_ PGRAPHICS_DEVICE pGraphicsDevice, + _In_opt_ PDEVMODEW pdm, + _In_ ULONG ldevtype) { - PGRAPHICS_DEVICE pGraphicsDevice; - PPDEVOBJ ppdev; - PDEVMODEW newDevMode; + PPDEVOBJ ppdev, ppdevMatch = NULL; + PLDEVOBJ pldev; + PSURFACE pSurface; - DPRINT("EngpCreatePDEV(%wZ, %p)\n", pustrDeviceName, pdm); + TRACE("PDEVOBJ_Create(%p %p %d)\n", pGraphicsDevice, pdm, ldevtype); - /* Try to find the GRAPHICS_DEVICE */ - if (pustrDeviceName) + if (ldevtype != LDEV_DEVICE_META) { - pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0); - if (!pGraphicsDevice) + ASSERT(pGraphicsDevice); + ASSERT(pdm); + /* Search if we already have a PPDEV with the required characteristics. + * We will compare the graphics device, the devmode and the desktop + */ + for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext) { - DPRINT1("No GRAPHICS_DEVICE found for %ls!\n", - pustrDeviceName ? pustrDeviceName->Buffer : 0); - return NULL; + if (ppdev->pGraphicsDevice == pGraphicsDevice) + { + PDEVOBJ_vReference(ppdev); + + if (RtlEqualMemory(pdm, ppdev->pdmwDev, sizeof(DEVMODEW))) + { + PDEVOBJ_vReference(ppdev); + ppdevMatch = ppdev; + } + else + { + PDEVOBJ_bDisableDisplay(ppdev); + } + + PDEVOBJ_vRelease(ppdev); + } + } + + if (ppdevMatch) + { + PDEVOBJ_vEnableDisplay(ppdevMatch); + + return ppdevMatch; } } - else + + /* Try to get a display driver */ + pldev = LDEVOBJ_pLoadDriver(pdm->dmDeviceName, ldevtype); + if (!pldev) { - ASSERT(gpPrimaryGraphicsDevice); - pGraphicsDevice = gpPrimaryGraphicsDevice; + ERR("Could not load display driver '%S'\n", + (ldevtype == LDEV_DEVICE_META) ? L"" : pdm->dmDeviceName); + return NULL; } /* Allocate a new PDEVOBJ */ ppdev = PDEVOBJ_AllocPDEV(); if (!ppdev) { - DPRINT1("failed to allocate a PDEV\n"); + ERR("failed to allocate a PDEV\n"); return NULL; } - /* If no DEVMODEW is given, ... */ - if (!pdm) + if (ldevtype != LDEV_DEVICE_META) { - /* ... use the device's default one */ - pdm = pGraphicsDevice->pDevModeList[pGraphicsDevice->iDefaultMode].pdm; - DPRINT("Using iDefaultMode = %lu\n", pGraphicsDevice->iDefaultMode); - } - - /* Try to get a diplay driver */ - ppdev->pldev = LDEVOBJ_pLoadDriver(pdm->dmDeviceName, LDEV_DEVICE_DISPLAY); - if (!ppdev->pldev) - { - DPRINT1("Could not load display driver '%ls', '%ls'\n", - pGraphicsDevice->pDiplayDrivers, - pdm->dmDeviceName); - PDEVOBJ_vRelease(ppdev); - return NULL; - } - - /* Copy the function table */ - ppdev->pfn = ppdev->pldev->pfn; - - /* Set MovePointer function */ - ppdev->pfnMovePointer = ppdev->pfn.MovePointer; - if (!ppdev->pfnMovePointer) - ppdev->pfnMovePointer = EngMovePointer; + ppdev->pGraphicsDevice = pGraphicsDevice; - ppdev->pGraphicsDevice = pGraphicsDevice; + // DxEngGetHdevData asks for Graphics DeviceObject in hSpooler field + ppdev->hSpooler = ppdev->pGraphicsDevice->DeviceObject; - // DxEngGetHdevData asks for Graphics DeviceObject in hSpooler field - ppdev->hSpooler = ppdev->pGraphicsDevice->DeviceObject; - - // Should we change the ative mode of pGraphicsDevice ? - if (!LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, pdm, &newDevMode, TRUE)) - { - DPRINT1("LDEVOBJ_bProbeAndCaptureDevmode() failed\n"); - PDEVOBJ_vRelease(ppdev); - return NULL; + /* Keep selected resolution */ + if (ppdev->pdmwDev) + ExFreePoolWithTag(ppdev->pdmwDev, GDITAG_DEVMODE); + ppdev->pdmwDev = ExAllocatePoolWithTag(PagedPool, pdm->dmSize + pdm->dmDriverExtra, GDITAG_DEVMODE); + if (ppdev->pdmwDev) + { + RtlCopyMemory(ppdev->pdmwDev, pdm, pdm->dmSize + pdm->dmDriverExtra); + /* FIXME: this must be done in a better way */ + pGraphicsDevice->StateFlags |= DISPLAY_DEVICE_ATTACHED_TO_DESKTOP; + } } - ppdev->pdmwDev = newDevMode; /* FIXME! */ ppdev->flFlags = PDEV_DISPLAY; @@ -436,20 +441,43 @@ EngpCreatePDEV( /* HACK: Don't use the pointer */ ppdev->Pointer.Exclude.right = -1; + /* Initialize PDEV */ + ppdev->pldev = pldev; + /* Call the driver to enable the PDEV */ if (!PDEVOBJ_bEnablePDEV(ppdev, pdm, NULL)) { - DPRINT1("Failed to enable PDEV!\n"); + ERR("Failed to enable PDEV!\n"); PDEVOBJ_vRelease(ppdev); + EngUnloadImage(pldev); return NULL; } - /* FIXME: this must be done in a better way */ - pGraphicsDevice->StateFlags |= DISPLAY_DEVICE_ATTACHED_TO_DESKTOP; + /* Copy the function table */ + ppdev->pfn = ppdev->pldev->pfn; /* Tell the driver that the PDEV is ready */ PDEVOBJ_vCompletePDEV(ppdev); + /* Create the initial surface */ + pSurface = PDEVOBJ_pSurface(ppdev); + if (!pSurface) + { + ERR("Failed to create surface\n"); + PDEVOBJ_vRelease(ppdev); + EngUnloadImage(pldev); + return NULL; + } + + /* Set MovePointer function */ + ppdev->pfnMovePointer = ppdev->pfn.MovePointer; + if (!ppdev->pfnMovePointer) + ppdev->pfnMovePointer = EngMovePointer; + + /* Insert the PDEV into the list */ + ppdev->ppdevNext = gppdevList; + gppdevList = ppdev; + /* Return the PDEV */ return ppdev; } @@ -531,7 +559,6 @@ PDEVOBJ_bSwitchMode( PPDEVOBJ ppdev, PDEVMODEW pdm) { - UNICODE_STRING ustrDevice; PPDEVOBJ ppdevTmp; PSURFACE pSurface; BOOL retval = FALSE; @@ -555,8 +582,7 @@ PDEVOBJ_bSwitchMode( } /* 2. Create new PDEV */ - RtlInitUnicodeString(&ustrDevice, ppdev->pGraphicsDevice->szWinDeviceName); - ppdevTmp = EngpCreatePDEV(&ustrDevice, pdm); + ppdevTmp = PDEVOBJ_Create(ppdev->pGraphicsDevice, pdm, LDEV_DEVICE_DISPLAY); if (!ppdevTmp) { DPRINT1("Failed to create a new PDEV\n"); @@ -657,14 +683,17 @@ EngpGetPDEV( } else { + if (pustrDeviceName) + pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0); + if (!pGraphicsDevice) + pGraphicsDevice = gpPrimaryGraphicsDevice; + /* No, create a new PDEV for the given device */ - ppdev = EngpCreatePDEV(pustrDeviceName, NULL); + ppdev = PDEVOBJ_Create(pGraphicsDevice, + pGraphicsDevice->pDevModeList[pGraphicsDevice->iDefaultMode].pdm, + LDEV_DEVICE_DISPLAY); if (ppdev) { - /* Insert the PDEV into the list */ - ppdev->ppdevNext = gppdevList; - gppdevList = ppdev; - /* Set as primary PDEV, if we don't have one yet */ if (!gppdevPrimary) { diff --git a/win32ss/gdi/eng/pdevobj.h b/win32ss/gdi/eng/pdevobj.h index c9fdd3252c1..fbd17f4a2cd 100644 --- a/win32ss/gdi/eng/pdevobj.h +++ b/win32ss/gdi/eng/pdevobj.h @@ -227,4 +227,10 @@ BOOL PDEVOBJ_bDisableDisplay( _Inout_ PPDEVOBJ ppdev); +PPDEVOBJ +PDEVOBJ_Create( + _In_opt_ PGRAPHICS_DEVICE pGraphicsDevice, + _In_opt_ PDEVMODEW pdm, + _In_ ULONG ldevtype); + #endif /* !__WIN32K_PDEVOBJ_H */
2 years, 8 months
1
0
0
0
[reactos] 10/18: [WIN32SS] Add PDEVOBJ_vEnableDisplay and PDEVOBJ_bDisplayDisplay
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c5fb89dced1da2ed4d6be…
commit c5fb89dced1da2ed4d6bedd478e417ef385cd71b Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Jan 9 11:33:38 2022 +0100 Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com> CommitDate: Fri Apr 15 23:09:16 2022 +0200 [WIN32SS] Add PDEVOBJ_vEnableDisplay and PDEVOBJ_bDisplayDisplay Use them where appropriate. --- win32ss/gdi/eng/pdevobj.c | 48 +++++++++++++++++++++++++++++++++++++++++------ win32ss/gdi/eng/pdevobj.h | 8 ++++++++ 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/win32ss/gdi/eng/pdevobj.c b/win32ss/gdi/eng/pdevobj.c index 1bf060dbec2..f6b58b1dd8d 100644 --- a/win32ss/gdi/eng/pdevobj.c +++ b/win32ss/gdi/eng/pdevobj.c @@ -276,6 +276,45 @@ PDEVOBJ_pSurface( return ppdev->pSurface; } +VOID +PDEVOBJ_vEnableDisplay( + _Inout_ PPDEVOBJ ppdev) +{ + BOOL assertVal; + + if (!(ppdev->flFlags & PDEV_DISABLED)) + return; + + /* Try to enable display until success */ + do + { + TRACE("DrvAssertMode(dhpdev %p, TRUE)\n", ppdev->dhpdev); + assertVal = ppdev->pfn.AssertMode(ppdev->dhpdev, TRUE); + TRACE("DrvAssertMode(dhpdev %p, TRUE) => %d\n", ppdev->dhpdev, assertVal); + } while (!assertVal); + + ppdev->flFlags &= ~PDEV_DISABLED; +} + +BOOL +PDEVOBJ_bDisableDisplay( + _Inout_ PPDEVOBJ ppdev) +{ + BOOL assertVal; + + if (ppdev->flFlags & PDEV_DISABLED) + return TRUE; + + TRACE("DrvAssertMode(dhpdev %p, FALSE)\n", ppdev->dhpdev); + assertVal = ppdev->pfn.AssertMode(ppdev->dhpdev, FALSE); + TRACE("DrvAssertMode(dhpdev %p, FALSE) => %d\n", ppdev->dhpdev, assertVal); + + if (assertVal) + ppdev->flFlags |= PDEV_DISABLED; + + return assertVal; +} + VOID NTAPI PDEVOBJ_vRefreshModeList( @@ -509,9 +548,9 @@ PDEVOBJ_bSwitchMode( // pdm = LDEVOBJ_bProbeAndCaptureDevmode(ppdev, pdm); /* 1. Temporarily disable the current PDEV and reset video to its default mode */ - if (!ppdev->pfn.AssertMode(ppdev->dhpdev, FALSE)) + if (!PDEVOBJ_bDisableDisplay(ppdev)) { - DPRINT1("DrvAssertMode(FALSE) failed\n"); + DPRINT1("PDEVOBJ_bDisableDisplay() failed\n"); goto leave; } @@ -560,10 +599,7 @@ PDEVOBJ_bSwitchMode( leave2: /* Set the new video mode, or restore the original one in case of failure */ - if (!ppdev->pfn.AssertMode(ppdev->dhpdev, TRUE)) - { - DPRINT1("DrvAssertMode(TRUE) failed\n"); - } + PDEVOBJ_vEnableDisplay(ppdev); leave: /* Unlock everything else */ diff --git a/win32ss/gdi/eng/pdevobj.h b/win32ss/gdi/eng/pdevobj.h index 4943c994d29..c9fdd3252c1 100644 --- a/win32ss/gdi/eng/pdevobj.h +++ b/win32ss/gdi/eng/pdevobj.h @@ -219,4 +219,12 @@ PDEVOBJ_bDynamicModeChange( _Inout_ PPDEVOBJ ppdev, _Inout_ PPDEVOBJ ppdev2); +VOID +PDEVOBJ_vEnableDisplay( + _Inout_ PPDEVOBJ ppdev); + +BOOL +PDEVOBJ_bDisableDisplay( + _Inout_ PPDEVOBJ ppdev); + #endif /* !__WIN32K_PDEVOBJ_H */
2 years, 8 months
1
0
0
0
[reactos] 09/18: [WIN32SS] Rename PDEVOBJ_vSwitchPdev to PDEVOBJ_bDynamicModeChange
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=34085be22d56684b16810…
commit 34085be22d56684b16810bc210a2453ef6368fe6 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Jan 9 11:26:59 2022 +0100 Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com> CommitDate: Fri Apr 15 23:09:16 2022 +0200 [WIN32SS] Rename PDEVOBJ_vSwitchPdev to PDEVOBJ_bDynamicModeChange Even if it currently always succeeds, let it return a boolean for later. --- win32ss/gdi/eng/pdevobj.c | 13 ++++++++++--- win32ss/gdi/eng/pdevobj.h | 6 ++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/win32ss/gdi/eng/pdevobj.c b/win32ss/gdi/eng/pdevobj.c index 9c7337698e2..1bf060dbec2 100644 --- a/win32ss/gdi/eng/pdevobj.c +++ b/win32ss/gdi/eng/pdevobj.c @@ -430,9 +430,9 @@ SwitchPointer( *ppvPointer2 = pvTemp; } -VOID +BOOL NTAPI -PDEVOBJ_vSwitchPdev( +PDEVOBJ_bDynamicModeChange( PPDEVOBJ ppdev, PPDEVOBJ ppdev2) { @@ -481,6 +481,8 @@ PDEVOBJ_vSwitchPdev( /* Notify each driver instance of its new HDEV association */ ppdev->pfn.CompletePDEV(ppdev->dhpdev, (HDEV)ppdev); ppdev2->pfn.CompletePDEV(ppdev2->dhpdev, (HDEV)ppdev2); + + return TRUE; } @@ -536,7 +538,12 @@ PDEVOBJ_bSwitchMode( /* 6. Copy old PDEV state to new PDEV instance */ /* 7. Switch the PDEVs */ - PDEVOBJ_vSwitchPdev(ppdev, ppdevTmp); + if (!PDEVOBJ_bDynamicModeChange(ppdev, ppdevTmp)) + { + DPRINT1("PDEVOBJ_bDynamicModeChange() failed\n"); + PDEVOBJ_vRelease(ppdevTmp); + goto leave2; + } /* 8. Disable DirectDraw */ diff --git a/win32ss/gdi/eng/pdevobj.h b/win32ss/gdi/eng/pdevobj.h index af4973b60f6..4943c994d29 100644 --- a/win32ss/gdi/eng/pdevobj.h +++ b/win32ss/gdi/eng/pdevobj.h @@ -213,4 +213,10 @@ PDEVOBJ_bSwitchMode( PPDEVOBJ ppdev, PDEVMODEW pdm); +BOOL +NTAPI +PDEVOBJ_bDynamicModeChange( + _Inout_ PPDEVOBJ ppdev, + _Inout_ PPDEVOBJ ppdev2); + #endif /* !__WIN32K_PDEVOBJ_H */
2 years, 8 months
1
0
0
0
[reactos] 08/18: [WIN32SS] Improve PDEVOBJ_bEnablePDEV/PDEVOBJ_vRelease/PDEVOBJ_pSurface
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=241e579dfab6240c06da2…
commit 241e579dfab6240c06da2fe39a3c490196cbe0d7 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Jan 9 11:18:18 2022 +0100 Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com> CommitDate: Fri Apr 15 23:09:16 2022 +0200 [WIN32SS] Improve PDEVOBJ_bEnablePDEV/PDEVOBJ_vRelease/PDEVOBJ_pSurface - use debug channels - handle a NULL ppdev->pGraphicsDevice - unreference graphic driver when needed --- win32ss/gdi/eng/pdevobj.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/win32ss/gdi/eng/pdevobj.c b/win32ss/gdi/eng/pdevobj.c index 76e8dde0d14..9c7337698e2 100644 --- a/win32ss/gdi/eng/pdevobj.c +++ b/win32ss/gdi/eng/pdevobj.c @@ -9,6 +9,7 @@ #include <win32k.h> #define NDEBUG #include <debug.h> +DBG_DEFAULT_CHANNEL(EngPDev); PPDEVOBJ gppdevPrimary = NULL; @@ -110,6 +111,7 @@ PDEVOBJ_vRelease( { /* Release the surface and let the driver free it */ SURFACE_ShareUnlockSurface(ppdev->pSurface); + TRACE("DrvDisableSurface(dhpdev %p)\n", ppdev->dhpdev); ppdev->pfn.DisableSurface(ppdev->dhpdev); } @@ -123,6 +125,7 @@ PDEVOBJ_vRelease( if (ppdev->dhpdev != NULL) { /* Disable the PDEV */ + TRACE("DrvDisablePDEV(dhpdev %p)\n", ppdev->dhpdev); ppdev->pfn.DisablePDEV(ppdev->dhpdev); } @@ -150,6 +153,9 @@ PDEVOBJ_vRelease( if (ppdev == gppdevPrimary) gppdevPrimary = NULL; + /* Unload display driver */ + EngUnloadImage(ppdev->pldev); + /* Free it */ PDEVOBJ_vDeletePDEV(ppdev); } @@ -161,19 +167,25 @@ PDEVOBJ_vRelease( BOOL NTAPI PDEVOBJ_bEnablePDEV( - PPDEVOBJ ppdev, - PDEVMODEW pdevmode, - PWSTR pwszLogAddress) + _In_ PPDEVOBJ ppdev, + _In_ PDEVMODEW pdevmode, + _In_ PWSTR pwszLogAddress) { PFN_DrvEnablePDEV pfnEnablePDEV; ULONG i; - DPRINT("PDEVOBJ_bEnablePDEV()\n"); - /* Get the DrvEnablePDEV function */ pfnEnablePDEV = ppdev->pldev->pfn.EnablePDEV; /* Call the drivers DrvEnablePDEV function */ + TRACE("DrvEnablePDEV(pdevmode %p (%dx%dx%d %d Hz) hdev %p (%S))\n", + pdevmode, + ppdev->pGraphicsDevice ? pdevmode->dmPelsWidth : 0, + ppdev->pGraphicsDevice ? pdevmode->dmPelsHeight : 0, + ppdev->pGraphicsDevice ? pdevmode->dmBitsPerPel : 0, + ppdev->pGraphicsDevice ? pdevmode->dmDisplayFrequency : 0, + ppdev, + ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->szNtDeviceName : L""); ppdev->dhpdev = pfnEnablePDEV(pdevmode, pwszLogAddress, HS_DDI_MAX, @@ -183,11 +195,12 @@ PDEVOBJ_bEnablePDEV( sizeof(DEVINFO), &ppdev->devinfo, (HDEV)ppdev, - ppdev->pGraphicsDevice->pwszDescription, - ppdev->pGraphicsDevice->DeviceObject); + ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->pwszDescription : NULL, + ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->DeviceObject : NULL); + TRACE("DrvEnablePDEV(pdevmode %p hdev %p) => dhpdev %p\n", pdevmode, ppdev, ppdev->dhpdev); if (ppdev->dhpdev == NULL) { - DPRINT1("Failed to enable PDEV\n"); + ERR("Failed to enable PDEV\n"); return FALSE; } @@ -217,7 +230,7 @@ PDEVOBJ_bEnablePDEV( ppdev->ahsurf[i] = gahsurfHatch[i]; } - DPRINT("PDEVOBJ_bEnablePDEV - dhpdev = %p\n", ppdev->dhpdev); + TRACE("PDEVOBJ_bEnablePDEV - dhpdev = %p\n", ppdev->dhpdev); return TRUE; } @@ -228,6 +241,7 @@ PDEVOBJ_vCompletePDEV( PPDEVOBJ ppdev) { /* Call the drivers DrvCompletePDEV function */ + TRACE("DrvCompletePDEV(dhpdev %p hdev %p)\n", ppdev->dhpdev, ppdev); ppdev->pldev->pfn.CompletePDEV(ppdev->dhpdev, (HDEV)ppdev); } @@ -242,10 +256,12 @@ PDEVOBJ_pSurface( if (ppdev->pSurface == NULL) { /* Call the drivers DrvEnableSurface */ + TRACE("DrvEnableSurface(dhpdev %p)\n", ppdev->dhpdev); hsurf = ppdev->pldev->pfn.EnableSurface(ppdev->dhpdev); + TRACE("DrvEnableSurface(dhpdev %p) => hsurf %p\n", ppdev->dhpdev, hsurf); if (hsurf== NULL) { - DPRINT1("Failed to create PDEV surface!\n"); + ERR("Failed to create PDEV surface!\n"); return NULL; } @@ -257,7 +273,6 @@ PDEVOBJ_pSurface( /* Increment reference count */ GDIOBJ_vReferenceObjectByPointer(&ppdev->pSurface->BaseObject); - DPRINT("PDEVOBJ_pSurface() returning %p\n", ppdev->pSurface); return ppdev->pSurface; }
2 years, 8 months
1
0
0
0
[reactos] 07/18: [WIN32SS] Remove useless parameter dwFlags in EngpFindGraphicsDevice()
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ded971c425ca139dd33c9…
commit ded971c425ca139dd33c972f2977938ae879ed13 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Jan 9 11:06:04 2022 +0100 Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com> CommitDate: Fri Apr 15 23:09:16 2022 +0200 [WIN32SS] Remove useless parameter dwFlags in EngpFindGraphicsDevice() --- win32ss/gdi/eng/device.c | 9 ++++----- win32ss/gdi/eng/device.h | 3 +-- win32ss/gdi/eng/pdevobj.c | 2 +- win32ss/user/ntuser/display.c | 4 ++-- win32ss/user/ntuser/winsta.c | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/win32ss/gdi/eng/device.c b/win32ss/gdi/eng/device.c index 4f2284fa1e6..af1c57f2652 100644 --- a/win32ss/gdi/eng/device.c +++ b/win32ss/gdi/eng/device.c @@ -80,7 +80,7 @@ EngpUpdateGraphicsDeviceList(VOID) RtlInitUnicodeString(&ustrDeviceName, awcWinDeviceName); /* Check if the device exists already */ - pGraphicsDevice = EngpFindGraphicsDevice(&ustrDeviceName, iDevNum, 0); + pGraphicsDevice = EngpFindGraphicsDevice(&ustrDeviceName, iDevNum); if (pGraphicsDevice != NULL) { continue; @@ -387,14 +387,13 @@ PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice( _In_opt_ PUNICODE_STRING pustrDevice, - _In_ ULONG iDevNum, - _In_ DWORD dwFlags) + _In_ ULONG iDevNum) { UNICODE_STRING ustrCurrent; PGRAPHICS_DEVICE pGraphicsDevice; ULONG i; - TRACE("EngpFindGraphicsDevice('%wZ', %lu, 0x%lx)\n", - pustrDevice, iDevNum, dwFlags); + TRACE("EngpFindGraphicsDevice('%wZ', %lu)\n", + pustrDevice, iDevNum); /* Lock list */ EngAcquireSemaphore(ghsemGraphicsDeviceList); diff --git a/win32ss/gdi/eng/device.h b/win32ss/gdi/eng/device.h index c66e4cf0ad6..43a0dd6ebb3 100644 --- a/win32ss/gdi/eng/device.h +++ b/win32ss/gdi/eng/device.h @@ -23,8 +23,7 @@ PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice( _In_opt_ PUNICODE_STRING pustrDevice, - _In_ ULONG iDevNum, - _In_ DWORD dwFlags); + _In_ ULONG iDevNum); PGRAPHICS_DEVICE NTAPI diff --git a/win32ss/gdi/eng/pdevobj.c b/win32ss/gdi/eng/pdevobj.c index 77b9a9fafc3..76e8dde0d14 100644 --- a/win32ss/gdi/eng/pdevobj.c +++ b/win32ss/gdi/eng/pdevobj.c @@ -313,7 +313,7 @@ EngpCreatePDEV( /* Try to find the GRAPHICS_DEVICE */ if (pustrDeviceName) { - pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0, 0); + pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0); if (!pGraphicsDevice) { DPRINT1("No GRAPHICS_DEVICE found for %ls!\n", diff --git a/win32ss/user/ntuser/display.c b/win32ss/user/ntuser/display.c index 81ed1bdb402..eb3365f0d33 100644 --- a/win32ss/user/ntuser/display.c +++ b/win32ss/user/ntuser/display.c @@ -253,7 +253,7 @@ UserEnumDisplayDevices( } /* Ask gdi for the GRAPHICS_DEVICE */ - pGraphicsDevice = EngpFindGraphicsDevice(pustrDevice, iDevNum, 0); + pGraphicsDevice = EngpFindGraphicsDevice(pustrDevice, iDevNum); if (!pGraphicsDevice) { /* No device found */ @@ -423,7 +423,7 @@ UserEnumDisplaySettings( pustrDevice, iModeNum); /* Ask GDI for the GRAPHICS_DEVICE */ - pGraphicsDevice = EngpFindGraphicsDevice(pustrDevice, 0, 0); + pGraphicsDevice = EngpFindGraphicsDevice(pustrDevice, 0); ppdev = EngpGetPDEV(pustrDevice); if (!pGraphicsDevice || !ppdev) diff --git a/win32ss/user/ntuser/winsta.c b/win32ss/user/ntuser/winsta.c index b6f5f5d1459..16e4f3c40b9 100644 --- a/win32ss/user/ntuser/winsta.c +++ b/win32ss/user/ntuser/winsta.c @@ -335,7 +335,7 @@ co_IntInitializeDesktopGraphics(VOID) HDC hdc; ULONG iDevNum; - for (iDevNum = 1; (pGraphicsDevice = EngpFindGraphicsDevice(NULL, iDevNum, 0)) != NULL; iDevNum++) + for (iDevNum = 1; (pGraphicsDevice = EngpFindGraphicsDevice(NULL, iDevNum)) != NULL; iDevNum++) { RtlInitUnicodeString(&DisplayName, pGraphicsDevice->szWinDeviceName); hdc = IntGdiCreateDC(&DriverName, &DisplayName, NULL, NULL, FALSE);
2 years, 8 months
1
0
0
0
[reactos] 06/18: [WIN32SS] Preparation to load internal drivers (ie entry point in win32k)
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=75f4be53dfb168981ff25…
commit 75f4be53dfb168981ff25a090aac8396d8b4fa23 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Jan 9 11:02:27 2022 +0100 Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com> CommitDate: Fri Apr 15 23:09:16 2022 +0200 [WIN32SS] Preparation to load internal drivers (ie entry point in win32k) - Change LDEVOBJ_bEnableDriver to directly take the entry point (pGdiDriverInfo not required anymore) - Add LDEVOBJ_pLoadInternal to load and start an internal driver --- win32ss/gdi/eng/ldevobj.c | 53 +++++++++++++++++++++++++++++++++++++++++------ win32ss/gdi/eng/ldevobj.h | 5 +++++ 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/win32ss/gdi/eng/ldevobj.c b/win32ss/gdi/eng/ldevobj.c index db46a0dfbb6..6321c8ad88d 100644 --- a/win32ss/gdi/eng/ldevobj.c +++ b/win32ss/gdi/eng/ldevobj.c @@ -194,18 +194,16 @@ LDEVOBJ_vUnloadImage( static BOOL LDEVOBJ_bEnableDriver( - _Inout_ PLDEVOBJ pldev) + _Inout_ PLDEVOBJ pldev, + _In_ PFN_DrvEnableDriver pfnEnableDriver) { - PFN_DrvEnableDriver pfnEnableDriver; DRVENABLEDATA ded; ULONG i; - /* Make sure we have a driver info */ - ASSERT(pldev && pldev->pGdiDriverInfo != NULL); + ASSERT(pldev); /* Call the drivers DrvEnableDriver function */ RtlZeroMemory(&ded, sizeof(ded)); - pfnEnableDriver = pldev->pGdiDriverInfo->EntryPoint; if (!pfnEnableDriver(GDI_ENGINE_VERSION, sizeof(ded), &ded)) { ERR("DrvEnableDriver failed\n"); @@ -325,6 +323,49 @@ LDEVOBJ_pvFindImageProcAddress( return pvProcAdress; } +PLDEVOBJ +LDEVOBJ_pLoadInternal( + _In_ PFN_DrvEnableDriver pfnEnableDriver, + _In_ ULONG ldevtype) +{ + PLDEVOBJ pldev; + + TRACE("LDEVOBJ_pLoadInternal(%lu)\n", ldevtype); + + /* Lock loader */ + EngAcquireSemaphore(ghsemLDEVList); + + /* Allocate a new LDEVOBJ */ + pldev = LDEVOBJ_AllocLDEV(ldevtype); + if (!pldev) + { + ERR("Could not allocate LDEV\n"); + goto leave; + } + + /* Load the driver */ + if (!LDEVOBJ_bEnableDriver(pldev, pfnEnableDriver)) + { + ERR("LDEVOBJ_bEnableDriver failed\n"); + LDEVOBJ_vFreeLDEV(pldev); + pldev = NULL; + goto leave; + } + + /* Insert the LDEV into the global list */ + InsertHeadList(&gleLdevListHead, &pldev->leLink); + + /* Increase ref count */ + pldev->cRefs++; + +leave: + /* Unlock loader */ + EngReleaseSemaphore(ghsemLDEVList); + + TRACE("LDEVOBJ_pLoadInternal returning %p\n", pldev); + return pldev; +} + PLDEVOBJ NTAPI LDEVOBJ_pLoadDriver( @@ -423,7 +464,7 @@ LDEVOBJ_pLoadDriver( if (ldevtype != LDEV_IMAGE) { /* Load the driver */ - if (!LDEVOBJ_bEnableDriver(pldev)) + if (!LDEVOBJ_bEnableDriver(pldev, pldev->pGdiDriverInfo->EntryPoint)) { ERR("LDEVOBJ_bEnableDriver failed\n"); diff --git a/win32ss/gdi/eng/ldevobj.h b/win32ss/gdi/eng/ldevobj.h index f1fc624950d..c603847cecc 100644 --- a/win32ss/gdi/eng/ldevobj.h +++ b/win32ss/gdi/eng/ldevobj.h @@ -46,6 +46,11 @@ LDEVOBJ_ulGetDriverModes( _In_ HANDLE hDriver, _Out_ PDEVMODEW *ppdm); +PLDEVOBJ +LDEVOBJ_pLoadInternal( + _In_ PFN_DrvEnableDriver pfnEnableDriver, + _In_ ULONG ldevtype); + PLDEVOBJ APIENTRY LDEVOBJ_pLoadDriver(
2 years, 8 months
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
16
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Results per page:
10
25
50
100
200