Revision 380cd056

b/hw/arm/musicpal.c
601 601
    .endianness = DEVICE_NATIVE_ENDIAN,
602 602
};
603 603

  
604
static const GraphicHwOps musicpal_gfx_ops = {
605
    .invalidate  = lcd_invalidate,
606
    .gfx_update  = lcd_refresh,
607
};
608

  
604 609
static int musicpal_lcd_init(SysBusDevice *dev)
605 610
{
606 611
    musicpal_lcd_state *s = FROM_SYSBUS(musicpal_lcd_state, dev);
......
611 616
                          "musicpal-lcd", MP_LCD_SIZE);
612 617
    sysbus_init_mmio(dev, &s->iomem);
613 618

  
614
    s->con = graphic_console_init(lcd_refresh, lcd_invalidate,
615
                                  NULL, s);
619
    s->con = graphic_console_init(&musicpal_gfx_ops, s);
616 620
    qemu_console_resize(s->con, 128*3, 64*3);
617 621

  
618 622
    qdev_init_gpio_in(&dev->qdev, musicpal_lcd_gpio_brigthness_in, 3);
b/hw/display/blizzard.c
944 944
#define DEPTH 32
945 945
#include "blizzard_template.h"
946 946

  
947
static const GraphicHwOps blizzard_ops = {
948
    .invalidate  = blizzard_invalidate_display,
949
    .gfx_update  = blizzard_update_display,
950
};
951

  
947 952
void *s1d13745_init(qemu_irq gpio_int)
948 953
{
949 954
    BlizzardState *s = (BlizzardState *) g_malloc0(sizeof(*s));
......
951 956

  
952 957
    s->fb = g_malloc(0x180000);
953 958

  
954
    s->con = graphic_console_init(blizzard_update_display,
955
                                  blizzard_invalidate_display,
956
                                  NULL, s);
959
    s->con = graphic_console_init(&blizzard_ops, s);
957 960
    surface = qemu_console_surface(s->con);
958 961

  
959 962
    switch (surface_bits_per_pixel(surface)) {
b/hw/display/cirrus_vga.c
2910 2910
    vga_common_init(s);
2911 2911
    cirrus_init_common(&d->cirrus_vga, CIRRUS_ID_CLGD5430, 0,
2912 2912
                       isa_address_space(dev), isa_address_space_io(dev));
2913
    s->con = graphic_console_init(s->update, s->invalidate,
2914
                                  s->text_update,
2915
                                  s);
2913
    s->con = graphic_console_init(s->hw_ops, s);
2916 2914
    rom_add_vga(VGABIOS_CIRRUS_FILENAME);
2917 2915
    /* XXX ISA-LFB support */
2918 2916
    /* FIXME not qdev yet */
......
2959 2957
     vga_common_init(&s->vga);
2960 2958
     cirrus_init_common(s, device_id, 1, pci_address_space(dev),
2961 2959
                        pci_address_space_io(dev));
2962
     s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate,
2963
                                       s->vga.text_update,
2964
                                       &s->vga);
2960
     s->vga.con = graphic_console_init(s->vga.hw_ops, &s->vga);
2965 2961

  
2966 2962
     /* setup PCI */
2967 2963

  
b/hw/display/exynos4210_fimd.c
1887 1887
    }
1888 1888
};
1889 1889

  
1890
static const GraphicHwOps exynos4210_fimd_ops = {
1891
    .invalidate  = exynos4210_fimd_invalidate,
1892
    .gfx_update  = exynos4210_fimd_update,
1893
};
1894

  
1890 1895
static int exynos4210_fimd_init(SysBusDevice *dev)
1891 1896
{
1892 1897
    Exynos4210fimdState *s = FROM_SYSBUS(Exynos4210fimdState, dev);
......
1900 1905
    memory_region_init_io(&s->iomem, &exynos4210_fimd_mmio_ops, s,
1901 1906
            "exynos4210.fimd", FIMD_REGS_SIZE);
1902 1907
    sysbus_init_mmio(dev, &s->iomem);
1903
    s->console = graphic_console_init(exynos4210_fimd_update,
1904
                                      exynos4210_fimd_invalidate, NULL, s);
1908
    s->console = graphic_console_init(&exynos4210_fimd_ops, s);
1905 1909

  
1906 1910
    return 0;
1907 1911
}
b/hw/display/g364fb.c
475 475
    }
476 476
};
477 477

  
478
static const GraphicHwOps g364fb_ops = {
479
    .invalidate  = g364fb_invalidate_display,
480
    .gfx_update  = g364fb_update_display,
481
};
482

  
478 483
static void g364fb_init(DeviceState *dev, G364State *s)
479 484
{
480 485
    s->vram = g_malloc0(s->vram_size);
481 486

  
482
    s->con = graphic_console_init(g364fb_update_display,
483
                                  g364fb_invalidate_display,
484
                                  NULL, s);
487
    s->con = graphic_console_init(&g364fb_ops, s);
485 488

  
486 489
    memory_region_init_io(&s->mem_ctrl, &g364fb_ctrl_ops, s, "ctrl", 0x180000);
487 490
    memory_region_init_ram_ptr(&s->mem_vram, "vram",
b/hw/display/jazz_led.c
254 254
    }
255 255
};
256 256

  
257
static const GraphicHwOps jazz_led_ops = {
258
    .invalidate  = jazz_led_invalidate_display,
259
    .gfx_update  = jazz_led_update_display,
260
    .text_update = jazz_led_text_update,
261
};
262

  
257 263
static int jazz_led_init(SysBusDevice *dev)
258 264
{
259 265
    LedState *s = FROM_SYSBUS(LedState, dev);
......
261 267
    memory_region_init_io(&s->iomem, &led_ops, s, "led", 1);
262 268
    sysbus_init_mmio(dev, &s->iomem);
263 269

  
264
    s->con = graphic_console_init(jazz_led_update_display,
265
                                  jazz_led_invalidate_display,
266
                                  jazz_led_text_update, s);
270
    s->con = graphic_console_init(&jazz_led_ops, s);
267 271

  
268 272
    return 0;
269 273
}
b/hw/display/milkymist-vgafb.c
270 270
    s->regs[R_BASEADDRESS] = 0;
271 271
}
272 272

  
273
static const GraphicHwOps vgafb_ops = {
274
    .invalidate  = vgafb_invalidate_display,
275
    .gfx_update  = vgafb_update_display,
276
};
277

  
273 278
static int milkymist_vgafb_init(SysBusDevice *dev)
274 279
{
275 280
    MilkymistVgafbState *s = FROM_SYSBUS(typeof(*s), dev);
......
278 283
            "milkymist-vgafb", R_MAX * 4);
279 284
    sysbus_init_mmio(dev, &s->regs_region);
280 285

  
281
    s->con = graphic_console_init(vgafb_update_display,
282
                                  vgafb_invalidate_display,
283
                                  NULL, s);
286
    s->con = graphic_console_init(&vgafb_ops, s);
284 287

  
285 288
    return 0;
286 289
}
b/hw/display/omap_lcdc.c
384 384
    s->ctrl = 0;
385 385
}
386 386

  
387
static const GraphicHwOps omap_ops = {
388
    .invalidate  = omap_invalidate_display,
389
    .gfx_update  = omap_update_display,
390
};
391

  
387 392
struct omap_lcd_panel_s *omap_lcdc_init(MemoryRegion *sysmem,
388 393
                                        hwaddr base,
389 394
                                        qemu_irq irq,
......
401 406
    memory_region_init_io(&s->iomem, &omap_lcdc_ops, s, "omap.lcdc", 0x100);
402 407
    memory_region_add_subregion(sysmem, base, &s->iomem);
403 408

  
404
    s->con = graphic_console_init(omap_update_display,
405
                                  omap_invalidate_display,
406
                                  NULL, s);
409
    s->con = graphic_console_init(&omap_ops, s);
407 410

  
408 411
    return s;
409 412
}
b/hw/display/pl110.c
444 444
    return 0;
445 445
}
446 446

  
447
static const GraphicHwOps pl110_gfx_ops = {
448
    .invalidate  = pl110_invalidate_display,
449
    .gfx_update  = pl110_update_display,
450
};
451

  
447 452
static int pl110_init(SysBusDevice *dev)
448 453
{
449 454
    pl110_state *s = FROM_SYSBUS(pl110_state, dev);
......
452 457
    sysbus_init_mmio(dev, &s->iomem);
453 458
    sysbus_init_irq(dev, &s->irq);
454 459
    qdev_init_gpio_in(&s->busdev.qdev, pl110_mux_ctrl_set, 1);
455
    s->con = graphic_console_init(pl110_update_display,
456
                                  pl110_invalidate_display,
457
                                  NULL, s);
460
    s->con = graphic_console_init(&pl110_gfx_ops, s);
458 461
    return 0;
459 462
}
460 463

  
b/hw/display/pxa2xx_lcd.c
991 991
#define BITS 32
992 992
#include "pxa2xx_template.h"
993 993

  
994
static const GraphicHwOps pxa2xx_ops = {
995
    .invalidate  = pxa2xx_invalidate_display,
996
    .gfx_update  = pxa2xx_update_display,
997
};
998

  
994 999
PXA2xxLCDState *pxa2xx_lcdc_init(MemoryRegion *sysmem,
995 1000
                                 hwaddr base, qemu_irq irq)
996 1001
{
......
1008 1013
                          "pxa2xx-lcd-controller", 0x00100000);
1009 1014
    memory_region_add_subregion(sysmem, base, &s->iomem);
1010 1015

  
1011
    s->con = graphic_console_init(pxa2xx_update_display,
1012
                                  pxa2xx_invalidate_display,
1013
                                  NULL, s);
1016
    s->con = graphic_console_init(&pxa2xx_ops, s);
1014 1017
    surface = qemu_console_surface(s->con);
1015 1018

  
1016 1019
    switch (surface_bits_per_pixel(surface)) {
b/hw/display/qxl.c
1753 1753

  
1754 1754
    switch (qxl->mode) {
1755 1755
    case QXL_MODE_VGA:
1756
        vga->update(vga);
1756
        vga->hw_ops->gfx_update(vga);
1757 1757
        break;
1758 1758
    case QXL_MODE_COMPAT:
1759 1759
    case QXL_MODE_NATIVE:
......
1769 1769
    PCIQXLDevice *qxl = opaque;
1770 1770
    VGACommonState *vga = &qxl->vga;
1771 1771

  
1772
    vga->invalidate(vga);
1772
    vga->hw_ops->invalidate(vga);
1773 1773
}
1774 1774

  
1775 1775
static void qxl_hw_text_update(void *opaque, console_ch_t *chardata)
......
1778 1778
    VGACommonState *vga = &qxl->vga;
1779 1779

  
1780 1780
    if (qxl->mode == QXL_MODE_VGA) {
1781
        vga->text_update(vga, chardata);
1781
        vga->hw_ops->text_update(vga, chardata);
1782 1782
        return;
1783 1783
    }
1784 1784
}
......
2038 2038
    return 0;
2039 2039
}
2040 2040

  
2041
static const GraphicHwOps qxl_ops = {
2042
    .invalidate  = qxl_hw_invalidate,
2043
    .gfx_update  = qxl_hw_update,
2044
    .text_update = qxl_hw_text_update,
2045
};
2046

  
2041 2047
static int qxl_init_primary(PCIDevice *dev)
2042 2048
{
2043 2049
    PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev);
......
2054 2060
    portio_list_init(qxl_vga_port_list, qxl_vga_portio_list, vga, "vga");
2055 2061
    portio_list_add(qxl_vga_port_list, pci_address_space_io(dev), 0x3b0);
2056 2062

  
2057
    vga->con = graphic_console_init(qxl_hw_update, qxl_hw_invalidate,
2058
                                    qxl_hw_text_update,
2059
                                    qxl);
2063
    vga->con = graphic_console_init(&qxl_ops, qxl);
2060 2064
    qxl->ssd.con = vga->con,
2061 2065
    qemu_spice_display_init_common(&qxl->ssd);
2062 2066

  
b/hw/display/sm501.c
1383 1383
	sm501_draw_crt(s);
1384 1384
}
1385 1385

  
1386
static const GraphicHwOps sm501_ops = {
1387
    .gfx_update  = sm501_update_display,
1388
};
1389

  
1386 1390
void sm501_init(MemoryRegion *address_space_mem, uint32_t base,
1387 1391
                uint32_t local_mem_bytes, qemu_irq irq, CharDriverState *chr)
1388 1392
{
......
1445 1449
    }
1446 1450

  
1447 1451
    /* create qemu graphic console */
1448
    s->con = graphic_console_init(sm501_update_display, NULL,
1449
                                  NULL, s);
1452
    s->con = graphic_console_init(&sm501_ops, s);
1450 1453
}
b/hw/display/ssd0303.c
284 284
    }
285 285
};
286 286

  
287
static const GraphicHwOps ssd0303_ops = {
288
    .invalidate  = ssd0303_invalidate_display,
289
    .gfx_update  = ssd0303_update_display,
290
};
291

  
287 292
static int ssd0303_init(I2CSlave *i2c)
288 293
{
289 294
    ssd0303_state *s = FROM_I2C_SLAVE(ssd0303_state, i2c);
290 295

  
291
    s->con = graphic_console_init(ssd0303_update_display,
292
                                  ssd0303_invalidate_display,
293
                                  NULL, s);
296
    s->con = graphic_console_init(&ssd0303_ops, s);
294 297
    qemu_console_resize(s->con, 96 * MAGNIFY, 16 * MAGNIFY);
295 298
    return 0;
296 299
}
b/hw/display/ssd0323.c
331 331
    return 0;
332 332
}
333 333

  
334
static const GraphicHwOps ssd0323_ops = {
335
    .invalidate  = ssd0323_invalidate_display,
336
    .gfx_update  = ssd0323_update_display,
337
};
338

  
334 339
static int ssd0323_init(SSISlave *dev)
335 340
{
336 341
    ssd0323_state *s = FROM_SSI_SLAVE(ssd0323_state, dev);
337 342

  
338 343
    s->col_end = 63;
339 344
    s->row_end = 79;
340
    s->con = graphic_console_init(ssd0323_update_display,
341
                                  ssd0323_invalidate_display,
342
                                  NULL, s);
345
    s->con = graphic_console_init(&ssd0323_ops, s);
343 346
    qemu_console_resize(s->con, 128 * MAGNIFY, 64 * MAGNIFY);
344 347

  
345 348
    qdev_init_gpio_in(&dev->qdev, ssd0323_cd, 1);
b/hw/display/tc6393xb.c
548 548
                (uint32_t) addr, (int)value & 0xff);
549 549
}
550 550

  
551
static const GraphicHwOps tc6393xb_gfx_ops = {
552
    .gfx_update  = tc6393xb_update_display,
553
};
554

  
551 555
TC6393xbState *tc6393xb_init(MemoryRegion *sysmem, uint32_t base, qemu_irq irq)
552 556
{
553 557
    TC6393xbState *s;
......
583 587
    memory_region_add_subregion(sysmem, base + 0x100000, &s->vram);
584 588
    s->scr_width = 480;
585 589
    s->scr_height = 640;
586
    s->con = graphic_console_init(tc6393xb_update_display,
587
            NULL, /* invalidate */
588
            NULL, /* text_update */
589
            s);
590
    s->con = graphic_console_init(&tc6393xb_gfx_ops, s);
590 591

  
591 592
    return s;
592 593
}
b/hw/display/tcx.c
510 510
    },
511 511
};
512 512

  
513
static const GraphicHwOps tcx_ops = {
514
    .invalidate = tcx_invalidate_display,
515
    .gfx_update = tcx_update_display,
516
};
517

  
518
static const GraphicHwOps tcx24_ops = {
519
    .invalidate = tcx24_invalidate_display,
520
    .gfx_update = tcx24_update_display,
521
};
522

  
513 523
static int tcx_init1(SysBusDevice *dev)
514 524
{
515 525
    TCXState *s = FROM_SYSBUS(TCXState, dev);
......
562 572
                                 &s->vram_mem, vram_offset, size);
563 573
        sysbus_init_mmio(dev, &s->vram_cplane);
564 574

  
565
        s->con = graphic_console_init(tcx24_update_display,
566
                                      tcx24_invalidate_display,
567
                                      NULL, s);
575
        s->con = graphic_console_init(&tcx24_ops, s);
568 576
    } else {
569 577
        /* THC 8 bit (dummy) */
570 578
        memory_region_init_io(&s->thc8, &dummy_ops, s, "tcx.thc8",
571 579
                              TCX_THC_NREGS_8);
572 580
        sysbus_init_mmio(dev, &s->thc8);
573 581

  
574
        s->con = graphic_console_init(tcx_update_display,
575
                                      tcx_invalidate_display,
576
                                      NULL, s);
582
        s->con = graphic_console_init(&tcx_ops, s);
577 583
    }
578 584

  
579 585
    qemu_console_resize(s->con, s->width, s->height);
b/hw/display/vga-isa-mm.c
135 135
    vga_common_init(&s->vga);
136 136
    vga_mm_init(s, vram_base, ctrl_base, it_shift, address_space);
137 137

  
138
    s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate,
139
                                      s->vga.text_update,
140
                                      s);
138
    s->vga.con = graphic_console_init(s->vga.hw_ops, s);
141 139

  
142 140
    vga_init_vbe(&s->vga, address_space);
143 141
    return 0;
b/hw/display/vga-isa.c
62 62
                                        isa_mem_base + 0x000a0000,
63 63
                                        vga_io_memory, 1);
64 64
    memory_region_set_coalescing(vga_io_memory);
65
    s->con = graphic_console_init(s->update, s->invalidate,
66
                                  s->text_update, s);
65
    s->con = graphic_console_init(s->hw_ops, s);
67 66

  
68 67
    vga_init_vbe(s, isa_address_space(dev));
69 68
    /* ROM BIOS */
b/hw/display/vga-pci.c
150 150
    vga_common_init(s);
151 151
    vga_init(s, pci_address_space(dev), pci_address_space_io(dev), true);
152 152

  
153
    s->con = graphic_console_init(s->update, s->invalidate,
154
                                  s->text_update, s);
153
    s->con = graphic_console_init(s->hw_ops, s);
155 154

  
156 155
    /* XXX: VGA_RAM_SIZE must be a power of two */
157 156
    pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->vram);
b/hw/display/vga.c
2250 2250
    }
2251 2251
};
2252 2252

  
2253
static const GraphicHwOps vga_ops = {
2254
    .invalidate  = vga_invalidate_display,
2255
    .gfx_update  = vga_update_display,
2256
    .text_update = vga_update_text,
2257
};
2258

  
2253 2259
void vga_common_init(VGACommonState *s)
2254 2260
{
2255 2261
    int i, j, v, b;
......
2293 2299
    s->get_bpp = vga_get_bpp;
2294 2300
    s->get_offsets = vga_get_offsets;
2295 2301
    s->get_resolution = vga_get_resolution;
2296
    s->update = vga_update_display;
2297
    s->invalidate = vga_invalidate_display;
2298
    s->text_update = vga_update_text;
2302
    s->hw_ops = &vga_ops;
2299 2303
    switch (vga_retrace_method) {
2300 2304
    case VGA_RETRACE_DUMB:
2301 2305
        s->retrace = vga_dumb_retrace;
b/hw/display/vga_int.h
152 152
    uint32_t cursor_offset;
153 153
    unsigned int (*rgb_to_pixel)(unsigned int r,
154 154
                                 unsigned int g, unsigned b);
155
    graphic_hw_update_ptr update;
156
    graphic_hw_invalidate_ptr invalidate;
157
    graphic_hw_text_update_ptr text_update;
155
    const GraphicHwOps *hw_ops;
158 156
    bool full_update_text;
159 157
    bool full_update_gfx;
160 158
    /* hardware mouse cursor support */
b/hw/display/vmware_vga.c
913 913
    case SVGA_REG_ENABLE:
914 914
        s->enable = !!value;
915 915
        s->invalidated = 1;
916
        s->vga.invalidate(&s->vga);
916
        s->vga.hw_ops->invalidate(&s->vga);
917 917
        if (s->enable && s->config) {
918 918
            vga_dirty_log_stop(&s->vga);
919 919
        } else {
......
1058 1058
    bool dirty = false;
1059 1059

  
1060 1060
    if (!s->enable) {
1061
        s->vga.update(&s->vga);
1061
        s->vga.hw_ops->gfx_update(&s->vga);
1062 1062
        return;
1063 1063
    }
1064 1064

  
......
1112 1112
{
1113 1113
    struct vmsvga_state_s *s = opaque;
1114 1114
    if (!s->enable) {
1115
        s->vga.invalidate(&s->vga);
1115
        s->vga.hw_ops->invalidate(&s->vga);
1116 1116
        return;
1117 1117
    }
1118 1118

  
......
1123 1123
{
1124 1124
    struct vmsvga_state_s *s = opaque;
1125 1125

  
1126
    if (s->vga.text_update) {
1127
        s->vga.text_update(&s->vga, chardata);
1126
    if (s->vga.hw_ops->text_update) {
1127
        s->vga.hw_ops->text_update(&s->vga, chardata);
1128 1128
    }
1129 1129
}
1130 1130

  
......
1179 1179
    }
1180 1180
};
1181 1181

  
1182
static const GraphicHwOps vmsvga_ops = {
1183
    .invalidate  = vmsvga_invalidate_display,
1184
    .gfx_update  = vmsvga_update_display,
1185
    .text_update = vmsvga_text_update,
1186
};
1187

  
1182 1188
static void vmsvga_init(struct vmsvga_state_s *s,
1183 1189
                        MemoryRegion *address_space, MemoryRegion *io)
1184 1190
{
1185 1191
    s->scratch_size = SVGA_SCRATCH_SIZE;
1186 1192
    s->scratch = g_malloc(s->scratch_size * 4);
1187 1193

  
1188
    s->vga.con = graphic_console_init(vmsvga_update_display,
1189
                                      vmsvga_invalidate_display,
1190
                                      vmsvga_text_update, s);
1194
    s->vga.con = graphic_console_init(&vmsvga_ops, s);
1191 1195

  
1192 1196
    s->fifo_size = SVGA_FIFO_SIZE;
1193 1197
    memory_region_init_ram(&s->fifo_ram, "vmsvga.fifo", s->fifo_size);
b/hw/display/xenfb.c
977 977
    .frontend_changed = fb_frontend_changed,
978 978
};
979 979

  
980
static const GraphicHwOps xenfb_ops = {
981
    .invalidate  = xenfb_invalidate,
982
    .gfx_update  = xenfb_update,
983
};
984

  
980 985
/*
981 986
 * FIXME/TODO: Kill this.
982 987
 * Temporary needed while DisplayState reorganization is in flight.
......
1004 1009

  
1005 1010
    /* vfb */
1006 1011
    fb = container_of(xfb, struct XenFB, c.xendev);
1007
    fb->c.con = graphic_console_init(xenfb_update,
1008
                                     xenfb_invalidate,
1009
                                     NULL,
1010
                                     fb);
1012
    fb->c.con = graphic_console_init(&xenfb_ops, fb);
1011 1013
    fb->have_console = 1;
1012 1014

  
1013 1015
    /* vkbd */
b/hw/unicore32/puv3.c
78 78
    memory_region_add_subregion(get_system_memory(), 0, ram_memory);
79 79
}
80 80

  
81
static const GraphicHwOps no_ops;
82

  
81 83
static void puv3_load_kernel(const char *kernel_filename)
82 84
{
83 85
    int size;
......
92 94
    }
93 95

  
94 96
    /* cheat curses that we have a graphic console, only under ocd console */
95
    graphic_console_init(NULL, NULL, NULL, NULL);
97
    graphic_console_init(&no_ops, NULL);
96 98
}
97 99

  
98 100
static void puv3_init(QEMUMachineInitArgs *args)
b/include/ui/console.h
267 267
    *dest = ch;
268 268
}
269 269

  
270
typedef void (*graphic_hw_update_ptr)(void *);
271
typedef void (*graphic_hw_invalidate_ptr)(void *);
272
typedef void (*graphic_hw_text_update_ptr)(void *, console_ch_t *);
270
typedef struct GraphicHwOps {
271
    void (*invalidate)(void *opaque);
272
    void (*gfx_update)(void *opaque);
273
    void (*text_update)(void *opaque, console_ch_t *text);
274
} GraphicHwOps;
273 275

  
274
QemuConsole *graphic_console_init(graphic_hw_update_ptr update,
275
                                  graphic_hw_invalidate_ptr invalidate,
276
                                  graphic_hw_text_update_ptr text_update,
276
QemuConsole *graphic_console_init(const GraphicHwOps *ops,
277 277
                                  void *opaque);
278 278

  
279 279
void graphic_hw_update(QemuConsole *con);
b/ui/console.c
119 119
    DisplaySurface *surface;
120 120

  
121 121
    /* Graphic console state.  */
122
    graphic_hw_update_ptr hw_update;
123
    graphic_hw_invalidate_ptr hw_invalidate;
124
    graphic_hw_text_update_ptr hw_text_update;
122
    const GraphicHwOps *hw_ops;
125 123
    void *hw;
126 124

  
127 125
    /* Text console state */
......
229 227
    if (!con) {
230 228
        con = active_console;
231 229
    }
232
    if (con && con->hw_update) {
233
        con->hw_update(con->hw);
230
    if (con && con->hw_ops->gfx_update) {
231
        con->hw_ops->gfx_update(con->hw);
234 232
    }
235 233
}
236 234

  
......
239 237
    if (!con) {
240 238
        con = active_console;
241 239
    }
242
    if (con && con->hw_invalidate) {
243
        con->hw_invalidate(con->hw);
240
    if (con && con->hw_ops->invalidate) {
241
        con->hw_ops->invalidate(con->hw);
244 242
    }
245 243
}
246 244

  
......
310 308
    if (!con) {
311 309
        con = active_console;
312 310
    }
313
    if (con && con->hw_text_update)
314
        con->hw_text_update(con->hw, chardata);
311
    if (con && con->hw_ops->text_update) {
312
        con->hw_ops->text_update(con->hw, chardata);
313
    }
315 314
}
316 315

  
317 316
static void vga_fill_rect(QemuConsole *con,
......
1493 1492
    return display_state;
1494 1493
}
1495 1494

  
1496
QemuConsole *graphic_console_init(graphic_hw_update_ptr update,
1497
                                  graphic_hw_invalidate_ptr invalidate,
1498
                                  graphic_hw_text_update_ptr text_update,
1495
QemuConsole *graphic_console_init(const GraphicHwOps *hw_ops,
1499 1496
                                  void *opaque)
1500 1497
{
1501 1498
    int width = 640;
......
1506 1503
    ds = get_alloc_displaystate();
1507 1504
    trace_console_gfx_new();
1508 1505
    s = new_console(ds, GRAPHIC_CONSOLE);
1509
    s->hw_update = update;
1510
    s->hw_invalidate = invalidate;
1511
    s->hw_text_update = text_update;
1506
    s->hw_ops = hw_ops;
1512 1507
    s->hw = opaque;
1513 1508

  
1514 1509
    s->surface = qemu_create_displaysurface(width, height);
......
1542 1537
                   qemu_get_clock_ms(rt_clock) + CONSOLE_CURSOR_PERIOD / 2);
1543 1538
}
1544 1539

  
1540
static const GraphicHwOps text_console_ops = {
1541
    .invalidate  = text_console_invalidate,
1542
    .text_update = text_console_update,
1543
};
1544

  
1545 1545
static void text_console_do_init(CharDriverState *chr, DisplayState *ds)
1546 1546
{
1547 1547
    QemuConsole *s;
......
1573 1573
    s->cursor_timer =
1574 1574
        qemu_new_timer_ms(rt_clock, text_console_update_cursor, s);
1575 1575

  
1576
    s->hw_invalidate = text_console_invalidate;
1577
    s->hw_text_update = text_console_update;
1576
    s->hw_ops = &text_console_ops;
1578 1577
    s->hw = s;
1579 1578

  
1580 1579
    /* Set text attribute defaults */

Also available in: Unified diff