1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +00:00

WindowServer: Introduce the ScreenBackend concept

The ScreenBackend is a thin wrapper around the actual screen hardware
connection. It contains all the variables specific to that hardware and
abstracts away operations that deal with controlling the hardware. The
standard ScreenBackend implementor is HardwareScreenBackend, which
contains all the existing frame buffer & ioctl handling code of Screen.
I took this opportunity to introduce ErrorOr wherever sensible.
This commit is contained in:
kleines Filmröllchen 2022-03-31 18:00:44 +02:00 committed by Linus Groh
parent 1fce201d15
commit 0acffa5ef4
4 changed files with 213 additions and 0 deletions

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "ScreenBackend.h"
#include "ScreenLayout.h"
#include <AK/Error.h>
#include <AK/Span.h>
#include <AK/String.h>
#include <sys/ioctl_numbers.h>
namespace WindowServer {
class HardwareScreenBackend : public ScreenBackend {
public:
virtual ~HardwareScreenBackend();
HardwareScreenBackend(String device);
virtual ErrorOr<void> open() override;
virtual void set_head_buffer(int index) override;
virtual ErrorOr<void> flush_framebuffer_rects(int buffer_index, Span<FBRect const> rects) override;
virtual ErrorOr<void> unmap_framebuffer() override;
virtual ErrorOr<void> map_framebuffer() override;
virtual ErrorOr<void> set_head_resolution(FBHeadResolution) override;
virtual ErrorOr<FBHeadProperties> get_head_properties() override;
String m_device {};
int m_framebuffer_fd { -1 };
};
}