Commit 2aebb3eb2b939d996ef6a905b42c70931e02a8ba
1 parent
95917e3f
blanking support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@726 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
50 additions
and
6 deletions
hw/vga.c
@@ -109,7 +109,8 @@ typedef struct VGAState { | @@ -109,7 +109,8 @@ typedef struct VGAState { | ||
109 | uint32_t line_compare; | 109 | uint32_t line_compare; |
110 | uint32_t start_addr; | 110 | uint32_t start_addr; |
111 | uint8_t last_cw, last_ch; | 111 | uint8_t last_cw, last_ch; |
112 | - uint32_t last_width, last_height; | 112 | + uint32_t last_width, last_height; /* in chars or pixels */ |
113 | + uint32_t last_scr_width, last_scr_height; /* in pixels */ | ||
113 | uint8_t cursor_start, cursor_end; | 114 | uint8_t cursor_start, cursor_end; |
114 | uint32_t cursor_offset; | 115 | uint32_t cursor_offset; |
115 | unsigned int (*rgb_to_pixel)(unsigned int r, unsigned int g, unsigned b); | 116 | unsigned int (*rgb_to_pixel)(unsigned int r, unsigned int g, unsigned b); |
@@ -1155,7 +1156,9 @@ static void vga_draw_text(VGAState *s, int full_update) | @@ -1155,7 +1156,9 @@ static void vga_draw_text(VGAState *s, int full_update) | ||
1155 | } | 1156 | } |
1156 | if (width != s->last_width || height != s->last_height || | 1157 | if (width != s->last_width || height != s->last_height || |
1157 | cw != s->last_cw || cheight != s->last_ch) { | 1158 | cw != s->last_cw || cheight != s->last_ch) { |
1158 | - dpy_resize(s->ds, width * cw, height * cheight); | 1159 | + s->last_scr_width = width * cw; |
1160 | + s->last_scr_height = height * cheight; | ||
1161 | + dpy_resize(s->ds, s->last_scr_width, s->last_scr_height); | ||
1159 | s->last_width = width; | 1162 | s->last_width = width; |
1160 | s->last_height = height; | 1163 | s->last_height = height; |
1161 | s->last_ch = cheight; | 1164 | s->last_ch = cheight; |
@@ -1412,6 +1415,8 @@ static void vga_draw_graphic(VGAState *s, int full_update) | @@ -1412,6 +1415,8 @@ static void vga_draw_graphic(VGAState *s, int full_update) | ||
1412 | if (disp_width != s->last_width || | 1415 | if (disp_width != s->last_width || |
1413 | height != s->last_height) { | 1416 | height != s->last_height) { |
1414 | dpy_resize(s->ds, disp_width, height); | 1417 | dpy_resize(s->ds, disp_width, height); |
1418 | + s->last_scr_width = disp_width; | ||
1419 | + s->last_scr_height = height; | ||
1415 | s->last_width = disp_width; | 1420 | s->last_width = disp_width; |
1416 | s->last_height = height; | 1421 | s->last_height = height; |
1417 | full_update = 1; | 1422 | full_update = 1; |
@@ -1494,6 +1499,33 @@ static void vga_draw_graphic(VGAState *s, int full_update) | @@ -1494,6 +1499,33 @@ static void vga_draw_graphic(VGAState *s, int full_update) | ||
1494 | } | 1499 | } |
1495 | } | 1500 | } |
1496 | 1501 | ||
1502 | +static void vga_draw_blank(VGAState *s, int full_update) | ||
1503 | +{ | ||
1504 | + int i, w, val; | ||
1505 | + uint8_t *d; | ||
1506 | + | ||
1507 | + if (!full_update) | ||
1508 | + return; | ||
1509 | + if (s->last_scr_width <= 0 || s->last_scr_height <= 0) | ||
1510 | + return; | ||
1511 | + if (s->ds->depth == 8) | ||
1512 | + val = s->rgb_to_pixel(0, 0, 0); | ||
1513 | + else | ||
1514 | + val = 0; | ||
1515 | + w = s->last_scr_width * ((s->ds->depth + 7) >> 3); | ||
1516 | + d = s->ds->data; | ||
1517 | + for(i = 0; i < s->last_scr_height; i++) { | ||
1518 | + memset(d, val, w); | ||
1519 | + d += s->ds->linesize; | ||
1520 | + } | ||
1521 | + dpy_update(s->ds, 0, 0, | ||
1522 | + s->last_scr_width, s->last_scr_height); | ||
1523 | +} | ||
1524 | + | ||
1525 | +#define GMODE_TEXT 0 | ||
1526 | +#define GMODE_GRAPH 1 | ||
1527 | +#define GMODE_BLANK 2 | ||
1528 | + | ||
1497 | void vga_update_display(void) | 1529 | void vga_update_display(void) |
1498 | { | 1530 | { |
1499 | VGAState *s = &vga_state; | 1531 | VGAState *s = &vga_state; |
@@ -1519,15 +1551,27 @@ void vga_update_display(void) | @@ -1519,15 +1551,27 @@ void vga_update_display(void) | ||
1519 | } | 1551 | } |
1520 | 1552 | ||
1521 | full_update = 0; | 1553 | full_update = 0; |
1522 | - graphic_mode = s->gr[6] & 1; | 1554 | + if (!(s->ar_index & 0x20)) { |
1555 | + graphic_mode = GMODE_BLANK; | ||
1556 | + } else { | ||
1557 | + graphic_mode = s->gr[6] & 1; | ||
1558 | + } | ||
1523 | if (graphic_mode != s->graphic_mode) { | 1559 | if (graphic_mode != s->graphic_mode) { |
1524 | s->graphic_mode = graphic_mode; | 1560 | s->graphic_mode = graphic_mode; |
1525 | full_update = 1; | 1561 | full_update = 1; |
1526 | } | 1562 | } |
1527 | - if (graphic_mode) | ||
1528 | - vga_draw_graphic(s, full_update); | ||
1529 | - else | 1563 | + switch(graphic_mode) { |
1564 | + case GMODE_TEXT: | ||
1530 | vga_draw_text(s, full_update); | 1565 | vga_draw_text(s, full_update); |
1566 | + break; | ||
1567 | + case GMODE_GRAPH: | ||
1568 | + vga_draw_graphic(s, full_update); | ||
1569 | + break; | ||
1570 | + case GMODE_BLANK: | ||
1571 | + default: | ||
1572 | + vga_draw_blank(s, full_update); | ||
1573 | + break; | ||
1574 | + } | ||
1531 | } | 1575 | } |
1532 | } | 1576 | } |
1533 | 1577 |