Commit e3697092228770c3b23d0bf524e18b508b109932
1 parent
570724dc
Fix vga on PPC
Fix crash introduced in revision 6336. (Stefano Stabellini) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6349 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
34 additions
and
34 deletions
hw/vga.c
... | ... | @@ -1618,6 +1618,40 @@ static void vga_draw_graphic(VGAState *s, int full_update) |
1618 | 1618 | s->double_scan = double_scan; |
1619 | 1619 | } |
1620 | 1620 | |
1621 | + depth = s->get_bpp(s); | |
1622 | + if (s->line_offset != s->last_line_offset || | |
1623 | + disp_width != s->last_width || | |
1624 | + height != s->last_height || | |
1625 | + s->last_depth != depth) { | |
1626 | + if (depth == 16 || depth == 32) { | |
1627 | + if (is_graphic_console()) { | |
1628 | + qemu_free_displaysurface(s->ds->surface); | |
1629 | + s->ds->surface = qemu_create_displaysurface_from(disp_width, height, depth, | |
1630 | + s->line_offset, | |
1631 | + s->vram_ptr + (s->start_addr * 4)); | |
1632 | + dpy_resize(s->ds); | |
1633 | + } else { | |
1634 | + qemu_console_resize(s->ds, disp_width, height); | |
1635 | + } | |
1636 | + } else { | |
1637 | + qemu_console_resize(s->ds, disp_width, height); | |
1638 | + } | |
1639 | + s->last_scr_width = disp_width; | |
1640 | + s->last_scr_height = height; | |
1641 | + s->last_width = disp_width; | |
1642 | + s->last_height = height; | |
1643 | + s->last_line_offset = s->line_offset; | |
1644 | + s->last_depth = depth; | |
1645 | + full_update = 1; | |
1646 | + } else if (is_graphic_console() && is_buffer_shared(s->ds->surface) && | |
1647 | + (full_update || s->ds->surface->data != s->vram_ptr + (s->start_addr * 4))) { | |
1648 | + s->ds->surface->data = s->vram_ptr + (s->start_addr * 4); | |
1649 | + dpy_setdata(s->ds); | |
1650 | + } | |
1651 | + | |
1652 | + s->rgb_to_pixel = | |
1653 | + rgb_to_pixel_dup_table[get_depth_index(s->ds)]; | |
1654 | + | |
1621 | 1655 | if (shift_control == 0) { |
1622 | 1656 | full_update |= update_palette16(s); |
1623 | 1657 | if (s->sr[0x01] & 8) { |
... | ... | @@ -1669,40 +1703,6 @@ static void vga_draw_graphic(VGAState *s, int full_update) |
1669 | 1703 | } |
1670 | 1704 | vga_draw_line = vga_draw_line_table[v * NB_DEPTHS + get_depth_index(s->ds)]; |
1671 | 1705 | |
1672 | - depth = s->get_bpp(s); | |
1673 | - if (s->line_offset != s->last_line_offset || | |
1674 | - disp_width != s->last_width || | |
1675 | - height != s->last_height || | |
1676 | - s->last_depth != depth) { | |
1677 | - if (depth == 16 || depth == 32) { | |
1678 | - if (is_graphic_console()) { | |
1679 | - qemu_free_displaysurface(s->ds->surface); | |
1680 | - s->ds->surface = qemu_create_displaysurface_from(disp_width, height, depth, | |
1681 | - s->line_offset, | |
1682 | - s->vram_ptr + (s->start_addr * 4)); | |
1683 | - dpy_resize(s->ds); | |
1684 | - } else { | |
1685 | - qemu_console_resize(s->ds, disp_width, height); | |
1686 | - } | |
1687 | - } else { | |
1688 | - qemu_console_resize(s->ds, disp_width, height); | |
1689 | - } | |
1690 | - s->last_scr_width = disp_width; | |
1691 | - s->last_scr_height = height; | |
1692 | - s->last_width = disp_width; | |
1693 | - s->last_height = height; | |
1694 | - s->last_line_offset = s->line_offset; | |
1695 | - s->last_depth = depth; | |
1696 | - full_update = 1; | |
1697 | - } else if (is_graphic_console() && is_buffer_shared(s->ds->surface) && | |
1698 | - (full_update || s->ds->surface->data != s->vram_ptr + (s->start_addr * 4))) { | |
1699 | - s->ds->surface->data = s->vram_ptr + (s->start_addr * 4); | |
1700 | - dpy_setdata(s->ds); | |
1701 | - } | |
1702 | - | |
1703 | - s->rgb_to_pixel = | |
1704 | - rgb_to_pixel_dup_table[get_depth_index(s->ds)]; | |
1705 | - | |
1706 | 1706 | if (!is_buffer_shared(s->ds->surface) && s->cursor_invalidate) |
1707 | 1707 | s->cursor_invalidate(s); |
1708 | 1708 | ... | ... |