/* * Copyright (c) 2022, kleines Filmröllchen * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include "ScreenBackend.h" #include "ScreenLayout.h" #include #include #include #include namespace WindowServer { class HardwareScreenBackend : public ScreenBackend { public: virtual ~HardwareScreenBackend(); explicit HardwareScreenBackend(DeprecatedString device); virtual ErrorOr open() override; virtual void set_head_buffer(int index) override; virtual ErrorOr flush_framebuffer_rects(int buffer_index, ReadonlySpan rects) override; virtual ErrorOr flush_framebuffer() override; virtual ErrorOr unmap_framebuffer() override; virtual ErrorOr map_framebuffer() override; virtual ErrorOr set_safe_head_mode_setting() override; virtual ErrorOr set_head_mode_setting(GraphicsHeadModeSetting) override; virtual ErrorOr get_head_mode_setting() override; DeprecatedString m_device {}; int m_display_connector_fd { -1 }; Gfx::ARGB32* scanline(int buffer_index, int y) const { size_t buffer_offset = buffer_index == 1 ? m_back_buffer_offset : 0; return reinterpret_cast(((u8*)m_framebuffer) + buffer_offset + (y * m_pitch)); } }; }