[VC, wip] VC rustfmt
This commit is contained in:
parent
1c0243ef58
commit
be7bfd842b
|
@ -1,6 +1,6 @@
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
use platform::display::{Display, PixelOrder, Size2d, CHARSIZE_X, CHARSIZE_Y};
|
use platform::display::{Display, PixelOrder, Size2d, CHARSIZE_X, CHARSIZE_Y};
|
||||||
use platform::mailbox::{self, channel, tag, GpuFb, Mailbox, response::VAL_LEN_FLAG};
|
use platform::mailbox::{self, channel, response::VAL_LEN_FLAG, tag, GpuFb, Mailbox};
|
||||||
use platform::rpi3::bus2phys;
|
use platform::rpi3::bus2phys;
|
||||||
use platform::uart::MiniUart;
|
use platform::uart::MiniUart;
|
||||||
|
|
||||||
|
@ -8,29 +8,32 @@ pub struct VC;
|
||||||
|
|
||||||
impl VC {
|
impl VC {
|
||||||
// Use mailbox framebuffer interface to initialize
|
// Use mailbox framebuffer interface to initialize
|
||||||
pub fn init_fb(size: Size2d/*, uart: &mut MiniUart*/) -> Option<Display> {
|
pub fn init_fb(size: Size2d /*, uart: &mut MiniUart*/) -> Option<Display> {
|
||||||
let mut fb_info: GpuFb = GpuFb::new(size, 24);
|
let mut fb_info = GpuFb::new(size, 24);
|
||||||
|
|
||||||
// uart.puts("initing fb_info\n");
|
// uart.puts("initing fb_info\n");
|
||||||
fb_info.call().map_err(|_| {/*uart.puts("fb_info error\n");*/()});
|
fb_info.call().map_err(|_| {
|
||||||
|
/*uart.puts("fb_info error\n");*/
|
||||||
|
()
|
||||||
|
});
|
||||||
|
|
||||||
// write!(uart, "inited fb_info: {}\n", fb_info);
|
// write!(uart, "inited fb_info: {}\n", fb_info);
|
||||||
|
|
||||||
// let mut pixel_order = Mailbox::new();
|
// let mut pixel_order = Mailbox::new();
|
||||||
//
|
//
|
||||||
// pixel_order.buffer[0] = 24;
|
// pixel_order.buffer[0] = 24;
|
||||||
// pixel_order.buffer[1] = mailbox::REQUEST;
|
// pixel_order.buffer[1] = mailbox::REQUEST;
|
||||||
// pixel_order.buffer[2] = tag::SetPixelOrder;
|
// pixel_order.buffer[2] = tag::SetPixelOrder;
|
||||||
// pixel_order.buffer[3] = 4;
|
// pixel_order.buffer[3] = 4;
|
||||||
// pixel_order.buffer[4] = 4;
|
// pixel_order.buffer[4] = 4;
|
||||||
// pixel_order.buffer[5] = 0; // 0 - BGR, 1 - RGB
|
// pixel_order.buffer[5] = 0; // 0 - BGR, 1 - RGB
|
||||||
//
|
//
|
||||||
// pixel_order.call(channel::PropertyTagsArmToVc).map_err(|_| ());
|
// pixel_order.call(channel::PropertyTagsArmToVc).map_err(|_| ());
|
||||||
|
|
||||||
/* Need to set up max_x/max_y before using Display::write */
|
/* Need to set up max_x/max_y before using Display::write */
|
||||||
let max_x = fb_info.vwidth / CHARSIZE_X;
|
let max_x = fb_info.vwidth / CHARSIZE_X;
|
||||||
let max_y = fb_info.vheight / CHARSIZE_Y;
|
let max_y = fb_info.vheight / CHARSIZE_Y;
|
||||||
// uart.puts("inited fb_info #2\n");
|
// uart.puts("inited fb_info #2\n");
|
||||||
|
|
||||||
Some(Display::new(
|
Some(Display::new(
|
||||||
bus2phys(fb_info.pointer),
|
bus2phys(fb_info.pointer),
|
||||||
|
@ -59,9 +62,9 @@ impl VC {
|
||||||
|
|
||||||
mbox.call(Channel::PropertyTagsArmToVc)?;
|
mbox.call(Channel::PropertyTagsArmToVc)?;
|
||||||
|
|
||||||
// if mbox.0[1] != MAILBOX_RESP_CODE_SUCCESS {
|
// if mbox.0[1] != MAILBOX_RESP_CODE_SUCCESS {
|
||||||
// return None;
|
// return None;
|
||||||
// }
|
// }
|
||||||
if mbox.0[5] == 0 && mbox.0[6] == 0 {
|
if mbox.0[5] == 0 && mbox.0[6] == 0 {
|
||||||
// Qemu emulation returns 0x0
|
// Qemu emulation returns 0x0
|
||||||
return Some(Size2d { x: 640, y: 480 });
|
return Some(Size2d { x: 640, y: 480 });
|
||||||
|
|
Loading…
Reference in New Issue