i965: cleanup, clear screen on initial mode set
This commit is contained in:
parent
f4473b6617
commit
eed45cbba9
@ -20,8 +20,10 @@ extern void lfb_set_resolution(uint16_t x, uint16_t y);
|
||||
extern uint16_t lfb_resolution_x;
|
||||
extern uint16_t lfb_resolution_y;
|
||||
extern uint16_t lfb_resolution_b;
|
||||
extern uint32_t lfb_resolution_s;
|
||||
extern uint8_t * lfb_vid_memory;
|
||||
extern const char * lfb_driver_name;
|
||||
extern void (*lfb_resolution_impl)(uint16_t,uint16_t);
|
||||
extern int framebuffer_initialize(void);
|
||||
extern size_t lfb_memsize;
|
||||
#endif
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <kernel/string.h>
|
||||
#include <kernel/args.h>
|
||||
#include <kernel/mmu.h>
|
||||
#include <kernel/video.h>
|
||||
|
||||
/* Whether to scroll or wrap when cursor reaches the bottom. */
|
||||
static int fbterm_scroll = 0;
|
||||
@ -29,14 +30,6 @@ static int term_state = 0;
|
||||
static char term_buf[1024] = {0};
|
||||
static int term_buf_c = 0;
|
||||
|
||||
/* Is this in a header somewhere? */
|
||||
extern uint8_t * lfb_vid_memory;
|
||||
extern uint16_t lfb_resolution_x;
|
||||
extern uint16_t lfb_resolution_y;
|
||||
extern uint16_t lfb_resolution_b;
|
||||
extern uint32_t lfb_resolution_s;
|
||||
extern size_t lfb_memsize;
|
||||
|
||||
/* Bitmap font details */
|
||||
#include "../../apps/terminal-font.h"
|
||||
#define char_height LARGE_FONT_CELL_HEIGHT
|
||||
@ -49,8 +42,6 @@ extern size_t lfb_memsize;
|
||||
static uint32_t fg_color = FG_COLOR;
|
||||
static uint32_t bg_color = BG_COLOR;
|
||||
|
||||
extern uint32_t lfb_resolution_s;
|
||||
|
||||
static inline void set_point(int x, int y, uint32_t value) {
|
||||
if (lfb_resolution_b == 32) {
|
||||
((uint32_t*)lfb_vid_memory)[y * (lfb_resolution_s/4) + x] = value;
|
||||
@ -132,7 +123,7 @@ static void draw_square(int x, int y) {
|
||||
}
|
||||
}
|
||||
|
||||
static void fbterm_draw_logo(void) {
|
||||
void fbterm_draw_logo(void) {
|
||||
uint64_t logo_squares = 0x981818181818FFFFUL;
|
||||
for (size_t y = 0; y < 8; ++y) {
|
||||
for (size_t x = 0; x < 8; ++x) {
|
||||
@ -144,6 +135,14 @@ static void fbterm_draw_logo(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void fbterm_reset(void) {
|
||||
x = 0;
|
||||
y = 0;
|
||||
term_state = 0;
|
||||
fg_color = FG_COLOR;
|
||||
bg_color = BG_COLOR;
|
||||
}
|
||||
|
||||
static void fbterm_init_framebuffer(void) {
|
||||
write_char = fb_write_char;
|
||||
get_width = fb_get_width;
|
||||
|
@ -31,7 +31,6 @@
|
||||
#define REG_DSPASTRIDE 0x70188
|
||||
#define REG_DSPASURF 0x7019c
|
||||
|
||||
extern uint32_t lfb_resolution_s;
|
||||
extern fs_node_t * lfb_device;
|
||||
static uintptr_t ctrl_regs = 0;
|
||||
|
||||
@ -72,10 +71,13 @@ static void i965_modeset(uint16_t x, uint16_t y) {
|
||||
lfb_resolution_y = y;
|
||||
lfb_resolution_b = 32;
|
||||
lfb_resolution_s = i965_mmio_read(REG_DSPASTRIDE);
|
||||
lfb_device->length = lfb_resolution_s * lfb_resolution_y;
|
||||
|
||||
lfb_memsize = lfb_resolution_s * lfb_resolution_y;
|
||||
lfb_device->length = lfb_memsize;
|
||||
}
|
||||
|
||||
extern void fbterm_draw_logo(void);
|
||||
extern void fbterm_reset(void);
|
||||
|
||||
static void setup_framebuffer(uint32_t pcidev) {
|
||||
/* Map BAR space for the control registers */
|
||||
uint32_t ctrl_space = pci_read_field(pcidev, PCI_BAR0, 4);
|
||||
@ -88,6 +90,17 @@ static void setup_framebuffer(uint32_t pcidev) {
|
||||
|
||||
lfb_resolution_impl = i965_modeset;
|
||||
lfb_set_resolution(1440,900);
|
||||
|
||||
/* Normally we don't clear the screen on mode set, but we should do it here */
|
||||
memset(lfb_vid_memory, 0, lfb_memsize);
|
||||
|
||||
/* Redraw the boot logo; if we were loaded by userspace, it'll probably
|
||||
* be overwritten pretty quickly by the compositor? But whatever... */
|
||||
fbterm_reset();
|
||||
fbterm_draw_logo();
|
||||
|
||||
/* Helpful to know why the console text got cleared */
|
||||
dprintf("i965: video configured for %u x %u\n", lfb_resolution_x, lfb_resolution_y);
|
||||
}
|
||||
|
||||
static void find_intel(uint32_t device, uint16_t v, uint16_t d, void * extra) {
|
||||
|
Loading…
Reference in New Issue
Block a user