aboutsummaryrefslogtreecommitdiffstats
path: root/vgasrc
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-10-17 21:47:10 -0400
committerKevin O'Connor <kevin@koconnor.net>2014-10-27 11:00:32 -0400
commit7217ae7bea6d07bb0ea780d1a1710d2cce8fe1c1 (patch)
tree67e36e204b86d8af9b1e37e055c9a439780f2d2e /vgasrc
parentf7f22630fdf50f6da973d9df210b7c8e32849975 (diff)
downloadseabios-7217ae7bea6d07bb0ea780d1a1710d2cce8fe1c1.tar.gz
seabios-7217ae7bea6d07bb0ea780d1a1710d2cce8fe1c1.tar.xz
seabios-7217ae7bea6d07bb0ea780d1a1710d2cce8fe1c1.zip
vgabios: Don't pass vmode_g to vgafb_move_chars() / vgafb_clear_chars()
Now that a pointer to the current video mode info struct is cached in memory, it's not necessary to pass the struct into the vgafb code. The vgafb code can lookup the struct itself. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'vgasrc')
-rw-r--r--vgasrc/vgabios.c22
-rw-r--r--vgasrc/vgabios.h4
-rw-r--r--vgasrc/vgafb.c12
3 files changed, 19 insertions, 19 deletions
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
index fcc5b34..8ec6aa6 100644
--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -212,19 +212,15 @@ write_teletype(struct cursorpos *pcp, struct carattr ca)
if (pcp->y > nbrows) {
pcp->y--;
- struct vgamode_s *vmode_g = get_current_mode();
- if (!vmode_g)
- return;
-
struct cursorpos dest = {0, 0, pcp->page};
struct cursorpos src = {0, 1, pcp->page};
struct cursorpos size = {GET_BDA(video_cols), nbrows};
- vgafb_move_chars(vmode_g, dest, src, size);
+ vgafb_move_chars(dest, src, size);
struct cursorpos clr = {0, nbrows, pcp->page};
struct carattr attr = {' ', 0, 0};
struct cursorpos clrsize = {GET_BDA(video_cols), 1};
- vgafb_clear_chars(vmode_g, clr, attr, clrsize);
+ vgafb_clear_chars(clr, attr, clrsize);
}
}
@@ -430,10 +426,6 @@ verify_scroll(struct bregs *regs, int dir)
if (wincols <= 0 || winrows <= 0)
return;
- struct vgamode_s *vmode_g = get_current_mode();
- if (!vmode_g)
- return;
-
u8 page = GET_BDA(video_page);
int clearlines = regs->al, movelines = winrows - clearlines;
if (!clearlines || movelines <= 0) {
@@ -441,7 +433,7 @@ verify_scroll(struct bregs *regs, int dir)
struct cursorpos clr = {ulx, uly, page};
struct carattr attr = {' ', regs->bh, 1};
struct cursorpos clrsize = {wincols, winrows};
- vgafb_clear_chars(vmode_g, clr, attr, clrsize);
+ vgafb_clear_chars(clr, attr, clrsize);
return;
}
@@ -450,23 +442,23 @@ verify_scroll(struct bregs *regs, int dir)
struct cursorpos dest = {ulx, uly, page};
struct cursorpos src = {ulx, uly + clearlines, page};
struct cursorpos size = {wincols, movelines};
- vgafb_move_chars(vmode_g, dest, src, size);
+ vgafb_move_chars(dest, src, size);
struct cursorpos clr = {ulx, uly + movelines, page};
struct carattr attr = {' ', regs->bh, 1};
struct cursorpos clrsize = {wincols, clearlines};
- vgafb_clear_chars(vmode_g, clr, attr, clrsize);
+ vgafb_clear_chars(clr, attr, clrsize);
} else {
// Scroll down
struct cursorpos dest = {ulx, uly + clearlines, page};
struct cursorpos src = {ulx, uly, page};
struct cursorpos size = {wincols, movelines};
- vgafb_move_chars(vmode_g, dest, src, size);
+ vgafb_move_chars(dest, src, size);
struct cursorpos clr = {ulx, uly, page};
struct carattr attr = {' ', regs->bh, 1};
struct cursorpos clrsize = {wincols, clearlines};
- vgafb_clear_chars(vmode_g, clr, attr, clrsize);
+ vgafb_clear_chars(clr, attr, clrsize);
}
}
diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h
index d17b48f..fc8d45a 100644
--- a/vgasrc/vgabios.h
+++ b/vgasrc/vgabios.h
@@ -123,9 +123,9 @@ int vga_set_mode(int mode, int flags);
void init_gfx_op(struct gfx_op *op, struct vgamode_s *vmode_g);
void handle_gfx_op(struct gfx_op *op);
void *text_address(struct cursorpos cp);
-void vgafb_move_chars(struct vgamode_s *vmode_g, struct cursorpos dest
+void vgafb_move_chars(struct cursorpos dest
, struct cursorpos src, struct cursorpos movesize);
-void vgafb_clear_chars(struct vgamode_s *vmode_g, struct cursorpos dest
+void vgafb_clear_chars(struct cursorpos dest
, struct carattr ca, struct cursorpos movesize);
void vgafb_write_char(struct cursorpos cp, struct carattr ca);
struct carattr vgafb_read_char(struct cursorpos cp);
diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c
index fdc525d..0100080 100644
--- a/vgasrc/vgafb.c
+++ b/vgasrc/vgafb.c
@@ -465,9 +465,13 @@ text_address(struct cursorpos cp)
// Move characters on screen.
void
-vgafb_move_chars(struct vgamode_s *vmode_g, struct cursorpos dest
+vgafb_move_chars(struct cursorpos dest
, struct cursorpos src, struct cursorpos movesize)
{
+ struct vgamode_s *vmode_g = get_current_mode();
+ if (!vmode_g)
+ return;
+
if (GET_GLOBAL(vmode_g->memmodel) != MM_TEXT) {
gfx_move_chars(vmode_g, dest, src, movesize);
return;
@@ -481,9 +485,13 @@ vgafb_move_chars(struct vgamode_s *vmode_g, struct cursorpos dest
// Clear are of screen.
void
-vgafb_clear_chars(struct vgamode_s *vmode_g, struct cursorpos dest
+vgafb_clear_chars(struct cursorpos dest
, struct carattr ca, struct cursorpos clearsize)
{
+ struct vgamode_s *vmode_g = get_current_mode();
+ if (!vmode_g)
+ return;
+
if (GET_GLOBAL(vmode_g->memmodel) != MM_TEXT) {
gfx_clear_chars(vmode_g, dest, ca, clearsize);
return;