mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-22 16:16:16 +04:00
fix fb_bitfield for all pixel formats
This commit is contained in:
parent
242cbfa76c
commit
7d849f8d30
@ -1,6 +1,6 @@
|
|||||||
use rcore_fs::vfs::*;
|
use rcore_fs::vfs::*;
|
||||||
|
|
||||||
use crate::drivers::gpu::fb::{FramebufferInfo, FRAME_BUFFER};
|
use crate::drivers::gpu::fb::{ColorFormat, FramebufferInfo, FRAME_BUFFER};
|
||||||
use crate::memory::phys_to_virt;
|
use crate::memory::phys_to_virt;
|
||||||
use alloc::{string::String, sync::Arc, vec::Vec};
|
use alloc::{string::String, sync::Arc, vec::Vec};
|
||||||
use core::any::Any;
|
use core::any::Any;
|
||||||
@ -244,24 +244,31 @@ impl FbVarScreeninfo {
|
|||||||
self.xoffset = fb_info.xoffset;
|
self.xoffset = fb_info.xoffset;
|
||||||
self.yoffset = fb_info.yoffset;
|
self.yoffset = fb_info.yoffset;
|
||||||
self.bits_per_pixel = fb_info.depth as u32;
|
self.bits_per_pixel = fb_info.depth as u32;
|
||||||
|
let (rl, gl, bl, al, ro, go, bo, ao) = match fb_info.format {
|
||||||
|
ColorFormat::RGB332 => (3, 3, 2, 0, 5, 3, 0, 0),
|
||||||
|
ColorFormat::RGB565 => (5, 6, 5, 0, 11, 5, 0, 0),
|
||||||
|
ColorFormat::RGBA8888 => (8, 8, 8, 8, 16, 8, 0, 24),
|
||||||
|
ColorFormat::BGRA8888 => (8, 8, 8, 8, 0, 8, 16, 24),
|
||||||
|
ColorFormat::VgaPalette => unimplemented!(),
|
||||||
|
};
|
||||||
self.blue = FbBitfield {
|
self.blue = FbBitfield {
|
||||||
offset: 0,
|
offset: bo,
|
||||||
length: fb_info.depth as u32 / 4,
|
length: bl,
|
||||||
msb_right: 1,
|
msb_right: 1,
|
||||||
};
|
};
|
||||||
self.green = FbBitfield {
|
self.green = FbBitfield {
|
||||||
offset: fb_info.depth as u32 / 4,
|
offset: go,
|
||||||
length: fb_info.depth as u32 / 4,
|
length: gl,
|
||||||
msb_right: 1,
|
msb_right: 1,
|
||||||
};
|
};
|
||||||
self.red = FbBitfield {
|
self.red = FbBitfield {
|
||||||
offset: fb_info.depth as u32 / 2,
|
offset: ro,
|
||||||
length: fb_info.depth as u32 / 4,
|
length: rl,
|
||||||
msb_right: 1,
|
msb_right: 1,
|
||||||
};
|
};
|
||||||
self.transp = FbBitfield {
|
self.transp = FbBitfield {
|
||||||
offset: fb_info.depth as u32 * 3 / 4,
|
offset: ao,
|
||||||
length: fb_info.depth as u32 / 4,
|
length: al,
|
||||||
msb_right: 1,
|
msb_right: 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user