qxl: remove flipped
[qemu/agraf.git] / hw / qxl.h
blob53a3acea37d56c44c1a0dca4e2855e9ad97f90ab
1 #include "qemu-common.h"
3 #include "console.h"
4 #include "hw.h"
5 #include "pci.h"
6 #include "vga_int.h"
7 #include "qemu-thread.h"
9 #include "ui/qemu-spice.h"
10 #include "ui/spice-display.h"
12 enum qxl_mode {
13 QXL_MODE_UNDEFINED,
14 QXL_MODE_VGA,
15 QXL_MODE_COMPAT, /* spice 0.4.x */
16 QXL_MODE_NATIVE,
19 #define QXL_UNDEFINED_IO UINT32_MAX
21 typedef struct PCIQXLDevice {
22 PCIDevice pci;
23 SimpleSpiceDisplay ssd;
24 int id;
25 uint32_t debug;
26 uint32_t guestdebug;
27 uint32_t cmdlog;
28 enum qxl_mode mode;
29 uint32_t cmdflags;
30 int generation;
31 uint32_t revision;
33 int32_t num_memslots;
34 int32_t num_surfaces;
36 uint32_t current_async;
37 QemuMutex async_lock;
39 struct guest_slots {
40 QXLMemSlot slot;
41 void *ptr;
42 uint64_t size;
43 uint64_t delta;
44 uint32_t active;
45 } guest_slots[NUM_MEMSLOTS];
47 struct guest_primary {
48 QXLSurfaceCreate surface;
49 uint32_t commands;
50 uint32_t resized;
51 int32_t qxl_stride;
52 uint32_t abs_stride;
53 uint32_t bits_pp;
54 uint32_t bytes_pp;
55 uint8_t *data;
56 } guest_primary;
58 struct surfaces {
59 QXLPHYSICAL cmds[NUM_SURFACES];
60 uint32_t count;
61 uint32_t max;
62 } guest_surfaces;
63 QXLPHYSICAL guest_cursor;
65 QemuMutex track_lock;
67 /* thread signaling */
68 QemuThread main;
69 int pipe[2];
71 /* ram pci bar */
72 QXLRam *ram;
73 VGACommonState vga;
74 uint32_t num_free_res;
75 QXLReleaseInfo *last_release;
76 uint32_t last_release_offset;
77 uint32_t oom_running;
79 /* rom pci bar */
80 QXLRom shadow_rom;
81 QXLRom *rom;
82 QXLModes *modes;
83 uint32_t rom_size;
84 MemoryRegion rom_bar;
86 /* vram pci bar */
87 uint32_t vram_size;
88 MemoryRegion vram_bar;
90 /* io bar */
91 MemoryRegion io_bar;
93 /* user-friendly properties (in megabytes) */
94 uint32_t ram_size_mb;
95 uint32_t vram_size_mb;
96 } PCIQXLDevice;
98 #define PANIC_ON(x) if ((x)) { \
99 printf("%s: PANIC %s failed\n", __FUNCTION__, #x); \
100 abort(); \
103 #define dprint(_qxl, _level, _fmt, ...) \
104 do { \
105 if (_qxl->debug >= _level) { \
106 fprintf(stderr, "qxl-%d: ", _qxl->id); \
107 fprintf(stderr, _fmt, ## __VA_ARGS__); \
109 } while (0)
111 #define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V10
113 /* qxl.c */
114 void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id);
115 void qxl_guest_bug(PCIQXLDevice *qxl, const char *msg, ...);
117 void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id,
118 struct QXLRect *area, struct QXLRect *dirty_rects,
119 uint32_t num_dirty_rects,
120 uint32_t clear_dirty_region,
121 qxl_async_io async);
122 void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext,
123 uint32_t count);
124 void qxl_spice_oom(PCIQXLDevice *qxl);
125 void qxl_spice_reset_memslots(PCIQXLDevice *qxl);
126 void qxl_spice_reset_image_cache(PCIQXLDevice *qxl);
127 void qxl_spice_reset_cursor(PCIQXLDevice *qxl);
129 /* qxl-logger.c */
130 void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id);
131 void qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext);
133 /* qxl-render.c */
134 void qxl_render_resize(PCIQXLDevice *qxl);
135 void qxl_render_update(PCIQXLDevice *qxl);
136 void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext);