mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
Kernel: Introduce a new graphics subsystem
This new subsystem is replacing the old code that was used to create device nodes of framebuffer devices in /dev. This subsystem includes for now 3 roles: 1. GraphicsManagement singleton object that is used in the boot process to enumerate and initialize display devices. 2. GraphicsDevice(s) that are used to control the display adapter. 3. FramebufferDevice(s) that are used to control the device node in /dev. For now, we support the Bochs display adapter and any other generic VGA compatible adapter that was configured by the boot loader to a known and fixed resolution. Two improvements in the Bochs display adapter code are that we can support native bochs-display device (this device doesn't expose any VGA capabilities) and also that we use the MMIO region, to configure the device, instead of setting IO ports for such tasks.
This commit is contained in:
parent
8515a1c49d
commit
6a728e2d76
18 changed files with 672 additions and 428 deletions
49
Kernel/Graphics/BochsGraphicsAdapter.h
Normal file
49
Kernel/Graphics/BochsGraphicsAdapter.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Graphics/GraphicsDevice.h>
|
||||
#include <Kernel/PCI/DeviceController.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class BochsFramebufferDevice;
|
||||
class GraphicsManagement;
|
||||
class BochsGraphicsAdapter final : public GraphicsDevice
|
||||
, public PCI::DeviceController {
|
||||
AK_MAKE_ETERNAL
|
||||
friend class BochsFramebufferDevice;
|
||||
friend class GraphicsManagement;
|
||||
|
||||
public:
|
||||
static NonnullRefPtr<BochsGraphicsAdapter> initialize(PCI::Address);
|
||||
virtual ~BochsGraphicsAdapter() = default;
|
||||
|
||||
private:
|
||||
// ^GraphicsDevice
|
||||
virtual void initialize_framebuffer_devices() override;
|
||||
virtual Type type() const override;
|
||||
|
||||
explicit BochsGraphicsAdapter(PCI::Address);
|
||||
|
||||
void set_safe_resolution();
|
||||
|
||||
bool validate_setup_resolution(size_t width, size_t height);
|
||||
u32 find_framebuffer_address();
|
||||
bool try_to_set_resolution(size_t width, size_t height);
|
||||
bool set_resolution(size_t width, size_t height);
|
||||
void set_resolution_registers(size_t width, size_t height);
|
||||
void set_y_offset(size_t);
|
||||
|
||||
PhysicalAddress m_mmio_registers;
|
||||
RefPtr<BochsFramebufferDevice> m_framebuffer;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue