Commit graph

17 commits

Author SHA1 Message Date
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 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 21ddeb76d9 [WIN32SS] Extract devmode list query to new function LDEVOBJ_bBuildDevmodeList
LDEVOBJ_bBuildDevmodeList() only queries the available display modes, without
choosing the one to use on the graphic device, and without immediately
creating a PDEV.

Replace first part of EngpPopulateDeviceModeList() function by a call
to this new function LDEVOBJ_bBuildDevmodeList().
Keep second part of EngpPopulateDeviceModeList() function, which
chooses the default display mode.
2022-04-15 23:09:16 +02:00
Hervé Poussineau 7d93362f5a [WIN32SS] Implement LDEVOBJ_ulGetDriverModes
- implement LDEVOBJ_ulGetDriverModes (which get modes from a not yet loaded driver),
  and use it in EngpPopulateDeviceModeList
- remove now useless LDEVOBJ_pdmiGetModes (replaced by LDEVOBJ_ulGetDriverModes)
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
Oleg Dubinskiy c05a45e17e
[WIN32K:ENG] Pass correct display name to EngpFindGraphicsDevice (#4128)
It actually should look like '\\.\DISPLAY<n>' (since it comes from user mode),
which the function expects, and not '\\Device\\Video<n>', like done in the
kernel mode. Otherwise, passing wrong name causes a mismatch.

Fix the problem with video device access (failure with status 0xc0000022 when
trying to open it). Hence, it also fixes the following debug log spam:
'err: Could not open device \Device\Video0, 0xc0000022'.

Addendum to 77e891b8. CORE-17719 CORE-17786
2021-12-01 18:28:45 +03:00
Timo Kreuzer 77e891b8ab [WIN32K] Check if a graphics device already exists before trying to add it
This avoids DPRINTs alleging a failure to open a device.
Also improve another DPRINT.
2021-07-15 08:32:46 +02:00
Timo Kreuzer 39d8a822d2 [WIN32K] Fix detection of multiple display devices on VBox 2021-07-15 08:32:46 +02:00
Hervé Poussineau 0f6b9664cd [WIN32K] HACK: create a DC on all display devices and display wallpaper 2021-07-10 16:27:44 +02:00
Hervé Poussineau 6739fb1bc3 [WIN32K] Move detection of available display devices a new fonction EngpUpdateGraphicsDeviceList
- rewrite InitVideo() to call this new function
- also call it at the start of UserEnumDisplayDevices, to detect new potential devices
2021-07-10 16:27:44 +02: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 0ad65796bb
[WIN32K][VIDEOPRT] Improve initialization and interfacing with INBV.
CORE-12149

VIDEOPRT:
=========

Improve interfacing with INBV, so as to detect when an external module
acquired INBV display ownership, and whether ownership is being released
later on. (This does NOT rely on hooking!)

For this purpose we improve the IntVideoPortResetDisplayParameters(Ex)
callback that gets registered with an InbvNotifyDisplayOwnershipLost()
call during initialization, and we add a monitoring thread.

The callback is called whenever an external module calls
InbvAcquireDisplayOwnership(), for example the bugcheck code or the KDBG
debugger in SCREEN mode. When this happens, a flag that tells the
monitoring thread to start monitoring INBV is set (ReactOS-specific),
and the display adapters get reset with HwResetHw() (as done on Windows).

Due to the fact that this INBV callback can be called at *ANY* IRQL, we
cannot use dispatcher synchronization mechanisms such as events to tell
the INBV monitoring thread to start its operations, so we need to rely
instead on a flag to be set. And, since INBV doesn't provide with any
proper callback/notification system either, we need to actively monitor
its state by pooling. To reduce the load on the system the monitoring
thread performs 1-second waits between each check for the flag set by
the INBV callback, and during checking the INBV ownership status.

When the INBV ownership is detected to be released by an external module,
the INBV callback is re-registered (this is *MANDATORY* since the
external module has called InbvNotifyDisplayOwnershipLost() with a
different callback parameter!), and then we callout to Win32k for
re-enabling the display.

This has the virtue of correctly resetting the display once the KDBG
debugger in SCREEN mode is being exited, and fixes CORE-12149 .

The following additional fixes were needed:

VIDEOPRT & WIN32K:
==================

Remove the registration with INBV that was previously done in a ReactOS-
specific hacked IRP_MJ_WRITE call; it is now done correctly during the
video device opening done by EngpRegisterGraphicsDevice() in the VIDEOPRT's
IRP_MJ_CREATE handler, as done on Windows.

WIN32K:
=======

- Stub the VideoPortCallout() support, for VIDEOPRT -> WIN32 callbacks.
  This function gets registered with VIDEOPRT through an
  IOCTL_VIDEO_INIT_WIN32K_CALLBACKS call in EngpRegisterGraphicsDevice().

- Only partially implement the 'VideoFindAdapterCallout' case, that just
  re-enables the primary display by refreshing it (using the new function
  UserRefreshDisplay()).

VIDEOPRT:
=========

- PVIDEO_WIN32K_CALLOUT is an NTAPI (stdcall) callback.

- In the IntVideoPortResetDisplayParameters(Ex) callback, reset all the
  "resettable" adapters registered in the HwResetAdaptersList list.
  We thus get rid of the global ResetDisplayParametersDeviceExtension.

- Make the IntVideoPortResetDisplayParameters(Ex) callback slightly more
  robust (using SEH) against potential HwResetListEntry list corruption
  or invalid DriverExtension->InitializationData.HwResetHw() that would
  otherwise trigger a BSOD, and this would be disastrous since that
  callback is precisely called when INBV is acquired, typically when the
  BSOD code initializes the display for displaying its information...

Extras:
- Validate the IrpStack->MajorFunction in IntVideoPortDispatchDeviceControl()
  and implement IRP_MJ_SHUTDOWN handling. Stub out the other IOCTLs that
  are handled by VIDEOPRT only (and not by the miniports).

- VIDEOPRT doesn't require IRP_MJ_INTERNAL_DEVICE_CONTROL (unused).

- Implement IOCTL_VIDEO_PREPARE_FOR_EARECOVERY that just resets the
  display to standard VGA 80x25 text mode.
2019-12-02 02:33:20 +01:00
Hermès Bélusca-Maïto acf689a973
[WIN32K] Use RtlString* routines. 2019-11-25 00:41:49 +01:00
Hermès Bélusca-Maïto 0ad90f83d3
[WIN32K] Code formatting. 2019-11-25 00:41:49 +01:00
Pierre Schweitzer 01b580d876
[WIN32K] Deny deviceless calls to EngDeviceIoControl
This fixes BSOD happening in ntoskrnl coming from win32k under certain
conditions with 3rd party display drivers (such as VBox or VMware)
2018-12-31 20:35:17 +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/device.c (Browse further)