1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:37:35 +00:00

Kernel/Graphics: Use VirtIO GPU3DDevice constructor indirectly

We shouldn't expose the VirtIO GPU3DDevice constructor as public method,
so instead, let's use the usual pattern of a static construction method
that uses the constructor within the method.
This commit is contained in:
Liav A 2022-04-30 09:39:03 +03:00 committed by Andreas Kling
parent 728358c599
commit 41283a2de6
3 changed files with 20 additions and 10 deletions

View file

@ -8,6 +8,7 @@
#include <AK/DistinctNumeric.h>
#include <Kernel/Devices/CharacterDevice.h>
#include <Kernel/Devices/DeviceManagement.h>
#include <Kernel/Graphics/VirtIOGPU/FramebufferDevice.h>
#include <Kernel/Graphics/VirtIOGPU/Protocol.h>
@ -87,9 +88,13 @@ union ClearType {
};
class GPU3DDevice : public CharacterDevice {
friend class Kernel::DeviceManagement;
public:
GPU3DDevice() = delete;
explicit GPU3DDevice(GraphicsAdapter& graphics_adapter);
static NonnullRefPtr<GPU3DDevice> must_create(GraphicsAdapter&);
private:
GPU3DDevice(GraphicsAdapter& graphics_adapter, NonnullOwnPtr<Memory::Region> transfer_buffer_region);
class PerContextState : public RefCounted<PerContextState> {
public:
@ -129,7 +134,7 @@ private:
ContextID m_kernel_context_id;
HashMap<OpenFileDescription*, RefPtr<PerContextState>> m_context_state_lookup;
// Memory management for backing buffers
OwnPtr<Memory::Region> m_transfer_buffer_region;
NonnullOwnPtr<Memory::Region> m_transfer_buffer_region;
constexpr static size_t NUM_TRANSFER_REGION_PAGES = 256;
};