Skip to content

Commit

Permalink
Kernel/Devices: Improve construction paths semantically
Browse files Browse the repository at this point in the history
Do this by:
- Removing more instances of `LockRefPtr` and `NonnullLockRefPtr`.
- Using better names of construction methods (i.e. `create` instead of
  `try_create`).
- Only returning `NonnullRefPtr` on the `Device::try_create_device`
  method.
- Removing a version of the `Device::try_create_device` method that
  called `DeviceType::try_create(forward<Args>(args)...)`, which was
  only used in a construction point in a VirtIO driver which now doesn't
  need this anymore.
  • Loading branch information
supercomputer7 committed Oct 4, 2024
1 parent 4f14a2c commit 081065f
Show file tree
Hide file tree
Showing 76 changed files with 161 additions and 189 deletions.
2 changes: 1 addition & 1 deletion Kernel/Arch/aarch64/RPi/MiniUART.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ enum LineStatus {

constexpr FlatPtr AUX_ENABLES = 0x21'5000;

UNMAP_AFTER_INIT ErrorOr<NonnullLockRefPtr<MiniUART>> MiniUART::create()
UNMAP_AFTER_INIT ErrorOr<NonnullRefPtr<MiniUART>> MiniUART::create()
{
return Device::try_create_device<MiniUART>();
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Arch/aarch64/RPi/MiniUART.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MiniUART final : public CharacterDevice {
friend class Kernel::Device;

public:
static ErrorOr<NonnullLockRefPtr<MiniUART>> create();
static ErrorOr<NonnullRefPtr<MiniUART>> create();

virtual ~MiniUART() override;

Expand Down
24 changes: 10 additions & 14 deletions Kernel/Arch/x86_64/Hypervisor/BochsDisplayConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ static u16 get_register_with_io(u16 index)
return IO::in16(VBE_DISPI_IOPORT_DATA);
}

LockRefPtr<BochsDisplayConnector> BochsDisplayConnector::try_create_for_vga_isa_connector()
ErrorOr<NonnullRefPtr<BochsDisplayConnector>> BochsDisplayConnector::try_create_for_vga_isa_connector()
{
VERIFY(PCI::Access::is_hardware_disabled());
BochsDisplayConnector::IndexID index_id = get_register_with_io(0);
if (index_id != VBE_DISPI_ID5)
return {};
return Error::from_errno(ENOTSUP);

auto video_ram_64k_chunks_count = get_register_with_io(to_underlying(BochsDISPIRegisters::VIDEO_RAM_64K_CHUNKS_COUNT));
if (video_ram_64k_chunks_count == 0 || video_ram_64k_chunks_count == 0xffff) {
Expand All @@ -47,24 +47,20 @@ LockRefPtr<BochsDisplayConnector> BochsDisplayConnector::try_create_for_vga_isa_
// Since this is probably hardcoded at other OSes in their guest drivers,
// we can assume this is going to stay the same framebuffer physical address for
// this device and will not be changed in the future.
auto device_or_error = Device::try_create_device<BochsDisplayConnector>(PhysicalAddress(0xE0000000), video_ram_64k_chunks_count * (64 * KiB));
VERIFY(!device_or_error.is_error());
auto connector = device_or_error.release_value();
MUST(connector->create_attached_framebuffer_console());
MUST(connector->initialize_edid_for_generic_monitor({}));
auto connector = TRY(Device::try_create_device<BochsDisplayConnector>(PhysicalAddress(0xE0000000), video_ram_64k_chunks_count * (64 * KiB)));
TRY(connector->create_attached_framebuffer_console());
TRY(connector->initialize_edid_for_generic_monitor({}));
return connector;
}

NonnullLockRefPtr<BochsDisplayConnector> BochsDisplayConnector::must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, bool virtual_box_hardware)
ErrorOr<NonnullRefPtr<BochsDisplayConnector>> BochsDisplayConnector::create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, bool virtual_box_hardware)
{
auto device_or_error = Device::try_create_device<BochsDisplayConnector>(framebuffer_address, framebuffer_resource_size);
VERIFY(!device_or_error.is_error());
auto connector = device_or_error.release_value();
MUST(connector->create_attached_framebuffer_console());
auto connector = TRY(Device::try_create_device<BochsDisplayConnector>(framebuffer_address, framebuffer_resource_size));
TRY(connector->create_attached_framebuffer_console());
if (virtual_box_hardware)
MUST(connector->initialize_edid_for_generic_monitor(Array<u8, 3> { 'V', 'B', 'X' }));
TRY(connector->initialize_edid_for_generic_monitor(Array<u8, 3> { 'V', 'B', 'X' }));
else
MUST(connector->initialize_edid_for_generic_monitor({}));
TRY(connector->initialize_edid_for_generic_monitor({}));
return connector;
}

Expand Down
4 changes: 2 additions & 2 deletions Kernel/Arch/x86_64/Hypervisor/BochsDisplayConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class BochsDisplayConnector
public:
AK_TYPEDEF_DISTINCT_ORDERED_ID(u16, IndexID);

static LockRefPtr<BochsDisplayConnector> try_create_for_vga_isa_connector();
static ErrorOr<NonnullRefPtr<BochsDisplayConnector>> try_create_for_vga_isa_connector();

static NonnullLockRefPtr<BochsDisplayConnector> must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, bool virtual_box_hardware);
static ErrorOr<NonnullRefPtr<BochsDisplayConnector>> create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, bool virtual_box_hardware);

private:
IndexID index_id() const;
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Arch/x86_64/ISABus/SerialDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ namespace Kernel {
#define SERIAL_COM3_ADDR 0x3E8
#define SERIAL_COM4_ADDR 0x2E8

UNMAP_AFTER_INIT NonnullLockRefPtr<SerialDevice> SerialDevice::must_create(size_t com_number)
UNMAP_AFTER_INIT NonnullRefPtr<SerialDevice> SerialDevice::must_create(size_t com_number)
{
// FIXME: This way of blindly doing release_value is really not a good thing, find
// a way to propagate errors back.
LockRefPtr<SerialDevice> serial_device;
RefPtr<SerialDevice> serial_device;
switch (com_number) {
case 0: {
auto io_window = IOWindow::create_for_io_space(IOAddress(SERIAL_COM1_ADDR), 16).release_value_but_fixme_should_propagate_errors();
Expand Down
13 changes: 2 additions & 11 deletions Kernel/Devices/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,9 @@ class Device : public File {
static void initialize_base_devices();

template<typename DeviceType, typename... Args>
static inline ErrorOr<NonnullLockRefPtr<DeviceType>> try_create_device(Args&&... args)
requires(requires(Args... args) { DeviceType::try_create(args...); })
static inline ErrorOr<NonnullRefPtr<DeviceType>> try_create_device(Args&&... args)
{
auto device = TRY(DeviceType::try_create(forward<Args>(args)...));
TRY(static_ptr_cast<Device>(device)->after_inserting());
return device;
}

template<typename DeviceType, typename... Args>
static inline ErrorOr<NonnullLockRefPtr<DeviceType>> try_create_device(Args&&... args)
{
auto device = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) DeviceType(forward<Args>(args)...)));
auto device = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) DeviceType(forward<Args>(args)...)));
TRY(static_ptr_cast<Device>(device)->after_inserting());
return device;
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/FUSEDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Kernel {

UNMAP_AFTER_INIT NonnullLockRefPtr<FUSEDevice> FUSEDevice::must_create()
UNMAP_AFTER_INIT NonnullRefPtr<FUSEDevice> FUSEDevice::must_create()
{
return MUST(Device::try_create_device<FUSEDevice>());
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/FUSEDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FUSEDevice final : public CharacterDevice {
friend class Device;

public:
static NonnullLockRefPtr<FUSEDevice> must_create();
static NonnullRefPtr<FUSEDevice> must_create();
virtual ~FUSEDevice() override;

ErrorOr<void> initialize_instance(OpenFileDescription const&);
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/GPU/3dfx/GraphicsAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ UNMAP_AFTER_INIT ErrorOr<void> VoodooGraphicsAdapter::initialize_adapter(PCI::De

auto io_window = TRY(IOWindow::create_for_pci_device_bar(pci_device_identifier, PCI::HeaderType0BaseRegister::BAR2));

m_display_connector = VoodooGraphics::VoodooDisplayConnector::must_create(vmem_addr, vmem_size, move(mmio_mapping), move(io_window));
m_display_connector = TRY(VoodooGraphics::VoodooDisplayConnector::create(vmem_addr, vmem_size, move(mmio_mapping), move(io_window)));
TRY(m_display_connector->set_safe_mode_setting());

return {};
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/GPU/3dfx/GraphicsAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class VoodooGraphicsAdapter final : public GPUDevice

explicit VoodooGraphicsAdapter(PCI::DeviceIdentifier const&);

LockRefPtr<DisplayConnector> m_display_connector;
RefPtr<DisplayConnector> m_display_connector;
};
}
10 changes: 4 additions & 6 deletions Kernel/Devices/GPU/3dfx/VoodooDisplayConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@

namespace Kernel::VoodooGraphics {

NonnullLockRefPtr<VoodooDisplayConnector> VoodooDisplayConnector::must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, Memory::TypedMapping<RegisterMap volatile> registers_mapping, NonnullOwnPtr<IOWindow> io_window)
ErrorOr<NonnullRefPtr<VoodooDisplayConnector>> VoodooDisplayConnector::create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, Memory::TypedMapping<RegisterMap volatile> registers_mapping, NonnullOwnPtr<IOWindow> io_window)
{
auto device_or_error = Device::try_create_device<VoodooDisplayConnector>(framebuffer_address, framebuffer_resource_size, move(registers_mapping), move(io_window));
VERIFY(!device_or_error.is_error());
auto connector = device_or_error.release_value();
MUST(connector->create_attached_framebuffer_console());
MUST(connector->fetch_and_initialize_edid());
auto connector = TRY(Device::try_create_device<VoodooDisplayConnector>(framebuffer_address, framebuffer_resource_size, move(registers_mapping), move(io_window)));
TRY(connector->create_attached_framebuffer_console());
TRY(connector->fetch_and_initialize_edid());
return connector;
}

Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/GPU/3dfx/VoodooDisplayConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class VoodooDisplayConnector final
friend class Kernel::Device;

public:
static NonnullLockRefPtr<VoodooDisplayConnector> must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, Memory::TypedMapping<RegisterMap volatile>, NonnullOwnPtr<IOWindow> io_window);
static ErrorOr<NonnullRefPtr<VoodooDisplayConnector>> create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, Memory::TypedMapping<RegisterMap volatile>, NonnullOwnPtr<IOWindow> io_window);

private:
ErrorOr<void> fetch_and_initialize_edid();
Expand Down
6 changes: 3 additions & 3 deletions Kernel/Devices/GPU/Bochs/GraphicsAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ UNMAP_AFTER_INIT ErrorOr<void> BochsGraphicsAdapter::initialize_adapter(PCI::Dev
#if ARCH(X86_64)
bool virtual_box_hardware = (pci_device_identifier.hardware_id().vendor_id == 0x80ee && pci_device_identifier.hardware_id().device_id == 0xbeef);
if (pci_device_identifier.revision_id().value() == 0x0 || virtual_box_hardware) {
m_display_connector = BochsDisplayConnector::must_create(PhysicalAddress(TRY(PCI::get_bar_address(pci_device_identifier, PCI::HeaderType0BaseRegister::BAR0))), bar0_space_size, virtual_box_hardware);
m_display_connector = TRY(BochsDisplayConnector::create(PhysicalAddress(TRY(PCI::get_bar_address(pci_device_identifier, PCI::HeaderType0BaseRegister::BAR0))), bar0_space_size, virtual_box_hardware));
} else {
auto registers_mapping = TRY(PCI::map_bar<BochsDisplayMMIORegisters volatile>(pci_device_identifier, PCI::HeaderType0BaseRegister::BAR2));
VERIFY(registers_mapping.region);
m_display_connector = QEMUDisplayConnector::must_create(PhysicalAddress(TRY(PCI::get_bar_address(pci_device_identifier, PCI::HeaderType0BaseRegister::BAR0))), bar0_space_size, move(registers_mapping));
m_display_connector = TRY(QEMUDisplayConnector::create(PhysicalAddress(TRY(PCI::get_bar_address(pci_device_identifier, PCI::HeaderType0BaseRegister::BAR0))), bar0_space_size, move(registers_mapping)));
}
#else
auto registers_mapping = TRY(PCI::map_bar<BochsDisplayMMIORegisters volatile>(pci_device_identifier, PCI::HeaderType0BaseRegister::BAR2));
VERIFY(registers_mapping.region);
m_display_connector = QEMUDisplayConnector::must_create(PhysicalAddress(TRY(PCI::get_bar_address(pci_device_identifier, PCI::HeaderType0BaseRegister::BAR0))), bar0_space_size, move(registers_mapping));
m_display_connector = TRY(QEMUDisplayConnector::create(PhysicalAddress(TRY(PCI::get_bar_address(pci_device_identifier, PCI::HeaderType0BaseRegister::BAR0))), bar0_space_size, move(registers_mapping)));
#endif

// Note: According to Gerd Hoffmann - "The linux driver simply does
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/GPU/Bochs/GraphicsAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ class BochsGraphicsAdapter final : public GPUDevice

explicit BochsGraphicsAdapter(PCI::DeviceIdentifier const&);

LockRefPtr<DisplayConnector> m_display_connector;
RefPtr<DisplayConnector> m_display_connector;
};
}
10 changes: 4 additions & 6 deletions Kernel/Devices/GPU/Bochs/QEMUDisplayConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@

namespace Kernel {

NonnullLockRefPtr<QEMUDisplayConnector> QEMUDisplayConnector::must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, Memory::TypedMapping<BochsDisplayMMIORegisters volatile> registers_mapping)
ErrorOr<NonnullRefPtr<QEMUDisplayConnector>> QEMUDisplayConnector::create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, Memory::TypedMapping<BochsDisplayMMIORegisters volatile> registers_mapping)
{
auto device_or_error = Device::try_create_device<QEMUDisplayConnector>(framebuffer_address, framebuffer_resource_size, move(registers_mapping));
VERIFY(!device_or_error.is_error());
auto connector = device_or_error.release_value();
MUST(connector->create_attached_framebuffer_console());
MUST(connector->fetch_and_initialize_edid());
auto connector = TRY(Device::try_create_device<QEMUDisplayConnector>(framebuffer_address, framebuffer_resource_size, move(registers_mapping)));
TRY(connector->create_attached_framebuffer_console());
TRY(connector->fetch_and_initialize_edid());
return connector;
}

Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/GPU/Bochs/QEMUDisplayConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class QEMUDisplayConnector final
public:
AK_TYPEDEF_DISTINCT_ORDERED_ID(u16, IndexID);

static NonnullLockRefPtr<QEMUDisplayConnector> must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, Memory::TypedMapping<BochsDisplayMMIORegisters volatile>);
static ErrorOr<NonnullRefPtr<QEMUDisplayConnector>> create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, Memory::TypedMapping<BochsDisplayMMIORegisters volatile>);

private:
IndexID index_id() const;
Expand Down
10 changes: 4 additions & 6 deletions Kernel/Devices/GPU/Generic/DisplayConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@

namespace Kernel {

NonnullLockRefPtr<GenericDisplayConnector> GenericDisplayConnector::must_create_with_preset_resolution(PhysicalAddress framebuffer_address, size_t width, size_t height, size_t pitch)
ErrorOr<NonnullRefPtr<GenericDisplayConnector>> GenericDisplayConnector::create_with_preset_resolution(PhysicalAddress framebuffer_address, size_t width, size_t height, size_t pitch)
{
auto device_or_error = Device::try_create_device<GenericDisplayConnector>(framebuffer_address, width, height, pitch);
VERIFY(!device_or_error.is_error());
auto connector = device_or_error.release_value();
MUST(connector->create_attached_framebuffer_console());
MUST(connector->initialize_edid_for_generic_monitor({}));
auto connector = TRY(Device::try_create_device<GenericDisplayConnector>(framebuffer_address, width, height, pitch));
TRY(connector->create_attached_framebuffer_console());
TRY(connector->initialize_edid_for_generic_monitor({}));
return connector;
}

Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/GPU/Generic/DisplayConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GenericDisplayConnector
friend class Device;

public:
static NonnullLockRefPtr<GenericDisplayConnector> must_create_with_preset_resolution(PhysicalAddress framebuffer_address, size_t width, size_t height, size_t pitch);
static ErrorOr<NonnullRefPtr<GenericDisplayConnector>> create_with_preset_resolution(PhysicalAddress framebuffer_address, size_t width, size_t height, size_t pitch);

protected:
ErrorOr<void> create_attached_framebuffer_console();
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/GPU/Intel/DisplayConnectorGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class IntelDisplayConnectorGroup : public RefCounted<IntelDisplayConnectorGroup>

// Note: The linux driver specifies an enum of possible ports and there is only
// 9 ports (PORT_{A-I}). PORT_TC{1-6} are mapped to PORT_{D-I}.
Array<LockRefPtr<IntelNativeDisplayConnector>, 9> m_connectors;
Array<RefPtr<IntelNativeDisplayConnector>, 9> m_connectors;

Array<OwnPtr<IntelDisplayTranscoder>, 5> m_transcoders;
Array<OwnPtr<IntelDisplayPlane>, 3> m_planes;
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/GPU/Intel/NativeDisplayConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace Kernel {

ErrorOr<NonnullLockRefPtr<IntelNativeDisplayConnector>> IntelNativeDisplayConnector::try_create_with_display_connector_group(IntelDisplayConnectorGroup const& parent_connector_group, ConnectorIndex connector_index, Type type, PhysicalAddress framebuffer_address, size_t framebuffer_resource_size)
ErrorOr<NonnullRefPtr<IntelNativeDisplayConnector>> IntelNativeDisplayConnector::try_create_with_display_connector_group(IntelDisplayConnectorGroup const& parent_connector_group, ConnectorIndex connector_index, Type type, PhysicalAddress framebuffer_address, size_t framebuffer_resource_size)
{
return TRY(Device::try_create_device<IntelNativeDisplayConnector>(parent_connector_group, connector_index, type, framebuffer_address, framebuffer_resource_size));
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/GPU/Intel/NativeDisplayConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class IntelNativeDisplayConnector final
PortI = 8,
};

static ErrorOr<NonnullLockRefPtr<IntelNativeDisplayConnector>> try_create_with_display_connector_group(IntelDisplayConnectorGroup const&, ConnectorIndex, Type, PhysicalAddress framebuffer_address, size_t framebuffer_resource_size);
static ErrorOr<NonnullRefPtr<IntelNativeDisplayConnector>> try_create_with_display_connector_group(IntelDisplayConnectorGroup const&, ConnectorIndex, Type, PhysicalAddress framebuffer_address, size_t framebuffer_resource_size);

void set_edid_bytes(Badge<IntelDisplayConnectorGroup>, Array<u8, 128> const& edid_bytes);
ErrorOr<void> create_attached_framebuffer_console(Badge<IntelDisplayConnectorGroup>);
Expand Down
12 changes: 6 additions & 6 deletions Kernel/Devices/GPU/Management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ UNMAP_AFTER_INIT void GraphicsManagement::initialize_preset_resolution_generic_d
VERIFY(!multiboot_framebuffer_addr.is_null());
VERIFY(multiboot_framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_RGB);
dmesgln("Graphics: Using a preset resolution from the bootloader, without knowing the PCI device");
m_preset_resolution_generic_display_connector = GenericDisplayConnector::must_create_with_preset_resolution(
m_preset_resolution_generic_display_connector = MUST(GenericDisplayConnector::create_with_preset_resolution(
multiboot_framebuffer_addr,
multiboot_framebuffer_width,
multiboot_framebuffer_height,
multiboot_framebuffer_pitch);
multiboot_framebuffer_pitch));
}

UNMAP_AFTER_INIT bool GraphicsManagement::initialize()
Expand Down Expand Up @@ -169,11 +169,11 @@ UNMAP_AFTER_INIT bool GraphicsManagement::initialize()
// for the framebuffer.
if (PCI::Access::is_hardware_disabled() && !(graphics_subsystem_mode == CommandLine::GraphicsSubsystemMode::Limited && !multiboot_framebuffer_addr.is_null() && multiboot_framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_RGB)) {
#if ARCH(X86_64)
auto vga_isa_bochs_display_connector = BochsDisplayConnector::try_create_for_vga_isa_connector();
if (vga_isa_bochs_display_connector) {
auto vga_isa_bochs_display_connector_or_error = BochsDisplayConnector::try_create_for_vga_isa_connector();
if (!vga_isa_bochs_display_connector_or_error.is_error()) {
m_platform_board_specific_display_connector = vga_isa_bochs_display_connector_or_error.release_value();
dmesgln("Graphics: Using a Bochs ISA VGA compatible adapter");
MUST(vga_isa_bochs_display_connector->set_safe_mode_setting());
m_platform_board_specific_display_connector = vga_isa_bochs_display_connector;
MUST(m_platform_board_specific_display_connector->set_safe_mode_setting());
dmesgln("Graphics: Invoking manual blanking with VGA ISA ports");
IO::out8(0x3c0, 0x20);
return true;
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Devices/GPU/Management.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class GraphicsManagement {
LockRefPtr<Graphics::Console> m_console;

// Note: This is only used when booting with kernel commandline that includes "graphics_subsystem_mode=limited"
LockRefPtr<GenericDisplayConnector> m_preset_resolution_generic_display_connector;
RefPtr<GenericDisplayConnector> m_preset_resolution_generic_display_connector;

LockRefPtr<DisplayConnector> m_platform_board_specific_display_connector;
RefPtr<DisplayConnector> m_platform_board_specific_display_connector;

unsigned m_current_minor_number { 0 };

Expand Down
Loading

0 comments on commit 081065f

Please sign in to comment.