Kernel/Graphics: Simplify the GenericGraphicsAdapter class

The old methods are already can be considered deprecated, and now after
we removed framebuffer devices entirely, we can safely remove these
methods too, which simplfies the GenericGraphicsAdapter class a lot.
This commit is contained in:
Liav A 2022-04-30 15:54:23 +03:00 committed by Andreas Kling
parent d49a35df31
commit b96b2fb9be
7 changed files with 3 additions and 89 deletions

View file

@ -71,11 +71,4 @@ bool BochsGraphicsAdapter::vga_compatible() const
return m_is_vga_capable;
}
ErrorOr<ByteBuffer> BochsGraphicsAdapter::get_edid(size_t output_port_index) const
{
if (output_port_index != 0)
return Error::from_errno(ENODEV);
return m_display_connector->get_edid();
}
}

View file

@ -28,26 +28,11 @@ public:
static NonnullRefPtr<BochsGraphicsAdapter> initialize(PCI::DeviceIdentifier const&);
virtual ~BochsGraphicsAdapter() = default;
// FIXME: Remove all of these methods when we get rid of the FramebufferDevice class.
virtual bool framebuffer_devices_initialized() const override { return false; }
virtual bool modesetting_capable() const override { return true; }
virtual bool double_framebuffering_capable() const override { return true; }
virtual bool vga_compatible() const override;
private:
ErrorOr<ByteBuffer> get_edid(size_t output_port_index) const override;
ErrorOr<void> initialize_adapter(PCI::DeviceIdentifier const&);
// ^GenericGraphicsAdapter
// FIXME: Remove all of these methods when we get rid of the FramebufferDevice class.
virtual bool try_to_set_resolution(size_t, size_t, size_t) override { VERIFY_NOT_REACHED(); }
virtual bool set_y_offset(size_t, size_t) override { VERIFY_NOT_REACHED(); }
virtual void initialize_framebuffer_devices() override { }
virtual void enable_consoles() override { }
virtual void disable_consoles() override { }
explicit BochsGraphicsAdapter(PCI::DeviceIdentifier const&);
RefPtr<BochsDisplayConnector> m_display_connector;

View file

@ -18,26 +18,11 @@ class GenericGraphicsAdapter
, public Weakable<GenericGraphicsAdapter> {
public:
virtual ~GenericGraphicsAdapter() = default;
virtual void initialize_framebuffer_devices() = 0;
virtual void enable_consoles() = 0;
virtual void disable_consoles() = 0;
bool consoles_enabled() const { return m_consoles_enabled; }
virtual bool framebuffer_devices_initialized() const = 0;
virtual bool modesetting_capable() const = 0;
virtual bool double_framebuffering_capable() const = 0;
virtual bool vga_compatible() const = 0;
virtual ErrorOr<ByteBuffer> get_edid(size_t output_port_index) const = 0;
virtual bool try_to_set_resolution(size_t output_port_index, size_t width, size_t height) = 0;
virtual bool set_y_offset(size_t output_port_index, size_t y) = 0;
protected:
GenericGraphicsAdapter() = default;
bool m_consoles_enabled { false };
};
}

View file

@ -85,22 +85,12 @@ void GraphicsManagement::set_vga_text_mode_cursor(size_t console_width, size_t x
void GraphicsManagement::deactivate_graphical_mode()
{
// FIXME: Remove this once we don't support Framebuffer devices anymore.
for (auto& graphics_device : m_graphics_devices) {
graphics_device.enable_consoles();
}
for (auto& connector : m_display_connector_nodes) {
connector.set_display_mode({}, DisplayConnector::DisplayMode::Console);
}
}
void GraphicsManagement::activate_graphical_mode()
{
// FIXME: Remove this once we don't support Framebuffer devices anymore.
for (auto& graphics_device : m_graphics_devices) {
graphics_device.disable_consoles();
}
for (auto& connector : m_display_connector_nodes) {
connector.set_display_mode({}, DisplayConnector::DisplayMode::Graphical);
}
@ -134,7 +124,6 @@ UNMAP_AFTER_INIT bool GraphicsManagement::determine_and_initialize_isa_graphics_
dmesgln("Graphics: Using a ISA VGA compatible generic adapter");
auto adapter = ISAVGAAdapter::initialize();
m_graphics_devices.append(*adapter);
adapter->enable_consoles();
m_vga_adapter = adapter;
return true;
}
@ -142,11 +131,6 @@ UNMAP_AFTER_INIT bool GraphicsManagement::determine_and_initialize_isa_graphics_
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 = [&](GenericGraphicsAdapter& graphics_device) {
m_graphics_devices.append(graphics_device);
graphics_device.enable_consoles();
graphics_device.initialize_framebuffer_devices();
};
RefPtr<GenericGraphicsAdapter> adapter;
auto create_bootloader_framebuffer_device = [&]() {
@ -210,7 +194,7 @@ UNMAP_AFTER_INIT bool GraphicsManagement::determine_and_initialize_graphics_devi
if (!adapter)
return false;
add_and_configure_adapter(*adapter);
m_graphics_devices.append(*adapter);
// Note: If IO space is enabled, this VGA adapter is operating in VGA mode.
// Note: If no other VGA adapter is attached as m_vga_adapter, we should attach it then.

View file

@ -24,24 +24,13 @@ public:
virtual ~IntelNativeGraphicsAdapter() = default;
virtual bool vga_compatible() const override { return true; }
private:
ErrorOr<void> initialize_adapter();
explicit IntelNativeGraphicsAdapter(PCI::Address);
// ^GenericGraphicsAdapter
// FIXME: Remove all of these methods when we get rid of the FramebufferDevice class.
virtual bool framebuffer_devices_initialized() const override { return false; }
virtual bool modesetting_capable() const override { return true; }
virtual bool vga_compatible() const override { return true; }
virtual bool double_framebuffering_capable() const override { return true; }
virtual bool try_to_set_resolution(size_t, size_t, size_t) override { VERIFY_NOT_REACHED(); }
virtual bool set_y_offset(size_t, size_t) override { VERIFY_NOT_REACHED(); }
virtual void initialize_framebuffer_devices() override { }
virtual void enable_consoles() override { }
virtual void disable_consoles() override { }
virtual ErrorOr<ByteBuffer> get_edid(size_t) const override { VERIFY_NOT_REACHED(); }
RefPtr<IntelNativeDisplayConnector> m_display_connector;
};
}

View file

@ -24,17 +24,6 @@ protected:
VGACompatibleAdapter() = default;
// ^GenericGraphicsAdapter
virtual bool modesetting_capable() const override { VERIFY_NOT_REACHED(); }
virtual bool double_framebuffering_capable() const override { VERIFY_NOT_REACHED(); }
virtual bool framebuffer_devices_initialized() const override { return false; }
virtual void initialize_framebuffer_devices() override { }
virtual void enable_consoles() override { }
virtual void disable_consoles() override { }
virtual bool try_to_set_resolution(size_t, size_t, size_t) override { VERIFY_NOT_REACHED(); }
virtual bool set_y_offset(size_t, size_t) override { VERIFY_NOT_REACHED(); }
ErrorOr<ByteBuffer> get_edid(size_t) const override { return Error::from_errno(ENOTSUP); }
RefPtr<GenericDisplayConnector> m_generic_display_connector;
};
}

View file

@ -59,17 +59,6 @@ private:
VirtIOGraphicsAdapter(PCI::DeviceIdentifier const&, NonnullOwnPtr<Memory::Region> scratch_space_region);
ErrorOr<void> initialize_adapter();
// ^GenericGraphicsAdapter
// FIXME: Remove all of these methods when we get rid of the FramebufferDevice class.
virtual ErrorOr<ByteBuffer> get_edid(size_t) const override { VERIFY_NOT_REACHED(); }
virtual bool try_to_set_resolution(size_t, size_t, size_t) override { VERIFY_NOT_REACHED(); }
virtual bool set_y_offset(size_t, size_t) override { VERIFY_NOT_REACHED(); }
virtual void initialize_framebuffer_devices() override { }
virtual void enable_consoles() override { }
virtual void disable_consoles() override { }
virtual bool framebuffer_devices_initialized() const override { return false; }
virtual bool modesetting_capable() const override { return true; }
virtual bool double_framebuffering_capable() const override { return true; }
virtual bool handle_device_config_change() override;
virtual void handle_queue_update(u16 queue_index) override;