1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-22 08:06:17 +04:00

update ioctl

This commit is contained in:
刘丰源 2019-10-30 17:06:30 +08:00
parent 2ec7f966cd
commit d28ce19ae4
2 changed files with 66 additions and 3 deletions

View File

@ -1,6 +1,6 @@
//! Framebuffer
use crate::fs::vga::{fb_fix_screeninfo, fb_var_screeninfo};
use crate::fs::vga::{self, fb_fix_screeninfo, fb_var_screeninfo};
use alloc::string::String;
use core::fmt;
use lazy_static::lazy_static;
@ -244,10 +244,56 @@ impl Framebuffer {
var_info.xoffset = self.fb_info.xoffset;
var_info.yoffset = self.fb_info.yoffset;
var_info.bits_per_pixel = self.fb_info.depth as u32;
var_info.blue = vga::fb_bitfield {
offset: 0 as u32,
length: 8 as u32,
msb_right: 1 as u32,
};
var_info.green = vga::fb_bitfield {
offset: 8 as u32,
length: 8 as u32,
msb_right: 1 as u32,
};
var_info.red = vga::fb_bitfield {
offset: 16 as u32,
length: 8 as u32,
msb_right: 1 as u32,
};
var_info.transp = vga::fb_bitfield {
offset: 24 as u32,
length: 8 as u32,
msb_right: 1 as u32,
};
}
pub fn fill_fix_screeninfo(&self, fix_info: &mut fb_fix_screeninfo) {
fix_info.line_length = self.fb_info.xres * self.fb_info.depth as u32 / 8
// pub id: [u8; 16], /* identification string eg "TT Builtin" */
// fix_info.smem_start = self.fb_info.vaddr as u64;
fix_info.smem_start = 0xC0000000 as u64;
/* (physical address) */
fix_info.smem_len = self.fb_info.screen_size as u32;
fix_info.type_ = vga::FB_TYPE_PACKED_PIXELS;
// fix_info.type_aux = self.fb_info.type_aux;
fix_info.visual = vga::FB_VISUAL_TRUECOLOR;
// fix_info.xpanstep = 0;
// fix_info.ypanstep = 0;
// fix_info.ywrapstep = 0;
fix_info.line_length = self.fb_info.xres * self.fb_info.depth as u32 / 8;
fix_info.mmio_start = 0 as u64;
/* (physical address) */
fix_info.mmio_len = 0 as u32;
fix_info.accel = vga::FB_ACCEL_NONE;
/* specific chip/card we have */
// fix_info.capabilities = self.fb_info.capabilities;
// pub reserved: [u16; 2], /* Reserved for future compatibility */
}
}

View File

@ -88,13 +88,30 @@ impl INode for Vga {
const FBIOGET_FSCREENINFO: u32 = 0x4602;
const FBIOGET_VSCREENINFO: u32 = 0x4600;
pub const FB_TYPE_PACKED_PIXELS: u32 = 0; /* Packed Pixels */
pub const FB_TYPE_PLANES: u32 = 1; /* Non interleaved planes */
pub const FB_TYPE_INTERLEAVED_PLANES: u32 = 2; /* Interleaved planes */
pub const FB_TYPE_TEXT: u32 = 3; /* Text/attributes */
pub const FB_TYPE_VGA_PLANES: u32 = 4; /* EGA/VGA planes */
pub const FB_TYPE_FOURCC: u32 = 5; /* Type identified by a V4L2 FOURCC */
pub const FB_VISUAL_MONO01: u32 = 0; /* Monochr. 1=Black 0=White */
pub const FB_VISUAL_MONO10: u32 = 1; /* Monochr. 1=White 0=Black */
pub const FB_VISUAL_TRUECOLOR: u32 = 2; /* True color */
pub const FB_VISUAL_PSEUDOCOLOR: u32 = 3; /* Pseudo color (like atari) */
pub const FB_VISUAL_DIRECTCOLOR: u32 = 4; /* Direct color */
pub const FB_VISUAL_STATIC_PSEUDOCOLOR: u32 = 5; /* Pseudo color readonly */
pub const FB_VISUAL_FOURCC: u32 = 6; /* Visual identified by a V4L2 FOURCC */
pub const FB_ACCEL_NONE: u32 = 0; /* no hardware accelerator */
#[repr(C)]
pub struct fb_fix_screeninfo {
pub id: [u8; 16], /* identification string eg "TT Builtin" */
pub smem_start: u64, /* Start of frame buffer mem */
/* (physical address) */
pub smem_len: u32, /* Length of frame buffer mem */
pub _type: u32, /* see FB_TYPE_* */
pub type_: u32, /* see FB_TYPE_* */
pub type_aux: u32, /* Interleave for interleaved Planes */
pub visual: u32, /* see FB_VISUAL_* */
pub xpanstep: u16, /* zero if no hardware panning */