From 78e724a899be13b54a08e24184283d2d18ec76bf Mon Sep 17 00:00:00 2001 From: Liav A Date: Wed, 22 Sep 2021 09:17:07 +0300 Subject: [PATCH] Kernel/Graphics: Rename GraphicsDevice => GenericGraphicsAdapter We already use the term adapter for instances of this class, so let's better represent this class by changing its name to what it really is. --- Kernel/Graphics/Bochs/GraphicsAdapter.h | 6 +++--- Kernel/Graphics/Console/Console.h | 2 +- Kernel/Graphics/FramebufferDevice.cpp | 6 +++--- Kernel/Graphics/FramebufferDevice.h | 10 +++++----- .../{GraphicsDevice.h => GenericGraphicsAdapter.h} | 6 +++--- Kernel/Graphics/GraphicsManagement.cpp | 6 +++--- Kernel/Graphics/GraphicsManagement.h | 4 ++-- Kernel/Graphics/Intel/NativeGraphicsAdapter.h | 2 +- Kernel/Graphics/VGACompatibleAdapter.h | 6 +++--- Kernel/Graphics/VirtIOGPU/FramebufferDevice.h | 2 +- Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h | 4 ++-- 11 files changed, 27 insertions(+), 27 deletions(-) rename Kernel/Graphics/{GraphicsDevice.h => GenericGraphicsAdapter.h} (85%) diff --git a/Kernel/Graphics/Bochs/GraphicsAdapter.h b/Kernel/Graphics/Bochs/GraphicsAdapter.h index 2f936eab39..c7d4234e85 100644 --- a/Kernel/Graphics/Bochs/GraphicsAdapter.h +++ b/Kernel/Graphics/Bochs/GraphicsAdapter.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include @@ -20,7 +20,7 @@ namespace Kernel { class GraphicsManagement; struct BochsDisplayMMIORegisters; -class BochsGraphicsAdapter final : public GraphicsDevice +class BochsGraphicsAdapter final : public GenericGraphicsAdapter , public PCI::Device { AK_MAKE_ETERNAL friend class GraphicsManagement; @@ -39,7 +39,7 @@ public: virtual bool vga_compatible() const override; private: - // ^GraphicsDevice + // ^GenericGraphicsAdapter virtual bool try_to_set_resolution(size_t output_port_index, size_t width, size_t height) override; virtual bool set_y_offset(size_t output_port_index, size_t y) override; diff --git a/Kernel/Graphics/Console/Console.h b/Kernel/Graphics/Console/Console.h index 949c5fc66f..2a50873bb0 100644 --- a/Kernel/Graphics/Console/Console.h +++ b/Kernel/Graphics/Console/Console.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include namespace Kernel::Graphics { diff --git a/Kernel/Graphics/FramebufferDevice.cpp b/Kernel/Graphics/FramebufferDevice.cpp index 547ca04b8a..56db1bc65f 100644 --- a/Kernel/Graphics/FramebufferDevice.cpp +++ b/Kernel/Graphics/FramebufferDevice.cpp @@ -21,7 +21,7 @@ namespace Kernel { -NonnullRefPtr FramebufferDevice::create(const GraphicsDevice& adapter, size_t output_port_index, PhysicalAddress paddr, size_t width, size_t height, size_t pitch) +NonnullRefPtr FramebufferDevice::create(const GenericGraphicsAdapter& adapter, size_t output_port_index, PhysicalAddress paddr, size_t width, size_t height, size_t pitch) { auto framebuffer_device_or_error = DeviceManagement::try_create_device(adapter, output_port_index, paddr, width, height, pitch); // FIXME: Find a way to propagate errors @@ -99,14 +99,14 @@ UNMAP_AFTER_INIT KResult FramebufferDevice::initialize() return KSuccess; } -UNMAP_AFTER_INIT FramebufferDevice::FramebufferDevice(const GraphicsDevice& adapter, size_t output_port_index) +UNMAP_AFTER_INIT FramebufferDevice::FramebufferDevice(const GenericGraphicsAdapter& adapter, size_t output_port_index) : BlockDevice(29, GraphicsManagement::the().allocate_minor_device_number()) , m_graphics_adapter(adapter) , m_output_port_index(output_port_index) { } -UNMAP_AFTER_INIT FramebufferDevice::FramebufferDevice(const GraphicsDevice& adapter, size_t output_port_index, PhysicalAddress addr, size_t width, size_t height, size_t pitch) +UNMAP_AFTER_INIT FramebufferDevice::FramebufferDevice(const GenericGraphicsAdapter& adapter, size_t output_port_index, PhysicalAddress addr, size_t width, size_t height, size_t pitch) : BlockDevice(29, GraphicsManagement::the().allocate_minor_device_number()) , m_graphics_adapter(adapter) , m_framebuffer_address(addr) diff --git a/Kernel/Graphics/FramebufferDevice.h b/Kernel/Graphics/FramebufferDevice.h index a838f1fb90..ad29892e81 100644 --- a/Kernel/Graphics/FramebufferDevice.h +++ b/Kernel/Graphics/FramebufferDevice.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -22,7 +22,7 @@ class FramebufferDevice : public BlockDevice { friend class DeviceManagement; public: - static NonnullRefPtr create(const GraphicsDevice&, size_t, PhysicalAddress, size_t, size_t, size_t); + static NonnullRefPtr create(const GenericGraphicsAdapter&, size_t, PhysicalAddress, size_t, size_t, size_t); virtual KResult ioctl(OpenFileDescription&, unsigned request, Userspace arg) override; virtual KResultOr mmap(Process&, OpenFileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) override; @@ -35,11 +35,11 @@ public: KResult initialize(); protected: - FramebufferDevice(const GraphicsDevice&, size_t); - NonnullRefPtr m_graphics_adapter; + FramebufferDevice(const GenericGraphicsAdapter&, size_t); + NonnullRefPtr m_graphics_adapter; private: - FramebufferDevice(const GraphicsDevice&, size_t, PhysicalAddress, size_t, size_t, size_t); + FramebufferDevice(const GenericGraphicsAdapter&, size_t, PhysicalAddress, size_t, size_t, size_t); // ^File virtual StringView class_name() const override { return "FramebufferDevice"sv; } diff --git a/Kernel/Graphics/GraphicsDevice.h b/Kernel/Graphics/GenericGraphicsAdapter.h similarity index 85% rename from Kernel/Graphics/GraphicsDevice.h rename to Kernel/Graphics/GenericGraphicsAdapter.h index 697da69a57..fe46ab2084 100644 --- a/Kernel/Graphics/GraphicsDevice.h +++ b/Kernel/Graphics/GenericGraphicsAdapter.h @@ -13,9 +13,9 @@ #include namespace Kernel { -class GraphicsDevice : public RefCounted { +class GenericGraphicsAdapter : public RefCounted { public: - virtual ~GraphicsDevice() = default; + virtual ~GenericGraphicsAdapter() = default; virtual void initialize_framebuffer_devices() = 0; virtual void enable_consoles() = 0; virtual void disable_consoles() = 0; @@ -31,7 +31,7 @@ public: virtual bool set_y_offset(size_t output_port_index, size_t y) = 0; protected: - GraphicsDevice() = default; + GenericGraphicsAdapter() = default; bool m_consoles_enabled { false }; }; diff --git a/Kernel/Graphics/GraphicsManagement.cpp b/Kernel/Graphics/GraphicsManagement.cpp index e1e759bcb1..d1b27ef2dc 100644 --- a/Kernel/Graphics/GraphicsManagement.cpp +++ b/Kernel/Graphics/GraphicsManagement.cpp @@ -71,7 +71,7 @@ static inline bool is_display_controller_pci_device(PCI::DeviceIdentifier const& UNMAP_AFTER_INIT bool GraphicsManagement::determine_and_initialize_graphics_device(PCI::DeviceIdentifier const& device_identifier) { VERIFY(is_vga_compatible_pci_device(device_identifier) || is_display_controller_pci_device(device_identifier)); - auto add_and_configure_adapter = [&](GraphicsDevice& graphics_device) { + auto add_and_configure_adapter = [&](GenericGraphicsAdapter& graphics_device) { m_graphics_devices.append(graphics_device); if (!framebuffer_devices_allowed()) { graphics_device.enable_consoles(); @@ -80,7 +80,7 @@ UNMAP_AFTER_INIT bool GraphicsManagement::determine_and_initialize_graphics_devi graphics_device.initialize_framebuffer_devices(); }; - RefPtr adapter; + RefPtr adapter; switch (device_identifier.hardware_id().vendor_id) { case PCI::VendorID::QEMUOld: if (device_identifier.hardware_id().device_id == 0x1111) @@ -104,7 +104,7 @@ UNMAP_AFTER_INIT bool GraphicsManagement::determine_and_initialize_graphics_devi // non-compatible VGA graphics device that was initialized by the // Multiboot bootloader to provide a framebuffer, in practice we // probably want to support these devices natively instead of - // initializing them as some sort of a generic GraphicsDevice. For now, + // initializing them as some sort of a generic GenericGraphicsAdapter. For now, // the only known example of this sort of device is qxl in QEMU. For VGA // compatible devices we don't have a special driver for (e.g. ati-vga, // qxl-vga, cirrus-vga, vmware-svga in QEMU), it's much more likely that diff --git a/Kernel/Graphics/GraphicsManagement.h b/Kernel/Graphics/GraphicsManagement.h index d21cee52f8..5588158863 100644 --- a/Kernel/Graphics/GraphicsManagement.h +++ b/Kernel/Graphics/GraphicsManagement.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include @@ -48,7 +48,7 @@ public: private: bool determine_and_initialize_graphics_device(PCI::DeviceIdentifier const&); - NonnullRefPtrVector m_graphics_devices; + NonnullRefPtrVector m_graphics_devices; RefPtr m_console; // Note: there could be multiple VGA adapters, but only one can operate in VGA mode diff --git a/Kernel/Graphics/Intel/NativeGraphicsAdapter.h b/Kernel/Graphics/Intel/NativeGraphicsAdapter.h index 8abf7ed147..c71081231b 100644 --- a/Kernel/Graphics/Intel/NativeGraphicsAdapter.h +++ b/Kernel/Graphics/Intel/NativeGraphicsAdapter.h @@ -113,7 +113,7 @@ private: void write_to_register(IntelGraphics::RegisterIndex, u32 value) const; u32 read_from_register(IntelGraphics::RegisterIndex) const; - // ^GraphicsDevice + // ^GenericGraphicsAdapter virtual void initialize_framebuffer_devices() override; bool pipe_a_enabled() const; diff --git a/Kernel/Graphics/VGACompatibleAdapter.h b/Kernel/Graphics/VGACompatibleAdapter.h index 4b1fbd30c9..70db475503 100644 --- a/Kernel/Graphics/VGACompatibleAdapter.h +++ b/Kernel/Graphics/VGACompatibleAdapter.h @@ -11,12 +11,12 @@ #include #include #include -#include +#include #include namespace Kernel { -class VGACompatibleAdapter : public GraphicsDevice +class VGACompatibleAdapter : public GenericGraphicsAdapter , public PCI::Device { AK_MAKE_ETERNAL public: @@ -39,7 +39,7 @@ protected: private: VGACompatibleAdapter(PCI::Address, PhysicalAddress, size_t framebuffer_width, size_t framebuffer_height, size_t framebuffer_pitch); - // ^GraphicsDevice + // ^GenericGraphicsAdapter virtual void initialize_framebuffer_devices() override; virtual void enable_consoles() override; diff --git a/Kernel/Graphics/VirtIOGPU/FramebufferDevice.h b/Kernel/Graphics/VirtIOGPU/FramebufferDevice.h index fa23fc3917..42bb524a92 100644 --- a/Kernel/Graphics/VirtIOGPU/FramebufferDevice.h +++ b/Kernel/Graphics/VirtIOGPU/FramebufferDevice.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include namespace Kernel::Graphics::VirtIOGPU { diff --git a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h index 78dd2dc4ce..95ae267eed 100644 --- a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h +++ b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ namespace Kernel::Graphics::VirtIOGPU { class FramebufferDevice; class GraphicsAdapter final - : public GraphicsDevice + : public GenericGraphicsAdapter , public VirtIO::Device { AK_MAKE_ETERNAL friend class FramebufferDevice;