Commit graph

75 commits

Author SHA1 Message Date
Hervé Poussineau 6dd94572e5 [VBEMP] Correctly report legacy resources (VGA I/O ports and memory)
CORE-17789
2021-10-14 23:39:30 +02:00
Hervé Poussineau 3379de3924 [VBEMP] Fail HwInitialize (ie IRP_MJ_CREATE) when /NOVESA switch is present
In that case, we want a simple VGA driver to drive the graphic adapter.

CORE-17789
2021-10-14 23:39:30 +02:00
Hervé Poussineau 92d0dd3633 [VIDEOPRT] Create and setup new registry key only for non-legacy drivers
CORE-17734
2021-09-29 22:56:35 +02:00
Hermès Bélusca-Maïto 9393fc320e
[FORMATTING] Remove trailing whitespace. Addendum to 34593d93.
Excluded: 3rd-party code (incl. wine) and most of the win32ss.
2021-09-13 03:52:22 +02:00
Timo Kreuzer ecf3416f49 [VIDEOPRT] Fix updating of new registry path values
CORE-17688
When a new driver is installed for the same device (like VBoxVideo), it uses the same hardware enum registry key and thus reuses the same DisplayId and the same display registry key. Therefore we need to update the setting in that key, even when the key already exists.

This seems to work good and not cause any issues, but testing indicated that on Windows some values are only updated, when the driver has changed. If neccessary, this can be achieved by updating and querying the ActiveService value in the device enum key (e.g. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI\VEN_80EE&DEV_BEEF&SUSYS_00000000&REV_00\3&267a616a&0&10\Control: ActiveService). If that doesn't match the current device name (from DriverExtension->RegistryPath) the values should be copied over.
2021-07-27 14:44:14 +02:00
Hervé Poussineau 8379c87b0b [VIDEOPRT] Write correct MaxObjectNumber to registry
VideoPortMaxObjectNumber variable will be updated later in the function, if everything went fine.
2021-07-10 19:03:37 +02:00
Timo Kreuzer 49c16e661a [VIDEOPRT] Do not attach secondary devices to the device stack
This fixes display on the primary screen.
2021-07-10 16:27:44 +02:00
Hervé Poussineau e9b5b22a8c [VIDEOPRT] Implement VideoPortCreateSecondaryDisplay 2021-07-10 16:27:44 +02:00
Timo Kreuzer 545352c655 [VIDEOPRT] Fix adapter id 2021-07-10 16:27:44 +02:00
Timo Kreuzer af314557c0 [VIDEOPRT] Use new registry path 2021-07-10 16:27:44 +02:00
Timo Kreuzer 066337dc84 [VIDEOPRT] Refactor device map key creation 2021-07-10 16:27:44 +02:00
Hervé Poussineau b5966977ac [VBEMP] Remove too verbose log, when debug is enabled in videoprt 2021-07-10 16:27:44 +02:00
Serge Gautherie 64a72787f2
[VIDEOPRT] Fix 'Irp->IoStatus.Information' copypasta (#3777)
Addendum to 25eae4b (r54237).
CORE-17651
2021-07-06 12:32:23 +03:00
Hervé Poussineau 93f986463a [VBEMP][VGAMP] Correctly fill VdmPhysicalVideoMemoryAddress/VdmPhysicalVideoMemoryLength
These variables must be filled by miniport if miniport is VGA-compatible.
2021-07-05 23:46:16 +02:00
Hervé Poussineau 8d24de7805 [BOOTDATA][VBEMP] Merge duplicated registry settings to vbemp_reg.inf 2021-07-05 23:44:35 +02:00
Hervé Poussineau 9b5d029c7a [FRAMEBUF] Early return if we got 0 available mode from video driver
This prevents allocating 0 bytes of memory a few lines later.
2021-07-05 23:44:35 +02:00
Eric Kohl 4db8b82aeb [VIDEOPRT] Fix monitor ID decoding issues 2021-06-06 21:27:00 +02:00
Hervé Poussineau 08e9000496 [VBE] Check if DDC is supported before trying to read EDID
Also set Edx to 0 when reading Edid, as per specification.

CORE-16695
2021-06-05 23:38:05 +02:00
Hervé Poussineau fa54704158 [VIDEOPRT] Report monitor name instead of the generic 'Monitor' string 2021-06-05 23:38:05 +02:00
Hervé Poussineau 2ae6bd7453 [VIDEOPRT] Give to each device its own entry in HKLM\SYSTEM\CurrentControlSet\Services
This is required if you have two graphic cards using the same driver.
2021-06-05 23:38:05 +02:00
Stanislav Motylkov ffa7cfc1ff
[INF] Remove remnants of XboxVmp driver which has its own INF file 2021-05-18 20:22:22 +03:00
Dmitry Borisov f7d825e620 [PC98VID] Fix MSVC 2015 build for PC-98 target
Addendum to 3adf450867

Also isolate the constant structures into page section
and restore the previous sections for start IO and entrypoint routines.
2021-05-18 19:30:29 +03:00
Stanislav Motylkov 0bd8a2110b
[WIN32SS] Always build all video miniport drivers
But include registry changes and INF files depending on SARCH variable.
This commit is expected to uncover pc98vid build error on MSVC 2015.

Addendum to 8c475e4. CORE-17529
2021-05-18 19:24:57 +03:00
Stanislav Motylkov 81987761d9
[PC98VID] Use unique target name but rename as vga.sys
This allows building pc98vid driver without conflict with vga_new.
2021-05-18 19:24:35 +03:00
Jérôme Gardou 3adf450867 [REACTOS] Addendum to 5c7ce4475e - Fix MSVC 2015 build
Put data into PAGEDATA or INITDATA sections
Keep section declaration for prototypes

CORE-17540
2021-05-12 11:04:29 +02:00
Eric Kohl 8c475e4709 [CMAKE] Build xboxvmp in Xbox-builds only
This prevents the creation of a fake Xbox GPU device on non-Xbox builds.

CORE-17529
2021-04-10 20:15:36 +02:00
Jérôme Gardou e46c2dd1b3 [VIDEOPRT] Mark low memory range as NOACCESS when we don't need to access it.
This allows to accomplish great things, such as crashing when dereferencing NULL pointer.
2021-02-10 17:48:30 +01:00
Victor Perevertkin 46ca069e42
[XDK] Remove UNREFERENCE_LOCAL_VARIABLE macro
Change UNREFERENCED_PARAMETER to (VOID)P to support const parameters
2021-01-19 00:15:02 +03:00
Jérôme Gardou c8d07514c8 [CMAKE] Fix GCC -fstack-protector usage 2021-01-05 13:38:57 +01:00
Victor Perevertkin 971cf12c9a
[VBE] Enable the driver start in the registry 2020-12-19 21:00:06 +03:00
Dmitry Borisov 4dc3125450
[PC98VID] Fix build for PC-98 target (#3352)
- Some prototypes are not needed anymore.

Addendum to 5c7ce4475e.
2020-11-05 00:26:37 +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
Serge Gautherie 889b077b23
[REACTOS] *.spec: Fix some function/parameter types (#3154) 2020-09-20 19:21:11 +02:00
Dmitry Borisov 0dfc7f06b7
[VIDEOPRT] Add global variable for debugging video drivers (#3080)
Reference: https://docs.microsoft.com/en-us/previous-versions/ff570170(v=vs.85)
2020-09-15 15:24:42 +03:00
Stanislav Motylkov 2a77e359e4
[XBOX] Move NV2A XGPU definitions into header file
TODO: helper functions should be also moved. CORE-16216
2020-08-26 16:58:01 +03:00
Dmitry Borisov 27cd9eaf1a
[PC98VID] Add framebuffer video miniport driver for NEC PC-98 series (#3040)
This adds generic graphics support on PC-9821.
2020-08-19 00:50:08 +03:00
Serge Gautherie fb023adf5a
[VIDEOPRT] IntVideoPortCreateAdapterDeviceObject(): 1+1 trivial fixes
Detected by Cppcheck: funcArgOrderDifferent, redundantAssignment.
2020-06-18 10:31:27 +02:00
Amine Khaldi 139a3d6661
[CMAKE] Implement PCH builds with target_precompile_headers. CORE-16905 2020-06-06 21:58:41 +03:00
Stanislav Motylkov f87a695b35
[XBOXVMP] Work with Xbox GPU registers properly
Bug was noticed with GCC 8.4
2020-05-02 23:24:36 +03:00
Victor Perevertkin 019f21ee1d
[MEDIA][CMAKE] Create add_driver_inf cmake function
*.inf files for drivers can now be placed along with the driver code
2020-04-26 20:28:04 +03:00
Timo Kreuzer b82bf8ce16
[NTOS:IO] Fix parsing of resource lists
Also add a hack to avoid failing on now occurring resource conflict detection and try to fix at least one resource in ACPI hal.

CORE-10146
CORE-12892
2020-04-24 13:58:09 +03:00
Hervé Poussineau 340d9360c3 [VIDEOPRT] Workaround bug CORE-16695 (infinite loop when reading EDID on LiveCD in QEMU)
For some reason, we don't get valid EDIDs when using LiveCD on QEMU.
We ignore them, and try to read the one of the next child.
This leads to a infinite loop and then, an out of memory error.

As it can also happen in other circonstances, stop enumeration as soon
as an invalid EDID is detected.

This breaks configurations with graphic cards with 2+ outputs, where
the first one is not plugged to a monitor, and the second one is plugged
to a monitor.

CORE-16695
2020-03-01 10:12:13 +01:00
Stanislav Motylkov afdb42023c [FREELDR][XBOXVMP] Check only low 28 bits for framebuffer address (#2249)
Fixes framebuffer detection on real hardware Xbox.
2020-01-14 20:20:22 +01:00
Hermès Bélusca-Maïto 0fe71544d2
[VIDEOPRT] Complete dispatch IOCTL with IO_VIDEO_INCREMENT priority boost. 2019-12-24 18:34:19 +01:00
Hermès Bélusca-Maïto 18a51dc7f5
[VIDEOPRT][WIN32K] Use a Windows-compatible way of communicating the 'BaseVideo' state from VIDEOPRT to WIN32K.
This is done by creating the volatile key
\Registry\Machine\System\CurrentControlSet\Control\GraphicsDrivers\BaseVideo .

Also cache during first initialization of VIDEOPRT the state of the boot
options BASEVIDEO and NOVESA, so that they can be readily retrieved later
(for example, in VideoPortIsNoVesa()).
2019-12-24 13:51:20 +01:00
Serge Gautherie cfdd483c0e [VGA_NEW] Fix 2 'MAX_USHORT' typos in commented code (#2145) 2019-12-10 13:17:17 +01:00
Hermès Bélusca-Maïto 4431418999
[VIDEOPRT] Protect access to HwResetAdaptersList with spinlock. 2019-12-03 02:46:38 +01: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 66909fa9d5
[VIDEOPRT] Implement VideoPortReadStateEvent(). 2019-11-25 00:41:53 +01:00
Hermès Bélusca-Maïto bf74f101c2
[VIDEOPRT] Use ExFreePoolWithTag() + Add some ASSERTs. 2019-11-25 00:41:53 +01:00