summaryrefslogtreecommitdiff
path: root/Kernel/Graphics/GenericGraphicsAdapter.h
blob: 4109af8c0dfed2191378fbc6e88e405a737bb8d2 (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
/*
 * Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#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 ErrorOr<ByteBuffer> get_edid(size_t output_port_index) 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 };
};

}