Lines Matching +full:io +full:- +full:width
2 * QEMU VMware-SVGA "chipset".
33 #include "hw/qdev-properties.h"
45 /* See http://vmware-svga.sf.net/ for some documentation on VMWare SVGA */
87 #define TYPE_VMWARE_SVGA "vmware-svga"
192 * FIFO offsets (seen as an array of 32-bit words)
319 trace_vmware_verify_rect_surface_bound_exceeded(name, "width", in vmsvga_verify_rect()
356 DisplaySurface *surface = qemu_console_surface(s->vga.con); in vmsvga_update_rect()
359 int width; in vmsvga_update_rect() local
373 width = surface_bytes_per_pixel(surface) * w; in vmsvga_update_rect()
375 src = s->vga.vram_ptr + start; in vmsvga_update_rect()
378 for (line = h; line > 0; line--, src += bypl, dst += bypl) { in vmsvga_update_rect()
379 memcpy(dst, src, width); in vmsvga_update_rect()
381 dpy_gfx_update(s->vga.con, x, y, w, h); in vmsvga_update_rect()
388 if (s->invalidated) { in vmsvga_update_rect_flush()
389 s->redraw_fifo_last = 0; in vmsvga_update_rect_flush()
392 /* Overlapping region updates can be optimised out here - if someone in vmsvga_update_rect_flush()
394 for (int i = 0; i < s->redraw_fifo_last; i++) { in vmsvga_update_rect_flush()
395 rect = &s->redraw_fifo[i]; in vmsvga_update_rect_flush()
396 vmsvga_update_rect(s, rect->x, rect->y, rect->w, rect->h); in vmsvga_update_rect_flush()
399 s->redraw_fifo_last = 0; in vmsvga_update_rect_flush()
406 if (s->redraw_fifo_last >= REDRAW_FIFO_LEN) { in vmsvga_update_rect_delayed()
411 struct vmsvga_rect_s *rect = &s->redraw_fifo[s->redraw_fifo_last++]; in vmsvga_update_rect_delayed()
413 rect->x = x; in vmsvga_update_rect_delayed()
414 rect->y = y; in vmsvga_update_rect_delayed()
415 rect->w = w; in vmsvga_update_rect_delayed()
416 rect->h = h; in vmsvga_update_rect_delayed()
423 DisplaySurface *surface = qemu_console_surface(s->vga.con); in vmsvga_copy_rect()
424 uint8_t *vram = s->vga.vram_ptr; in vmsvga_copy_rect()
427 int width = bypp * w; in vmsvga_copy_rect() local
432 return -1; in vmsvga_copy_rect()
435 return -1; in vmsvga_copy_rect()
439 ptr[0] = vram + bypp * x0 + bypl * (y0 + h - 1); in vmsvga_copy_rect()
440 ptr[1] = vram + bypp * x1 + bypl * (y1 + h - 1); in vmsvga_copy_rect()
441 for (; line > 0; line --, ptr[0] -= bypl, ptr[1] -= bypl) { in vmsvga_copy_rect()
442 memmove(ptr[1], ptr[0], width); in vmsvga_copy_rect()
447 for (; line > 0; line --, ptr[0] += bypl, ptr[1] += bypl) { in vmsvga_copy_rect()
448 memmove(ptr[1], ptr[0], width); in vmsvga_copy_rect()
461 DisplaySurface *surface = qemu_console_surface(s->vga.con); in vmsvga_fill_rect()
463 int width = surface_bytes_per_pixel(surface) * w; in vmsvga_fill_rect() local
472 return -1; in vmsvga_fill_rect()
480 fst = s->vga.vram_ptr + surface_bytes_per_pixel(surface) * x + bypl * y; in vmsvga_fill_rect()
482 if (line--) { in vmsvga_fill_rect()
485 for (column = width; column > 0; column--) { in vmsvga_fill_rect()
487 if (src - col == surface_bytes_per_pixel(surface)) { in vmsvga_fill_rect()
492 for (; line > 0; line--) { in vmsvga_fill_rect()
494 memcpy(dst, fst, width); in vmsvga_fill_rect()
504 uint32_t width; member
524 qc = cursor_alloc(c->width, c->height); in vmsvga_cursor_define()
527 qc->hot_x = c->hot_x; in vmsvga_cursor_define()
528 qc->hot_y = c->hot_y; in vmsvga_cursor_define()
529 switch (c->bpp) { in vmsvga_cursor_define()
531 cursor_set_mono(qc, 0xffffff, 0x000000, (void *)c->image, in vmsvga_cursor_define()
532 1, (void *)c->mask); in vmsvga_cursor_define()
539 cursor_set_mono(qc, 0x000000, 0x000000, (void *)c->mask, in vmsvga_cursor_define()
540 1, (void *)c->mask); in vmsvga_cursor_define()
542 pixels = c->width * c->height; in vmsvga_cursor_define()
544 qc->data[i] |= c->image[i] & 0xffffff; in vmsvga_cursor_define()
552 __func__, c->bpp); in vmsvga_cursor_define()
557 dpy_cursor_define(s->vga.con, qc); in vmsvga_cursor_define()
566 if (!s->config || !s->enable) { in vmsvga_fifo_length()
570 s->fifo_min = le32_to_cpu(s->fifo[SVGA_FIFO_MIN]); in vmsvga_fifo_length()
571 s->fifo_max = le32_to_cpu(s->fifo[SVGA_FIFO_MAX]); in vmsvga_fifo_length()
572 s->fifo_next = le32_to_cpu(s->fifo[SVGA_FIFO_NEXT]); in vmsvga_fifo_length()
573 s->fifo_stop = le32_to_cpu(s->fifo[SVGA_FIFO_STOP]); in vmsvga_fifo_length()
576 if ((s->fifo_min | s->fifo_max | s->fifo_next | s->fifo_stop) & 3) { in vmsvga_fifo_length()
579 if (s->fifo_min < sizeof(uint32_t) * 4) { in vmsvga_fifo_length()
582 if (s->fifo_max > SVGA_FIFO_SIZE || in vmsvga_fifo_length()
583 s->fifo_min >= SVGA_FIFO_SIZE || in vmsvga_fifo_length()
584 s->fifo_stop >= SVGA_FIFO_SIZE || in vmsvga_fifo_length()
585 s->fifo_next >= SVGA_FIFO_SIZE) { in vmsvga_fifo_length()
588 if (s->fifo_max < s->fifo_min + 10 * KiB) { in vmsvga_fifo_length()
592 num = s->fifo_next - s->fifo_stop; in vmsvga_fifo_length()
594 num += s->fifo_max - s->fifo_min; in vmsvga_fifo_length()
601 uint32_t cmd = s->fifo[s->fifo_stop >> 2]; in vmsvga_fifo_read_raw()
603 s->fifo_stop += 4; in vmsvga_fifo_read_raw()
604 if (s->fifo_stop >= s->fifo_max) { in vmsvga_fifo_read_raw()
605 s->fifo_stop = s->fifo_min; in vmsvga_fifo_read_raw()
607 s->fifo[SVGA_FIFO_STOP] = cpu_to_le32(s->fifo_stop); in vmsvga_fifo_read_raw()
620 int x, y, dx, dy, width, height; in vmsvga_fifo_run() local
625 while (len > 0 && --maxloop > 0) { in vmsvga_fifo_run()
627 cmd_start = s->fifo_stop; in vmsvga_fifo_run()
632 len -= 5; in vmsvga_fifo_run()
639 width = vmsvga_fifo_read(s); in vmsvga_fifo_run()
641 vmsvga_update_rect_delayed(s, x, y, width, height); in vmsvga_fifo_run()
645 len -= 6; in vmsvga_fifo_run()
653 width = vmsvga_fifo_read(s); in vmsvga_fifo_run()
656 if (vmsvga_fill_rect(s, colour, x, y, width, height) == 0) { in vmsvga_fifo_run()
664 len -= 7; in vmsvga_fifo_run()
673 width = vmsvga_fifo_read(s); in vmsvga_fifo_run()
676 if (vmsvga_copy_rect(s, x, y, dx, dy, width, height) == 0) { in vmsvga_fifo_run()
684 len -= 8; in vmsvga_fifo_run()
692 cursor.width = x = vmsvga_fifo_read(s); in vmsvga_fifo_run()
698 if (cursor.width > 256 in vmsvga_fifo_run()
707 len -= args; in vmsvga_fifo_run()
731 len -= 6; in vmsvga_fifo_run()
749 len -= 4; in vmsvga_fifo_run()
775 len -= args; in vmsvga_fifo_run()
779 while (args--) { in vmsvga_fifo_run()
787 s->fifo_stop = cmd_start; in vmsvga_fifo_run()
788 s->fifo[SVGA_FIFO_STOP] = cpu_to_le32(s->fifo_stop); in vmsvga_fifo_run()
793 s->syncing = 0; in vmsvga_fifo_run()
800 return s->index; in vmsvga_index_read()
807 s->index = index; in vmsvga_index_write()
814 DisplaySurface *surface = qemu_console_surface(s->vga.con); in vmsvga_value_read()
818 switch (s->index) { in vmsvga_value_read()
820 ret = s->svgaid; in vmsvga_value_read()
824 ret = s->enable; in vmsvga_value_read()
828 ret = s->new_width ? s->new_width : surface_width(surface); in vmsvga_value_read()
832 ret = s->new_height ? s->new_height : surface_height(surface); in vmsvga_value_read()
844 ret = (s->new_depth == 32) ? 24 : s->new_depth; in vmsvga_value_read()
849 ret = s->new_depth; in vmsvga_value_read()
857 pf = qemu_default_pixelformat(s->new_depth); in vmsvga_value_read()
862 pf = qemu_default_pixelformat(s->new_depth); in vmsvga_value_read()
867 pf = qemu_default_pixelformat(s->new_depth); in vmsvga_value_read()
872 if (s->new_width) { in vmsvga_value_read()
873 ret = (s->new_depth * s->new_width) / 8; in vmsvga_value_read()
891 ret = s->vga.vram_size; /* No physical VRAM besides the framebuffer */ in vmsvga_value_read()
895 ret = s->vga.vram_size; in vmsvga_value_read()
921 ret = s->fifo_size; in vmsvga_value_read()
925 ret = s->config; in vmsvga_value_read()
930 ret = s->syncing; in vmsvga_value_read()
934 ret = s->guest; in vmsvga_value_read()
938 ret = s->cursor.id; in vmsvga_value_read()
942 ret = s->cursor.x; in vmsvga_value_read()
946 ret = s->cursor.y; in vmsvga_value_read()
950 ret = s->cursor.on; in vmsvga_value_read()
954 ret = s->scratch_size; in vmsvga_value_read()
965 if (s->index >= SVGA_SCRATCH_BASE && in vmsvga_value_read()
966 s->index < SVGA_SCRATCH_BASE + s->scratch_size) { in vmsvga_value_read()
967 ret = s->scratch[s->index - SVGA_SCRATCH_BASE]; in vmsvga_value_read()
971 "%s: Bad register %02x\n", __func__, s->index); in vmsvga_value_read()
976 if (s->index >= SVGA_SCRATCH_BASE) { in vmsvga_value_read()
977 trace_vmware_scratch_read(s->index, ret); in vmsvga_value_read()
978 } else if (s->index >= SVGA_PALETTE_BASE) { in vmsvga_value_read()
979 trace_vmware_palette_read(s->index, ret); in vmsvga_value_read()
981 trace_vmware_value_read(s->index, ret); in vmsvga_value_read()
990 if (s->index >= SVGA_SCRATCH_BASE) { in vmsvga_value_write()
991 trace_vmware_scratch_write(s->index, value); in vmsvga_value_write()
992 } else if (s->index >= SVGA_PALETTE_BASE) { in vmsvga_value_write()
993 trace_vmware_palette_write(s->index, value); in vmsvga_value_write()
995 trace_vmware_value_write(s->index, value); in vmsvga_value_write()
997 switch (s->index) { in vmsvga_value_write()
1000 s->svgaid = value; in vmsvga_value_write()
1005 s->enable = !!value; in vmsvga_value_write()
1006 s->invalidated = 1; in vmsvga_value_write()
1007 s->vga.hw_ops->invalidate(&s->vga); in vmsvga_value_write()
1008 if (s->enable && s->config) { in vmsvga_value_write()
1009 vga_dirty_log_stop(&s->vga); in vmsvga_value_write()
1011 vga_dirty_log_start(&s->vga); in vmsvga_value_write()
1017 s->new_width = value; in vmsvga_value_write()
1018 s->invalidated = 1; in vmsvga_value_write()
1021 "%s: Bad width: %i\n", __func__, value); in vmsvga_value_write()
1027 s->new_height = value; in vmsvga_value_write()
1028 s->invalidated = 1; in vmsvga_value_write()
1039 s->config = 0; in vmsvga_value_write()
1040 s->invalidated = 1; in vmsvga_value_write()
1046 s->fifo = (uint32_t *) s->fifo_ptr; in vmsvga_value_write()
1047 vga_dirty_log_stop(&s->vga); in vmsvga_value_write()
1049 s->config = !!value; in vmsvga_value_write()
1053 s->syncing = 1; in vmsvga_value_write()
1058 s->guest = value; in vmsvga_value_write()
1063 vmsvga_guest_id[value - GUEST_OS_BASE]); in vmsvga_value_write()
1069 s->cursor.id = value; in vmsvga_value_write()
1073 s->cursor.x = value; in vmsvga_value_write()
1077 s->cursor.y = value; in vmsvga_value_write()
1081 s->cursor.on |= (value == SVGA_CURSOR_ON_SHOW); in vmsvga_value_write()
1082 s->cursor.on &= (value != SVGA_CURSOR_ON_HIDE); in vmsvga_value_write()
1085 dpy_mouse_set(s->vga.con, s->cursor.x, s->cursor.y, s->cursor.on); in vmsvga_value_write()
1098 if (s->index >= SVGA_SCRATCH_BASE && in vmsvga_value_write()
1099 s->index < SVGA_SCRATCH_BASE + s->scratch_size) { in vmsvga_value_write()
1100 s->scratch[s->index - SVGA_SCRATCH_BASE] = value; in vmsvga_value_write()
1104 "%s: Bad register %02x\n", __func__, s->index); in vmsvga_value_write()
1121 DisplaySurface *surface = qemu_console_surface(s->vga.con); in vmsvga_check_size()
1123 if (s->new_width != surface_width(surface) || in vmsvga_check_size()
1124 s->new_height != surface_height(surface) || in vmsvga_check_size()
1125 s->new_depth != surface_bits_per_pixel(surface)) { in vmsvga_check_size()
1126 int stride = (s->new_depth * s->new_width) / 8; in vmsvga_check_size()
1128 qemu_default_pixman_format(s->new_depth, true); in vmsvga_check_size()
1129 trace_vmware_setmode(s->new_width, s->new_height, s->new_depth); in vmsvga_check_size()
1130 surface = qemu_create_displaysurface_from(s->new_width, s->new_height, in vmsvga_check_size()
1132 s->vga.vram_ptr); in vmsvga_check_size()
1133 dpy_gfx_replace_surface(s->vga.con, surface); in vmsvga_check_size()
1134 s->invalidated = 1; in vmsvga_check_size()
1142 if (!s->enable || !s->config) { in vmsvga_update_display()
1144 s->vga.hw_ops->gfx_update(&s->vga); in vmsvga_update_display()
1153 if (s->invalidated) { in vmsvga_update_display()
1154 s->invalidated = 0; in vmsvga_update_display()
1155 dpy_gfx_update_full(s->vga.con); in vmsvga_update_display()
1162 struct vmsvga_state_s *s = &pci->chip; in vmsvga_reset()
1164 s->index = 0; in vmsvga_reset()
1165 s->enable = 0; in vmsvga_reset()
1166 s->config = 0; in vmsvga_reset()
1167 s->svgaid = SVGA_ID; in vmsvga_reset()
1168 s->cursor.on = false; in vmsvga_reset()
1169 s->redraw_fifo_last = 0; in vmsvga_reset()
1170 s->syncing = 0; in vmsvga_reset()
1172 vga_dirty_log_start(&s->vga); in vmsvga_reset()
1178 if (!s->enable) { in vmsvga_invalidate_display()
1179 s->vga.hw_ops->invalidate(&s->vga); in vmsvga_invalidate_display()
1183 s->invalidated = 1; in vmsvga_invalidate_display()
1190 if (s->vga.hw_ops->text_update) { in vmsvga_text_update()
1191 s->vga.hw_ops->text_update(&s->vga, chardata); in vmsvga_text_update()
1199 s->invalidated = 1; in vmsvga_post_load()
1200 if (s->config) { in vmsvga_post_load()
1201 s->fifo = (uint32_t *) s->fifo_ptr; in vmsvga_post_load()
1251 MemoryRegion *address_space, MemoryRegion *io) in vmsvga_init() argument
1253 s->scratch_size = SVGA_SCRATCH_SIZE; in vmsvga_init()
1254 s->scratch = g_malloc(s->scratch_size * 4); in vmsvga_init()
1256 s->vga.con = graphic_console_init(dev, 0, &vmsvga_ops, s); in vmsvga_init()
1258 s->fifo_size = SVGA_FIFO_SIZE; in vmsvga_init()
1259 memory_region_init_ram(&s->fifo_ram, NULL, "vmsvga.fifo", s->fifo_size, in vmsvga_init()
1261 s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram); in vmsvga_init()
1263 vga_common_init(&s->vga, OBJECT(dev), &error_fatal); in vmsvga_init()
1264 vga_init(&s->vga, OBJECT(dev), address_space, io, true); in vmsvga_init()
1265 vmstate_register_any(NULL, &vmstate_vga_common, &s->vga); in vmsvga_init()
1266 s->new_depth = 32; in vmsvga_init()
1277 default: return -1u; in vmsvga_io_read()
1317 dev->config[PCI_CACHE_LINE_SIZE] = 0x08; in pci_vmsvga_realize()
1318 dev->config[PCI_LATENCY_TIMER] = 0x40; in pci_vmsvga_realize()
1319 dev->config[PCI_INTERRUPT_LINE] = 0xff; /* End */ in pci_vmsvga_realize()
1321 memory_region_init_io(&s->io_bar, OBJECT(dev), &vmsvga_io_ops, &s->chip, in pci_vmsvga_realize()
1322 "vmsvga-io", 0x10); in pci_vmsvga_realize()
1323 memory_region_set_flush_coalesced(&s->io_bar); in pci_vmsvga_realize()
1324 pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar); in pci_vmsvga_realize()
1326 vmsvga_init(DEVICE(dev), &s->chip, in pci_vmsvga_realize()
1330 &s->chip.vga.vram); in pci_vmsvga_realize()
1332 &s->chip.fifo_ram); in pci_vmsvga_realize()
1338 DEFINE_PROP_BOOL("global-vmstate", struct pci_vmsvga_state_s,
1347 k->realize = pci_vmsvga_realize; in vmsvga_class_init()
1348 k->romfile = "vgabios-vmware.bin"; in vmsvga_class_init()
1349 k->vendor_id = PCI_VENDOR_ID_VMWARE; in vmsvga_class_init()
1350 k->device_id = SVGA_PCI_DEVICE_ID; in vmsvga_class_init()
1351 k->class_id = PCI_CLASS_DISPLAY_VGA; in vmsvga_class_init()
1352 k->subsystem_vendor_id = PCI_VENDOR_ID_VMWARE; in vmsvga_class_init()
1353 k->subsystem_id = SVGA_PCI_DEVICE_ID; in vmsvga_class_init()
1355 dc->vmsd = &vmstate_vmware_vga; in vmsvga_class_init()
1357 dc->hotpluggable = false; in vmsvga_class_init()
1358 set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); in vmsvga_class_init()