vga: cleanup and endianness patch series
PATCH v2 7/11 vga: Remove some "should be done in BIOS" comments
In reply to Gerd HoffmannFrom: Benjamin Herrenschmidt <[email protected]>
Not all platforms have a VGA BIOS, powerpc typically relies on using the DISPI interface to initialize the card.
--- hw/display/vga.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
hw/display/vga.c +2 -4
@@ -761,14 +761,13 @@ void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val) s->vbe_regs[VBE_DISPI_INDEX_ENABLE ] |=VBE_DISPI_ENABLED ;vbe_fixup_regs (s); -/* clear the screen (should be done in BIOS) */ +/* clear the screen */ if (!(val &VBE_DISPI_NOCLEARMEM )) {memset (s->vram_ptr,0 , s->vbe_regs[VBE_DISPI_INDEX_YRES ] * s->vbe_line_offset); } -/* we initialize the VGA graphic mode (should be done -in BIOS) */ +/* we initialize the VGA graphic mode */ /* graphic mode + memory map 1 */ s->gr[VGA_GFX_MISC ] = (s->gr[VGA_GFX_MISC ] & ~0x0c ) |0x04 |VGA_GR06_GRAPHICS_MODE ;
@@ -801,7 +800,6 @@ void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val) (shift_control <<5 ); s->cr[VGA_CRTC_MAX_SCAN ] &= ~0x9f ;/* no double scan */ }else { -/* XXX: the bios should do that */ s->bank_offset =0 ; } s->dac_8bit = (val &VBE_DISPI_8BIT_DAC ) >0 ;
Signature · 1 line
1.8.3.1
PATCH v2 1/11 vga: Start cutting out non-32bpp conversion support
In reply to Gerd HoffmannFrom: Benjamin Herrenschmidt <[email protected]>
Nowadays, we either share a surface with the host, or we create a 32bpp ARGB console surface.
So we only need to draw/convert to 32bpp, enabling us to remove all but one instance of vga_template.h inclusion (to be further cleaned up), rgb_to_pixel_* etc...
--- hw/display/vga.c | 258 +++++-------------------------------------------------- 1 file changed, 22 insertions(+), 236 deletions(-)
hw/display/vga.c +22 -236
@@ -1006,81 +1006,12 @@ void vga_mem_writeb(VGACommonState *s, hwaddr addr, uint32_t val) } } -typedef void vga_draw_glyph8_func (uint8_t *d,int linesize, -const uint8_t *font_ptr,int h, -uint32_t fgcol,uint32_t bgcol); -typedef void vga_draw_glyph9_func (uint8_t *d,int linesize, -const uint8_t *font_ptr,int h, -uint32_t fgcol,uint32_t bgcol,int dup9);typedef void vga_draw_line_func (VGACommonState *s1,uint8_t *d,const uint8_t *s,int width); -#define DEPTH 8 -#include "vga_template.h" - -#define DEPTH 15 -#include "vga_template.h" - -#define BGR_FORMAT -#define DEPTH 15 -#include "vga_template.h" - -#define DEPTH 16 -#include "vga_template.h" - -#define BGR_FORMAT -#define DEPTH 16 -#include "vga_template.h" -#define DEPTH 32#include "vga_template.h" -#define BGR_FORMAT -#define DEPTH 32 -#include "vga_template.h" - -static unsigned int rgb_to_pixel8_dup (unsigned int r,unsigned int g,unsigned b) -{ -unsigned int col; - col =rgb_to_pixel8 (r, g, b); - col |= col <<8 ; - col |= col <<16 ; -return col; -} - -static unsigned int rgb_to_pixel15_dup (unsigned int r,unsigned int g,unsigned b) -{ -unsigned int col; - col =rgb_to_pixel15 (r, g, b); - col |= col <<16 ; -return col; -} - -static unsigned int rgb_to_pixel15bgr_dup (unsigned int r,unsigned int g, -unsigned int b) -{ -unsigned int col; - col =rgb_to_pixel15bgr (r, g, b); - col |= col <<16 ; -return col; -} - -static unsigned int rgb_to_pixel16_dup (unsigned int r,unsigned int g,unsigned b) -{ -unsigned int col; - col =rgb_to_pixel16 (r, g, b); - col |= col <<16 ; -return col; -} - -static unsigned int rgb_to_pixel16bgr_dup (unsigned int r,unsigned int g, -unsigned int b) -{ -unsigned int col; - col =rgb_to_pixel16bgr (r, g, b); - col |= col <<16 ; -return col; -}static unsigned int rgb_to_pixel32_dup (unsigned int r,unsigned int g,unsigned b) {
@@ -1089,13 +1020,6 @@ static unsigned int rgb_to_pixel32_dup(unsigned int r, unsigned int g, unsignedreturn col; } -static unsigned int rgb_to_pixel32bgr_dup (unsigned int r,unsigned int g,unsigned b) -{ -unsigned int col; - col =rgb_to_pixel32bgr (r, g, b); -return col; -} -/* return true if the palette was modified */ static int update_palette16 (VGACommonState *s) {
@@ -1202,56 +1126,6 @@ static int update_basic_params(VGACommonState *s)return full_update; } -#define NB_DEPTHS 7 - -static inline int get_depth_index (DisplaySurface *s) -{ -switch (surface_bits_per_pixel (s)) { -default : -case 8 : -return 0 ; -case 15 : -return 1 ; -case 16 : -return 2 ; -case 32 : -if (is_surface_bgr (s)) { -return 4 ; - }else { -return 3 ; - } - } -} - -static vga_draw_glyph8_func *const vga_draw_glyph8_table[NB_DEPTHS ] = { - vga_draw_glyph8_8, - vga_draw_glyph8_16, - vga_draw_glyph8_16, - vga_draw_glyph8_32, - vga_draw_glyph8_32, - vga_draw_glyph8_16, - vga_draw_glyph8_16, -}; - -static vga_draw_glyph8_func *const vga_draw_glyph16_table[NB_DEPTHS ] = { - vga_draw_glyph16_8, - vga_draw_glyph16_16, - vga_draw_glyph16_16, - vga_draw_glyph16_32, - vga_draw_glyph16_32, - vga_draw_glyph16_16, - vga_draw_glyph16_16, -}; - -static vga_draw_glyph9_func *const vga_draw_glyph9_table[NB_DEPTHS ] = { - vga_draw_glyph9_8, - vga_draw_glyph9_16, - vga_draw_glyph9_16, - vga_draw_glyph9_32, - vga_draw_glyph9_32, - vga_draw_glyph9_16, - vga_draw_glyph9_16, -};static const uint8_t cursor_glyph[32 *4 ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,
@@ -1303,18 +1177,6 @@ static void vga_get_text_resolution(VGACommonState *s, int *pwidth, int *pheight *pcheight = cheight; } -typedef unsigned int rgb_to_pixel_dup_func (unsigned int r,unsigned int g,unsigned b); - -static rgb_to_pixel_dup_func *const rgb_to_pixel_dup_table[NB_DEPTHS ] = { - rgb_to_pixel8_dup, - rgb_to_pixel15_dup, - rgb_to_pixel16_dup, - rgb_to_pixel32_dup, - rgb_to_pixel32bgr_dup, - rgb_to_pixel15bgr_dup, - rgb_to_pixel16bgr_dup, -}; -/* * Text mode update * Missing:
@@ -1331,11 +1193,9 @@ static void vga_draw_text(VGACommonState *s, int full_update)uint32_t offset, fgcol, bgcol, v, cursor_offset;uint8_t *d1, *d, *src, *dest, *cursor_ptr;const uint8_t *font_ptr, *font_base[2 ]; -int dup9, line_offset, depth_index; +int dup9, line_offset;uint32_t *palette;uint32_t *ch_attr_ptr; -vga_draw_glyph8_func *vga_draw_glyph8; -vga_draw_glyph9_func *vga_draw_glyph9;int64_t now =qemu_clock_get_ms (QEMU_CLOCK_VIRTUAL );/* compute font data address (in plane 2) */
@@ -1387,8 +1247,7 @@ static void vga_draw_text(VGACommonState *s, int full_update) s->last_cw = cw; full_update =1 ; } - s->rgb_to_pixel = - rgb_to_pixel_dup_table[get_depth_index (surface)]; + s->rgb_to_pixel = rgb_to_pixel32_dup; full_update |=update_palette16 (s); palette = s->last_palette; x_incr = cw *surface_bytes_per_pixel (surface);
@@ -1422,13 +1281,6 @@ static void vga_draw_text(VGACommonState *s, int full_update) s->cursor_visible_phase = !s->cursor_visible_phase; } - depth_index =get_depth_index (surface); -if (cw ==16 ) - vga_draw_glyph8 = vga_draw_glyph16_table[depth_index]; -else - vga_draw_glyph8 = vga_draw_glyph8_table[depth_index]; - vga_draw_glyph9 = vga_draw_glyph9_table[depth_index]; - dest =surface_data (surface); linesize =surface_stride (surface); ch_attr_ptr = s->last_ch_attr;
@@ -1458,17 +1310,20 @@ static void vga_draw_text(VGACommonState *s, int full_update) font_ptr +=32 *4 * ch; bgcol = palette[cattr >>4 ]; fgcol = palette[cattr &0x0f ]; -if (cw !=9 ) { -vga_draw_glyph8 (d1, linesize, - font_ptr, cheight, fgcol, bgcol); +if (cw ==16 ) { +vga_draw_glyph16_32 (d1, linesize, + font_ptr, cheight, fgcol, bgcol); + }else if (cw !=9 ) { +vga_draw_glyph8_32 (d1, linesize, + font_ptr, cheight, fgcol, bgcol); }else { dup9 =0 ;if (ch >=0xb0 && ch <=0xdf && (s->ar[VGA_ATC_MODE ] &0x04 )) { dup9 =1 ; } -vga_draw_glyph9 (d1, linesize, - font_ptr, cheight, fgcol, bgcol, dup9); +vga_draw_glyph9_32 (d1, linesize, + font_ptr, cheight, fgcol, bgcol, dup9); } if (src == cursor_ptr && !(s->cr[VGA_CRTC_CURSOR_START] & 0x20) &&
@@ -1483,12 +1338,15 @@ static void vga_draw_text(VGACommonState *s, int full_update)if (line_last >= line_start && line_start < cheight) { h = line_last - line_start +1 ; d = d1 + linesize * line_start; -if (cw !=9 ) { -vga_draw_glyph8 (d, linesize, - cursor_glyph, h, fgcol, bgcol); +if (cw ==16 ) { +vga_draw_glyph16_32 (d, linesize, + cursor_glyph, h, fgcol, bgcol); + }else if (cw !=9 ) { +vga_draw_glyph8_32 (d, linesize, + cursor_glyph, h, fgcol, bgcol); }else { -vga_draw_glyph9 (d, linesize, - cursor_glyph, h, fgcol, bgcol,1 ); +vga_draw_glyph9_32 (d, linesize, + cursor_glyph, h, fgcol, bgcol,1 ); } } }
@@ -1525,86 +1383,17 @@ enum { VGA_DRAW_LINE_NB, }; -static vga_draw_line_func *const vga_draw_line_table[NB_DEPTHS *VGA_DRAW_LINE_NB ] = { - vga_draw_line2_8, - vga_draw_line2_16, - vga_draw_line2_16, - vga_draw_line2_32, +static vga_draw_line_func *const vga_draw_line_table[VGA_DRAW_LINE_NB ] = { vga_draw_line2_32, - vga_draw_line2_16, - vga_draw_line2_16, - - vga_draw_line2d2_8, - vga_draw_line2d2_16, - vga_draw_line2d2_16, - vga_draw_line2d2_32, vga_draw_line2d2_32, - vga_draw_line2d2_16, - vga_draw_line2d2_16, - - vga_draw_line4_8, - vga_draw_line4_16, - vga_draw_line4_16, vga_draw_line4_32, - vga_draw_line4_32, - vga_draw_line4_16, - vga_draw_line4_16, - - vga_draw_line4d2_8, - vga_draw_line4d2_16, - vga_draw_line4d2_16, vga_draw_line4d2_32, - vga_draw_line4d2_32, - vga_draw_line4d2_16, - vga_draw_line4d2_16, - - vga_draw_line8d2_8, - vga_draw_line8d2_16, - vga_draw_line8d2_16, - vga_draw_line8d2_32, vga_draw_line8d2_32, - vga_draw_line8d2_16, - vga_draw_line8d2_16, - - vga_draw_line8_8, - vga_draw_line8_16, - vga_draw_line8_16, - vga_draw_line8_32, vga_draw_line8_32, - vga_draw_line8_16, - vga_draw_line8_16, - - vga_draw_line15_8, - vga_draw_line15_15, - vga_draw_line15_16, vga_draw_line15_32, - vga_draw_line15_32bgr, - vga_draw_line15_15bgr, - vga_draw_line15_16bgr, - - vga_draw_line16_8, - vga_draw_line16_15, - vga_draw_line16_16, vga_draw_line16_32, - vga_draw_line16_32bgr, - vga_draw_line16_15bgr, - vga_draw_line16_16bgr, - - vga_draw_line24_8, - vga_draw_line24_15, - vga_draw_line24_16, vga_draw_line24_32, - vga_draw_line24_32bgr, - vga_draw_line24_15bgr, - vga_draw_line24_16bgr, - - vga_draw_line32_8, - vga_draw_line32_15, - vga_draw_line32_16, vga_draw_line32_32, - vga_draw_line32_32bgr, - vga_draw_line32_15bgr, - vga_draw_line32_16bgr, };static int vga_get_bpp (VGACommonState *s)
@@ -1753,8 +1542,7 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)dpy_gfx_replace_surface (s->con, surface); } - s->rgb_to_pixel = - rgb_to_pixel_dup_table[get_depth_index (surface)]; + s->rgb_to_pixel = rgb_to_pixel32_dup;if (shift_control ==0 ) { full_update |=update_palette16 (s);
@@ -1803,8 +1591,7 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)break ; } } - vga_draw_line = vga_draw_line_table[v *NB_DEPTHS + -get_depth_index (surface)]; + vga_draw_line = vga_draw_line_table[v];if (!is_buffer_shared (surface) && s->cursor_invalidate) { s->cursor_invalidate (s);
@@ -1902,8 +1689,7 @@ static void vga_draw_blank(VGACommonState *s, int full_update)if (s->last_scr_width <=0 || s->last_scr_height <=0 )return ; - s->rgb_to_pixel = - rgb_to_pixel_dup_table[get_depth_index (surface)]; + s->rgb_to_pixel = rgb_to_pixel32_dup;if (surface_bits_per_pixel (surface) ==8 ) { val = s->rgb_to_pixel (0 ,0 ,0 ); }else {
Signature · 1 line
1.8.3.1
PATCH v2 4/11 vga: Remove rgb_to_pixel indirection
In reply to Gerd HoffmannFrom: Benjamin Herrenschmidt <[email protected]>
We always use rgb_to_pixel32 nowadays.
--- hw/display/cirrus_vga.c | 15 +++++++++------ hw/display/vga.c | 31 ++++++++++--------------------- hw/display/vga_int.h | 2 -- 3 files changed, 19 insertions(+), 29 deletions(-)
hw/display/cirrus_vga.c +9 -6
@@ -29,6 +29,7 @@#include "hw/hw.h" #include "hw/pci/pci.h" #include "ui/console.h" +#include "ui/pixel_ops.h" #include "vga_int.h" #include "hw/loader.h"
@@ -2212,6 +2213,8 @@ static void cirrus_cursor_draw_line(VGACommonState *s1, uint8_t *d1, int scr_y) }else { src += (s->vga.sr[0x13 ] &0x3f ) *256 ; src += (scr_y - s->hw_cursor_y) *4 ; + + poffset =128 ; content = ((uint32_t *)src)[0 ] | ((uint32_t *)(src +128 ))[0 ];
@@ -2229,12 +2232,12 @@ static void cirrus_cursor_draw_line(VGACommonState *s1, uint8_t *d1, int scr_y) x2 = s->vga.last_scr_width; w = x2 - x1; palette = s->cirrus_hidden_palette; - color0 = s->vga.rgb_to_pixel (c6_to_8 (palette[0x0 *3 ]), -c6_to_8 (palette[0x0 *3 +1 ]), -c6_to_8 (palette[0x0 *3 +2 ])); - color1 = s->vga.rgb_to_pixel (c6_to_8 (palette[0xf *3 ]), -c6_to_8 (palette[0xf *3 +1 ]), -c6_to_8 (palette[0xf *3 +2 ])); + color0 =rgb_to_pixel32 (c6_to_8 (palette[0x0 *3 ]), +c6_to_8 (palette[0x0 *3 +1 ]), +c6_to_8 (palette[0x0 *3 +2 ])); + color1 =rgb_to_pixel32 (c6_to_8 (palette[0xf *3 ]), +c6_to_8 (palette[0xf *3 +1 ]), +c6_to_8 (palette[0xf *3 +2 ])); bpp =surface_bytes_per_pixel (surface); d1 += x1 * bpp;switch (surface_bits_per_pixel (surface)) {
hw/display/vga.c +10 -21
@@ -1011,13 +1011,6 @@ typedef void vga_draw_line_func(VGACommonState *s1, uint8_t *d,#include "vga_template.h" -static unsigned int rgb_to_pixel32_dup (unsigned int r,unsigned int g,unsigned b) -{ -unsigned int col; - col =rgb_to_pixel32 (r, g, b); -return col; -} -/* return true if the palette was modified */ static int update_palette16 (VGACommonState *s) {
@@ -1034,9 +1027,9 @@ static int update_palette16(VGACommonState *s) v = ((s->ar[VGA_ATC_COLOR_PAGE ] &0xc ) <<4 ) | (v &0x3f ); } v = v *3 ; - col = s->rgb_to_pixel (c6_to_8 (s->palette[v]), -c6_to_8 (s->palette[v +1 ]), -c6_to_8 (s->palette[v +2 ])); + col =rgb_to_pixel32 (c6_to_8 (s->palette[v]), +c6_to_8 (s->palette[v +1 ]), +c6_to_8 (s->palette[v +2 ]));if (col != palette[i]) { full_update =1 ; palette[i] = col;
@@ -1056,13 +1049,13 @@ static int update_palette256(VGACommonState *s) v =0 ;for (i =0 ; i <256 ; i++) {if (s->dac_8bit) { - col = s->rgb_to_pixel (s->palette[v], - s->palette[v +1 ], - s->palette[v +2 ]); + col =rgb_to_pixel32 (s->palette[v], + s->palette[v +1 ], + s->palette[v +2 ]); }else { - col = s->rgb_to_pixel (c6_to_8 (s->palette[v]), -c6_to_8 (s->palette[v +1 ]), -c6_to_8 (s->palette[v +2 ])); + col =rgb_to_pixel32 (c6_to_8 (s->palette[v]), +c6_to_8 (s->palette[v +1 ]), +c6_to_8 (s->palette[v +2 ])); }if (col != palette[i]) { full_update =1 ;
@@ -1245,7 +1238,6 @@ static void vga_draw_text(VGACommonState *s, int full_update) s->last_cw = cw; full_update =1 ; } - s->rgb_to_pixel = rgb_to_pixel32_dup; full_update |=update_palette16 (s); palette = s->last_palette; x_incr = cw *surface_bytes_per_pixel (surface);
@@ -1553,8 +1545,6 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)dpy_gfx_replace_surface (s->con, surface); } - s->rgb_to_pixel = rgb_to_pixel32_dup; -if (shift_control ==0 ) { full_update |=update_palette16 (s);if (s->sr[VGA_SEQ_CLOCK_MODE ] &8 ) {
@@ -1700,9 +1690,8 @@ static void vga_draw_blank(VGACommonState *s, int full_update)if (s->last_scr_width <=0 || s->last_scr_height <=0 )return ; - s->rgb_to_pixel = rgb_to_pixel32_dup;if (surface_bits_per_pixel (surface) ==8 ) { - val = s->rgb_to_pixel (0 ,0 ,0 ); + val =rgb_to_pixel32 (0 ,0 ,0 ); }else { val =0 ; }
hw/display/vga_int.h +0 -2
@@ -154,8 +154,6 @@ typedef struct VGACommonState {bool cursor_visible_phase;int64_t cursor_blink_time;uint32_t cursor_offset; -unsigned int (*rgb_to_pixel)(unsigned int r, -unsigned int g,unsigned b);const GraphicHwOps *hw_ops;bool full_update_text;bool full_update_gfx;
Signature · 1 line
1.8.3.1
PATCH v2 6/11 cirrus: Remove non-32bpp cursor drawing
In reply to Gerd HoffmannFrom: Benjamin Herrenschmidt <[email protected]>
We only draw cursor on non-shared surfaces (so it seems...) and these are always 32bpp
--- hw/display/cirrus_vga.c | 64 +++++++++++++----------- hw/display/cirrus_vga_template.h | 102 --------------------------------------- 2 files changed, 36 insertions(+), 130 deletions(-) delete mode 100644 hw/display/cirrus_vga_template.h
hw/display/cirrus_vga.c +36 -28
@@ -2171,20 +2171,44 @@ static void cirrus_cursor_invalidate(VGACommonState *s1) } } -#define DEPTH 8 -#include "cirrus_vga_template.h" - -#define DEPTH 16 -#include "cirrus_vga_template.h" - -#define DEPTH 32 -#include "cirrus_vga_template.h" +static void vga_draw_cursor_line (uint8_t *d1, +const uint8_t *src1, +int poffset,int w, +unsigned int color0, +unsigned int color1, +unsigned int color_xor) +{ +const uint8_t *plane0, *plane1; +int x, b0, b1; +uint8_t *d; + + d = d1; + plane0 = src1; + plane1 = src1 + poffset; +for (x =0 ; x < w; x++) { + b0 = (plane0[x >>3 ] >> (7 - (x &7 ))) &1 ; + b1 = (plane1[x >>3 ] >> (7 - (x &7 ))) &1 ; +switch (b0 | (b1 <<1 )) { +case 0 : +break ; +case 1 : + ((uint32_t *)d)[0 ] ^= color_xor; +break ; +case 2 : + ((uint32_t *)d)[0 ] = color0; +break ; +case 3 : + ((uint32_t *)d)[0 ] = color1; +break ; + } + d +=4 ; + } +}static void cirrus_cursor_draw_line (VGACommonState *s1,uint8_t *d1,int scr_y) {CirrusVGAState *s =container_of (s1, CirrusVGAState, vga); -DisplaySurface *surface =qemu_console_surface (s->vga.con); -int w, h, bpp, x1, x2, poffset; +int w, h, x1, x2, poffset;unsigned int color0, color1;const uint8_t *palette, *src;uint32_t content;
@@ -2238,24 +2262,8 @@ static void cirrus_cursor_draw_line(VGACommonState *s1, uint8_t *d1, int scr_y) color1 =rgb_to_pixel32 (c6_to_8 (palette[0xf *3 ]),c6_to_8 (palette[0xf *3 +1 ]),c6_to_8 (palette[0xf *3 +2 ])); - bpp =surface_bytes_per_pixel (surface); - d1 += x1 * bpp; -switch (surface_bits_per_pixel (surface)) { -default : -break ; -case 8 : -vga_draw_cursor_line_8 (d1, src, poffset, w, color0, color1,0xff ); -break ; -case 15 : -vga_draw_cursor_line_16 (d1, src, poffset, w, color0, color1,0x7fff ); -break ; -case 16 : -vga_draw_cursor_line_16 (d1, src, poffset, w, color0, color1,0xffff ); -break ; -case 32 : -vga_draw_cursor_line_32 (d1, src, poffset, w, color0, color1,0xffffff ); -break ; - } + d1 += x1 *4 ; +vga_draw_cursor_line (d1, src, poffset, w, color0, color1,0xffffff ); }/***************************************
hw/display/cirrus_vga_template.h deleted +0 -102
102 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 8/11 vga: Rename vga_template.h to vga-helpers.h
In reply to Gerd HoffmannFrom: Benjamin Herrenschmidt <[email protected]>
It's no longer a template, we only instanciate the file once.
Keep it a #included file so the functions remain static.
---
hw/display/{vga_template.h => vga-helpers.h} | 0
hw/display/vga.c | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename hw/display/{vga_template.h => vga-helpers.h} (100%)hw/display/vga-helpers.h renamed from hw/display/vga_template.h +0 -0
hw/display/vga.c +1 -1
@@ -1007,7 +1007,7 @@ void vga_mem_writeb(VGACommonState *s, hwaddr addr, uint32_t val)typedef void vga_draw_line_func (VGACommonState *s1,uint8_t *d,const uint8_t *s,int width); -#include "vga_template.h" +#include "vga-helpers.h" /* return true if the palette was modified */ static int update_palette16 (VGACommonState *s)
Signature · 1 line
1.8.3.1
PATCH v2 9/11 vga: Make fb endian a common state variable
In reply to Gerd HoffmannFrom: Benjamin Herrenschmidt <[email protected]>
And initialize it based on target endian
--- hw/display/vga.c | 32 +++++++++++++++++++------------- hw/display/vga_int.h | 1 + 2 files changed, 20 insertions(+), 13 deletions(-)
hw/display/vga.c +19 -13
@@ -1461,16 +1461,11 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)int disp_width, multi_scan, multi_run;uint8_t *d;uint32_t v, addr1, addr; -vga_draw_line_func *vga_draw_line; -#if defined(TARGET_WORDS_BIGENDIAN ) -static const bool big_endian_fb = true; -#else -static const bool big_endian_fb = false; -#endif -#if defined(HOST_WORDS_BIGENDIAN ) -static const bool byteswap = !big_endian_fb; +vga_draw_line_func *vga_draw_line =NULL ; +#ifdef HOST_WORDS_BIGENDIAN +bool byteswap = !s->big_endian_fb;#else -static const bool byteswap = big_endian_fb; +bool byteswap = s->big_endian_fb;#endif full_update |=update_basic_params (s);
@@ -1573,19 +1568,19 @@ static void vga_draw_graphic(VGACommonState *s, int full_update) bits =8 ;break ;case 15 : - v = big_endian_fb ?VGA_DRAW_LINE15_BE :VGA_DRAW_LINE15_LE ; + v = s->big_endian_fb ?VGA_DRAW_LINE15_BE :VGA_DRAW_LINE15_LE ; bits =16 ;break ;case 16 : - v = big_endian_fb ?VGA_DRAW_LINE16_BE :VGA_DRAW_LINE16_LE ; + v = s->big_endian_fb ?VGA_DRAW_LINE16_BE :VGA_DRAW_LINE16_LE ; bits =16 ;break ;case 24 : - v = big_endian_fb ?VGA_DRAW_LINE24_BE :VGA_DRAW_LINE24_LE ; + v = s->big_endian_fb ?VGA_DRAW_LINE24_BE :VGA_DRAW_LINE24_LE ; bits =24 ;break ;case 32 : - v = big_endian_fb ?VGA_DRAW_LINE32_BE :VGA_DRAW_LINE32_LE ; + v = s->big_endian_fb ?VGA_DRAW_LINE32_BE :VGA_DRAW_LINE32_LE ; bits =32 ;break ; }
@@ -2129,6 +2124,17 @@ void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate) s->update_retrace_info = vga_precise_update_retrace_info;break ; } + +/* +* Set default fb endian based on target, should probably be turned +* into a device attribute set by the machine/platform to remove +* all target endian dependencies from this file. +*/ +#ifdef TARGET_WORDS_BIGENDIAN + s->big_endian_fb = true; +#else + s->big_endian_fb = false; +#endif vga_dirty_log_start (s); }
hw/display/vga_int.h +1 -0
@@ -157,6 +157,7 @@ typedef struct VGACommonState {const GraphicHwOps *hw_ops;bool full_update_text;bool full_update_gfx; +bool big_endian_fb;/* hardware mouse cursor support */ uint32_t invalidated_y_table[VGA_MAX_HEIGHT /32 ];void (*cursor_invalidate)(struct VGACommonState *s);
Signature · 1 line
1.8.3.1
PATCH v2 11/11 vga-pci: add qext region to mmio
In reply to Gerd HoffmannAdd a qemu extented register range to the standard vga mmio bar. Right nowe there are two registers: One readonly register returning the size of the region (so we can easily add more registers there if needed) and one endian control register, so guests (especially ppc) can flip the framebuffer endianness as they need it.
--- docs/specs/standard-vga.txt | 9 ++++++ hw/display/vga-pci.c | 68 +++++++++++++++++++++++++++++++++++++++++++++ include/hw/i386/pc.h | 8 ++++++ 3 files changed, 85 insertions(+)
docs/specs/standard-vga.txt +9 -0
@@ -70,3 +70,12 @@ Likewise applies to the pci variant only for obvious reasons. 0500 - 0515 : bochs dispi interface registers, mapped flat without index/data ports. Use (index << 1) as offset for (16bit) register access. + +0600 - 0607 : qemu extended registers. qemu 2.2+ only. + The pci revision is 2 (or greater) when + these registers are present. The registers + are 32bit. + 0600 : qemu extended register region size, in bytes. + 0604 : framebuffer endianness register. + - 0xbebebebe indicates big endian. + - 0x1e1e1e1e indicates little endian.
hw/display/vga-pci.c +68 -0
113 lines not on this page · raw message
include/hw/i386/pc.h +8 -0
@@ -306,6 +306,14 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); .driver = "intel-hda",\ .property = "old_msi_addr",\ .value = "on",\ + },{\ + .driver = "VGA",\ + .property = "qext",\ + .value = "off",\ + },{\ + .driver = "secondary-vga",\ + .property = "qext",\ + .value = "off",\ }#define PC_COMPAT_2_0 \
Signature · 1 line
1.8.3.1
PATCH v2 2/11 vga: Remove remainder of old conversion cruft
In reply to Gerd HoffmannFrom: Benjamin Herrenschmidt <[email protected]>
All the macros used to generate different versions of vga_template.h are now unnecessary, take them all out and remove the _32 suffix from most functions.
--- hw/display/vga.c | 46 +++++----- hw/display/vga_template.h | 227 +++++++++++++++------------------------------- 2 files changed, 95 insertions(+), 178 deletions(-)
hw/display/vga.c +22 -24
@@ -1009,10 +1009,8 @@ void vga_mem_writeb(VGACommonState *s, hwaddr addr, uint32_t val)typedef void vga_draw_line_func (VGACommonState *s1,uint8_t *d,const uint8_t *s,int width); -#define DEPTH 32#include "vga_template.h" -static unsigned int rgb_to_pixel32_dup (unsigned int r,unsigned int g,unsigned b) {unsigned int col;
@@ -1311,19 +1309,19 @@ static void vga_draw_text(VGACommonState *s, int full_update) bgcol = palette[cattr >>4 ]; fgcol = palette[cattr &0x0f ];if (cw ==16 ) { -vga_draw_glyph16_32 (d1, linesize, - font_ptr, cheight, fgcol, bgcol); +vga_draw_glyph16 (d1, linesize, + font_ptr, cheight, fgcol, bgcol); }else if (cw !=9 ) { -vga_draw_glyph8_32 (d1, linesize, - font_ptr, cheight, fgcol, bgcol); +vga_draw_glyph8 (d1, linesize, + font_ptr, cheight, fgcol, bgcol); }else { dup9 =0 ;if (ch >=0xb0 && ch <=0xdf && (s->ar[VGA_ATC_MODE ] &0x04 )) { dup9 =1 ; } -vga_draw_glyph9_32 (d1, linesize, - font_ptr, cheight, fgcol, bgcol, dup9); +vga_draw_glyph9 (d1, linesize, + font_ptr, cheight, fgcol, bgcol, dup9); } if (src == cursor_ptr && !(s->cr[VGA_CRTC_CURSOR_START] & 0x20) &&
@@ -1339,14 +1337,14 @@ static void vga_draw_text(VGACommonState *s, int full_update) h = line_last - line_start +1 ; d = d1 + linesize * line_start;if (cw ==16 ) { -vga_draw_glyph16_32 (d, linesize, - cursor_glyph, h, fgcol, bgcol); +vga_draw_glyph16 (d, linesize, + cursor_glyph, h, fgcol, bgcol); }else if (cw !=9 ) { -vga_draw_glyph8_32 (d, linesize, - cursor_glyph, h, fgcol, bgcol); +vga_draw_glyph8 (d, linesize, + cursor_glyph, h, fgcol, bgcol); }else { -vga_draw_glyph9_32 (d, linesize, - cursor_glyph, h, fgcol, bgcol,1 ); +vga_draw_glyph9 (d, linesize, + cursor_glyph, h, fgcol, bgcol,1 ); } } }
@@ -1384,16 +1382,16 @@ enum { };static vga_draw_line_func *const vga_draw_line_table[VGA_DRAW_LINE_NB ] = { - vga_draw_line2_32, - vga_draw_line2d2_32, - vga_draw_line4_32, - vga_draw_line4d2_32, - vga_draw_line8d2_32, - vga_draw_line8_32, - vga_draw_line15_32, - vga_draw_line16_32, - vga_draw_line24_32, - vga_draw_line32_32, + vga_draw_line2, + vga_draw_line2d2, + vga_draw_line4, + vga_draw_line4d2, + vga_draw_line8d2, + vga_draw_line8, + vga_draw_line15, + vga_draw_line16, + vga_draw_line24, + vga_draw_line32, };static int vga_get_bpp (VGACommonState *s)
hw/display/vga_template.h +73 -154
414 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 3/11 vga: Separate LE and BE conversion functions
In reply to Gerd HoffmannFrom: Benjamin Herrenschmidt <[email protected]>
Provide different functions for converting from an LE vs a BE framebuffer. We cannot rely on the simple cases always being shared surfaces since cirrus will need to always shadow for cursor emulation, so we need the full set of functions to be able to later handle runtime switching.
--- hw/display/vga.c | 43 +++++++++++------- hw/display/vga_template.h | 109 +++++++++++++++++++++++++++++++++++----------- 2 files changed, 112 insertions(+), 40 deletions(-)
hw/display/vga.c +28 -15
@@ -1374,10 +1374,14 @@ enum {VGA_DRAW_LINE4D2 ,VGA_DRAW_LINE8D2 ,VGA_DRAW_LINE8 , -VGA_DRAW_LINE15 , -VGA_DRAW_LINE16 , -VGA_DRAW_LINE24 , -VGA_DRAW_LINE32 , +VGA_DRAW_LINE15_LE , +VGA_DRAW_LINE16_LE , +VGA_DRAW_LINE24_LE , +VGA_DRAW_LINE32_LE , +VGA_DRAW_LINE15_BE , +VGA_DRAW_LINE16_BE , +VGA_DRAW_LINE24_BE , +VGA_DRAW_LINE32_BE , VGA_DRAW_LINE_NB, };
@@ -1388,10 +1392,14 @@ static vga_draw_line_func * const vga_draw_line_table[VGA_DRAW_LINE_NB] = { vga_draw_line4d2, vga_draw_line8d2, vga_draw_line8, - vga_draw_line15, - vga_draw_line16, - vga_draw_line24, - vga_draw_line32, + vga_draw_line15_le, + vga_draw_line16_le, + vga_draw_line24_le, + vga_draw_line32_le, + vga_draw_line15_be, + vga_draw_line16_be, + vga_draw_line24_be, + vga_draw_line32_be, };static int vga_get_bpp (VGACommonState *s)
@@ -1464,10 +1472,15 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)uint8_t *d;uint32_t v, addr1, addr;vga_draw_line_func *vga_draw_line; -#if defined(HOST_WORDS_BIGENDIAN ) == defined(TARGET_WORDS_BIGENDIAN ) -static const bool byteswap = false; +#if defined(TARGET_WORDS_BIGENDIAN ) +static const bool big_endian_fb = true;#else -static const bool byteswap = true; +static const bool big_endian_fb = false; +#endif +#if defined(HOST_WORDS_BIGENDIAN ) +static const bool byteswap = !big_endian_fb; +#else +static const bool byteswap = big_endian_fb;#endif full_update |=update_basic_params (s);
@@ -1572,19 +1585,19 @@ static void vga_draw_graphic(VGACommonState *s, int full_update) bits =8 ;break ;case 15 : - v =VGA_DRAW_LINE15 ; + v = big_endian_fb ?VGA_DRAW_LINE15_BE :VGA_DRAW_LINE15_LE ; bits =16 ;break ;case 16 : - v =VGA_DRAW_LINE16 ; + v = big_endian_fb ?VGA_DRAW_LINE16_BE :VGA_DRAW_LINE16_LE ; bits =16 ;break ;case 24 : - v =VGA_DRAW_LINE24 ; + v = big_endian_fb ?VGA_DRAW_LINE24_BE :VGA_DRAW_LINE24_LE ; bits =24 ;break ;case 32 : - v =VGA_DRAW_LINE32 ; + v = big_endian_fb ?VGA_DRAW_LINE32_BE :VGA_DRAW_LINE32_LE ; bits =32 ;break ; }
hw/display/vga_template.h +84 -25
168 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 10/11 vga: Add endian control register
In reply to Gerd HoffmannFrom: Benjamin Herrenschmidt <[email protected]>
Include the endian state in the migration stream as an optional subsection which we only include when the endian isn't the default, thus enabling backward compatibility of the common case.
Changes by kraxel:
* Remove bochs dispi interface changes. We'll do that in a different way to make sure we don't conflict with possible future bochs dispi interface changes.
* keep live migration bits.
--- hw/display/vga.c | 41 +++++++++++++++++++++++++++++++++++++---- hw/display/vga_int.h | 2 ++ 2 files changed, 39 insertions(+), 4 deletions(-)
hw/display/vga.c +37 -4
@@ -1508,7 +1508,8 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)if (s->line_offset != s->last_line_offset || disp_width != s->last_width || height != s->last_height || - s->last_depth != depth) { + s->last_depth != depth || + s->last_byteswap != byteswap) {if (depth ==32 || (depth ==16 && !byteswap)) {pixman_format_code_t format =qemu_default_pixman_format (depth, !byteswap);
@@ -1526,6 +1527,7 @@ static void vga_draw_graphic(VGACommonState *s, int full_update) s->last_height = height; s->last_line_offset = s->line_offset; s->last_depth = depth; + s->last_byteswap = byteswap; full_update =1 ; } else if (is_buffer_shared(surface) && (full_update || surface_data(surface) != s->vram_ptr
@@ -1789,6 +1791,7 @@ void vga_common_reset(VGACommonState *s) s->cursor_start =0 ; s->cursor_end =0 ; s->cursor_offset =0 ; + s->big_endian_fb = s->default_endian_fb;memset (s->invalidated_y_table,'\0' ,sizeof (s->invalidated_y_table));memset (s->last_palette,'\0' ,sizeof (s->last_palette));memset (s->last_ch_attr,'\0' ,sizeof (s->last_ch_attr));
@@ -2020,6 +2023,28 @@ static int vga_common_post_load(void *opaque, int version_id)return 0 ; } +static bool vga_endian_state_needed (void *opaque) +{ +VGACommonState *s = opaque; + +/* +* Only send the endian state if it's different from the +* default one, thus ensuring backward compatibility for +* migration of the common case +*/ +return s->default_endian_fb != s->big_endian_fb; +} + +const VMStateDescription vmstate_vga_endian = { + .name ="vga.endian" , + .version_id =1 , + .minimum_version_id =1 , + .fields = (VMStateField []) { +VMSTATE_BOOL (big_endian_fb, VGACommonState), +VMSTATE_END_OF_LIST () + } +}; +const VMStateDescription vmstate_vga_common = { .name ="vga" , .version_id =2 ,
@@ -2056,6 +2081,14 @@ const VMStateDescription vmstate_vga_common = { VMSTATE_UINT32(vbe_line_offset, VGACommonState), VMSTATE_UINT32(vbe_bank_mask, VGACommonState),VMSTATE_END_OF_LIST () + }, + .subsections = (VMStateSubsection []) { + { + .vmsd = &vmstate_vga_endian, + .needed = vga_endian_state_needed, + }, { +/* empty */ + } } };
@@ -2126,14 +2159,14 @@ void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate) }/* -* Set default fb endian based on target, should probably be turned +* Set default fb endian based on target, could probably be turned * into a device attribute set by the machine/platform to remove * all target endian dependencies from this file. */ #ifdef TARGET_WORDS_BIGENDIAN - s->big_endian_fb = true; + s->default_endian_fb = true;#else - s->big_endian_fb = false; + s->default_endian_fb = false;#endif vga_dirty_log_start (s); }
hw/display/vga_int.h +2 -0
@@ -150,6 +150,7 @@ typedef struct VGACommonState {uint32_t last_width, last_height;/* in chars or pixels */ uint32_t last_scr_width, last_scr_height;/* in pixels */ uint32_t last_depth;/* in bits */ +bool last_byteswap;uint8_t cursor_start, cursor_end;bool cursor_visible_phase;int64_t cursor_blink_time;
@@ -158,6 +159,7 @@ typedef struct VGACommonState {bool full_update_text;bool full_update_gfx;bool big_endian_fb; +bool default_endian_fb;/* hardware mouse cursor support */ uint32_t invalidated_y_table[VGA_MAX_HEIGHT /32 ];void (*cursor_invalidate)(struct VGACommonState *s);
Signature · 1 line
1.8.3.1
v2 cover vga: cleanup and endianness patch series
Hi,
Here comes v2 of the vga patches, this time the two patch series combined into one. Fixed issues found by David Gibson in review, fixed some codestyle issues. Nothing major. Should be ready for merge now, /me plans to send a pull req later this week, possibly excluding patch #11 as I'd like to have ppc64le testing feedback for that one first.
please review,
Gerd
Benjamin Herrenschmidt (10):
vga: Start cutting out non-32bpp conversion support
vga: Remove remainder of old conversion cruft
vga: Separate LE and BE conversion functions
vga: Remove rgb_to_pixel indirection
vga: Simplify vga_draw_blank() a bit
cirrus: Remove non-32bpp cursor drawing
vga: Remove some "should be done in BIOS" comments
vga: Rename vga_template.h to vga-helpers.h
vga: Make fb endian a common state variable
vga: Add endian control register
Gerd Hoffmann (1):
vga-pci: add qext region to mmio
docs/specs/standard-vga.txt | 9 +
hw/display/cirrus_vga.c | 79 +++---
hw/display/cirrus_vga_template.h | 102 -------
hw/display/{vga_template.h => vga-helpers.h} | 318 +++++++++++-----------
hw/display/vga-pci.c | 68 +++++
hw/display/vga.c | 382 +++++++--------------------
hw/display/vga_int.h | 5 +-
include/hw/i386/pc.h | 8 +
8 files changed, 381 insertions(+), 590 deletions(-)
delete mode 100644 hw/display/cirrus_vga_template.h
rename hw/display/{vga_template.h => vga-helpers.h} (52%)Signature · 1 line
1.8.3.1
PATCH v2 5/11 vga: Simplify vga_draw_blank() a bit
From: Benjamin Herrenschmidt <[email protected]>
The test for surface_bits_per_pixel() isn't necessary anymore, the 8bpp case never happens.
--- hw/display/vga.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
hw/display/vga.c +2 -7
@@ -1682,7 +1682,7 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)static void vga_draw_blank (VGACommonState *s,int full_update) {DisplaySurface *surface =qemu_console_surface (s->con); -int i, w, val; +int i, w;uint8_t *d;if (!full_update)
@@ -1690,15 +1690,10 @@ static void vga_draw_blank(VGACommonState *s, int full_update)if (s->last_scr_width <=0 || s->last_scr_height <=0 )return ; -if (surface_bits_per_pixel (surface) ==8 ) { - val =rgb_to_pixel32 (0 ,0 ,0 ); - }else { - val =0 ; - } w = s->last_scr_width *surface_bytes_per_pixel (surface); d =surface_data (surface);for (i =0 ; i < s->last_scr_height; i++) { -memset (d, val, w); +memset (d,0 , w); d +=surface_stride (surface); } dpy_gfx_update(s->con, 0, 0,
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH v2 03/11] vga: Separate LE and BE conversion functions
In reply to Gerd HoffmannQuoted 10 lines · Gerd Hoffmann
From: Benjamin Herrenschmidt <[email protected]>
Provide different functions for converting from an LE vs a BE framebuffer. We cannot rely on the simple cases always being shared surfaces since cirrus will need to always shadow for cursor emulation, so we need the full set of functions to be able to later handle runtime switching.
Signed-off-by Benjamin Herrenschmidt <[email protected]>\Signed-off-by Gerd Hoffmann <[email protected]>
[snip]
hw/display/vga.c static void vga_draw_graphic(VGACommonState *s, int full_update) · line 1594
Quoted 13 lines
hw/display/vga.c +2
-2@@ -1572,19 +1585,19 @@ static void vga_draw_graphic(VGACommonState *s, int full_update) bits =8 ;break ;case 15 : - v =VGA_DRAW_LINE15 ; + v = big_endian_fb ?VGA_DRAW_LINE15_BE :VGA_DRAW_LINE15_LE ; bits =16 ;break ;case 16 : - v =VGA_DRAW_LINE16 ; + v = big_endian_fb ?VGA_DRAW_LINE16_BE :VGA_DRAW_LINE16_LE ; bits =16 ;break ;
So, v1 changed both of these cases to bits = 15, which looked wrong for case 16. v2 changes neither, which looks wrong for case 15. Or is there a reason it should be 16 for case 15?
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH v2 10/11] vga: Add endian control register
In reply to Gerd HoffmannQuoted 8 lines · Gerd Hoffmann
From: Benjamin Herrenschmidt <[email protected]>
Include the endian state in the migration stream as an optional subsection which we only include when the endian isn't the default, thus enabling backward compatibility of the common case.
Signed-off-by Benjamin Herrenschmidt <[email protected]>
Quoted 7 lines
Changes by kraxel:
* Remove bochs dispi interface changes. We'll do that in a different way to make sure we don't conflict with possible future bochs dispi interface changes.
* keep live migration bits.Signed-off-by Gerd Hoffmann <[email protected]>
short desc doesn't quite seem to match the patch contents. Otherwise
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH v2 03/11] vga: Separate LE and BE conversion functions
In reply to David GibsonHi,
Quoted 11 lines
hw/display/vga.c static void vga_draw_graphic(VGACommonState *s, int full_update) · line 1594
Quoted 10 lines
case 15:hw/display/vga.c +2
-2- v =VGA_DRAW_LINE15 ; + v = big_endian_fb ?VGA_DRAW_LINE15_BE :VGA_DRAW_LINE15_LE ; bits =16 ;break ;case 16 : - v =VGA_DRAW_LINE16 ; + v = big_endian_fb ?VGA_DRAW_LINE16_BE :VGA_DRAW_LINE16_LE ; bits =16 ;break ;
Quoted 3 lines
So, v1 changed both of these cases to bits = 15, which looked wrong for case 16. v2 changes neither, which looks wrong for case 15. Or is there a reason it should be 16 for case 15?
It is correct. The '15' is the color depth, and 'bits' is the number of bits per pixel, which is 16 because the color format uses two bytes per pixel and one of the bits is unused.
cheers,
Gerd
David Gibson
Reviewed-byRe: [Qemu-devel] [PATCH v2 03/11] vga: Separate LE and BE conversion functions
Quoted 13 lines · Gerd Hoffmann
Hi,
Quoted 11 lines
Quoted 10 lines
case 15:hw/display/vga.c +2
-2- v =VGA_DRAW_LINE15 ; + v = big_endian_fb ?VGA_DRAW_LINE15_BE :VGA_DRAW_LINE15_LE ; bits =16 ;break ;case 16 : - v =VGA_DRAW_LINE16 ; + v = big_endian_fb ?VGA_DRAW_LINE16_BE :VGA_DRAW_LINE16_LE ; bits =16 ;break ;
Quoted 7 lines
Quoted 3 lines
So, v1 changed both of these cases to bits = 15, which looked wrong for case 16. v2 changes neither, which looks wrong for case 15. Or is there a reason it should be 16 for case 15?
It is correct. The '15' is the color depth, and 'bits' is the number of bits per pixel, which is 16 because the color format uses two bytes per pixel and one of the bits is unused.
Ok, then:
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH v2 10/11] vga: Add endian control register
In reply to David GibsonQuoted 15 lines · David Gibson
Quoted 14 lines · Gerd Hoffmann
From: Benjamin Herrenschmidt <[email protected]>
Include the endian state in the migration stream as an optional subsection which we only include when the endian isn't the default, thus enabling backward compatibility of the common case.
Signed-off-by Benjamin Herrenschmidt <[email protected]>Changes by kraxel:
* Remove bochs dispi interface changes. We'll do that in a different way to make sure we don't conflict with possible future bochs dispi interface changes.
* keep live migration bits.
Quoted 3 lines
Quoted 1 line
Signed-off-by Gerd Hoffmann <[email protected]>short desc doesn't quite seem to match the patch contents. Otherwise
Indeed, with my changes it isn't correct any more. Retitled to say "vga: Add endian to vmstate".
cheers,
Gerd