blob: 4e96bd7f2f51461afa5cae4d52652c2cffea547d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "ScreenLayout.h"
#include <AK/Error.h>
#include <AK/Span.h>
#include <sys/ioctl_numbers.h>
namespace WindowServer {
// Handles low-level device interfacing for the screen.
// ScreenBackend is a thin transparent wrapper around framebuffer-related data which is responsible for setting up this data,
// tearing it down, changing its properties like size, and performing flushes.
// The screen is intended to directly access the members to perform its function, but it only ever reads from anything
// except the data in the framebuffer memory.
class ScreenBackend {
public:
virtual ~ScreenBackend() = default;
virtual ErrorOr<void> open() = 0;
virtual void set_head_buffer(int index) = 0;
virtual ErrorOr<void> flush_framebuffer_rects(int buffer_index, Span<FBRect const> rects) = 0;
virtual ErrorOr<void> unmap_framebuffer() = 0;
virtual ErrorOr<void> map_framebuffer() = 0;
virtual ErrorOr<void> set_head_resolution(FBHeadResolution) = 0;
virtual ErrorOr<FBHeadProperties> get_head_properties() = 0;
virtual ErrorOr<void> write_all_contents(Gfx::IntRect const&) { return {}; }
bool m_can_device_flush_buffers { true };
bool m_can_set_head_buffer { false };
Gfx::ARGB32* m_framebuffer { nullptr };
size_t m_size_in_bytes { 0 };
size_t m_back_buffer_offset { 0 };
int m_pitch { 0 };
};
}
|