1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 01:27:42 +00:00

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.
This commit is contained in:
Liav A 2021-09-22 09:17:07 +03:00 committed by Idan Horowitz
parent c7eb761b7f
commit 78e724a899
11 changed files with 27 additions and 27 deletions

View file

@ -11,7 +11,7 @@
#include <Kernel/Bus/PCI/Device.h> #include <Kernel/Bus/PCI/Device.h>
#include <Kernel/Graphics/Console/GenericFramebufferConsole.h> #include <Kernel/Graphics/Console/GenericFramebufferConsole.h>
#include <Kernel/Graphics/FramebufferDevice.h> #include <Kernel/Graphics/FramebufferDevice.h>
#include <Kernel/Graphics/GraphicsDevice.h> #include <Kernel/Graphics/GenericGraphicsAdapter.h>
#include <Kernel/Memory/TypedMapping.h> #include <Kernel/Memory/TypedMapping.h>
#include <Kernel/PhysicalAddress.h> #include <Kernel/PhysicalAddress.h>
@ -20,7 +20,7 @@ namespace Kernel {
class GraphicsManagement; class GraphicsManagement;
struct BochsDisplayMMIORegisters; struct BochsDisplayMMIORegisters;
class BochsGraphicsAdapter final : public GraphicsDevice class BochsGraphicsAdapter final : public GenericGraphicsAdapter
, public PCI::Device { , public PCI::Device {
AK_MAKE_ETERNAL AK_MAKE_ETERNAL
friend class GraphicsManagement; friend class GraphicsManagement;
@ -39,7 +39,7 @@ public:
virtual bool vga_compatible() const override; virtual bool vga_compatible() const override;
private: private:
// ^GraphicsDevice // ^GenericGraphicsAdapter
virtual bool try_to_set_resolution(size_t output_port_index, size_t width, size_t height) override; 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; virtual bool set_y_offset(size_t output_port_index, size_t y) override;

View file

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

View file

@ -21,7 +21,7 @@
namespace Kernel { 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); 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 // FIXME: Find a way to propagate errors
@ -99,14 +99,14 @@ UNMAP_AFTER_INIT KResult FramebufferDevice::initialize()
return KSuccess; 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()) : BlockDevice(29, GraphicsManagement::the().allocate_minor_device_number())
, m_graphics_adapter(adapter) , m_graphics_adapter(adapter)
, m_output_port_index(output_port_index) , 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()) : BlockDevice(29, GraphicsManagement::the().allocate_minor_device_number())
, m_graphics_adapter(adapter) , m_graphics_adapter(adapter)
, m_framebuffer_address(addr) , m_framebuffer_address(addr)

View file

@ -10,7 +10,7 @@
#include <AK/String.h> #include <AK/String.h>
#include <AK/Types.h> #include <AK/Types.h>
#include <Kernel/Devices/BlockDevice.h> #include <Kernel/Devices/BlockDevice.h>
#include <Kernel/Graphics/GraphicsDevice.h> #include <Kernel/Graphics/GenericGraphicsAdapter.h>
#include <Kernel/Locking/Spinlock.h> #include <Kernel/Locking/Spinlock.h>
#include <Kernel/Memory/AnonymousVMObject.h> #include <Kernel/Memory/AnonymousVMObject.h>
#include <Kernel/PhysicalAddress.h> #include <Kernel/PhysicalAddress.h>
@ -22,7 +22,7 @@ class FramebufferDevice : public BlockDevice {
friend class DeviceManagement; friend class DeviceManagement;
public: 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 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; virtual KResultOr<Memory::Region*> mmap(Process&, OpenFileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) override;
@ -35,11 +35,11 @@ public:
KResult initialize(); KResult initialize();
protected: protected:
FramebufferDevice(const GraphicsDevice&, size_t); FramebufferDevice(const GenericGraphicsAdapter&, size_t);
NonnullRefPtr<GraphicsDevice> m_graphics_adapter; NonnullRefPtr<GenericGraphicsAdapter> m_graphics_adapter;
private: 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 // ^File
virtual StringView class_name() const override { return "FramebufferDevice"sv; } virtual StringView class_name() const override { return "FramebufferDevice"sv; }

View file

@ -13,9 +13,9 @@
#include <Kernel/PhysicalAddress.h> #include <Kernel/PhysicalAddress.h>
namespace Kernel { namespace Kernel {
class GraphicsDevice : public RefCounted<GraphicsDevice> { class GenericGraphicsAdapter : public RefCounted<GenericGraphicsAdapter> {
public: public:
virtual ~GraphicsDevice() = default; virtual ~GenericGraphicsAdapter() = default;
virtual void initialize_framebuffer_devices() = 0; virtual void initialize_framebuffer_devices() = 0;
virtual void enable_consoles() = 0; virtual void enable_consoles() = 0;
virtual void disable_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; virtual bool set_y_offset(size_t output_port_index, size_t y) = 0;
protected: protected:
GraphicsDevice() = default; GenericGraphicsAdapter() = default;
bool m_consoles_enabled { false }; bool m_consoles_enabled { false };
}; };

View file

@ -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) 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)); 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); m_graphics_devices.append(graphics_device);
if (!framebuffer_devices_allowed()) { if (!framebuffer_devices_allowed()) {
graphics_device.enable_consoles(); graphics_device.enable_consoles();
@ -80,7 +80,7 @@ UNMAP_AFTER_INIT bool GraphicsManagement::determine_and_initialize_graphics_devi
graphics_device.initialize_framebuffer_devices(); graphics_device.initialize_framebuffer_devices();
}; };
RefPtr<GraphicsDevice> adapter; RefPtr<GenericGraphicsAdapter> adapter;
switch (device_identifier.hardware_id().vendor_id) { switch (device_identifier.hardware_id().vendor_id) {
case PCI::VendorID::QEMUOld: case PCI::VendorID::QEMUOld:
if (device_identifier.hardware_id().device_id == 0x1111) 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 // non-compatible VGA graphics device that was initialized by the
// Multiboot bootloader to provide a framebuffer, in practice we // Multiboot bootloader to provide a framebuffer, in practice we
// probably want to support these devices natively instead of // 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 // 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, // 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 // qxl-vga, cirrus-vga, vmware-svga in QEMU), it's much more likely that

View file

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

View file

@ -113,7 +113,7 @@ private:
void write_to_register(IntelGraphics::RegisterIndex, u32 value) const; void write_to_register(IntelGraphics::RegisterIndex, u32 value) const;
u32 read_from_register(IntelGraphics::RegisterIndex) const; u32 read_from_register(IntelGraphics::RegisterIndex) const;
// ^GraphicsDevice // ^GenericGraphicsAdapter
virtual void initialize_framebuffer_devices() override; virtual void initialize_framebuffer_devices() override;
bool pipe_a_enabled() const; bool pipe_a_enabled() const;

View file

@ -11,12 +11,12 @@
#include <Kernel/Bus/PCI/Device.h> #include <Kernel/Bus/PCI/Device.h>
#include <Kernel/Graphics/Console/Console.h> #include <Kernel/Graphics/Console/Console.h>
#include <Kernel/Graphics/FramebufferDevice.h> #include <Kernel/Graphics/FramebufferDevice.h>
#include <Kernel/Graphics/GraphicsDevice.h> #include <Kernel/Graphics/GenericGraphicsAdapter.h>
#include <Kernel/PhysicalAddress.h> #include <Kernel/PhysicalAddress.h>
namespace Kernel { namespace Kernel {
class VGACompatibleAdapter : public GraphicsDevice class VGACompatibleAdapter : public GenericGraphicsAdapter
, public PCI::Device { , public PCI::Device {
AK_MAKE_ETERNAL AK_MAKE_ETERNAL
public: public:
@ -39,7 +39,7 @@ protected:
private: private:
VGACompatibleAdapter(PCI::Address, PhysicalAddress, size_t framebuffer_width, size_t framebuffer_height, size_t framebuffer_pitch); 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 initialize_framebuffer_devices() override;
virtual void enable_consoles() override; virtual void enable_consoles() override;

View file

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

View file

@ -11,7 +11,7 @@
#include <Kernel/Bus/VirtIO/Device.h> #include <Kernel/Bus/VirtIO/Device.h>
#include <Kernel/Bus/VirtIO/Queue.h> #include <Kernel/Bus/VirtIO/Queue.h>
#include <Kernel/Devices/BlockDevice.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/Console.h>
#include <Kernel/Graphics/VirtIOGPU/FramebufferDevice.h> #include <Kernel/Graphics/VirtIOGPU/FramebufferDevice.h>
#include <Kernel/Graphics/VirtIOGPU/Protocol.h> #include <Kernel/Graphics/VirtIOGPU/Protocol.h>
@ -33,7 +33,7 @@ namespace Kernel::Graphics::VirtIOGPU {
class FramebufferDevice; class FramebufferDevice;
class GraphicsAdapter final class GraphicsAdapter final
: public GraphicsDevice : public GenericGraphicsAdapter
, public VirtIO::Device { , public VirtIO::Device {
AK_MAKE_ETERNAL AK_MAKE_ETERNAL
friend class FramebufferDevice; friend class FramebufferDevice;