summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-05-17 00:02:47 +0300
committerLinus Groh <mail@linusgroh.de>2021-05-17 00:30:40 +0100
commit02b73cb93d559202d91f8306cb578a65e263466a (patch)
tree52e69f776eb88883f86e38f70ee3458846679907
parentca9101e5f0c804eee9cfb44ce770a98a249f75c6 (diff)
downloadserenity-02b73cb93d559202d91f8306cb578a65e263466a.zip
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.
-rw-r--r--Kernel/Graphics/BochsFramebufferDevice.cpp6
-rw-r--r--Kernel/Graphics/BochsGraphicsAdapter.cpp2
-rw-r--r--Kernel/Graphics/Console/FramebufferConsole.h8
-rw-r--r--Kernel/Graphics/FramebufferDevice.cpp2
-rw-r--r--Kernel/Graphics/GraphicsManagement.cpp4
-rw-r--r--Kernel/Graphics/IntelNativeGraphicsAdapter.cpp2
-rw-r--r--Kernel/Graphics/RawFramebufferDevice.cpp8
-rw-r--r--Kernel/Graphics/RawFramebufferDevice.h4
8 files changed, 18 insertions, 18 deletions
diff --git a/Kernel/Graphics/BochsFramebufferDevice.cpp b/Kernel/Graphics/BochsFramebufferDevice.cpp
index 15af62d532..23c3108d96 100644
--- a/Kernel/Graphics/BochsFramebufferDevice.cpp
+++ b/Kernel/Graphics/BochsFramebufferDevice.cpp
@@ -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();
diff --git a/Kernel/Graphics/BochsGraphicsAdapter.cpp b/Kernel/Graphics/BochsGraphicsAdapter.cpp
index 0fb47c36fe..b6695216e8 100644
--- a/Kernel/Graphics/BochsGraphicsAdapter.cpp
+++ b/Kernel/Graphics/BochsGraphicsAdapter.cpp
@@ -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();
}
diff --git a/Kernel/Graphics/Console/FramebufferConsole.h b/Kernel/Graphics/Console/FramebufferConsole.h
index 336d117367..48574768b7 100644
--- a/Kernel/Graphics/Console/FramebufferConsole.h
+++ b/Kernel/Graphics/Console/FramebufferConsole.h
@@ -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;
diff --git a/Kernel/Graphics/FramebufferDevice.cpp b/Kernel/Graphics/FramebufferDevice.cpp
index 82665e1d1b..aebc9f5b49 100644
--- a/Kernel/Graphics/FramebufferDevice.cpp
+++ b/Kernel/Graphics/FramebufferDevice.cpp
@@ -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)
diff --git a/Kernel/Graphics/GraphicsManagement.cpp b/Kernel/Graphics/GraphicsManagement.cpp
index 0c5ad939bd..c056cfd164 100644
--- a/Kernel/Graphics/GraphicsManagement.cpp
+++ b/Kernel/Graphics/GraphicsManagement.cpp
@@ -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);
}
diff --git a/Kernel/Graphics/IntelNativeGraphicsAdapter.cpp b/Kernel/Graphics/IntelNativeGraphicsAdapter.cpp
index 2ce0266920..dfd00638fb 100644
--- a/Kernel/Graphics/IntelNativeGraphicsAdapter.cpp
+++ b/Kernel/Graphics/IntelNativeGraphicsAdapter.cpp
@@ -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();
}
}
diff --git a/Kernel/Graphics/RawFramebufferDevice.cpp b/Kernel/Graphics/RawFramebufferDevice.cpp
index f36a5cfa27..993e513441 100644
--- a/Kernel/Graphics/RawFramebufferDevice.cpp
+++ b/Kernel/Graphics/RawFramebufferDevice.cpp
@@ -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)
{
}
diff --git a/Kernel/Graphics/RawFramebufferDevice.h b/Kernel/Graphics/RawFramebufferDevice.h
index 10ddf44ea8..53ef6920fe 100644
--- a/Kernel/Graphics/RawFramebufferDevice.h
+++ b/Kernel/Graphics/RawFramebufferDevice.h
@@ -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"; }
};