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

#pragma once

#include <Kernel/Graphics/Console/GenericFramebufferConsole.h>
#include <Kernel/Graphics/VirtIOGPU/DisplayConnector.h>
#include <Kernel/TimerQueue.h>

namespace Kernel::Graphics::VirtIOGPU {

class Console final : public GenericFramebufferConsole {
public:
    static NonnullLockRefPtr<Console> initialize(VirtIODisplayConnector& parent_display_connector);

    virtual void set_resolution(size_t width, size_t height, size_t pitch) override;
    virtual void flush(size_t x, size_t y, size_t width, size_t height) override;
    virtual void enable() override;

    virtual void set_cursor(size_t x, size_t y) override;

private:
    void enqueue_refresh_timer();
    virtual u8* framebuffer_data() override;

    virtual void hide_cursor() override;
    virtual void show_cursor() override;

    Console(VirtIODisplayConnector const& parent_display_connector, DisplayConnector::ModeSetting current_resolution);
    NonnullLockRefPtr<VirtIODisplayConnector> m_parent_display_connector;
    bool m_dirty { false };
};

}