summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer/Screen.h
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2021-07-03 20:36:16 -0600
committerAndreas Kling <kling@serenityos.org>2021-07-04 23:59:17 +0200
commit6e792553f26a0fb0f4d763d9befe4f79716a81d0 (patch)
tree88c806936e2e1cb94d58618dec399208330837fc /Userland/Services/WindowServer/Screen.h
parentfdae117600925e17dfbab54961dd68ddcfe27dc2 (diff)
downloadserenity-6e792553f26a0fb0f4d763d9befe4f79716a81d0.zip
WindowServer: Query driver for framebuffer offset
Depending on the driver, the second buffer may not be located right after the first, e.g. it may be page aligned. This removes this assumption and queries the driver for the appropriate offset.
Diffstat (limited to 'Userland/Services/WindowServer/Screen.h')
-rw-r--r--Userland/Services/WindowServer/Screen.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Services/WindowServer/Screen.h b/Userland/Services/WindowServer/Screen.h
index 4233cc78f1..159e830584 100644
--- a/Userland/Services/WindowServer/Screen.h
+++ b/Userland/Services/WindowServer/Screen.h
@@ -147,6 +147,7 @@ public:
bool can_set_buffer() { return m_can_set_buffer; }
void set_buffer(int index);
+ size_t buffer_offset(int index) const;
int physical_width() const { return width() * scale_factor(); }
int physical_height() const { return height() * scale_factor(); }
@@ -156,7 +157,7 @@ public:
int height() const { return m_virtual_rect.height(); }
int scale_factor() const { return m_info.scale_factor; }
- Gfx::RGBA32* scanline(int y);
+ Gfx::RGBA32* scanline(int buffer_index, int y);
Gfx::IntSize physical_size() const { return { physical_width(), physical_height() }; }
@@ -190,7 +191,8 @@ private:
static Vector<int, default_scale_factors_in_use_count> s_scale_factors_in_use;
size_t m_index { 0 };
- size_t m_size_in_bytes;
+ size_t m_size_in_bytes { 0 };
+ size_t m_back_buffer_offset { 0 };
Gfx::RGBA32* m_framebuffer { nullptr };
bool m_can_set_buffer { false };
@@ -204,9 +206,9 @@ private:
ScreenLayout::Screen& m_info;
};
-inline Gfx::RGBA32* Screen::scanline(int y)
+inline Gfx::RGBA32* Screen::scanline(int buffer_index, int y)
{
- return reinterpret_cast<Gfx::RGBA32*>(((u8*)m_framebuffer) + (y * m_pitch));
+ return reinterpret_cast<Gfx::RGBA32*>(((u8*)m_framebuffer) + buffer_offset(buffer_index) + (y * m_pitch));
}
}