mirror of
https://github.com/reactos/reactos.git
synced 2026-05-07 06:29:46 +08:00
[VIDEOPRT] Consistently perform legacy detection in IntVideoPortFindAdapter() (#8719)
When `VideoPortInitialize()` detects that it should perform video legacy detection (`LegacyDetection` is TRUE), inform `IntVideoPortFindAdapter()` so that it can correctly take its `LegacyDetection` code path. This wasn't the case before.
This commit is contained in:
@@ -964,9 +964,8 @@ IntVideoPortPnPStartDevice(
|
||||
DeviceExtension->InterruptVector);
|
||||
|
||||
/* Create adapter device object */
|
||||
return IntVideoPortFindAdapter(DriverObject,
|
||||
DriverExtension,
|
||||
DeviceObject);
|
||||
return IntVideoPortFindAdapter(DriverObject, DriverExtension,
|
||||
DeviceObject, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -430,11 +430,11 @@ IntVideoPortEnumBuses(
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
IntVideoPortFindAdapter(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
|
||||
IN PDEVICE_OBJECT DeviceObject)
|
||||
_In_ PDRIVER_OBJECT DriverObject,
|
||||
_In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
|
||||
_In_ _When_(LegacyDetection, _Null_) PDEVICE_OBJECT DeviceObject,
|
||||
_In_ BOOLEAN LegacyDetection)
|
||||
{
|
||||
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
@@ -442,9 +442,24 @@ IntVideoPortFindAdapter(
|
||||
VIDEO_PORT_CONFIG_INFO ConfigInfo;
|
||||
SYSTEM_BASIC_INFORMATION SystemBasicInfo;
|
||||
UCHAR Again = FALSE;
|
||||
BOOL LegacyDetection = FALSE;
|
||||
BOOLEAN VgaResourcesReleased = FALSE;
|
||||
|
||||
if (LegacyDetection)
|
||||
{
|
||||
ASSERT(DeviceObject == NULL);
|
||||
Status = IntVideoPortCreateAdapterDeviceObject(DriverObject,
|
||||
DriverExtension,
|
||||
NULL, // no DeviceExtension->PhysicalDeviceObject
|
||||
DriverExtension->InitializationData.StartingDeviceNumber,
|
||||
0,
|
||||
&DeviceObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR_(VIDEOPRT, "IntVideoPortCreateAdapterDeviceObject returned 0x%x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
DeviceExtension->IsVgaDetect = DeviceExtension->IsVgaDriver;
|
||||
DeviceExtension->IsLegacyDetect = FALSE;
|
||||
@@ -485,12 +500,13 @@ IntVideoPortFindAdapter(
|
||||
*/
|
||||
if (DeviceExtension->PhysicalDeviceObject == NULL)
|
||||
{
|
||||
LegacyDetection = TRUE;
|
||||
ASSERT(LegacyDetection == TRUE);
|
||||
DeviceExtension->IsLegacyDevice = TRUE;
|
||||
DeviceExtension->IsLegacyDetect = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(LegacyDetection == FALSE);
|
||||
DeviceExtension->IsLegacyDevice = FALSE;
|
||||
}
|
||||
|
||||
@@ -1025,8 +1041,7 @@ VideoPortInitialize(
|
||||
INFO_(VIDEOPRT, "Legacy detection for adapter interface %d\n",
|
||||
HwInitializationData->AdapterInterfaceType);
|
||||
|
||||
/* FIXME: Move the code for legacy detection
|
||||
to another function and call it here */
|
||||
/* Enable legacy detection, will be invoked below */
|
||||
LegacyDetection = TRUE;
|
||||
}
|
||||
|
||||
@@ -1100,46 +1115,26 @@ VideoPortInitialize(
|
||||
DriverExtension->HwContext = HwContext;
|
||||
|
||||
/*
|
||||
* Plug & Play drivers registers the device in AddDevice routine.
|
||||
* Plug & Play drivers register the device in the AddDevice routine.
|
||||
* For legacy drivers we must do it now.
|
||||
*/
|
||||
if (LegacyDetection)
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
|
||||
if (HwInitializationData->HwInitDataSize != SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA)
|
||||
{
|
||||
/* Power management */
|
||||
/* Power management */
|
||||
if (HwInitializationData->HwInitDataSize > SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA)
|
||||
DriverObject->MajorFunction[IRP_MJ_POWER] = IntVideoPortDispatchPower;
|
||||
}
|
||||
|
||||
Status = IntVideoPortCreateAdapterDeviceObject(DriverObject,
|
||||
DriverExtension,
|
||||
NULL,
|
||||
DriverExtension->InitializationData.StartingDeviceNumber,
|
||||
0,
|
||||
&DeviceObject);
|
||||
Status = IntVideoPortFindAdapter(DriverObject, DriverExtension, NULL, TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR_(VIDEOPRT, "IntVideoPortCreateAdapterDeviceObject returned 0x%x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = IntVideoPortFindAdapter(DriverObject, DriverExtension, DeviceObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
ERR_(VIDEOPRT, "IntVideoPortFindAdapter returned 0x%x\n", Status);
|
||||
|
||||
ERR_(VIDEOPRT, "IntVideoPortFindAdapter(Legacy) returned 0x%x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
else
|
||||
{
|
||||
DriverObject->DriverExtension->AddDevice = IntVideoPortAddDevice;
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = IntVideoPortDispatchPnp;
|
||||
DriverObject->MajorFunction[IRP_MJ_POWER] = IntVideoPortDispatchPower;
|
||||
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = IntVideoPortDispatchSystemControl;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
DriverObject->DriverExtension->AddDevice = IntVideoPortAddDevice;
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = IntVideoPortDispatchPnp;
|
||||
DriverObject->MajorFunction[IRP_MJ_POWER] = IntVideoPortDispatchPower;
|
||||
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = IntVideoPortDispatchSystemControl;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -288,11 +288,12 @@ IntVideoPortCreateAdapterDeviceObject(
|
||||
_In_ USHORT DisplayNumber,
|
||||
_Out_opt_ PDEVICE_OBJECT *DeviceObject);
|
||||
|
||||
NTSTATUS NTAPI
|
||||
NTSTATUS
|
||||
IntVideoPortFindAdapter(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
|
||||
IN PDEVICE_OBJECT DeviceObject);
|
||||
_In_ PDRIVER_OBJECT DriverObject,
|
||||
_In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
|
||||
_In_ _When_(LegacyDetection, _Null_) PDEVICE_OBJECT DeviceObject,
|
||||
_In_ BOOLEAN LegacyDetection);
|
||||
|
||||
PVOID
|
||||
NTAPI
|
||||
|
||||
Reference in New Issue
Block a user