Commit graph

29 commits

Author SHA1 Message Date
Hervé Poussineau 8b7770aa2c [WIN32SS:ENG] Rework EngpUpdateGraphicsDeviceList
- choose VGA adapter outside of driver initialization loop
- choose primary adapter outside of driver initialization loop
- link VGA adapter to primary adapter at the end
- only set DISPLAY_DEVICE_PRIMARY_DEVICE in this function

Also mark VgaSave driver as SystemStart instead of Disabled,
so it is available if main display driver doesn't work.

CORE-7728, CORE-19224
2024-02-07 22:41:36 +01:00
Oleg Dubinskiy e034377b51
[WIN32SS][ENG][NTDDRAW] Manage DirectDraw instances when switching display mode (#4519)
CORE-17932

[ENG] Implement DirectDraw management in switch display mode functions
(e.g. resolution change, color depth, display frequency etc.):

- Switch DirectDraw instances between the two PDEVs (the current one and
  the new one allocated by ourselves) by calling dxg!DxDdDynamicModeChange
  function.

- Suspend them before and resume after the display mode switch, by calling
  dxg!DxDdsuspendDirectDraw and dxg!DxDdResumeDirectDraw appropriately.

We currently don't have these functions implemented, but MS DXG has, so
it allows to properly manage DirectDraw PDEVs using this driver, similarly
to Windows.
My analysis confirms that these functions are always called in XP/2k3 on
display mode switch, even when there is no any DirectX app running at the
moment. Analyzing their prototypes show that my guesses are correct.

- Initialize hDev and dhpdev members for EDD_DIRECTDRAW_GLOBAL for newly
  created surfaces, switch them during mode change and re-initialize after
  it also. They are commonly used by DirectDraw stack.
  In addition, enable DirectDraw for old and new PDEVs, by calling
  dxg!DxDdEnableDirectDraw function.


[NTDDRAW] Additionally, fix usage of DirectDraw lock count in the PDEVOBJ
structure.

- Enable cDirectDrawDisableLocks member for storing its value, instead of
  DxDd_nCount, which is marked as ROS-specific.

- Use it in win32k!DxEngGet/SetHdevData for getting/setting DirectDraw
  count appropriately.

My analysis also shows that in Windows, the PDEVOBJ::cDirectDrawDisableLocks
method calls DxEngGetHdevData with type 8, which corresponds to our DxDd_nCount.
So there are no doubts that this member is used there.

- Rename DxEngGetHdevData_dd_count alias of type 8 to DxEngGetHdevData_dd_locks,
  to match more accurately an actual member name. Update the enumeration
  and fix all code parts appropriately.

All these changes allow to properly change display mode during executing
DirectDraw applications, when they try to switch in full-screen mode.
At least a bugcheck that happened before my changes, does no longer appear.

There are still some games that don't run correctly, as if there is no
3D acceleration (which actually exists). This requires further investigations.
2023-06-21 18:00:24 +02:00
Hervé Poussineau 81aa81e38f [WIN32SS] Implement display acceleration level 5 (ie no acceleration)
This is a easy as forcing usage of panning driver.
2022-05-14 21:29:12 +02:00
Hervé Poussineau 4e0f2fc01c [WIN32SS] Implement panning driver
This can be configured in registry with DefaultSettings.XPanning and
DefaultSettings.YPanning, which describe the real screen resolution.

DefaultSettings.XResolution and DefaultSettings.YResolution describe
the resolution of the virtual screen.
2022-05-14 21:29:12 +02:00
Hervé Poussineau 185f2dac85 [WIN32SS] Copy function table earlier, and use it in all PDEVOBJ operations 2022-05-14 21:29:12 +02:00
Hervé Poussineau d8b3402fe6 [WIN32SS] In PDEVOBJ_vRefreshModeList, do not change current stored mode
When changing current devmode, we must not only change ppdev->pdmwDev
pointer, but also update lots of other structures. This work is done by
PDEVOBJ_lChangeDisplaySettings.

CORE-18169
2022-04-30 23:33:42 +02:00
Hervé Poussineau d1cd80c861 [WIN32SS] Set DISPLAY_DEVICE_PRIMARY_DEVICE flag
This flag was not set anymore since 2d2824f1b9
Note that this is still wrong for multi-monitor.

CORE-18169
2022-04-30 22:02:28 +02:00
Hervé Poussineau cb504d7b0c [WIN32SS] Fix crash if releasing a PDEVOBJ before switching to graphic mode
- do not try to remove ppdev from gppdevList if gppdevList is NULL
- do not check (and maybe change) gpmdev, as it should be done only in MDEVOBJ_vDestroy
2022-04-25 22:18:41 +02:00
Hervé Poussineau 3a1a2aa16f [WIN32SS] Fix use of unitialized variable 2022-04-17 08:46:09 +02:00
James Tabor 001e300d92 [Win32SS] Fix Build 2
Fix Build 2
2022-04-15 19:30:59 -05:00
Hervé Poussineau 9400063aae [WIN32SS] Enable multidisplay driver when required
For now, it is only a stub which returns an error.
2022-04-15 23:09:16 +02:00
Hervé Poussineau f3f4cc0f25 [WIN32SS] Implement EngQueryDeviceAttribute 2022-04-15 23:09:16 +02:00
Hervé Poussineau c89ac107ce [WIN32SS] Handle Graphics acceleration level (registry key Acceleration.Level)
- store the acceleration level in PDEVOBJ
- when searching a pdev, search a pdev with required acceleration level
- disable some functions when not at full acceleration level
  (levels 3 and 5 are not implemented)
2022-04-15 23:09:16 +02:00
Hervé Poussineau 2d2824f1b9 [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
2022-04-15 23:09:16 +02:00
Hervé Poussineau a0cfdcd409 [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.
2022-04-15 23:09:16 +02:00
Hervé Poussineau 0f617ddfbb [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
2022-04-15 23:09:16 +02:00
Hervé Poussineau c5fb89dced [WIN32SS] Add PDEVOBJ_vEnableDisplay and PDEVOBJ_bDisplayDisplay
Use them where appropriate.
2022-04-15 23:09:16 +02:00
Hervé Poussineau 34085be22d [WIN32SS] Rename PDEVOBJ_vSwitchPdev to PDEVOBJ_bDynamicModeChange
Even if it currently always succeeds, let it return a boolean for later.
2022-04-15 23:09:16 +02:00
Hervé Poussineau 241e579dfa [WIN32SS] Improve PDEVOBJ_bEnablePDEV/PDEVOBJ_vRelease/PDEVOBJ_pSurface
- use debug channels
- handle a NULL ppdev->pGraphicsDevice
- unreference graphic driver when needed
2022-04-15 23:09:16 +02:00
Hervé Poussineau ded971c425 [WIN32SS] Remove useless parameter dwFlags in EngpFindGraphicsDevice() 2022-04-15 23:09:16 +02:00
Hervé Poussineau 3cb1dd8ab2 [WIN32SS] Rewrite PDEVOBJ_pdmMatchDevMode to LDEVOBJ_bProbeAndCaptureDevmode
- make it return a new allocated PDEVMODEW instead of a pointer into
  existing PGRAPHICS_DEVICE (usefull when available display modes can
  dynamically change: VirtualBox, RDP, ...)
- update all callers
2022-04-15 23:09:16 +02:00
Hervé Poussineau 3b234cce25 [WIN32SS] Rename EngLoadDriverEx to LDEVOBJ_pLoadDriver 2022-04-15 23:09:16 +02:00
Victor Perevertkin d74eb54b06
[WIN32SS:GDI] Add a sanity assert 2021-09-14 17:58:23 +03:00
Victor Perevertkin 5c7ce4475e
[REACTOS] Cleanup INIT and some PAGE section allocations
- Change INIT_FUNCTION and INIT_SECTION to CODE_SEG("INIT") and DATA_SEG("INIT") respectively
- Remove INIT_FUNCTION from function prototypes
- Remove alloc_text pragma calls as they are not needed anymore
2020-11-02 21:45:31 +03:00
Hermès Bélusca-Maïto 148e137b42
[WIN32K] Add some validity checks in PDEVOBJ_vReference() and use it instead of explicitly manipulating ppdev->cPdevRefs. 2019-11-25 00:41:51 +01:00
Hermès Bélusca-Maïto 0ad90f83d3
[WIN32K] Code formatting. 2019-11-25 00:41:49 +01:00
Thomas Faber 00e882c2b1
[WIN32K:ENG] In PDEVOBJ_vRefreshModeList, find a proper match for the current display mode instead of assuming a constant index. CORE-15325 2019-06-16 12:45:58 +02:00
Hermès Bélusca-Maïto 333ce14dad
[WIN32SS] Try to recover display when changing the display mode fails for whatever reason.
This helps when e.g. changing the resolution on the Dell Latitude D531,
which reports that it supports large resolutions (e.g. 1920x1440x32 and
others larger than 1024x768x32) but fails to apply these.
This usually happens because PDEVOBJ_pSurface(), and more precisely
ppdev->pldev->pfn.EnableSurface(), fails for these resolutions.

- PDEVOBJ_bSwitchMode(): Set the new video mode, or restore the original
  one in case of failure + release the allocated ppdevTmp if previous
  calls fail. Also unlock in reverse order of locking order.

- UserChangeDisplaySettings(): In case PDEVOBJ_pSurface() fails (but has
  reverted the original video mode), we still need to refresh the
  display since the display may have been messed up.
2019-01-02 21:12:22 +01:00
Colin Finck c2c66aff7d Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
Renamed from reactos/win32ss/gdi/eng/pdevobj.c (Browse further)