Revision c78f7137 hw/omap_lcdc.c

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
}

Also available in: Unified diff