From 052ca1dc143b1df2800f9c4e43daf80c96fb472e Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 11 Mar 2015 13:08:23 +0100 Subject: Refactor ; add default font (8x16 standard VGA font). --- src/common/include/proto/fb.h | 10 ++++++++-- src/kernel/dev/vesa.c | 12 ++++++------ src/lib/include/proto/gip.h | 6 +++--- src/sysbin/giosrv/main.c | 2 +- src/sysbin/login/main.c | 4 ++-- 5 files changed, 20 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/common/include/proto/fb.h b/src/common/include/proto/fb.h index 6bc6a6c..dab9643 100644 --- a/src/common/include/proto/fb.h +++ b/src/common/include/proto/fb.h @@ -18,11 +18,17 @@ typedef struct { uint32_t pitch; // bytes per line uint32_t bpp; uint32_t memory_model; -} framebuffer_info_t; +} fb_info_t; + +typedef struct { + uint32_t x, y; + uint32_t w, h; +} fb_region_t; + typedef struct { int mode_number; - framebuffer_info_t geom; + fb_info_t geom; } fbdev_mode_info_t; #define IOCTL_FB_GET_INFO 1 diff --git a/src/kernel/dev/vesa.c b/src/kernel/dev/vesa.c index 67a6d70..a039d01 100644 --- a/src/kernel/dev/vesa.c +++ b/src/kernel/dev/vesa.c @@ -199,7 +199,7 @@ typedef struct { // ---- VESA driver data structures typedef struct { - framebuffer_info_t info; + fb_info_t info; uint16_t vesa_mode_id; void* phys_fb_addr; } vesa_mode_t; @@ -375,7 +375,7 @@ int vesa_ioctl(fs_handle_t *h, int command, void* data) { if ((void*)m < (void*)K_HIGHHALF_ADDR) probe_for_write(m, sizeof(fbdev_mode_info_t)); if (m->mode_number >= 0 && m->mode_number < d->nmodes) { - memcpy(&m->geom, &d->modes[m->mode_number].info, sizeof(framebuffer_info_t)); + memcpy(&m->geom, &d->modes[m->mode_number].info, sizeof(fb_info_t)); return 1; } } else if (command == IOCTL_FBDEV_SET_MODE) { @@ -388,10 +388,10 @@ int vesa_ioctl(fs_handle_t *h, int command, void* data) { } } else if (command == IOCTL_FB_GET_INFO) { if (d->current_mode != -1) { - framebuffer_info_t *i = (framebuffer_info_t*)data; + fb_info_t *i = (fb_info_t*)data; - if ((void*)i < (void*)K_HIGHHALF_ADDR) probe_for_write(i, sizeof(framebuffer_info_t)); - memcpy(i, &d->modes[d->current_mode].info, sizeof(framebuffer_info_t)); + if ((void*)i < (void*)K_HIGHHALF_ADDR) probe_for_write(i, sizeof(fb_info_t)); + memcpy(i, &d->modes[d->current_mode].info, sizeof(fb_info_t)); return 1; } @@ -403,7 +403,7 @@ int vesa_ioctl(fs_handle_t *h, int command, void* data) { bool vesa_stat(fs_node_t *n, stat_t *st) { vesa_driver_t *d = (vesa_driver_t*)n->data; - framebuffer_info_t *i = (d->current_mode == -1 ? 0 : &d->modes[d->current_mode].info); + fb_info_t *i = (d->current_mode == -1 ? 0 : &d->modes[d->current_mode].info); st->type = FT_DEV | FT_FRAMEBUFFER; st->size = (i ? i->width * i->pitch : 0); diff --git a/src/lib/include/proto/gip.h b/src/lib/include/proto/gip.h index f79e29f..ca8b868 100644 --- a/src/lib/include/proto/gip.h +++ b/src/lib/include/proto/gip.h @@ -104,15 +104,15 @@ typedef struct { typedef struct { token_t tok; - framebuffer_info_t geom; + fb_info_t geom; } gip_buffer_info_msg; typedef struct { - framebuffer_info_t geom; + fb_info_t geom; } gip_mode_info_msg; typedef struct { - uint32_t x, y, w, h; + fb_region_t region; } gip_buffer_damage_msg; /* vim: set ts=4 sw=4 tw=0 noet :*/ diff --git a/src/sysbin/giosrv/main.c b/src/sysbin/giosrv/main.c index 19d01f7..fcb9360 100644 --- a/src/sysbin/giosrv/main.c +++ b/src/sysbin/giosrv/main.c @@ -9,7 +9,7 @@ #include typedef struct { - framebuffer_info_t mode; + fb_info_t mode; fd_t fd; } giosrv_t; diff --git a/src/sysbin/login/main.c b/src/sysbin/login/main.c index 1d5da8a..eac19e7 100644 --- a/src/sysbin/login/main.c +++ b/src/sysbin/login/main.c @@ -6,7 +6,7 @@ #include typedef struct { - framebuffer_info_t mode; + fb_info_t mode; size_t fb_size; void* map; @@ -71,7 +71,7 @@ void c_buffer_info(gip_handler_t *s, gip_msg_header *p, gip_buffer_info_msg *m) c->fd = use_token(&m->tok); if (c->fd != 0) { - memcpy(&c->mode, &m->geom, sizeof(framebuffer_info_t)); + memcpy(&c->mode, &m->geom, sizeof(fb_info_t)); dbg_printf("[login] Got buffer on FD %d, %dx%dx%d\n", c->fd, c->mode.width, c->mode.height, c->mode.bpp); -- cgit v1.2.3