ia64/xen-unstable

changeset 17281:683d7a6294dd

ioemu: Allow VNC buffer sharing when linesize != width * depth

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Mar 20 10:48:21 2008 +0000 (2008-03-20)
parents 5c940fbeb82c
children 8f96b9d78ff1
files tools/ioemu/hw/vga.c tools/ioemu/vnc.c
line diff
     1.1 --- a/tools/ioemu/hw/vga.c	Thu Mar 20 10:47:17 2008 +0000
     1.2 +++ b/tools/ioemu/hw/vga.c	Thu Mar 20 10:48:21 2008 +0000
     1.3 @@ -1148,7 +1148,7 @@ static void vga_draw_text(VGAState *s, i
     1.4          cw != s->last_cw || cheight != s->last_ch) {
     1.5          s->last_scr_width = width * cw;
     1.6          s->last_scr_height = height * cheight;
     1.7 -        dpy_resize(s->ds, s->last_scr_width, s->last_scr_height, s->last_scr_width * (depth / 8));
     1.8 +        dpy_resize(s->ds, s->last_scr_width, s->last_scr_height, s->last_scr_width * (s->ds->depth / 8));
     1.9          s->last_width = width;
    1.10          s->last_height = height;
    1.11          s->last_ch = cheight;
    1.12 @@ -1571,7 +1571,7 @@ static void vga_draw_graphic(VGAState *s
    1.13      vga_draw_line = vga_draw_line_table[v * NB_DEPTHS + get_depth_index(s->ds)];
    1.14      if (disp_width != s->last_width ||
    1.15          height != s->last_height) {
    1.16 -        dpy_resize(s->ds, disp_width, height, disp_width * (depth / 8));
    1.17 +        dpy_resize(s->ds, disp_width, height, s->line_offset);
    1.18          s->last_scr_width = disp_width;
    1.19          s->last_scr_height = height;
    1.20          s->last_width = disp_width;
     2.1 --- a/tools/ioemu/vnc.c	Thu Mar 20 10:47:17 2008 +0000
     2.2 +++ b/tools/ioemu/vnc.c	Thu Mar 20 10:48:21 2008 +0000
     2.3 @@ -369,20 +369,17 @@ static void vnc_dpy_resize(DisplayState 
     2.4      VncState *vs = ds->opaque;
     2.5      int o;
     2.6  
     2.7 -    if (linesize != w * vs->depth)
     2.8 -        ds->shared_buf = 0;
     2.9 -
    2.10      if (!ds->shared_buf) {
    2.11          if (allocated)
    2.12 -            ds->data = realloc(ds->data, w * h * vs->depth);
    2.13 +            ds->data = realloc(ds->data,  h * linesize);
    2.14          else
    2.15 -            ds->data = malloc(w * h * vs->depth);
    2.16 +            ds->data = malloc(h * linesize);
    2.17          allocated = 1;
    2.18      } else if (allocated) {
    2.19          free(ds->data);
    2.20          allocated = 0;
    2.21      }
    2.22 -    vs->old_data = realloc(vs->old_data, w * h * vs->depth);
    2.23 +    vs->old_data = realloc(vs->old_data, h * linesize);
    2.24      vs->dirty_row = realloc(vs->dirty_row, h * sizeof(vs->dirty_row[0]));
    2.25      vs->update_row = realloc(vs->update_row, h * sizeof(vs->dirty_row[0]));
    2.26  
    2.27 @@ -399,7 +396,7 @@ static void vnc_dpy_resize(DisplayState 
    2.28      size_changed = ds->width != w || ds->height != h;
    2.29      ds->width = w;
    2.30      ds->height = h;
    2.31 -    ds->linesize = w * vs->depth;
    2.32 +    ds->linesize = linesize;
    2.33      if (vs->csock != -1 && vs->has_resize && size_changed) {
    2.34          vs->width = ds->width;
    2.35          vs->height = ds->height;
    2.36 @@ -2494,6 +2491,7 @@ void vnc_display_init(DisplayState *ds)
    2.37  
    2.38      vs->ds->width = 640;
    2.39      vs->ds->height = 400;
    2.40 +    vs->ds->linesize = 640 * 4;
    2.41      vnc_dpy_colourdepth(vs->ds, 24);
    2.42  }
    2.43