[VBEMP] Disable reporting multiple monitors
authorHervé Poussineau <hpoussin@reactos.org>
Thu, 23 Dec 2021 18:08:13 +0000 (19:08 +0100)
committerHervé Poussineau <hpoussin@reactos.org>
Thu, 6 Jan 2022 19:16:12 +0000 (20:16 +0100)
It has never worked, and only leads to some infinite loops with some hardware or BIOS configurations.

win32ss/drivers/miniport/vbe/edid.c

index cde4fc3..6637ee8 100644 (file)
@@ -235,80 +235,38 @@ VBEGetVideoChildDescriptor(
    OUT PULONG UId,
    OUT PULONG pUnused)
 {
-   PVBE_DEVICE_EXTENSION VBEDeviceExtension =
-     (PVBE_DEVICE_EXTENSION)HwDeviceExtension;
-   ULONG ChildIndex;
-
-   /*
-    * We are called very early in device initialization, even before
-    * VBEInitialize is called. So, our Int10 interface is not set.
-    * Ignore this call, we will trigger another one later.
-    */
-   if (VBEDeviceExtension->Int10Interface.Size == 0)
-      return VIDEO_ENUM_NO_MORE_DEVICES;
-
-   if (ChildEnumInfo->Size != sizeof(VIDEO_CHILD_ENUM_INFO))
-   {
-      VideoPortDebugPrint(Error, "VBEMP: Wrong VIDEO_CHILD_ENUM_INFO structure size\n");
-      return VIDEO_ENUM_NO_MORE_DEVICES;
-   }
-   else if (ChildEnumInfo->ChildDescriptorSize < MAX_SIZE_OF_EDID)
-   {
-      VideoPortDebugPrint(Warn, "VBEMP: Too small buffer for EDID\n");
-      return VIDEO_ENUM_NO_MORE_DEVICES;
-   }
-   else if (ChildEnumInfo->ChildIndex == DISPLAY_ADAPTER_HW_ID)
-   {
-      *VideoChildType = VideoChip;
-      *UId = 0;
-      return VIDEO_ENUM_MORE_DEVICES; /* FIXME: not sure... */
-   }
-
-   /*
-    * Get Child ID
-    */
-   if (ChildEnumInfo->ChildIndex != 0)
-      ChildIndex = ChildEnumInfo->ChildIndex;
-   else
-      ChildIndex = ChildEnumInfo->ACPIHwId;
-   VideoPortDebugPrint(Info, "VBEMP: ChildEnumInfo->ChildIndex %lu, ChildEnumInfo->ACPIHwId %lu => %lu\n",
-      ChildEnumInfo->ChildIndex, ChildEnumInfo->ACPIHwId, ChildIndex);
-
-   /*
-    * Try to read EDID information using 2 different methods.
-    */
-   if (VBEReadEdid(HwDeviceExtension, ChildIndex, pChildDescriptor))
-   {
-      VideoPortDebugPrint(Info, "VBEMP: EDID information read directly\n");
-   }
-   else if (VBEReadEdidUsingSCI(HwDeviceExtension, ChildIndex, pChildDescriptor))
-   {
-      VideoPortDebugPrint(Info, "VBEMP: EDID information read using I²C\n");
-   }
-   else if (ChildEnumInfo->ChildIndex == 1)
-   {
-       /* We must have 1 monitor, so just report it with no EDID information */
-       VideoPortDebugPrint(Info, "VBEMP: Reporting monitor with no EDID information\n");
-   }
-   else
-   {
-      VideoPortDebugPrint(Warn, "VBEMP: Unable to read EDID information\n");
-      return VIDEO_ENUM_NO_MORE_DEVICES;
-   }
-
-   /*
-    * Fill return data
-    */
-   *VideoChildType = Monitor;
-   if (ChildIndex == 0)
-   {
-      /*
-       * This is the actual display adapter
-       */
-      *UId = DISPLAY_ADAPTER_HW_ID;
-   }
-   else
-      *UId = ChildIndex;
-   *pUnused = 0;
-   return VIDEO_ENUM_MORE_DEVICES;
+    if (ChildEnumInfo->Size != sizeof(VIDEO_CHILD_ENUM_INFO) ||
+        ChildEnumInfo->ChildDescriptorSize < MAX_SIZE_OF_EDID)
+    {
+        return ERROR_INVALID_FUNCTION;
+    }
+
+    if (ChildEnumInfo->ChildIndex == 0)
+    {
+        /* We don't support enumeration of ACPI children */
+        return ERROR_NO_MORE_DEVICES;
+    }
+    else if (ChildEnumInfo->ChildIndex == 1)
+    {
+        /* Our screen */
+        *VideoChildType = Monitor;
+        *UId = 1;
+
+        /* Try to read EDID information using 2 different methods. */
+        if (VBEReadEdid(HwDeviceExtension, 0, pChildDescriptor))
+        {
+            VideoPortDebugPrint(Info, "VBEMP: EDID information read directly\n");
+        }
+        else if (VBEReadEdidUsingSCI(HwDeviceExtension, 0, pChildDescriptor))
+        {
+            VideoPortDebugPrint(Info, "VBEMP: EDID information read using I2C\n");
+        }
+
+        return VIDEO_ENUM_MORE_DEVICES;
+    }
+    else
+    {
+        /* Unknown hardware id */
+        return ERROR_NO_MORE_DEVICES;
+    }
 }