Revision c78f7137

b/hw/arm/musicpal.c
462 462
    uint32_t irqctrl;
463 463
    uint32_t page;
464 464
    uint32_t page_off;
465
    DisplayState *ds;
465
    QemuConsole *con;
466 466
    uint8_t video_ram[128*64/8];
467 467
} musicpal_lcd_state;
468 468

  
......
483 483
        (musicpal_lcd_state *s, int x, int y, type col) \
484 484
{ \
485 485
    int dx, dy; \
486
    type *pixel = &((type *) ds_get_data(s->ds))[(y * 128 * 3 + x) * 3]; \
486
    DisplaySurface *surface = qemu_console_surface(s->con); \
487
    type *pixel = &((type *) surface_data(surface))[(y * 128 * 3 + x) * 3]; \
487 488
\
488 489
    for (dy = 0; dy < 3; dy++, pixel += 127 * 3) \
489 490
        for (dx = 0; dx < 3; dx++, pixel++) \
......
496 497
static void lcd_refresh(void *opaque)
497 498
{
498 499
    musicpal_lcd_state *s = opaque;
500
    DisplaySurface *surface = qemu_console_surface(s->con);
499 501
    int x, y, col;
500 502

  
501
    switch (ds_get_bits_per_pixel(s->ds)) {
503
    switch (surface_bits_per_pixel(surface)) {
502 504
    case 0:
503 505
        return;
504 506
#define LCD_REFRESH(depth, func) \
......
518 520
        break;
519 521
    LCD_REFRESH(8, rgb_to_pixel8)
520 522
    LCD_REFRESH(16, rgb_to_pixel16)
521
    LCD_REFRESH(32, (is_surface_bgr(s->ds->surface) ?
523
    LCD_REFRESH(32, (is_surface_bgr(surface) ?
522 524
                     rgb_to_pixel32bgr : rgb_to_pixel32))
523 525
    default:
524 526
        hw_error("unsupported colour depth %i\n",
525
                  ds_get_bits_per_pixel(s->ds));
527
                 surface_bits_per_pixel(surface));
526 528
    }
527 529

  
528
    dpy_gfx_update(s->ds, 0, 0, 128*3, 64*3);
530
    dpy_gfx_update(s->con, 0, 0, 128*3, 64*3);
529 531
}
530 532

  
531 533
static void lcd_invalidate(void *opaque)
......
609 611
                          "musicpal-lcd", MP_LCD_SIZE);
610 612
    sysbus_init_mmio(dev, &s->iomem);
611 613

  
612
    s->ds = graphic_console_init(lcd_refresh, lcd_invalidate,
613
                                 NULL, NULL, s);
614
    qemu_console_resize(s->ds, 128*3, 64*3);
614
    s->con = graphic_console_init(lcd_refresh, lcd_invalidate,
615
                                  NULL, NULL, s);
616
    qemu_console_resize(s->con, 128*3, 64*3);
615 617

  
616 618
    qdev_init_gpio_in(&dev->qdev, musicpal_lcd_gpio_brigthness_in, 3);
617 619

  
b/hw/blizzard.c
69 69
    uint8_t effect;
70 70
    uint8_t iformat;
71 71
    uint8_t source;
72
    DisplayState *state;
72
    QemuConsole *con;
73 73
    blizzard_fn_t *line_fn_tab[2];
74 74
    void *fb;
75 75

  
......
144 144

  
145 145
static void blizzard_window(BlizzardState *s)
146 146
{
147
    DisplaySurface *surface = qemu_console_surface(s->con);
147 148
    uint8_t *src, *dst;
148 149
    int bypp[2];
149 150
    int bypl[3];
......
162 163
        s->my[1] = s->data.y + s->data.dy;
163 164

  
164 165
    bypp[0] = s->bpp;
165
    bypp[1] = (ds_get_bits_per_pixel(s->state) + 7) >> 3;
166
    bypp[1] = surface_bytes_per_pixel(surface);
166 167
    bypl[0] = bypp[0] * s->data.pitch;
167 168
    bypl[1] = bypp[1] * s->x;
168 169
    bypl[2] = bypp[0] * s->data.dx;
......
883 884
static void blizzard_update_display(void *opaque)
884 885
{
885 886
    BlizzardState *s = (BlizzardState *) opaque;
887
    DisplaySurface *surface = qemu_console_surface(s->con);
886 888
    int y, bypp, bypl, bwidth;
887 889
    uint8_t *src, *dst;
888 890

  
889 891
    if (!s->enable)
890 892
        return;
891 893

  
892
    if (s->x != ds_get_width(s->state) || s->y != ds_get_height(s->state)) {
894
    if (s->x != surface_width(surface) || s->y != surface_height(surface)) {
893 895
        s->invalidate = 1;
894
        qemu_console_resize(s->state, s->x, s->y);
896
        qemu_console_resize(s->con, s->x, s->y);
897
        surface = qemu_console_surface(s->con);
895 898
    }
896 899

  
897 900
    if (s->invalidate) {
898 901
        s->invalidate = 0;
899 902

  
900 903
        if (s->blank) {
901
            bypp = (ds_get_bits_per_pixel(s->state) + 7) >> 3;
902
            memset(ds_get_data(s->state), 0, bypp * s->x * s->y);
904
            bypp = surface_bytes_per_pixel(surface);
905
            memset(surface_data(surface), 0, bypp * s->x * s->y);
903 906
            return;
904 907
        }
905 908

  
......
912 915
    if (s->mx[1] <= s->mx[0])
913 916
        return;
914 917

  
915
    bypp = (ds_get_bits_per_pixel(s->state) + 7) >> 3;
918
    bypp = surface_bytes_per_pixel(surface);
916 919
    bypl = bypp * s->x;
917 920
    bwidth = bypp * (s->mx[1] - s->mx[0]);
918 921
    y = s->my[0];
919 922
    src = s->fb + bypl * y + bypp * s->mx[0];
920
    dst = ds_get_data(s->state) + bypl * y + bypp * s->mx[0];
923
    dst = surface_data(surface) + bypl * y + bypp * s->mx[0];
921 924
    for (; y < s->my[1]; y ++, src += bypl, dst += bypl)
922 925
        memcpy(dst, src, bwidth);
923 926

  
924
    dpy_gfx_update(s->state, s->mx[0], s->my[0],
927
    dpy_gfx_update(s->con, s->mx[0], s->my[0],
925 928
                   s->mx[1] - s->mx[0], y - s->my[0]);
926 929

  
927 930
    s->mx[0] = s->x;
......
934 937
                                 bool cswitch, Error **errp)
935 938
{
936 939
    BlizzardState *s = (BlizzardState *) opaque;
940
    DisplaySurface *surface = qemu_console_surface(s->con);
937 941

  
938 942
    blizzard_update_display(opaque);
939
    if (s && ds_get_data(s->state))
940
        ppm_save(filename, s->state->surface, errp);
943
    if (s && surface_data(surface)) {
944
        ppm_save(filename, surface, errp);
945
    }
941 946
}
942 947

  
943 948
#define DEPTH 8
......
954 959
void *s1d13745_init(qemu_irq gpio_int)
955 960
{
956 961
    BlizzardState *s = (BlizzardState *) g_malloc0(sizeof(*s));
962
    DisplaySurface *surface;
957 963

  
958 964
    s->fb = g_malloc(0x180000);
959 965

  
960
    s->state = graphic_console_init(blizzard_update_display,
961
                                 blizzard_invalidate_display,
962
                                 blizzard_screen_dump, NULL, s);
966
    s->con = graphic_console_init(blizzard_update_display,
967
                                  blizzard_invalidate_display,
968
                                  blizzard_screen_dump, NULL, s);
969
    surface = qemu_console_surface(s->con);
963 970

  
964
    switch (ds_get_bits_per_pixel(s->state)) {
971
    switch (surface_bits_per_pixel(surface)) {
965 972
    case 0:
966 973
        s->line_fn_tab[0] = s->line_fn_tab[1] =
967 974
                g_malloc0(sizeof(blizzard_fn_t) * 0x10);
b/hw/cirrus_vga.c
729 729
		      s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch,
730 730
		      s->cirrus_blt_width, s->cirrus_blt_height);
731 731

  
732
    if (notify)
733
	qemu_console_copy(s->vga.ds,
732
    if (notify) {
733
        qemu_console_copy(s->vga.con,
734 734
			  sx, sy, dx, dy,
735 735
			  s->cirrus_blt_width / depth,
736 736
			  s->cirrus_blt_height);
737
    }
737 738

  
738 739
    /* we don't have to notify the display that this portion has
739 740
       changed since qemu_console_copy implies this */
......
2176 2177
static void cirrus_cursor_draw_line(VGACommonState *s1, uint8_t *d1, int scr_y)
2177 2178
{
2178 2179
    CirrusVGAState *s = container_of(s1, CirrusVGAState, vga);
2180
    DisplaySurface *surface = qemu_console_surface(s->vga.con);
2179 2181
    int w, h, bpp, x1, x2, poffset;
2180 2182
    unsigned int color0, color1;
2181 2183
    const uint8_t *palette, *src;
......
2228 2230
    color1 = s->vga.rgb_to_pixel(c6_to_8(palette[0xf * 3]),
2229 2231
                                 c6_to_8(palette[0xf * 3 + 1]),
2230 2232
                                 c6_to_8(palette[0xf * 3 + 2]));
2231
    bpp = ((ds_get_bits_per_pixel(s->vga.ds) + 7) >> 3);
2233
    bpp = surface_bytes_per_pixel(surface);
2232 2234
    d1 += x1 * bpp;
2233
    switch(ds_get_bits_per_pixel(s->vga.ds)) {
2235
    switch (surface_bits_per_pixel(surface)) {
2234 2236
    default:
2235 2237
        break;
2236 2238
    case 8:
......
2908 2910
    vga_common_init(s);
2909 2911
    cirrus_init_common(&d->cirrus_vga, CIRRUS_ID_CLGD5430, 0,
2910 2912
                       isa_address_space(dev), isa_address_space_io(dev));
2911
    s->ds = graphic_console_init(s->update, s->invalidate,
2912
                                 s->screen_dump, s->text_update,
2913
                                 s);
2913
    s->con = graphic_console_init(s->update, s->invalidate,
2914
                                  s->screen_dump, s->text_update,
2915
                                  s);
2914 2916
    rom_add_vga(VGABIOS_CIRRUS_FILENAME);
2915 2917
    /* XXX ISA-LFB support */
2916 2918
    /* FIXME not qdev yet */
......
2957 2959
     vga_common_init(&s->vga);
2958 2960
     cirrus_init_common(s, device_id, 1, pci_address_space(dev),
2959 2961
                        pci_address_space_io(dev));
2960
     s->vga.ds = graphic_console_init(s->vga.update, s->vga.invalidate,
2961
                                      s->vga.screen_dump, s->vga.text_update,
2962
                                      &s->vga);
2962
     s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate,
2963
                                       s->vga.screen_dump, s->vga.text_update,
2964
                                       &s->vga);
2963 2965

  
2964 2966
     /* setup PCI */
2965 2967

  
b/hw/exynos4210_fimd.c
296 296
typedef struct {
297 297
    SysBusDevice busdev;
298 298
    MemoryRegion iomem;
299
    DisplayState *console;
299
    QemuConsole *console;
300 300
    qemu_irq irq[3];
301 301

  
302 302
    uint32_t vidcon[4];     /* Video main control registers 0-3 */
......
1221 1221

  
1222 1222
static void exynos4210_update_resolution(Exynos4210fimdState *s)
1223 1223
{
1224
    DisplaySurface *surface = qemu_console_surface(s->console);
1225

  
1224 1226
    /* LCD resolution is stored in VIDEO TIME CONTROL REGISTER 2 */
1225 1227
    uint32_t width = ((s->vidtcon[2] >> FIMD_VIDTCON2_HOR_SHIFT) &
1226 1228
            FIMD_VIDTCON2_SIZE_MASK) + 1;
1227 1229
    uint32_t height = ((s->vidtcon[2] >> FIMD_VIDTCON2_VER_SHIFT) &
1228 1230
            FIMD_VIDTCON2_SIZE_MASK) + 1;
1229 1231

  
1230
    if (s->ifb == NULL || ds_get_width(s->console) != width ||
1231
            ds_get_height(s->console) != height) {
1232
    if (s->ifb == NULL || surface_width(surface) != width ||
1233
            surface_height(surface) != height) {
1232 1234
        DPRINT_L1("Resolution changed from %ux%u to %ux%u\n",
1233
           ds_get_width(s->console), ds_get_height(s->console), width, height);
1235
           surface_width(surface), surface_height(surface), width, height);
1234 1236
        qemu_console_resize(s->console, width, height);
1235 1237
        s->ifb = g_realloc(s->ifb, width * height * RGBA_SIZE + 1);
1236 1238
        memset(s->ifb, 0, width * height * RGBA_SIZE + 1);
......
1241 1243
static void exynos4210_fimd_update(void *opaque)
1242 1244
{
1243 1245
    Exynos4210fimdState *s = (Exynos4210fimdState *)opaque;
1246
    DisplaySurface *surface = qemu_console_surface(s->console);
1244 1247
    Exynos4210fimdWindow *w;
1245 1248
    int i, line;
1246 1249
    hwaddr fb_line_addr, inc_size;
......
1253 1256
    const int global_height = ((s->vidtcon[2] >> FIMD_VIDTCON2_VER_SHIFT) &
1254 1257
            FIMD_VIDTCON2_SIZE_MASK) + 1;
1255 1258

  
1256
    if (!s || !s->console || !ds_get_bits_per_pixel(s->console) ||
1259
    if (!s || !s->console || !surface_bits_per_pixel(surface) ||
1257 1260
            !s->enabled) {
1258 1261
        return;
1259 1262
    }
......
1299 1302
        uint8_t *d;
1300 1303
        int bpp;
1301 1304

  
1302
        bpp = ds_get_bits_per_pixel(s->console);
1305
        bpp = surface_bits_per_pixel(surface);
1303 1306
        fimd_update_putpix_qemu(bpp);
1304 1307
        bpp = (bpp + 1) >> 3;
1305
        d = ds_get_data(s->console);
1308
        d = surface_data(surface);
1306 1309
        for (line = first_line; line <= last_line; line++) {
1307 1310
            fimd_copy_line_toqemu(global_width, s->ifb + global_width * line *
1308 1311
                    RGBA_SIZE, d + global_width * line * bpp);
b/hw/framebuffer.c
24 24
/* Render an image from a shared memory framebuffer.  */
25 25
   
26 26
void framebuffer_update_display(
27
    DisplayState *ds,
27
    DisplaySurface *ds,
28 28
    MemoryRegion *address_space,
29 29
    hwaddr base,
30 30
    int cols, /* Width in pixels.  */
......
73 73
        return;
74 74
    }
75 75
    src = src_base;
76
    dest = ds_get_data(ds);
76
    dest = surface_data(ds);
77 77
    if (dest_col_pitch < 0)
78 78
        dest -= dest_col_pitch * (cols - 1);
79 79
    if (dest_row_pitch < 0) {
b/hw/framebuffer.h
8 8
typedef void (*drawfn)(void *, uint8_t *, const uint8_t *, int, int);
9 9

  
10 10
void framebuffer_update_display(
11
    DisplayState *ds,
11
    DisplaySurface *ds,
12 12
    MemoryRegion *address_space,
13 13
    hwaddr base,
14 14
    int cols,
b/hw/g364fb.c
39 39
    uint32_t top_of_screen;
40 40
    uint32_t width, height; /* in pixels */
41 41
    /* display refresh support */
42
    DisplayState *ds;
42
    QemuConsole *con;
43 43
    int depth;
44 44
    int blanked;
45 45
} G364State;
......
77 77

  
78 78
static void g364fb_draw_graphic8(G364State *s)
79 79
{
80
    DisplaySurface *surface = qemu_console_surface(s->con);
80 81
    int i, w;
81 82
    uint8_t *vram;
82 83
    uint8_t *data_display, *dd;
......
87 88
    int xcursor, ycursor;
88 89
    unsigned int (*rgb_to_pixel)(unsigned int r, unsigned int g, unsigned int b);
89 90

  
90
    switch (ds_get_bits_per_pixel(s->ds)) {
91
    switch (surface_bits_per_pixel(surface)) {
91 92
        case 8:
92 93
            rgb_to_pixel = rgb_to_pixel8;
93 94
            w = 1;
......
106 107
            break;
107 108
        default:
108 109
            hw_error("g364: unknown host depth %d",
109
                     ds_get_bits_per_pixel(s->ds));
110
                     surface_bits_per_pixel(surface));
110 111
            return;
111 112
    }
112 113

  
......
129 130

  
130 131
    vram = s->vram + s->top_of_screen;
131 132
    /* XXX: out of range in vram? */
132
    data_display = dd = ds_get_data(s->ds);
133
    data_display = dd = surface_data(surface);
133 134
    while (y < s->height) {
134 135
        if (check_dirty(s, page)) {
135 136
            if (y < ymin)
......
182 183
                        ymax = s->height - 1;
183 184
                        goto done;
184 185
                    }
185
                    data_display = dd = data_display + ds_get_linesize(s->ds);
186
                    data_display = dd = data_display + surface_stride(surface);
186 187
                    xmin = 0;
187 188
                    x = 0;
188 189
                }
......
197 198
                reset_dirty(s, page_min, page_max);
198 199
                page_min = (ram_addr_t)-1;
199 200
                page_max = 0;
200
                dpy_gfx_update(s->ds, xmin, ymin,
201
                dpy_gfx_update(s->con, xmin, ymin,
201 202
                               xmax - xmin + 1, ymax - ymin + 1);
202 203
                xmin = s->width;
203 204
                xmax = 0;
......
209 210
            x = x % s->width;
210 211
            y += dy;
211 212
            vram += G364_PAGE_SIZE;
212
            data_display += dy * ds_get_linesize(s->ds);
213
            data_display += dy * surface_stride(surface);
213 214
            dd = data_display + x * w;
214 215
        }
215 216
        page += G364_PAGE_SIZE;
......
217 218

  
218 219
done:
219 220
    if (page_min != (ram_addr_t)-1) {
220
        dpy_gfx_update(s->ds, xmin, ymin, xmax - xmin + 1, ymax - ymin + 1);
221
        dpy_gfx_update(s->con, xmin, ymin, xmax - xmin + 1, ymax - ymin + 1);
221 222
        reset_dirty(s, page_min, page_max);
222 223
    }
223 224
}
224 225

  
225 226
static void g364fb_draw_blank(G364State *s)
226 227
{
228
    DisplaySurface *surface = qemu_console_surface(s->con);
227 229
    int i, w;
228 230
    uint8_t *d;
229 231

  
......
232 234
        return;
233 235
    }
234 236

  
235
    w = s->width * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);
236
    d = ds_get_data(s->ds);
237
    w = s->width * surface_bytes_per_pixel(surface);
238
    d = surface_data(surface);
237 239
    for (i = 0; i < s->height; i++) {
238 240
        memset(d, 0, w);
239
        d += ds_get_linesize(s->ds);
241
        d += surface_stride(surface);
240 242
    }
241 243

  
242
    dpy_gfx_update(s->ds, 0, 0, s->width, s->height);
244
    dpy_gfx_update(s->con, 0, 0, s->width, s->height);
243 245
    s->blanked = 1;
244 246
}
245 247

  
246 248
static void g364fb_update_display(void *opaque)
247 249
{
248 250
    G364State *s = opaque;
251
    DisplaySurface *surface = qemu_console_surface(s->con);
249 252

  
250 253
    qemu_flush_coalesced_mmio_buffer();
251 254

  
252 255
    if (s->width == 0 || s->height == 0)
253 256
        return;
254 257

  
255
    if (s->width != ds_get_width(s->ds) || s->height != ds_get_height(s->ds)) {
256
        qemu_console_resize(s->ds, s->width, s->height);
258
    if (s->width != surface_width(surface) ||
259
        s->height != surface_height(surface)) {
260
        qemu_console_resize(s->con, s->width, s->height);
257 261
    }
258 262

  
259 263
    if (s->ctla & CTLA_FORCE_BLANK) {
......
413 417

  
414 418
static void g364_invalidate_cursor_position(G364State *s)
415 419
{
420
    DisplaySurface *surface = qemu_console_surface(s->con);
416 421
    int ymin, ymax, start, end;
417 422

  
418 423
    /* invalidate only near the cursor */
419 424
    ymin = s->cursor_position & 0xfff;
420 425
    ymax = MIN(s->height, ymin + 64);
421
    start = ymin * ds_get_linesize(s->ds);
422
    end = (ymax + 1) * ds_get_linesize(s->ds);
426
    start = ymin * surface_stride(surface);
427
    end = (ymax + 1) * surface_stride(surface);
423 428

  
424 429
    memory_region_set_dirty(&s->mem_vram, start, end - start);
425 430
}
......
545 550
{
546 551
    s->vram = g_malloc0(s->vram_size);
547 552

  
548
    s->ds = graphic_console_init(g364fb_update_display,
549
                                 g364fb_invalidate_display,
550
                                 g364fb_screen_dump, NULL, s);
553
    s->con = graphic_console_init(g364fb_update_display,
554
                                  g364fb_invalidate_display,
555
                                  g364fb_screen_dump, NULL, s);
551 556

  
552 557
    memory_region_init_io(&s->mem_ctrl, &g364fb_ctrl_ops, s, "ctrl", 0x180000);
553 558
    memory_region_init_ram_ptr(&s->mem_vram, "vram",
b/hw/jazz_led.c
36 36
    SysBusDevice busdev;
37 37
    MemoryRegion iomem;
38 38
    uint8_t segments;
39
    DisplayState *ds;
39
    QemuConsole *con;
40 40
    screen_state_t state;
41 41
} LedState;
42 42

  
......
75 75
/***********************************************************/
76 76
/* jazz_led display */
77 77

  
78
static void draw_horizontal_line(DisplayState *ds, int posy, int posx1, int posx2, uint32_t color)
78
static void draw_horizontal_line(DisplaySurface *ds,
79
                                 int posy, int posx1, int posx2,
80
                                 uint32_t color)
79 81
{
80 82
    uint8_t *d;
81 83
    int x, bpp;
82 84

  
83
    bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
84
    d = ds_get_data(ds) + ds_get_linesize(ds) * posy + bpp * posx1;
85
    bpp = (surface_bits_per_pixel(ds) + 7) >> 3;
86
    d = surface_data(ds) + surface_stride(ds) * posy + bpp * posx1;
85 87
    switch(bpp) {
86 88
        case 1:
87 89
            for (x = posx1; x <= posx2; x++) {
......
104 106
    }
105 107
}
106 108

  
107
static void draw_vertical_line(DisplayState *ds, int posx, int posy1, int posy2, uint32_t color)
109
static void draw_vertical_line(DisplaySurface *ds,
110
                               int posx, int posy1, int posy2,
111
                               uint32_t color)
108 112
{
109 113
    uint8_t *d;
110 114
    int y, bpp;
111 115

  
112
    bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
113
    d = ds_get_data(ds) + ds_get_linesize(ds) * posy1 + bpp * posx;
116
    bpp = (surface_bits_per_pixel(ds) + 7) >> 3;
117
    d = surface_data(ds) + surface_stride(ds) * posy1 + bpp * posx;
114 118
    switch(bpp) {
115 119
        case 1:
116 120
            for (y = posy1; y <= posy2; y++) {
117 121
                *((uint8_t *)d) = color;
118
                d += ds_get_linesize(ds);
122
                d += surface_stride(ds);
119 123
            }
120 124
            break;
121 125
        case 2:
122 126
            for (y = posy1; y <= posy2; y++) {
123 127
                *((uint16_t *)d) = color;
124
                d += ds_get_linesize(ds);
128
                d += surface_stride(ds);
125 129
            }
126 130
            break;
127 131
        case 4:
128 132
            for (y = posy1; y <= posy2; y++) {
129 133
                *((uint32_t *)d) = color;
130
                d += ds_get_linesize(ds);
134
                d += surface_stride(ds);
131 135
            }
132 136
            break;
133 137
    }
......
136 140
static void jazz_led_update_display(void *opaque)
137 141
{
138 142
    LedState *s = opaque;
139
    DisplayState *ds = s->ds;
143
    DisplaySurface *surface = qemu_console_surface(s->con);
140 144
    uint8_t *d1;
141 145
    uint32_t color_segment, color_led;
142 146
    int y, bpp;
143 147

  
144 148
    if (s->state & REDRAW_BACKGROUND) {
145 149
        /* clear screen */
146
        bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
147
        d1 = ds_get_data(ds);
148
        for (y = 0; y < ds_get_height(ds); y++) {
149
            memset(d1, 0x00, ds_get_width(ds) * bpp);
150
            d1 += ds_get_linesize(ds);
150
        bpp = (surface_bits_per_pixel(surface) + 7) >> 3;
151
        d1 = surface_data(surface);
152
        for (y = 0; y < surface_height(surface); y++) {
153
            memset(d1, 0x00, surface_width(surface) * bpp);
154
            d1 += surface_stride(surface);
151 155
        }
152 156
    }
153 157

  
154 158
    if (s->state & REDRAW_SEGMENTS) {
155 159
        /* set colors according to bpp */
156
        switch (ds_get_bits_per_pixel(ds)) {
160
        switch (surface_bits_per_pixel(surface)) {
157 161
            case 8:
158 162
                color_segment = rgb_to_pixel8(0xaa, 0xaa, 0xaa);
159 163
                color_led = rgb_to_pixel8(0x00, 0xff, 0x00);
......
178 182
        }
179 183

  
180 184
        /* display segments */
181
        draw_horizontal_line(ds, 40, 10, 40, (s->segments & 0x02) ? color_segment : 0);
182
        draw_vertical_line(ds, 10, 10, 40, (s->segments & 0x04) ? color_segment : 0);
183
        draw_vertical_line(ds, 10, 40, 70, (s->segments & 0x08) ? color_segment : 0);
184
        draw_horizontal_line(ds, 70, 10, 40, (s->segments & 0x10) ? color_segment : 0);
185
        draw_vertical_line(ds, 40, 40, 70, (s->segments & 0x20) ? color_segment : 0);
186
        draw_vertical_line(ds, 40, 10, 40, (s->segments & 0x40) ? color_segment : 0);
187
        draw_horizontal_line(ds, 10, 10, 40, (s->segments & 0x80) ? color_segment : 0);
185
        draw_horizontal_line(surface, 40, 10, 40,
186
                             (s->segments & 0x02) ? color_segment : 0);
187
        draw_vertical_line(surface, 10, 10, 40,
188
                           (s->segments & 0x04) ? color_segment : 0);
189
        draw_vertical_line(surface, 10, 40, 70,
190
                           (s->segments & 0x08) ? color_segment : 0);
191
        draw_horizontal_line(surface, 70, 10, 40,
192
                             (s->segments & 0x10) ? color_segment : 0);
193
        draw_vertical_line(surface, 40, 40, 70,
194
                           (s->segments & 0x20) ? color_segment : 0);
195
        draw_vertical_line(surface, 40, 10, 40,
196
                           (s->segments & 0x40) ? color_segment : 0);
197
        draw_horizontal_line(surface, 10, 10, 40,
198
                             (s->segments & 0x80) ? color_segment : 0);
188 199

  
189 200
        /* display led */
190 201
        if (!(s->segments & 0x01))
191 202
            color_led = 0; /* black */
192
        draw_horizontal_line(ds, 68, 50, 50, color_led);
193
        draw_horizontal_line(ds, 69, 49, 51, color_led);
194
        draw_horizontal_line(ds, 70, 48, 52, color_led);
195
        draw_horizontal_line(ds, 71, 49, 51, color_led);
196
        draw_horizontal_line(ds, 72, 50, 50, color_led);
203
        draw_horizontal_line(surface, 68, 50, 50, color_led);
204
        draw_horizontal_line(surface, 69, 49, 51, color_led);
205
        draw_horizontal_line(surface, 70, 48, 52, color_led);
206
        draw_horizontal_line(surface, 71, 49, 51, color_led);
207
        draw_horizontal_line(surface, 72, 50, 50, color_led);
197 208
    }
198 209

  
199 210
    s->state = REDRAW_NONE;
200
    dpy_gfx_update(ds, 0, 0, ds_get_width(ds), ds_get_height(ds));
211
    dpy_gfx_update(s->con, 0, 0,
212
                   surface_width(surface), surface_height(surface));
201 213
}
202 214

  
203 215
static void jazz_led_invalidate_display(void *opaque)
......
211 223
    LedState *s = opaque;
212 224
    char buf[2];
213 225

  
214
    dpy_text_cursor(s->ds, -1, -1);
215
    qemu_console_resize(s->ds, 2, 1);
226
    dpy_text_cursor(s->con, -1, -1);
227
    qemu_console_resize(s->con, 2, 1);
216 228

  
217 229
    /* TODO: draw the segments */
218 230
    snprintf(buf, 2, "%02hhx\n", s->segments);
219 231
    console_write_ch(chardata++, 0x00200100 | buf[0]);
220 232
    console_write_ch(chardata++, 0x00200100 | buf[1]);
221 233

  
222
    dpy_text_update(s->ds, 0, 0, 2, 1);
234
    dpy_text_update(s->con, 0, 0, 2, 1);
223 235
}
224 236

  
225 237
static int jazz_led_post_load(void *opaque, int version_id)
......
249 261
    memory_region_init_io(&s->iomem, &led_ops, s, "led", 1);
250 262
    sysbus_init_mmio(dev, &s->iomem);
251 263

  
252
    s->ds = graphic_console_init(jazz_led_update_display,
253
                                 jazz_led_invalidate_display,
254
                                 NULL,
255
                                 jazz_led_text_update, s);
264
    s->con = graphic_console_init(jazz_led_update_display,
265
                                  jazz_led_invalidate_display,
266
                                  NULL,
267
                                  jazz_led_text_update, s);
256 268

  
257 269
    return 0;
258 270
}
......
263 275

  
264 276
    s->segments = 0;
265 277
    s->state = REDRAW_SEGMENTS | REDRAW_BACKGROUND;
266
    qemu_console_resize(s->ds, 60, 80);
278
    qemu_console_resize(s->con, 60, 80);
267 279
}
268 280

  
269 281
static void jazz_led_class_init(ObjectClass *klass, void *data)
b/hw/milkymist-vgafb.c
66 66
struct MilkymistVgafbState {
67 67
    SysBusDevice busdev;
68 68
    MemoryRegion regs_region;
69
    DisplayState *ds;
69
    QemuConsole *con;
70 70

  
71 71
    int invalidate;
72 72
    uint32_t fb_offset;
......
84 84
static void vgafb_update_display(void *opaque)
85 85
{
86 86
    MilkymistVgafbState *s = opaque;
87
    DisplaySurface *surface = qemu_console_surface(s->con);
87 88
    int first = 0;
88 89
    int last = 0;
89 90
    drawfn fn;
......
94 95

  
95 96
    int dest_width = s->regs[R_HRES];
96 97

  
97
    switch (ds_get_bits_per_pixel(s->ds)) {
98
    switch (surface_bits_per_pixel(surface)) {
98 99
    case 0:
99 100
        return;
100 101
    case 8:
......
121 122
        break;
122 123
    }
123 124

  
124
    framebuffer_update_display(s->ds, sysbus_address_space(&s->busdev),
125
    framebuffer_update_display(surface, sysbus_address_space(&s->busdev),
125 126
                               s->regs[R_BASEADDRESS] + s->fb_offset,
126 127
                               s->regs[R_HRES],
127 128
                               s->regs[R_VRES],
......
134 135
                               &first, &last);
135 136

  
136 137
    if (first >= 0) {
137
        dpy_gfx_update(s->ds, 0, first, s->regs[R_HRES], last - first + 1);
138
        dpy_gfx_update(s->con, 0, first, s->regs[R_HRES], last - first + 1);
138 139
    }
139 140
    s->invalidate = 0;
140 141
}
......
151 152
        return;
152 153
    }
153 154

  
154
    qemu_console_resize(s->ds, s->regs[R_HRES], s->regs[R_VRES]);
155
    qemu_console_resize(s->con, s->regs[R_HRES], s->regs[R_VRES]);
155 156
    s->invalidate = 1;
156 157
}
157 158

  
......
277 278
            "milkymist-vgafb", R_MAX * 4);
278 279
    sysbus_init_mmio(dev, &s->regs_region);
279 280

  
280
    s->ds = graphic_console_init(vgafb_update_display,
281
                                 vgafb_invalidate_display,
282
                                 NULL, NULL, s);
281
    s->con = graphic_console_init(vgafb_update_display,
282
                                  vgafb_invalidate_display,
283
                                  NULL, NULL, s);
283 284

  
284 285
    return 0;
285 286
}
b/hw/omap_lcdc.c
26 26
    MemoryRegion *sysmem;
27 27
    MemoryRegion iomem;
28 28
    qemu_irq irq;
29
    DisplayState *state;
29
    QemuConsole *con;
30 30

  
31 31
    int plm;
32 32
    int tft;
......
113 113
static void omap_update_display(void *opaque)
114 114
{
115 115
    struct omap_lcd_panel_s *omap_lcd = (struct omap_lcd_panel_s *) opaque;
116
    DisplaySurface *surface = qemu_console_surface(omap_lcd->con);
116 117
    draw_line_func draw_line;
117 118
    int size, height, first, last;
118 119
    int width, linesize, step, bpp, frame_offset;
119 120
    hwaddr frame_base;
120 121

  
121
    if (!omap_lcd || omap_lcd->plm == 1 ||
122
                    !omap_lcd->enable || !ds_get_bits_per_pixel(omap_lcd->state))
122
    if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable ||
123
        !surface_bits_per_pixel(surface)) {
123 124
        return;
125
    }
124 126

  
125 127
    frame_offset = 0;
126 128
    if (omap_lcd->plm != 2) {
......
139 141
    /* Colour depth */
140 142
    switch ((omap_lcd->palette[0] >> 12) & 7) {
141 143
    case 1:
142
        draw_line = draw_line_table2[ds_get_bits_per_pixel(omap_lcd->state)];
144
        draw_line = draw_line_table2[surface_bits_per_pixel(surface)];
143 145
        bpp = 2;
144 146
        break;
145 147

  
146 148
    case 2:
147
        draw_line = draw_line_table4[ds_get_bits_per_pixel(omap_lcd->state)];
149
        draw_line = draw_line_table4[surface_bits_per_pixel(surface)];
148 150
        bpp = 4;
149 151
        break;
150 152

  
151 153
    case 3:
152
        draw_line = draw_line_table8[ds_get_bits_per_pixel(omap_lcd->state)];
154
        draw_line = draw_line_table8[surface_bits_per_pixel(surface)];
153 155
        bpp = 8;
154 156
        break;
155 157

  
156 158
    case 4 ... 7:
157 159
        if (!omap_lcd->tft)
158
            draw_line = draw_line_table12[ds_get_bits_per_pixel(omap_lcd->state)];
160
            draw_line = draw_line_table12[surface_bits_per_pixel(surface)];
159 161
        else
160
            draw_line = draw_line_table16[ds_get_bits_per_pixel(omap_lcd->state)];
162
            draw_line = draw_line_table16[surface_bits_per_pixel(surface)];
161 163
        bpp = 16;
162 164
        break;
163 165

  
......
168 170

  
169 171
    /* Resolution */
170 172
    width = omap_lcd->width;
171
    if (width != ds_get_width(omap_lcd->state) ||
172
            omap_lcd->height != ds_get_height(omap_lcd->state)) {
173
        qemu_console_resize(omap_lcd->state,
173
    if (width != surface_width(surface) ||
174
        omap_lcd->height != surface_height(surface)) {
175
        qemu_console_resize(omap_lcd->con,
174 176
                            omap_lcd->width, omap_lcd->height);
177
        surface = qemu_console_surface(omap_lcd->con);
175 178
        omap_lcd->invalidate = 1;
176 179
    }
177 180

  
......
196 199
    if (omap_lcd->dma->dual)
197 200
        omap_lcd->dma->current_frame ^= 1;
198 201

  
199
    if (!ds_get_bits_per_pixel(omap_lcd->state))
202
    if (!surface_bits_per_pixel(surface)) {
200 203
        return;
204
    }
201 205

  
202 206
    first = 0;
203 207
    height = omap_lcd->height;
......
210 214
    }
211 215

  
212 216
    step = width * bpp >> 3;
213
    linesize = ds_get_linesize(omap_lcd->state);
214
    framebuffer_update_display(omap_lcd->state, omap_lcd->sysmem,
217
    linesize = surface_stride(surface);
218
    framebuffer_update_display(surface, omap_lcd->sysmem,
215 219
                               frame_base, width, height,
216 220
                               step, linesize, 0,
217 221
                               omap_lcd->invalidate,
218 222
                               draw_line, omap_lcd->palette,
219 223
                               &first, &last);
220 224
    if (first >= 0) {
221
        dpy_gfx_update(omap_lcd->state, 0, first, width, last - first + 1);
225
        dpy_gfx_update(omap_lcd->con, 0, first, width, last - first + 1);
222 226
    }
223 227
    omap_lcd->invalidate = 0;
224 228
}
......
298 302
                             Error **errp)
299 303
{
300 304
    struct omap_lcd_panel_s *omap_lcd = opaque;
305
    DisplaySurface *surface = qemu_console_surface(omap_lcd->con);
301 306

  
302 307
    omap_update_display(opaque);
303
    if (omap_lcd && ds_get_data(omap_lcd->state))
304
        omap_ppm_save(filename, ds_get_data(omap_lcd->state),
308
    if (omap_lcd && surface_data(surface))
309
        omap_ppm_save(filename, surface_data(surface),
305 310
                    omap_lcd->width, omap_lcd->height,
306
                    ds_get_linesize(omap_lcd->state), errp);
311
                    surface_stride(surface), errp);
307 312
}
308 313

  
309 314
static void omap_invalidate_display(void *opaque) {
......
480 485
    memory_region_init_io(&s->iomem, &omap_lcdc_ops, s, "omap.lcdc", 0x100);
481 486
    memory_region_add_subregion(sysmem, base, &s->iomem);
482 487

  
483
    s->state = graphic_console_init(omap_update_display,
484
                                    omap_invalidate_display,
485
                                    omap_screen_dump, NULL, s);
488
    s->con = graphic_console_init(omap_update_display,
489
                                  omap_invalidate_display,
490
                                  omap_screen_dump, NULL, s);
486 491

  
487 492
    return s;
488 493
}
b/hw/pl110.c
42 42
typedef struct {
43 43
    SysBusDevice busdev;
44 44
    MemoryRegion iomem;
45
    DisplayState *ds;
45
    QemuConsole *con;
46 46

  
47 47
    int version;
48 48
    uint32_t timing[4];
......
129 129
static void pl110_update_display(void *opaque)
130 130
{
131 131
    pl110_state *s = (pl110_state *)opaque;
132
    DisplaySurface *surface = qemu_console_surface(s->con);
132 133
    drawfn* fntable;
133 134
    drawfn fn;
134 135
    int dest_width;
......
140 141
    if (!pl110_enabled(s))
141 142
        return;
142 143

  
143
    switch (ds_get_bits_per_pixel(s->ds)) {
144
    switch (surface_bits_per_pixel(surface)) {
144 145
    case 0:
145 146
        return;
146 147
    case 8:
......
231 232
    }
232 233
    dest_width *= s->cols;
233 234
    first = 0;
234
    framebuffer_update_display(s->ds, sysbus_address_space(&s->busdev),
235
    framebuffer_update_display(surface, sysbus_address_space(&s->busdev),
235 236
                               s->upbase, s->cols, s->rows,
236 237
                               src_width, dest_width, 0,
237 238
                               s->invalidate,
238 239
                               fn, s->palette,
239 240
                               &first, &last);
240 241
    if (first >= 0) {
241
        dpy_gfx_update(s->ds, 0, first, s->cols, last - first + 1);
242
        dpy_gfx_update(s->con, 0, first, s->cols, last - first + 1);
242 243
    }
243 244
    s->invalidate = 0;
244 245
}
......
248 249
    pl110_state *s = (pl110_state *)opaque;
249 250
    s->invalidate = 1;
250 251
    if (pl110_enabled(s)) {
251
        qemu_console_resize(s->ds, s->cols, s->rows);
252
        qemu_console_resize(s->con, s->cols, s->rows);
252 253
    }
253 254
}
254 255

  
255 256
static void pl110_update_palette(pl110_state *s, int n)
256 257
{
258
    DisplaySurface *surface = qemu_console_surface(s->con);
257 259
    int i;
258 260
    uint32_t raw;
259 261
    unsigned int r, g, b;
......
268 270
        b = (raw & 0x1f) << 3;
269 271
        /* The I bit is ignored.  */
270 272
        raw >>= 6;
271
        switch (ds_get_bits_per_pixel(s->ds)) {
273
        switch (surface_bits_per_pixel(surface)) {
272 274
        case 8:
273 275
            s->palette[n] = rgb_to_pixel8(r, g, b);
274 276
            break;
......
291 293
{
292 294
    if (width != s->cols || height != s->rows) {
293 295
        if (pl110_enabled(s)) {
294
            qemu_console_resize(s->ds, width, height);
296
            qemu_console_resize(s->con, width, height);
295 297
        }
296 298
    }
297 299
    s->cols = width;
......
409 411
        s->cr = val;
410 412
        s->bpp = (val >> 1) & 7;
411 413
        if (pl110_enabled(s)) {
412
            qemu_console_resize(s->ds, s->cols, s->rows);
414
            qemu_console_resize(s->con, s->cols, s->rows);
413 415
        }
414 416
        break;
415 417
    case 10: /* LCDICR */
......
450 452
    sysbus_init_mmio(dev, &s->iomem);
451 453
    sysbus_init_irq(dev, &s->irq);
452 454
    qdev_init_gpio_in(&s->busdev.qdev, pl110_mux_ctrl_set, 1);
453
    s->ds = graphic_console_init(pl110_update_display,
454
                                 pl110_invalidate_display,
455
                                 NULL, NULL, s);
455
    s->con = graphic_console_init(pl110_update_display,
456
                                  pl110_invalidate_display,
457
                                  NULL, NULL, s);
456 458
    return 0;
457 459
}
458 460

  
b/hw/pxa2xx_lcd.c
39 39
    int irqlevel;
40 40

  
41 41
    int invalidated;
42
    DisplayState *ds;
42
    QemuConsole *con;
43 43
    drawfn *line_fn[2];
44 44
    int dest_width;
45 45
    int xres, yres;
......
579 579
/* Load new palette for a given DMA channel, convert to internal format */
580 580
static void pxa2xx_palette_parse(PXA2xxLCDState *s, int ch, int bpp)
581 581
{
582
    DisplaySurface *surface = qemu_console_surface(s->con);
582 583
    int i, n, format, r, g, b, alpha;
583 584
    uint32_t *dest;
584 585
    uint8_t *src;
......
652 653
            src += 4;
653 654
            break;
654 655
        }
655
        switch (ds_get_bits_per_pixel(s->ds)) {
656
        switch (surface_bits_per_pixel(surface)) {
656 657
        case 8:
657 658
            *dest = rgb_to_pixel8(r, g, b) | alpha;
658 659
            break;
......
676 677
static void pxa2xx_lcdc_dma0_redraw_rot0(PXA2xxLCDState *s,
677 678
                hwaddr addr, int *miny, int *maxy)
678 679
{
680
    DisplaySurface *surface = qemu_console_surface(s->con);
679 681
    int src_width, dest_width;
680 682
    drawfn fn = NULL;
681 683
    if (s->dest_width)
......
693 695

  
694 696
    dest_width = s->xres * s->dest_width;
695 697
    *miny = 0;
696
    framebuffer_update_display(s->ds, s->sysmem,
698
    framebuffer_update_display(surface, s->sysmem,
697 699
                               addr, s->xres, s->yres,
698 700
                               src_width, dest_width, s->dest_width,
699 701
                               s->invalidated,
......
703 705
static void pxa2xx_lcdc_dma0_redraw_rot90(PXA2xxLCDState *s,
704 706
               hwaddr addr, int *miny, int *maxy)
705 707
{
708
    DisplaySurface *surface = qemu_console_surface(s->con);
706 709
    int src_width, dest_width;
707 710
    drawfn fn = NULL;
708 711
    if (s->dest_width)
......
720 723

  
721 724
    dest_width = s->yres * s->dest_width;
722 725
    *miny = 0;
723
    framebuffer_update_display(s->ds, s->sysmem,
726
    framebuffer_update_display(surface, s->sysmem,
724 727
                               addr, s->xres, s->yres,
725 728
                               src_width, s->dest_width, -dest_width,
726 729
                               s->invalidated,
......
731 734
static void pxa2xx_lcdc_dma0_redraw_rot180(PXA2xxLCDState *s,
732 735
                hwaddr addr, int *miny, int *maxy)
733 736
{
737
    DisplaySurface *surface = qemu_console_surface(s->con);
734 738
    int src_width, dest_width;
735 739
    drawfn fn = NULL;
736 740
    if (s->dest_width) {
......
751 755

  
752 756
    dest_width = s->xres * s->dest_width;
753 757
    *miny = 0;
754
    framebuffer_update_display(s->ds, s->sysmem,
758
    framebuffer_update_display(surface, s->sysmem,
755 759
                               addr, s->xres, s->yres,
756 760
                               src_width, -dest_width, -s->dest_width,
757 761
                               s->invalidated,
......
761 765
static void pxa2xx_lcdc_dma0_redraw_rot270(PXA2xxLCDState *s,
762 766
               hwaddr addr, int *miny, int *maxy)
763 767
{
768
    DisplaySurface *surface = qemu_console_surface(s->con);
764 769
    int src_width, dest_width;
765 770
    drawfn fn = NULL;
766 771
    if (s->dest_width) {
......
781 786

  
782 787
    dest_width = s->yres * s->dest_width;
783 788
    *miny = 0;
784
    framebuffer_update_display(s->ds, s->sysmem,
789
    framebuffer_update_display(surface, s->sysmem,
785 790
                               addr, s->xres, s->yres,
786 791
                               src_width, -s->dest_width, dest_width,
787 792
                               s->invalidated,
......
800 805

  
801 806
    if (width != s->xres || height != s->yres) {
802 807
        if (s->orientation == 90 || s->orientation == 270) {
803
            qemu_console_resize(s->ds, height, width);
808
            qemu_console_resize(s->con, height, width);
804 809
        } else {
805
            qemu_console_resize(s->ds, width, height);
810
            qemu_console_resize(s->con, width, height);
806 811
        }
807 812
        s->invalidated = 1;
808 813
        s->xres = width;
......
871 876
    if (miny >= 0) {
872 877
        switch (s->orientation) {
873 878
        case 0:
874
            dpy_gfx_update(s->ds, 0, miny, s->xres, maxy - miny + 1);
879
            dpy_gfx_update(s->con, 0, miny, s->xres, maxy - miny + 1);
875 880
            break;
876 881
        case 90:
877
            dpy_gfx_update(s->ds, miny, 0, maxy - miny + 1, s->xres);
882
            dpy_gfx_update(s->con, miny, 0, maxy - miny + 1, s->xres);
878 883
            break;
879 884
        case 180:
880 885
            maxy = s->yres - maxy - 1;
881 886
            miny = s->yres - miny - 1;
882
            dpy_gfx_update(s->ds, 0, maxy, s->xres, miny - maxy + 1);
887
            dpy_gfx_update(s->con, 0, maxy, s->xres, miny - maxy + 1);
883 888
            break;
884 889
        case 270:
885 890
            maxy = s->yres - maxy - 1;
886 891
            miny = s->yres - miny - 1;
887
            dpy_gfx_update(s->ds, maxy, 0, miny - maxy + 1, s->xres);
892
            dpy_gfx_update(s->con, maxy, 0, miny - maxy + 1, s->xres);
888 893
            break;
889 894
        }
890 895
    }
......
990 995
                                 hwaddr base, qemu_irq irq)
991 996
{
992 997
    PXA2xxLCDState *s;
998
    DisplaySurface *surface;
993 999

  
994 1000
    s = (PXA2xxLCDState *) g_malloc0(sizeof(PXA2xxLCDState));
995 1001
    s->invalidated = 1;
......
1002 1008
                          "pxa2xx-lcd-controller", 0x00100000);
1003 1009
    memory_region_add_subregion(sysmem, base, &s->iomem);
1004 1010

  
1005
    s->ds = graphic_console_init(pxa2xx_update_display,
1006
                                 pxa2xx_invalidate_display,
1007
                                 NULL, NULL, s);
1011
    s->con = graphic_console_init(pxa2xx_update_display,
1012
                                  pxa2xx_invalidate_display,
1013
                                  NULL, NULL, s);
1014
    surface = qemu_console_surface(s->con);
1008 1015

  
1009
    switch (ds_get_bits_per_pixel(s->ds)) {
1016
    switch (surface_bits_per_pixel(surface)) {
1010 1017
    case 0:
1011 1018
        s->dest_width = 0;
1012 1019
        break;
b/hw/qxl-render.c
23 23

  
24 24
static void qxl_blit(PCIQXLDevice *qxl, QXLRect *rect)
25 25
{
26
    DisplaySurface *surface = qemu_console_surface(qxl->vga.con);
27
    uint8_t *dst = surface_data(surface);
26 28
    uint8_t *src;
27
    uint8_t *dst = ds_get_data(qxl->vga.ds);
28 29
    int len, i;
29 30

  
30
    if (is_buffer_shared(qxl->vga.ds->surface)) {
31
    if (is_buffer_shared(surface)) {
31 32
        return;
32 33
    }
33 34
    if (!qxl->guest_primary.data) {
......
125 126
                (qxl->guest_primary.surface.width,
126 127
                 qxl->guest_primary.surface.height);
127 128
        }
128
        dpy_gfx_replace_surface(vga->ds, surface);
129
        dpy_gfx_replace_surface(vga->con, surface);
129 130
    }
130 131
    for (i = 0; i < qxl->num_dirty_rects; i++) {
131 132
        if (qemu_spice_rect_is_empty(qxl->dirty+i)) {
132 133
            break;
133 134
        }
134 135
        qxl_blit(qxl, qxl->dirty+i);
135
        dpy_gfx_update(vga->ds,
136
        dpy_gfx_update(vga->con,
136 137
                       qxl->dirty[i].left, qxl->dirty[i].top,
137 138
                       qxl->dirty[i].right - qxl->dirty[i].left,
138 139
                       qxl->dirty[i].bottom - qxl->dirty[i].top);
......
236 237
        return 1;
237 238
    }
238 239

  
239
    if (!dpy_cursor_define_supported(qxl->ssd.dcl.ds)) {
240
    if (!dpy_cursor_define_supported(qxl->vga.con)) {
240 241
        return 0;
241 242
    }
242 243

  
b/hw/qxl.c
2063 2063
    PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev);
2064 2064
    VGACommonState *vga = &qxl->vga;
2065 2065
    PortioList *qxl_vga_port_list = g_new(PortioList, 1);
2066
    DisplayState *ds;
2066 2067
    int rc;
2067 2068

  
2068 2069
    qxl->id = 0;
......
2073 2074
    portio_list_init(qxl_vga_port_list, qxl_vga_portio_list, vga, "vga");
2074 2075
    portio_list_add(qxl_vga_port_list, pci_address_space_io(dev), 0x3b0);
2075 2076

  
2076
    vga->ds = graphic_console_init(qxl_hw_update, qxl_hw_invalidate,
2077
                                   qxl_hw_screen_dump, qxl_hw_text_update, qxl);
2078
    qemu_spice_display_init_common(&qxl->ssd, vga->ds);
2077
    vga->con = graphic_console_init(qxl_hw_update, qxl_hw_invalidate,
2078
                                    qxl_hw_screen_dump, qxl_hw_text_update,
2079
                                    qxl);
2080
    qxl->ssd.con = vga->con,
2081
    qemu_spice_display_init_common(&qxl->ssd);
2079 2082

  
2080 2083
    rc = qxl_init_common(qxl);
2081 2084
    if (rc != 0) {
......
2083 2086
    }
2084 2087

  
2085 2088
    qxl->ssd.dcl.ops = &display_listener_ops;
2086
    register_displaychangelistener(vga->ds, &qxl->ssd.dcl);
2089
    ds = qemu_console_displaystate(vga->con);
2090
    register_displaychangelistener(ds, &qxl->ssd.dcl);
2087 2091
    return rc;
2088 2092
}
2089 2093

  
b/hw/sm501.c
454 454

  
455 455
typedef struct SM501State {
456 456
    /* graphic console status */
457
    DisplayState *ds;
457
    QemuConsole *con;
458 458

  
459 459
    /* status & internal resources */
460 460
    hwaddr base;
......
1234 1234
    draw_hwc_line_16bgr,
1235 1235
};
1236 1236

  
1237
static inline int get_depth_index(DisplayState *s)
1237
static inline int get_depth_index(DisplaySurface *surface)
1238 1238
{
1239
    switch(ds_get_bits_per_pixel(s)) {
1239
    switch (surface_bits_per_pixel(surface)) {
1240 1240
    default:
1241 1241
    case 8:
1242 1242
	return 0;
......
1245 1245
    case 16:
1246 1246
        return 2;
1247 1247
    case 32:
1248
	if (is_surface_bgr(s->surface))
1249
	    return 4;
1250
	else
1251
	    return 3;
1248
        if (is_surface_bgr(surface)) {
1249
            return 4;
1250
        } else {
1251
            return 3;
1252
        }
1252 1253
    }
1253 1254
}
1254 1255

  
1255 1256
static void sm501_draw_crt(SM501State * s)
1256 1257
{
1258
    DisplaySurface *surface = qemu_console_surface(s->con);
1257 1259
    int y;
1258 1260
    int width = (s->dc_crt_h_total & 0x00000FFF) + 1;
1259 1261
    int height = (s->dc_crt_v_total & 0x00000FFF) + 1;
1260 1262

  
1261 1263
    uint8_t  * src = s->local_mem;
1262 1264
    int src_bpp = 0;
1263
    int dst_bpp = ds_get_bytes_per_pixel(s->ds) + (ds_get_bits_per_pixel(s->ds) % 8 ? 1 : 0);
1265
    int dst_bpp = surface_bytes_per_pixel(surface);
1264 1266
    uint32_t * palette = (uint32_t *)&s->dc_palette[SM501_DC_CRT_PALETTE
1265 1267
						    - SM501_DC_PANEL_PALETTE];
1266 1268
    uint8_t hwc_palette[3 * 3];
1267
    int ds_depth_index = get_depth_index(s->ds);
1269
    int ds_depth_index = get_depth_index(surface);
1268 1270
    draw_line_func * draw_line = NULL;
1269 1271
    draw_hwc_line_func * draw_hwc_line = NULL;
1270 1272
    int full_update = 0;
......
1312 1314

  
1313 1315
    /* adjust console size */
1314 1316
    if (s->last_width != width || s->last_height != height) {
1315
	qemu_console_resize(s->ds, width, height);
1317
        qemu_console_resize(s->con, width, height);
1318
        surface = qemu_console_surface(s->con);
1316 1319
	s->last_width = width;
1317 1320
	s->last_height = height;
1318 1321
	full_update = 1;
......
1331 1334

  
1332 1335
	/* draw line and change status */
1333 1336
	if (update) {
1334
            uint8_t * d = &(ds_get_data(s->ds)[y * width * dst_bpp]);
1337
            uint8_t *d = surface_data(surface);
1338
            d +=  y * width * dst_bpp;
1335 1339

  
1336 1340
            /* draw graphics layer */
1337 1341
            draw_line(d, src, width, palette);
......
1350 1354
	} else {
1351 1355
	    if (y_start >= 0) {
1352 1356
		/* flush to display */
1353
                dpy_gfx_update(s->ds, 0, y_start, width, y - y_start);
1357
                dpy_gfx_update(s->con, 0, y_start, width, y - y_start);
1354 1358
		y_start = -1;
1355 1359
	    }
1356 1360
	}
......
1361 1365

  
1362 1366
    /* complete flush to display */
1363 1367
    if (y_start >= 0)
1364
        dpy_gfx_update(s->ds, 0, y_start, width, y - y_start);
1368
        dpy_gfx_update(s->con, 0, y_start, width, y - y_start);
1365 1369

  
1366 1370
    /* clear dirty flags */
1367 1371
    if (page_min != ~0l) {
......
1441 1445
    }
1442 1446

  
1443 1447
    /* create qemu graphic console */
1444
    s->ds = graphic_console_init(sm501_update_display, NULL,
1445
				 NULL, NULL, s);
1448
    s->con = graphic_console_init(sm501_update_display, NULL,
1449
                                  NULL, NULL, s);
1446 1450
}
b/hw/ssd0303.c
43 43

  
44 44
typedef struct {
45 45
    I2CSlave i2c;
46
    DisplayState *ds;
46
    QemuConsole *con;
47 47
    int row;
48 48
    int col;
49 49
    int start_line;
......
191 191
static void ssd0303_update_display(void *opaque)
192 192
{
193 193
    ssd0303_state *s = (ssd0303_state *)opaque;
194
    DisplaySurface *surface = qemu_console_surface(s->con);
194 195
    uint8_t *dest;
195 196
    uint8_t *src;
196 197
    int x;
......
204 205
    if (!s->redraw)
205 206
        return;
206 207

  
207
    switch (ds_get_bits_per_pixel(s->ds)) {
208
    switch (surface_bits_per_pixel(surface)) {
208 209
    case 0:
209 210
        return;
210 211
    case 15:
......
236 237
        colors[0] = colortab + dest_width;
237 238
        colors[1] = colortab;
238 239
    }
239
    dest = ds_get_data(s->ds);
240
    dest = surface_data(surface);
240 241
    for (y = 0; y < 16; y++) {
241 242
        line = (y + s->start_line) & 63;
242 243
        src = s->framebuffer + 132 * (line >> 3) + 36;
......
252 253
        }
253 254
    }
254 255
    s->redraw = 0;
255
    dpy_gfx_update(s->ds, 0, 0, 96 * MAGNIFY, 16 * MAGNIFY);
256
    dpy_gfx_update(s->con, 0, 0, 96 * MAGNIFY, 16 * MAGNIFY);
256 257
}
257 258

  
258 259
static void ssd0303_invalidate_display(void * opaque)
......
287 288
{
288 289
    ssd0303_state *s = FROM_I2C_SLAVE(ssd0303_state, i2c);
289 290

  
290
    s->ds = graphic_console_init(ssd0303_update_display,
291
                                 ssd0303_invalidate_display,
292
                                 NULL, NULL, s);
293
    qemu_console_resize(s->ds, 96 * MAGNIFY, 16 * MAGNIFY);
291
    s->con = graphic_console_init(ssd0303_update_display,
292
                                  ssd0303_invalidate_display,
293
                                  NULL, NULL, s);
294
    qemu_console_resize(s->con, 96 * MAGNIFY, 16 * MAGNIFY);
294 295
    return 0;
295 296
}
296 297

  
b/hw/ssd0323.c
45 45

  
46 46
typedef struct {
47 47
    SSISlave ssidev;
48
    DisplayState *ds;
48
    QemuConsole *con;
49 49

  
50 50
    int cmd_len;
51 51
    int cmd;
......
175 175
static void ssd0323_update_display(void *opaque)
176 176
{
177 177
    ssd0323_state *s = (ssd0323_state *)opaque;
178
    DisplaySurface *surface = qemu_console_surface(s->con);
178 179
    uint8_t *dest;
179 180
    uint8_t *src;
180 181
    int x;
......
189 190
    if (!s->redraw)
190 191
        return;
191 192

  
192
    switch (ds_get_bits_per_pixel(s->ds)) {
193
    switch (surface_bits_per_pixel(surface)) {
193 194
    case 0:
194 195
        return;
195 196
    case 15:
......
212 213
    for (i = 0; i < 16; i++) {
213 214
        int n;
214 215
        colors[i] = p;
215
        switch (ds_get_bits_per_pixel(s->ds)) {
216
        switch (surface_bits_per_pixel(surface)) {
216 217
        case 15:
217 218
            n = i * 2 + (i >> 3);
218 219
            p[0] = n | (n << 5);
......
235 236
        p += dest_width;
236 237
    }
237 238
    /* TODO: Implement row/column remapping.  */
238
    dest = ds_get_data(s->ds);
239
    dest = surface_data(surface);
239 240
    for (y = 0; y < 64; y++) {
240 241
        line = y;
241 242
        src = s->framebuffer + 64 * line;
......
260 261
        }
261 262
    }
262 263
    s->redraw = 0;
263
    dpy_gfx_update(s->ds, 0, 0, 128 * MAGNIFY, 64 * MAGNIFY);
264
    dpy_gfx_update(s->con, 0, 0, 128 * MAGNIFY, 64 * MAGNIFY);
264 265
}
265 266

  
266 267
static void ssd0323_invalidate_display(void * opaque)
......
336 337

  
337 338
    s->col_end = 63;
338 339
    s->row_end = 79;
339
    s->ds = graphic_console_init(ssd0323_update_display,
340
                                 ssd0323_invalidate_display,
341
                                 NULL, NULL, s);
342
    qemu_console_resize(s->ds, 128 * MAGNIFY, 64 * MAGNIFY);
340
    s->con = graphic_console_init(ssd0323_update_display,
341
                                  ssd0323_invalidate_display,
342
                                  NULL, NULL, s);
343
    qemu_console_resize(s->con, 128 * MAGNIFY, 64 * MAGNIFY);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff