[VBE] Check if DDC is supported before trying to read EDID

Also set Edx to 0 when reading Edid, as per specification.

CORE-16695
This commit is contained in:
Hervé Poussineau 2021-05-29 21:37:03 +02:00
parent fa54704158
commit 08e9000496
2 changed files with 13 additions and 5 deletions

View file

@ -184,6 +184,19 @@ VBEReadEdid(
VideoPortDebugPrint(Trace, "VBEMP: VBEReadEdid() called\n");
/*
* Check if DDC1/DDC2 is supported
*/
VideoPortZeroMemory(&BiosRegisters, sizeof(BiosRegisters));
BiosRegisters.Eax = VBE_DDC;
VBEDeviceExtension->Int10Interface.Int10CallBios(
VBEDeviceExtension->Int10Interface.Context,
&BiosRegisters);
if (VBE_GETRETURNCODE(BiosRegisters.Eax) != VBE_SUCCESS)
return FALSE;
if ((BiosRegisters.Ebx & 3) == 0)
return FALSE;
/*
* Directly read EDID information
*/
@ -191,7 +204,6 @@ VBEReadEdid(
BiosRegisters.Eax = VBE_DDC;
BiosRegisters.Ebx = VBE_DDC_READ_EDID;
BiosRegisters.Ecx = ChildIndex;
BiosRegisters.Edx = 1;
BiosRegisters.Edi = VBEDeviceExtension->TrampolineMemoryOffset;
BiosRegisters.SegEs = VBEDeviceExtension->TrampolineMemorySegment;
VBEDeviceExtension->Int10Interface.Int10CallBios(

View file

@ -1233,10 +1233,6 @@ VideoPortEnumerateChildren(
{
/* Mark it invalid */
ChildExtension->EdidValid = FALSE;
// FIXME: the following break workarounds CORE-16695
// but prevents graphic cards to return an invalid
// EDID as first child, and a valid one as second child.
break;
}
}
}