mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:27:45 +00:00
Kernel/Graphics: Ensure we set BGR format of bochs-display if supported
Instead of blindly forcing BGR format on the bochs-display device, let's ensure we do that only on QEMU bochs-display and not on VirtualBox graphics adapter too.
This commit is contained in:
parent
de1b649783
commit
38bddca378
2 changed files with 18 additions and 1 deletions
|
@ -19,6 +19,8 @@
|
||||||
#define VBE_DISPI_IOPORT_INDEX 0x01CE
|
#define VBE_DISPI_IOPORT_INDEX 0x01CE
|
||||||
#define VBE_DISPI_IOPORT_DATA 0x01CF
|
#define VBE_DISPI_IOPORT_DATA 0x01CF
|
||||||
|
|
||||||
|
#define VBE_DISPI_ID5 0xB0C5
|
||||||
|
|
||||||
#define VBE_DISPI_INDEX_ID 0x0
|
#define VBE_DISPI_INDEX_ID 0x0
|
||||||
#define VBE_DISPI_INDEX_XRES 0x1
|
#define VBE_DISPI_INDEX_XRES 0x1
|
||||||
#define VBE_DISPI_INDEX_YRES 0x2
|
#define VBE_DISPI_INDEX_YRES 0x2
|
||||||
|
@ -156,6 +158,14 @@ static u16 get_register_with_io(u16 index)
|
||||||
return IO::in16(VBE_DISPI_IOPORT_DATA);
|
return IO::in16(VBE_DISPI_IOPORT_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BochsGraphicsAdapter::IndexID BochsGraphicsAdapter::index_id() const
|
||||||
|
{
|
||||||
|
if (m_io_required) {
|
||||||
|
return get_register_with_io(0);
|
||||||
|
}
|
||||||
|
return m_registers->bochs_regs.index_id;
|
||||||
|
}
|
||||||
|
|
||||||
void BochsGraphicsAdapter::set_resolution_registers_via_io(size_t width, size_t height)
|
void BochsGraphicsAdapter::set_resolution_registers_via_io(size_t width, size_t height)
|
||||||
{
|
{
|
||||||
dbgln_if(BXVGA_DEBUG, "BochsGraphicsAdapter resolution registers set to - {}x{}", width, height);
|
dbgln_if(BXVGA_DEBUG, "BochsGraphicsAdapter resolution registers set to - {}x{}", width, height);
|
||||||
|
@ -184,7 +194,9 @@ void BochsGraphicsAdapter::set_resolution_registers(size_t width, size_t height)
|
||||||
m_registers->bochs_regs.enable = VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED;
|
m_registers->bochs_regs.enable = VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED;
|
||||||
full_memory_barrier();
|
full_memory_barrier();
|
||||||
m_registers->bochs_regs.bank = 0;
|
m_registers->bochs_regs.bank = 0;
|
||||||
set_framebuffer_to_little_endian_format();
|
if (index_id().value() == VBE_DISPI_ID5) {
|
||||||
|
set_framebuffer_to_little_endian_format();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BochsGraphicsAdapter::try_to_set_resolution(size_t output_port_index, size_t width, size_t height)
|
bool BochsGraphicsAdapter::try_to_set_resolution(size_t output_port_index, size_t width, size_t height)
|
||||||
|
|
|
@ -25,6 +25,9 @@ class BochsGraphicsAdapter final : public GraphicsDevice
|
||||||
AK_MAKE_ETERNAL
|
AK_MAKE_ETERNAL
|
||||||
friend class GraphicsManagement;
|
friend class GraphicsManagement;
|
||||||
|
|
||||||
|
private:
|
||||||
|
TYPEDEF_DISTINCT_ORDERED_ID(u16, IndexID);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static NonnullRefPtr<BochsGraphicsAdapter> initialize(PCI::Address);
|
static NonnullRefPtr<BochsGraphicsAdapter> initialize(PCI::Address);
|
||||||
virtual ~BochsGraphicsAdapter() = default;
|
virtual ~BochsGraphicsAdapter() = default;
|
||||||
|
@ -46,6 +49,8 @@ private:
|
||||||
|
|
||||||
explicit BochsGraphicsAdapter(PCI::Address);
|
explicit BochsGraphicsAdapter(PCI::Address);
|
||||||
|
|
||||||
|
IndexID index_id() const;
|
||||||
|
|
||||||
void set_safe_resolution();
|
void set_safe_resolution();
|
||||||
void unblank();
|
void unblank();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue