Ver Fonte

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.
Liav A há 3 anos atrás
pai
commit
78e724a899

+ 3 - 3
Kernel/Graphics/Bochs/GraphicsAdapter.h

@@ -11,7 +11,7 @@
 #include <Kernel/Bus/PCI/Device.h>
 #include <Kernel/Graphics/Console/GenericFramebufferConsole.h>
 #include <Kernel/Graphics/FramebufferDevice.h>
-#include <Kernel/Graphics/GraphicsDevice.h>
+#include <Kernel/Graphics/GenericGraphicsAdapter.h>
 #include <Kernel/Memory/TypedMapping.h>
 #include <Kernel/PhysicalAddress.h>
 
@@ -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;
 

+ 1 - 1
Kernel/Graphics/Console/Console.h

@@ -9,7 +9,7 @@
 #include <AK/RefCounted.h>
 #include <AK/String.h>
 #include <AK/Types.h>
-#include <Kernel/Graphics/GraphicsDevice.h>
+#include <Kernel/Graphics/GenericGraphicsAdapter.h>
 
 namespace Kernel::Graphics {
 

+ 3 - 3
Kernel/Graphics/FramebufferDevice.cpp

@@ -21,7 +21,7 @@
 
 namespace Kernel {
 
-NonnullRefPtr<FramebufferDevice> FramebufferDevice::create(const GraphicsDevice& adapter, size_t output_port_index, PhysicalAddress paddr, size_t width, size_t height, size_t pitch)
+NonnullRefPtr<FramebufferDevice> 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<FramebufferDevice>(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)

+ 5 - 5
Kernel/Graphics/FramebufferDevice.h

@@ -10,7 +10,7 @@
 #include <AK/String.h>
 #include <AK/Types.h>
 #include <Kernel/Devices/BlockDevice.h>
-#include <Kernel/Graphics/GraphicsDevice.h>
+#include <Kernel/Graphics/GenericGraphicsAdapter.h>
 #include <Kernel/Locking/Spinlock.h>
 #include <Kernel/Memory/AnonymousVMObject.h>
 #include <Kernel/PhysicalAddress.h>
@@ -22,7 +22,7 @@ class FramebufferDevice : public BlockDevice {
     friend class DeviceManagement;
 
 public:
-    static NonnullRefPtr<FramebufferDevice> create(const GraphicsDevice&, size_t, PhysicalAddress, size_t, size_t, size_t);
+    static NonnullRefPtr<FramebufferDevice> create(const GenericGraphicsAdapter&, size_t, PhysicalAddress, size_t, size_t, size_t);
 
     virtual KResult ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override;
     virtual KResultOr<Memory::Region*> 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<GraphicsDevice> m_graphics_adapter;
+    FramebufferDevice(const GenericGraphicsAdapter&, size_t);
+    NonnullRefPtr<GenericGraphicsAdapter> 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; }

+ 3 - 3
Kernel/Graphics/GraphicsDevice.h → Kernel/Graphics/GenericGraphicsAdapter.h

@@ -13,9 +13,9 @@
 #include <Kernel/PhysicalAddress.h>
 
 namespace Kernel {
-class GraphicsDevice : public RefCounted<GraphicsDevice> {
+class GenericGraphicsAdapter : public RefCounted<GenericGraphicsAdapter> {
 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 };
 };

+ 3 - 3
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<GraphicsDevice> adapter;
+    RefPtr<GenericGraphicsAdapter> 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

+ 2 - 2
Kernel/Graphics/GraphicsManagement.h

@@ -12,7 +12,7 @@
 #include <AK/Types.h>
 #include <Kernel/Bus/PCI/Definitions.h>
 #include <Kernel/Graphics/Console/Console.h>
-#include <Kernel/Graphics/GraphicsDevice.h>
+#include <Kernel/Graphics/GenericGraphicsAdapter.h>
 #include <Kernel/Graphics/VGACompatibleAdapter.h>
 #include <Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h>
 #include <Kernel/Memory/Region.h>
@@ -48,7 +48,7 @@ public:
 
 private:
     bool determine_and_initialize_graphics_device(PCI::DeviceIdentifier const&);
-    NonnullRefPtrVector<GraphicsDevice> m_graphics_devices;
+    NonnullRefPtrVector<GenericGraphicsAdapter> m_graphics_devices;
     RefPtr<Graphics::Console> m_console;
 
     // Note: there could be multiple VGA adapters, but only one can operate in VGA mode

+ 1 - 1
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;

+ 3 - 3
Kernel/Graphics/VGACompatibleAdapter.h

@@ -11,12 +11,12 @@
 #include <Kernel/Bus/PCI/Device.h>
 #include <Kernel/Graphics/Console/Console.h>
 #include <Kernel/Graphics/FramebufferDevice.h>
-#include <Kernel/Graphics/GraphicsDevice.h>
+#include <Kernel/Graphics/GenericGraphicsAdapter.h>
 #include <Kernel/PhysicalAddress.h>
 
 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;

+ 1 - 1
Kernel/Graphics/VirtIOGPU/FramebufferDevice.h

@@ -9,7 +9,7 @@
 #include <Kernel/Bus/VirtIO/Device.h>
 #include <Kernel/Bus/VirtIO/Queue.h>
 #include <Kernel/Graphics/FramebufferDevice.h>
-#include <Kernel/Graphics/GraphicsDevice.h>
+#include <Kernel/Graphics/GenericGraphicsAdapter.h>
 #include <Kernel/Graphics/VirtIOGPU/Protocol.h>
 
 namespace Kernel::Graphics::VirtIOGPU {

+ 2 - 2
Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h

@@ -11,7 +11,7 @@
 #include <Kernel/Bus/VirtIO/Device.h>
 #include <Kernel/Bus/VirtIO/Queue.h>
 #include <Kernel/Devices/BlockDevice.h>
-#include <Kernel/Graphics/GraphicsDevice.h>
+#include <Kernel/Graphics/GenericGraphicsAdapter.h>
 #include <Kernel/Graphics/VirtIOGPU/Console.h>
 #include <Kernel/Graphics/VirtIOGPU/FramebufferDevice.h>
 #include <Kernel/Graphics/VirtIOGPU/Protocol.h>
@@ -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;