1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:28:11 +00:00

Kernel/Graphics: Merge VirtIO GraphicsAdapter and VirtIO GPU code

A VirtIO graphics adapter is really the VirtIO GPU, so the virtualized
hardware has no distinction between both components so there's no
need to put such distinction in software.

We might need to split things in the future, but when we do so, we must
take proper care to ensure that the interface between the components
is correct and use the usual codebase patterns.
This commit is contained in:
Liav A 2021-09-21 10:08:28 +03:00 committed by Idan Horowitz
parent a9538b5879
commit f476b49fd8
11 changed files with 435 additions and 474 deletions

View file

@ -10,10 +10,11 @@
#include <Kernel/Bus/VirtIO/Queue.h>
#include <Kernel/Graphics/FramebufferDevice.h>
#include <Kernel/Graphics/GraphicsDevice.h>
#include <Kernel/Graphics/VirtIOGPU/GPU.h>
#include <Kernel/Graphics/VirtIOGPU/Protocol.h>
namespace Kernel::Graphics::VirtIOGPU {
class GraphicsAdapter;
class FramebufferDevice final : public Kernel::FramebufferDevice {
friend class Console;
struct Buffer {
@ -24,7 +25,7 @@ class FramebufferDevice final : public Kernel::FramebufferDevice {
};
public:
FramebufferDevice(GraphicsDevice const&, VirtIOGPU::GPU& virtio_gpu, ScanoutID);
FramebufferDevice(GraphicsAdapter const&, ScanoutID);
virtual ~FramebufferDevice() override;
virtual void deactivate_writes();
@ -75,7 +76,9 @@ private:
}
Buffer& current_buffer() const { return *m_current_buffer; }
GPU& m_gpu;
GraphicsAdapter const& adapter() const;
GraphicsAdapter& adapter();
const ScanoutID m_scanout;
Buffer* m_current_buffer { nullptr };
Atomic<int, AK::memory_order_relaxed> m_last_set_buffer_index { 0 };