[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [qemu] Re-calculate color_table after color depth reset.
# HG changeset patch # User chris@xxxxxxxxxxxxxxxxxxxxxxxx # Node ID 060025203f542fcad5ee2fef73370bbacba556ee # Parent 42aa63188a88d8c384a74e42163963bb84f974af [qemu] Re-calculate color_table after color depth reset. VNC client may reset color depth after connection, so if we don't re-calculate color_table, monitor/console's background is abnormal. Signed-off-by: Yang Xiaowei <xiaowei.yang@xxxxxxxxx> Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx> --- tools/ioemu/console.c | 19 ++++++++------ tools/ioemu/patches/vnc-fixes | 43 +++++++++++++++++--------------- tools/ioemu/patches/vnc-start-vncviewer | 10 +++---- tools/ioemu/vl.h | 1 tools/ioemu/vnc.c | 5 ++- 5 files changed, 46 insertions(+), 32 deletions(-) diff -r 42aa63188a88 -r 060025203f54 tools/ioemu/console.c --- a/tools/ioemu/console.c Wed Jul 26 13:41:10 2006 +0100 +++ b/tools/ioemu/console.c Wed Jul 26 14:20:13 2006 +0100 @@ -954,11 +954,21 @@ int is_graphic_console(void) return !active_console->text_console; } +void set_color_table(DisplayState *ds) +{ + int i, j; + for(j = 0; j < 2; j++) { + for(i = 0; i < 8; i++) { + color_table[j][i] = + col_expand(ds, vga_get_color(ds, color_table_rgb[j][i])); + } + } +} + CharDriverState *text_console_init(DisplayState *ds) { CharDriverState *chr; TextConsole *s; - int i,j; static int color_inited; chr = qemu_mallocz(sizeof(CharDriverState)); @@ -976,12 +986,7 @@ CharDriverState *text_console_init(Displ if (!color_inited) { color_inited = 1; - for(j = 0; j < 2; j++) { - for(i = 0; i < 8; i++) { - color_table[j][i] = col_expand(s->ds, - vga_get_color(s->ds, color_table_rgb[j][i])); - } - } + set_color_table(ds); } s->y_displayed = 0; s->y_base = 0; diff -r 42aa63188a88 -r 060025203f54 tools/ioemu/patches/vnc-fixes --- a/tools/ioemu/patches/vnc-fixes Wed Jul 26 13:41:10 2006 +0100 +++ b/tools/ioemu/patches/vnc-fixes Wed Jul 26 14:20:13 2006 +0100 @@ -1,7 +1,7 @@ Index: ioemu/vl.c Index: ioemu/vl.c =================================================================== --- ioemu.orig/vl.c 2006-07-26 13:39:18.439320475 +0100 -+++ ioemu/vl.c 2006-07-26 13:39:18.499314057 +0100 ++++ ioemu/vl.c 2006-07-26 14:13:44.488196651 +0100 @@ -6003,8 +6003,10 @@ kernel_filename, kernel_cmdline, initrd_filename, timeoffset); @@ -18,7 +18,7 @@ Index: ioemu/vnc.c Index: ioemu/vnc.c =================================================================== --- ioemu.orig/vnc.c 2006-07-26 13:39:18.437320689 +0100 -+++ ioemu/vnc.c 2006-07-26 13:39:18.500313950 +0100 ++++ ioemu/vnc.c 2006-07-26 14:16:51.636538318 +0100 @@ -3,6 +3,7 @@ * * Copyright (C) 2006 Anthony Liguori <anthony@xxxxxxxxxxxxx> @@ -112,7 +112,7 @@ Index: ioemu/vnc.c } static void vnc_framebuffer_update(VncState *vs, int x, int y, int w, int h, -@@ -109,11 +142,15 @@ +@@ -109,16 +142,23 @@ static void vnc_dpy_resize(DisplayState *ds, int w, int h) { VncState *vs = ds->opaque; @@ -129,7 +129,16 @@ Index: ioemu/vnc.c fprintf(stderr, "vnc: memory allocation failed\n"); exit(1); } -@@ -131,6 +168,10 @@ + +- ds->depth = vs->depth * 8; ++ if (ds->depth != vs->depth * 8) { ++ ds->depth = vs->depth * 8; ++ set_color_table(ds); ++ } + ds->width = w; + ds->height = h; + ds->linesize = w * vs->depth; +@@ -131,6 +171,10 @@ vs->width = ds->width; vs->height = ds->height; } @@ -140,7 +149,7 @@ Index: ioemu/vnc.c } static void send_framebuffer_update_raw(VncState *vs, int x, int y, int w, int h) -@@ -215,8 +256,20 @@ +@@ -215,8 +259,20 @@ int y = 0; int pitch = ds->linesize; VncState *vs = ds->opaque; @@ -162,7 +171,7 @@ Index: ioemu/vnc.c if (dst_y > src_y) { y = h - 1; -@@ -238,31 +291,34 @@ +@@ -238,31 +294,34 @@ old_row += pitch; } @@ -209,16 +218,16 @@ Index: ioemu/vnc.c { VncState *vs = opaque; int64_t now = qemu_get_clock(rt_clock); -@@ -274,11 +330,12 @@ +@@ -274,11 +333,12 @@ uint64_t width_mask; int n_rectangles; int saved_offset; - int has_dirty = 0; +- +- width_mask = (1ULL << (vs->width / 16)) - 1; + int maxx, maxy; + int tile_bytes = vs->depth * DP2X(vs, 1); -- width_mask = (1ULL << (vs->width / 16)) - 1; -- - if (vs->width == 1024) + if (vs->width != DP2X(vs, DIRTY_PIXEL_BITS)) + width_mask = (1ULL << X2DP_UP(vs, vs->ds->width)) - 1; @@ -226,7 +235,7 @@ Index: ioemu/vnc.c width_mask = ~(0ULL); /* Walk through the dirty map and eliminate tiles that -@@ -294,16 +351,18 @@ +@@ -294,16 +354,18 @@ ptr = row; old_ptr = old_row; @@ -253,7 +262,7 @@ Index: ioemu/vnc.c } } -@@ -311,7 +370,8 @@ +@@ -311,7 +373,8 @@ old_row += vs->ds->linesize; } @@ -263,7 +272,7 @@ Index: ioemu/vnc.c goto out; /* Count rectangles */ -@@ -321,40 +381,61 @@ +@@ -321,40 +384,61 @@ saved_offset = vs->output.offset; vnc_write_u16(vs, 0); @@ -337,7 +346,7 @@ Index: ioemu/vnc.c static void vnc_timer_init(VncState *vs) { if (vs->timer == NULL) { -@@ -365,8 +446,6 @@ +@@ -365,8 +449,6 @@ static void vnc_dpy_refresh(DisplayState *ds) { @@ -346,7 +355,7 @@ Index: ioemu/vnc.c vga_hw_update(); } -@@ -402,7 +481,7 @@ +@@ -402,7 +484,7 @@ static void buffer_reset(Buffer *buffer) { @@ -355,7 +364,7 @@ Index: ioemu/vnc.c } static void buffer_append(Buffer *buffer, const void *data, size_t len) -@@ -443,12 +522,12 @@ +@@ -443,12 +525,12 @@ if (!ret) return; @@ -371,7 +380,7 @@ Index: ioemu/vnc.c } static void vnc_read_when(VncState *vs, VncReadEvent *func, size_t expecting) -@@ -480,11 +559,11 @@ +@@ -480,11 +562,11 @@ return; if (!ret) { @@ -386,7 +395,7 @@ Index: ioemu/vnc.c } } -@@ -492,9 +571,9 @@ +@@ -492,9 +574,9 @@ { buffer_reserve(&vs->output, len); @@ -399,7 +408,7 @@ Index: ioemu/vnc.c buffer_append(&vs->output, data, len); } -@@ -616,24 +695,25 @@ +@@ -616,24 +698,25 @@ do_key_event(vs, down, sym); } @@ -438,7 +447,7 @@ Index: ioemu/vnc.c } static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) -@@ -690,8 +770,6 @@ +@@ -690,8 +773,6 @@ vnc_client_error(vs); vnc_dpy_resize(vs->ds, vs->ds->width, vs->ds->height); @@ -447,7 +456,7 @@ Index: ioemu/vnc.c vga_hw_invalidate(); vga_hw_update(); -@@ -848,11 +926,11 @@ +@@ -848,11 +929,11 @@ vnc_write(vs, "RFB 003.003\n", 12); vnc_flush(vs); vnc_read_when(vs, protocol_version, 12); @@ -461,7 +470,7 @@ Index: ioemu/vnc.c } } -@@ -909,17 +987,15 @@ +@@ -909,17 +990,15 @@ exit(1); } diff -r 42aa63188a88 -r 060025203f54 tools/ioemu/patches/vnc-start-vncviewer --- a/tools/ioemu/patches/vnc-start-vncviewer Wed Jul 26 13:41:10 2006 +0100 +++ b/tools/ioemu/patches/vnc-start-vncviewer Wed Jul 26 14:20:13 2006 +0100 @@ -1,8 +1,8 @@ Index: ioemu/vnc.c Index: ioemu/vnc.c =================================================================== ---- ioemu.orig/vnc.c 2006-07-26 13:39:18.500313950 +0100 -+++ ioemu/vnc.c 2006-07-26 13:39:18.648298117 +0100 -@@ -999,3 +999,25 @@ +--- ioemu.orig/vnc.c 2006-07-26 14:16:51.636538318 +0100 ++++ ioemu/vnc.c 2006-07-26 14:18:15.612266329 +0100 +@@ -1002,3 +1002,25 @@ vnc_dpy_resize(vs->ds, 640, 400); } @@ -30,8 +30,8 @@ Index: ioemu/vnc.c +} Index: ioemu/vl.c =================================================================== ---- ioemu.orig/vl.c 2006-07-26 13:39:18.499314057 +0100 -+++ ioemu/vl.c 2006-07-26 13:39:18.650297903 +0100 +--- ioemu.orig/vl.c 2006-07-26 14:13:44.488196651 +0100 ++++ ioemu/vl.c 2006-07-26 14:18:15.615265998 +0100 @@ -121,6 +121,7 @@ int bios_size; static DisplayState display_state; @@ -93,9 +93,9 @@ Index: ioemu/vl.c sdl_display_init(ds, full_screen); Index: ioemu/vl.h =================================================================== ---- ioemu.orig/vl.h 2006-07-26 13:39:18.030364229 +0100 -+++ ioemu/vl.h 2006-07-26 13:39:18.651297796 +0100 -@@ -732,6 +732,7 @@ +--- ioemu.orig/vl.h 2006-07-26 14:18:05.490383989 +0100 ++++ ioemu/vl.h 2006-07-26 14:18:15.616265887 +0100 +@@ -733,6 +733,7 @@ /* vnc.c */ void vnc_display_init(DisplayState *ds, int display); diff -r 42aa63188a88 -r 060025203f54 tools/ioemu/vl.h --- a/tools/ioemu/vl.h Wed Jul 26 13:41:10 2006 +0100 +++ b/tools/ioemu/vl.h Wed Jul 26 14:20:13 2006 +0100 @@ -301,6 +301,7 @@ int is_graphic_console(void); int is_graphic_console(void); CharDriverState *text_console_init(DisplayState *ds); void console_select(unsigned int index); +void set_color_table(DisplayState *ds); /* serial ports */ diff -r 42aa63188a88 -r 060025203f54 tools/ioemu/vnc.c --- a/tools/ioemu/vnc.c Wed Jul 26 13:41:10 2006 +0100 +++ b/tools/ioemu/vnc.c Wed Jul 26 14:20:13 2006 +0100 @@ -155,7 +155,10 @@ static void vnc_dpy_resize(DisplayState exit(1); } - ds->depth = vs->depth * 8; + if (ds->depth != vs->depth * 8) { + ds->depth = vs->depth * 8; + set_color_table(ds); + } ds->width = w; ds->height = h; ds->linesize = w * vs->depth; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |