mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
Kernel/Graphics: Be more consistent about arguments passing
This fixes a bug that was reported on this discord server by @ElectrodeYT - due to the confusion of passing arguments in different orders, we messed up and triggered a page fault due to faulty sizes.
This commit is contained in:
parent
ca9101e5f0
commit
02b73cb93d
8 changed files with 18 additions and 18 deletions
|
@ -17,13 +17,13 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<BochsFramebufferDevice> BochsFramebufferDevice::create(const BochsGraphicsAdapter& adapter, PhysicalAddress framebuffer_address, size_t pitch, size_t width, size_t height)
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<BochsFramebufferDevice> BochsFramebufferDevice::create(const BochsGraphicsAdapter& adapter, PhysicalAddress framebuffer_address, size_t width, size_t height, size_t pitch)
|
||||
{
|
||||
return adopt_ref(*new BochsFramebufferDevice(adapter, framebuffer_address, pitch, width, height));
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT BochsFramebufferDevice::BochsFramebufferDevice(const BochsGraphicsAdapter& adapter, PhysicalAddress framebuffer_address, size_t pitch, size_t width, size_t height)
|
||||
: FramebufferDevice(framebuffer_address, pitch, width, height)
|
||||
UNMAP_AFTER_INIT BochsFramebufferDevice::BochsFramebufferDevice(const BochsGraphicsAdapter& adapter, PhysicalAddress framebuffer_address, size_t width, size_t height, size_t pitch)
|
||||
: FramebufferDevice(framebuffer_address, width, height, pitch)
|
||||
, m_bochs_adapter(adapter)
|
||||
{
|
||||
m_bochs_adapter->set_safe_resolution();
|
||||
|
|
|
@ -63,7 +63,7 @@ UNMAP_AFTER_INIT BochsGraphicsAdapter::BochsGraphicsAdapter(PCI::Address pci_add
|
|||
UNMAP_AFTER_INIT void BochsGraphicsAdapter::initialize_framebuffer_devices()
|
||||
{
|
||||
// FIXME: Find a better way to determine default resolution...
|
||||
m_framebuffer_device = BochsFramebufferDevice::create(*this, PhysicalAddress(PCI::get_BAR0(pci_address()) & 0xfffffff0), 1024 * 4, 1024, 768);
|
||||
m_framebuffer_device = BochsFramebufferDevice::create(*this, PhysicalAddress(PCI::get_BAR0(pci_address()) & 0xfffffff0), 1024, 768, 1024 * sizeof(u32));
|
||||
m_framebuffer_device->initialize();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
namespace Kernel::Graphics {
|
||||
class FramebufferConsole final : public Console {
|
||||
public:
|
||||
static NonnullRefPtr<FramebufferConsole> initialize(PhysicalAddress, size_t width, size_t height, size_t bpp);
|
||||
static NonnullRefPtr<FramebufferConsole> initialize(PhysicalAddress, size_t width, size_t height, size_t pitch);
|
||||
|
||||
virtual size_t bytes_per_base_glyph() const override;
|
||||
virtual size_t chars_per_line() const override;
|
||||
|
||||
virtual size_t max_column() const { return m_width / 8; }
|
||||
virtual size_t max_row() const { return m_height / 8; }
|
||||
virtual size_t max_column() const override { return m_width / 8; }
|
||||
virtual size_t max_row() const override { return m_height / 8; }
|
||||
|
||||
virtual bool is_hardware_paged_capable() const override { return false; }
|
||||
virtual bool has_hardware_cursor() const override { return false; }
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
protected:
|
||||
void clear_glyph(size_t x, size_t y) const;
|
||||
FramebufferConsole(PhysicalAddress, size_t width, size_t height, size_t bpp);
|
||||
FramebufferConsole(PhysicalAddress, size_t width, size_t height, size_t pitch);
|
||||
OwnPtr<Region> m_framebuffer_region;
|
||||
PhysicalAddress m_framebuffer_address;
|
||||
size_t m_pitch;
|
||||
|
|
|
@ -94,7 +94,7 @@ UNMAP_AFTER_INIT void FramebufferDevice::initialize()
|
|||
VERIFY(m_swapped_framebuffer_region);
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT FramebufferDevice::FramebufferDevice(PhysicalAddress addr, size_t pitch, size_t width, size_t height)
|
||||
UNMAP_AFTER_INIT FramebufferDevice::FramebufferDevice(PhysicalAddress addr, size_t width, size_t height, size_t pitch)
|
||||
: BlockDevice(29, GraphicsManagement::the().allocate_minor_device_number())
|
||||
, m_framebuffer_address(addr)
|
||||
, m_framebuffer_pitch(pitch)
|
||||
|
|
|
@ -66,9 +66,9 @@ UNMAP_AFTER_INIT RefPtr<GraphicsDevice> GraphicsManagement::determine_graphics_d
|
|||
dmesgln("Graphics: Using a preset resolution from the bootloader");
|
||||
return VGACompatibleAdapter::initialize_with_preset_resolution(address,
|
||||
PhysicalAddress((u32)(multiboot_info_ptr->framebuffer_addr)),
|
||||
multiboot_info_ptr->framebuffer_pitch,
|
||||
multiboot_info_ptr->framebuffer_width,
|
||||
multiboot_info_ptr->framebuffer_height);
|
||||
multiboot_info_ptr->framebuffer_height,
|
||||
multiboot_info_ptr->framebuffer_pitch);
|
||||
}
|
||||
return VGACompatibleAdapter::initialize(address);
|
||||
}
|
||||
|
|
|
@ -625,7 +625,7 @@ void IntelNativeGraphicsAdapter::initialize_framebuffer_devices()
|
|||
VERIFY(m_framebuffer_pitch != 0);
|
||||
VERIFY(m_framebuffer_height != 0);
|
||||
VERIFY(m_framebuffer_width != 0);
|
||||
m_framebuffer_device = RawFramebufferDevice::create(*this, address, m_framebuffer_pitch, m_framebuffer_width, m_framebuffer_height);
|
||||
m_framebuffer_device = RawFramebufferDevice::create(*this, address, m_framebuffer_width, m_framebuffer_height, m_framebuffer_pitch);
|
||||
m_framebuffer_device->initialize();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<RawFramebufferDevice> RawFramebufferDevice::create(const GraphicsDevice&, PhysicalAddress framebuffer_address, size_t pitch, size_t width, size_t height)
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<RawFramebufferDevice> RawFramebufferDevice::create(const GraphicsDevice&, PhysicalAddress framebuffer_address, size_t width, size_t height, size_t pitch)
|
||||
{
|
||||
return adopt_ref(*new RawFramebufferDevice(framebuffer_address, pitch, width, height));
|
||||
return adopt_ref(*new RawFramebufferDevice(framebuffer_address, width, height, pitch));
|
||||
}
|
||||
UNMAP_AFTER_INIT RawFramebufferDevice::RawFramebufferDevice(PhysicalAddress framebuffer_address, size_t pitch, size_t width, size_t height)
|
||||
: FramebufferDevice(framebuffer_address, pitch, width, height)
|
||||
UNMAP_AFTER_INIT RawFramebufferDevice::RawFramebufferDevice(PhysicalAddress framebuffer_address, size_t width, size_t height, size_t pitch)
|
||||
: FramebufferDevice(framebuffer_address, width, height, pitch)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ class RawFramebufferDevice : public FramebufferDevice {
|
|||
friend class GraphicsDevice;
|
||||
|
||||
public:
|
||||
static NonnullRefPtr<RawFramebufferDevice> create(const GraphicsDevice&, PhysicalAddress, size_t pitch, size_t width, size_t height);
|
||||
static NonnullRefPtr<RawFramebufferDevice> create(const GraphicsDevice&, PhysicalAddress, size_t width, size_t height, size_t pitch);
|
||||
|
||||
virtual ~RawFramebufferDevice() {};
|
||||
|
||||
private:
|
||||
RawFramebufferDevice(PhysicalAddress, size_t pitch, size_t width, size_t height);
|
||||
RawFramebufferDevice(PhysicalAddress, size_t width, size_t height, size_t pitch);
|
||||
virtual const char* class_name() const override { return "RawFramebuffer"; }
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue