ladybird/Kernel/Graphics/GenericGraphicsAdapter.h
Liav A 8554952690 Kernel + WindowServer: Re-define the interface to framebuffer devices
We create a base class called GenericFramebufferDevice, which defines
all the virtual functions that must be implemented by a
FramebufferDevice. Then, we make the VirtIO FramebufferDevice and other
FramebufferDevice implementations inherit from it.
The most important consequence of rearranging the classes is that we now
have one IOCTL method, so all drivers should be committed to not
override the IOCTL method or make their own IOCTLs of FramebufferDevice.
All graphical IOCTLs are known to all FramebufferDevices, and it's up to
the specific implementation whether to support them or discard them (so
we require extensive usage of KResult and KResultOr, together with
virtual characteristic functions).
As a result, the interface is much cleaner and understandable to read.
2021-10-27 07:57:44 +03:00

43 lines
1.2 KiB
C++

/*
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <AK/Types.h>
#include <AK/Weakable.h>
#include <Kernel/Bus/PCI/Definitions.h>
#include <Kernel/Devices/BlockDevice.h>
#include <Kernel/PhysicalAddress.h>
namespace Kernel {
class GenericGraphicsAdapter
: public RefCounted<GenericGraphicsAdapter>
, public Weakable<GenericGraphicsAdapter> {
public:
virtual ~GenericGraphicsAdapter() = default;
virtual void initialize_framebuffer_devices() = 0;
virtual void enable_consoles() = 0;
virtual void disable_consoles() = 0;
bool consoles_enabled() const { return m_consoles_enabled; }
virtual bool framebuffer_devices_initialized() const = 0;
virtual bool modesetting_capable() const = 0;
virtual bool double_framebuffering_capable() const = 0;
virtual bool vga_compatible() const = 0;
virtual bool try_to_set_resolution(size_t output_port_index, size_t width, size_t height) = 0;
virtual bool set_y_offset(size_t output_port_index, size_t y) = 0;
protected:
GenericGraphicsAdapter() = default;
bool m_consoles_enabled { false };
};
}