mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:27:45 +00:00
LibEDID: Fix calculating height and refresh rate for interlaced modes
The vertical values need to be multiplied with 2 for interlaced modes.
This commit is contained in:
parent
e04e52186d
commit
18fc54fc34
2 changed files with 11 additions and 3 deletions
|
@ -672,13 +672,19 @@ u16 Parser::DetailedTiming::horizontal_blanking_pixels() const
|
||||||
return ((u16)high << 8) | (u16)low;
|
return ((u16)high << 8) | (u16)low;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 Parser::DetailedTiming::vertical_addressable_lines() const
|
u16 Parser::DetailedTiming::vertical_addressable_lines_raw() const
|
||||||
{
|
{
|
||||||
u8 low = m_edid.read_host(&m_detailed_timings.vertical_addressable_lines_low);
|
u8 low = m_edid.read_host(&m_detailed_timings.vertical_addressable_lines_low);
|
||||||
u8 high = m_edid.read_host(&m_detailed_timings.vertical_addressable_and_blanking_lines_high) >> 4;
|
u8 high = m_edid.read_host(&m_detailed_timings.vertical_addressable_and_blanking_lines_high) >> 4;
|
||||||
return ((u16)high << 8) | (u16)low;
|
return ((u16)high << 8) | (u16)low;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u16 Parser::DetailedTiming::vertical_addressable_lines() const
|
||||||
|
{
|
||||||
|
auto lines = vertical_addressable_lines_raw();
|
||||||
|
return is_interlaced() ? lines * 2 : lines;
|
||||||
|
}
|
||||||
|
|
||||||
u16 Parser::DetailedTiming::vertical_blanking_lines() const
|
u16 Parser::DetailedTiming::vertical_blanking_lines() const
|
||||||
{
|
{
|
||||||
u8 low = m_edid.read_host(&m_detailed_timings.vertical_blanking_lines_low);
|
u8 low = m_edid.read_host(&m_detailed_timings.vertical_blanking_lines_low);
|
||||||
|
@ -745,9 +751,9 @@ bool Parser::DetailedTiming::is_interlaced() const
|
||||||
|
|
||||||
FixedPoint<16, u32> Parser::DetailedTiming::refresh_rate() const
|
FixedPoint<16, u32> Parser::DetailedTiming::refresh_rate() const
|
||||||
{
|
{
|
||||||
// Blanking = front porch + sync pulse width = back porch
|
// Blanking = front porch + sync pulse width + back porch
|
||||||
u32 total_horizontal_pixels = (u32)horizontal_addressable_pixels() + (u32)horizontal_blanking_pixels();
|
u32 total_horizontal_pixels = (u32)horizontal_addressable_pixels() + (u32)horizontal_blanking_pixels();
|
||||||
u32 total_vertical_lines = (u32)vertical_addressable_lines() + (u32)vertical_blanking_lines();
|
u32 total_vertical_lines = (u32)vertical_addressable_lines_raw() + (u32)vertical_blanking_lines();
|
||||||
u32 total_pixels = total_horizontal_pixels * total_vertical_lines;
|
u32 total_pixels = total_horizontal_pixels * total_vertical_lines;
|
||||||
if (total_pixels == 0)
|
if (total_pixels == 0)
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -349,6 +349,8 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u16 vertical_addressable_lines_raw() const;
|
||||||
|
|
||||||
Parser const& m_edid;
|
Parser const& m_edid;
|
||||||
Definitions::DetailedTiming const& m_detailed_timings;
|
Definitions::DetailedTiming const& m_detailed_timings;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue