summaryrefslogtreecommitdiff
path: root/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h
blob: 69d3f35230e29112f26b1f4ce90b3e9334ee59cd (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
/*
 * Copyright (c) 2021, Sahan Fernando <sahan.h.fernando@gmail.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <Kernel/Graphics/VirtIOGPU/Console.h>
#include <Kernel/Graphics/VirtIOGPU/FramebufferDevice.h>
#include <Kernel/Graphics/VirtIOGPU/GPU.h>

namespace Kernel::Graphics::VirtIOGPU {

class GraphicsAdapter final
    : public GraphicsDevice
    , public PCI::Device {
    AK_MAKE_ETERNAL

public:
    static NonnullRefPtr<GraphicsAdapter> initialize(PCI::DeviceIdentifier const&);

    virtual bool framebuffer_devices_initialized() const override { return m_created_framebuffer_devices; }

    // FIXME: There's a VirtIO VGA GPU variant, so we should consider that
    virtual bool vga_compatible() const override { return false; }

private:
    explicit GraphicsAdapter(PCI::DeviceIdentifier const&);

    virtual void initialize_framebuffer_devices() override;
    virtual void enable_consoles() override;
    virtual void disable_consoles() override;

    virtual bool modesetting_capable() const override { return false; }
    virtual bool double_framebuffering_capable() const override { return false; }

    virtual bool try_to_set_resolution(size_t, size_t, size_t) override { return false; }
    virtual bool set_y_offset(size_t, size_t) override { return false; }

    RefPtr<GPU> m_gpu_device;
    bool m_created_framebuffer_devices { false };
};
}