int ret;
bs = bdrv_new("");
- if (!bs)
- return -ENOMEM;
- ret = bdrv_open2(bs, filename, flags | BDRV_O_FILE, NULL);
+ ret = bdrv_open2(bs, filename, flags | BDRV_O_FILE, &bdrv_raw);
if (ret < 0) {
bdrv_delete(bs);
return ret;
if (bs->backing_file[0] != '\0') {
/* if there is a backing file, use it */
bs->backing_hd = bdrv_new("");
- if (!bs->backing_hd) {
- fail:
- bdrv_close(bs);
- return -ENOMEM;
- }
path_combine(backing_filename, sizeof(backing_filename),
filename, bs->backing_file);
- if (bdrv_open2(bs->backing_hd, backing_filename, open_flags, &bdrv_raw) < 0)
- goto fail;
- ret = bdrv_open(bs->backing_hd, backing_filename, open_flags);
++ ret = bdrv_open2(bs->backing_hd, backing_filename, open_flags, &bdrv_raw);
+ if (ret < 0) {
+ bdrv_close(bs);
+ return ret;
+ }
}
/* call the change callback */
BlockDriverAIOCB *bdrv_aio_write(BlockDriverState *bs, int64_t sector_num,
const uint8_t *buf, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque);
+BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs,
+ BlockDriverCompletionFunc *cb, void *opaque);
void bdrv_aio_cancel(BlockDriverAIOCB *acb);
- int qemu_key_check(BlockDriverState *bs, const char *name);
-
/* Ensure contents are flushed to disk. */
-void bdrv_flush(BlockDriverState *bs);
-void bdrv_flush_all(void);
+int bdrv_flush(BlockDriverState *bs);
+int bdrv_flush_all(void);
int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
int *pnum);
*/
static void vga_draw_graphic(VGAState *s, int full_update)
{
- int y1, y, update, page_min, page_max, linesize, y_start, double_scan, mask, depth;
- int width, height, shift_control, line_offset, page0, page1, bwidth, bits;
+ int y1, y, update, linesize, y_start, double_scan, mask, depth;
- int width, height, shift_control, line_offset, bwidth, ds_depth, bits;
++ int width, height, shift_control, line_offset, bwidth, bits;
+ ram_addr_t page0, page1;
int disp_width, multi_scan, multi_run;
uint8_t *d;
uint32_t v, addr1, addr;
s->shift_control = shift_control;
s->double_scan = double_scan;
}
+ if (shift_control == 1 && (s->sr[0x01] & 8)) {
+ disp_width <<= 1;
+ }
- ds_depth = ds_get_bits_per_pixel(s->ds);
+ if (shift_control == 0) {
+ if (s->sr[0x01] & 8) {
+ disp_width <<= 1;
+ }
+ } else if (shift_control == 1) {
+ if (s->sr[0x01] & 8) {
+ disp_width <<= 1;
+ }
+ }
+
depth = s->get_bpp(s);
- if (s->line_offset != s->last_line_offset ||
+ if (s->line_offset != s->last_line_offset ||
disp_width != s->last_width ||
height != s->last_height ||
s->last_depth != depth) {
ppm_save(filename, ds->surface);
- qemu_free_displaysurface(ds->surface);
+ qemu_free_displaysurface(ds);
s->ds = saved_ds;
-}
-
-static void vga_screen_dump_graphic(VGAState *s, const char *filename)
-{
- int w, h;
-
- s->get_resolution(s, &w, &h);
- vga_screen_dump_common(s, filename, w, h);
-}
-
-static void vga_screen_dump_text(VGAState *s, const char *filename)
-{
- int w, h, cwidth, cheight;
-
- vga_get_text_resolution(s, &w, &h, &cwidth, &cheight);
- vga_screen_dump_common(s, filename, w * cwidth, h * cheight);
-}
-
-/* save the vga display in a PPM image even if no display is
- available */
-static void vga_screen_dump(void *opaque, const char *filename)
-{
- VGAState *s = (VGAState *)opaque;
-
- if (!(s->ar_index & 0x20))
- vga_screen_dump_blank(s, filename);
- else if (s->gr[6] & 1)
- vga_screen_dump_graphic(s, filename);
- else
- vga_screen_dump_text(s, filename);
+ vga_invalidate_display(s);
}