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
Notes:
sideshowbarker
2024-07-17 20:17:54 +09:00
Author: https://github.com/tomuta Commit: https://github.com/SerenityOS/serenity/commit/18fc54fc348 Pull-request: https://github.com/SerenityOS/serenity/pull/12116
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;
|
||||
}
|
||||
|
||||
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 high = m_edid.read_host(&m_detailed_timings.vertical_addressable_and_blanking_lines_high) >> 4;
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
// 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_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;
|
||||
if (total_pixels == 0)
|
||||
return {};
|
||||
|
|
|
@ -349,6 +349,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
u16 vertical_addressable_lines_raw() const;
|
||||
|
||||
Parser const& m_edid;
|
||||
Definitions::DetailedTiming const& m_detailed_timings;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue