Commit 100c5332 authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Merge remote-tracking branch 'kraxel/pixman.v11' into staging



# By Gerd Hoffmann (22) and Igor Mitsyanko (2)
# Via Gerd Hoffmann
* kraxel/pixman.v11: (24 commits)
  qxl: register QemuConsole for secondary cards
  gtk: custom cursor support
  console: allow pinning displaychangelisteners to consoles
  console: add qemu_console_is_*
  xen: re-enable refresh interval reporting for xenfb
  console: gui timer fixes
  console: add GraphicHwOps
  console: make DisplayState private to console.c
  console: move gui_update+gui_setup_refresh from vl.c into console.c
  console: zap g_width + g_height
  console: simplify screendump
  console: give each QemuConsole its own DisplaySurface
  console: rename vga_hw_*, add QemuConsole param
  console: displaystate init revamp
  console: add trace events
  console: switch color_table_rgb to pixman_color_t
  console: use pixman for font rendering
  console: use pixman for fill+blit
  pixman: render vgafont glyphs into pixman images
  pixman: add qemu_pixman_color()
  ...

Message-id: 1366105178-26744-1-git-send-email-kraxel@redhat.com
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parents 398973fe bfe528b9
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -601,6 +601,11 @@ static const MemoryRegionOps musicpal_lcd_ops = {
    .endianness = DEVICE_NATIVE_ENDIAN,
};

static const GraphicHwOps musicpal_gfx_ops = {
    .invalidate  = lcd_invalidate,
    .gfx_update  = lcd_refresh,
};

static int musicpal_lcd_init(SysBusDevice *dev)
{
    musicpal_lcd_state *s = FROM_SYSBUS(musicpal_lcd_state, dev);
@@ -611,8 +616,7 @@ static int musicpal_lcd_init(SysBusDevice *dev)
                          "musicpal-lcd", MP_LCD_SIZE);
    sysbus_init_mmio(dev, &s->iomem);

    s->con = graphic_console_init(lcd_refresh, lcd_invalidate,
                                  NULL, NULL, s);
    s->con = graphic_console_init(&musicpal_gfx_ops, s);
    qemu_console_resize(s->con, 128*3, 64*3);

    qdev_init_gpio_in(&dev->qdev, musicpal_lcd_gpio_brigthness_in, 3);
+6 −15
Original line number Diff line number Diff line
@@ -933,18 +933,6 @@ static void blizzard_update_display(void *opaque)
    s->my[1] = 0;
}

static void blizzard_screen_dump(void *opaque, const char *filename,
                                 bool cswitch, Error **errp)
{
    BlizzardState *s = (BlizzardState *) opaque;
    DisplaySurface *surface = qemu_console_surface(s->con);

    blizzard_update_display(opaque);
    if (s && surface_data(surface)) {
        ppm_save(filename, surface, errp);
    }
}

#define DEPTH 8
#include "blizzard_template.h"
#define DEPTH 15
@@ -956,6 +944,11 @@ static void blizzard_screen_dump(void *opaque, const char *filename,
#define DEPTH 32
#include "blizzard_template.h"

static const GraphicHwOps blizzard_ops = {
    .invalidate  = blizzard_invalidate_display,
    .gfx_update  = blizzard_update_display,
};

void *s1d13745_init(qemu_irq gpio_int)
{
    BlizzardState *s = (BlizzardState *) g_malloc0(sizeof(*s));
@@ -963,9 +956,7 @@ void *s1d13745_init(qemu_irq gpio_int)

    s->fb = g_malloc(0x180000);

    s->con = graphic_console_init(blizzard_update_display,
                                  blizzard_invalidate_display,
                                  blizzard_screen_dump, NULL, s);
    s->con = graphic_console_init(&blizzard_ops, s);
    surface = qemu_console_surface(s->con);

    switch (surface_bits_per_pixel(surface)) {
+3 −7
Original line number Diff line number Diff line
@@ -720,7 +720,7 @@ static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
    /* we have to flush all pending changes so that the copy
       is generated at the appropriate moment in time */
    if (notify)
	vga_hw_update();
        graphic_hw_update(s->vga.con);

    (*s->cirrus_rop) (s, s->vga.vram_ptr +
		      (s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
@@ -2910,9 +2910,7 @@ static int vga_initfn(ISADevice *dev)
    vga_common_init(s);
    cirrus_init_common(&d->cirrus_vga, CIRRUS_ID_CLGD5430, 0,
                       isa_address_space(dev), isa_address_space_io(dev));
    s->con = graphic_console_init(s->update, s->invalidate,
                                  s->screen_dump, s->text_update,
                                  s);
    s->con = graphic_console_init(s->hw_ops, s);
    rom_add_vga(VGABIOS_CIRRUS_FILENAME);
    /* XXX ISA-LFB support */
    /* FIXME not qdev yet */
@@ -2959,9 +2957,7 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
     vga_common_init(&s->vga);
     cirrus_init_common(s, device_id, 1, pci_address_space(dev),
                        pci_address_space_io(dev));
     s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate,
                                       s->vga.screen_dump, s->vga.text_update,
                                       &s->vga);
     s->vga.con = graphic_console_init(s->vga.hw_ops, &s->vga);

     /* setup PCI */

+10 −5
Original line number Diff line number Diff line
@@ -1242,7 +1242,7 @@ static void exynos4210_update_resolution(Exynos4210fimdState *s)
static void exynos4210_fimd_update(void *opaque)
{
    Exynos4210fimdState *s = (Exynos4210fimdState *)opaque;
    DisplaySurface *surface = qemu_console_surface(s->console);
    DisplaySurface *surface;
    Exynos4210fimdWindow *w;
    int i, line;
    hwaddr fb_line_addr, inc_size;
@@ -1255,11 +1255,12 @@ static void exynos4210_fimd_update(void *opaque)
    const int global_height = ((s->vidtcon[2] >> FIMD_VIDTCON2_VER_SHIFT) &
            FIMD_VIDTCON2_SIZE_MASK) + 1;

    if (!s || !s->console || !surface_bits_per_pixel(surface) ||
            !s->enabled) {
    if (!s || !s->console || !s->enabled ||
        surface_bits_per_pixel(qemu_console_surface(s->console)) == 0) {
        return;
    }
    exynos4210_update_resolution(s);
    surface = qemu_console_surface(s->console);

    for (i = 0; i < NUM_OF_WINDOWS; i++) {
        w = &s->window[i];
@@ -1886,6 +1887,11 @@ static const VMStateDescription exynos4210_fimd_vmstate = {
    }
};

static const GraphicHwOps exynos4210_fimd_ops = {
    .invalidate  = exynos4210_fimd_invalidate,
    .gfx_update  = exynos4210_fimd_update,
};

static int exynos4210_fimd_init(SysBusDevice *dev)
{
    Exynos4210fimdState *s = FROM_SYSBUS(Exynos4210fimdState, dev);
@@ -1899,8 +1905,7 @@ static int exynos4210_fimd_init(SysBusDevice *dev)
    memory_region_init_io(&s->iomem, &exynos4210_fimd_mmio_ops, s,
            "exynos4210.fimd", FIMD_REGS_SIZE);
    sysbus_init_mmio(dev, &s->iomem);
    s->console = graphic_console_init(exynos4210_fimd_update,
                                  exynos4210_fimd_invalidate, NULL, NULL, s);
    s->console = graphic_console_init(&exynos4210_fimd_ops, s);

    return 0;
}
+6 −74
Original line number Diff line number Diff line
@@ -294,77 +294,6 @@ static void g364fb_reset(G364State *s)
    g364fb_invalidate_display(s);
}

static void g364fb_screen_dump(void *opaque, const char *filename, bool cswitch,
                               Error **errp)
{
    G364State *s = opaque;
    int ret, y, x;
    uint8_t index;
    uint8_t *data_buffer;
    FILE *f;

    qemu_flush_coalesced_mmio_buffer();

    if (s->depth != 8) {
        error_setg(errp, "g364: unknown guest depth %d", s->depth);
        return;
    }

    f = fopen(filename, "wb");
    if (!f) {
        error_setg(errp, "failed to open file '%s': %s", filename,
                   strerror(errno));
        return;
    }

    if (s->ctla & CTLA_FORCE_BLANK) {
        /* blank screen */
        ret = fprintf(f, "P4\n%d %d\n", s->width, s->height);
        if (ret < 0) {
            goto write_err;
        }
        for (y = 0; y < s->height; y++)
            for (x = 0; x < s->width; x++) {
                ret = fputc(0, f);
                if (ret == EOF) {
                    goto write_err;
                }
            }
    } else {
        data_buffer = s->vram + s->top_of_screen;
        ret = fprintf(f, "P6\n%d %d\n%d\n", s->width, s->height, 255);
        if (ret < 0) {
            goto write_err;
        }
        for (y = 0; y < s->height; y++)
            for (x = 0; x < s->width; x++, data_buffer++) {
                index = *data_buffer;
                ret = fputc(s->color_palette[index][0], f);
                if (ret == EOF) {
                    goto write_err;
                }
                ret = fputc(s->color_palette[index][1], f);
                if (ret == EOF) {
                    goto write_err;
                }
                ret = fputc(s->color_palette[index][2], f);
                if (ret == EOF) {
                    goto write_err;
                }
        }
    }

out:
    fclose(f);
    return;

write_err:
    error_setg(errp, "failed to write to file '%s': %s", filename,
               strerror(errno));
    unlink(filename);
    goto out;
}

/* called for accesses to io ports */
static uint64_t g364fb_ctrl_read(void *opaque,
                                 hwaddr addr,
@@ -546,13 +475,16 @@ static const VMStateDescription vmstate_g364fb = {
    }
};

static const GraphicHwOps g364fb_ops = {
    .invalidate  = g364fb_invalidate_display,
    .gfx_update  = g364fb_update_display,
};

static void g364fb_init(DeviceState *dev, G364State *s)
{
    s->vram = g_malloc0(s->vram_size);

    s->con = graphic_console_init(g364fb_update_display,
                                  g364fb_invalidate_display,
                                  g364fb_screen_dump, NULL, s);
    s->con = graphic_console_init(&g364fb_ops, s);

    memory_region_init_io(&s->mem_ctrl, &g364fb_ctrl_ops, s, "ctrl", 0x180000);
    memory_region_init_ram_ptr(&s->mem_vram, "vram",
Loading