]>
Commit | Line | Data |
---|---|---|
cb9c377f PB |
1 | #ifndef HW_QXL_H |
2 | #define HW_QXL_H 1 | |
3 | ||
a19cbfb3 GH |
4 | #include "qemu-common.h" |
5 | ||
28ecbaee | 6 | #include "ui/console.h" |
83c9f4ca PB |
7 | #include "hw/hw.h" |
8 | #include "hw/pci/pci.h" | |
47b43a1f | 9 | #include "vga_int.h" |
1de7afc9 | 10 | #include "qemu/thread.h" |
a19cbfb3 GH |
11 | |
12 | #include "ui/qemu-spice.h" | |
13 | #include "ui/spice-display.h" | |
14 | ||
15 | enum qxl_mode { | |
16 | QXL_MODE_UNDEFINED, | |
17 | QXL_MODE_VGA, | |
18 | QXL_MODE_COMPAT, /* spice 0.4.x */ | |
19 | QXL_MODE_NATIVE, | |
20 | }; | |
21 | ||
6f2b175a GH |
22 | #ifndef QXL_VRAM64_RANGE_INDEX |
23 | #define QXL_VRAM64_RANGE_INDEX 4 | |
24 | #endif | |
25 | ||
5ff4e36c AL |
26 | #define QXL_UNDEFINED_IO UINT32_MAX |
27 | ||
81fb6f15 AL |
28 | #define QXL_NUM_DIRTY_RECTS 64 |
29 | ||
a19cbfb3 GH |
30 | typedef struct PCIQXLDevice { |
31 | PCIDevice pci; | |
32 | SimpleSpiceDisplay ssd; | |
33 | int id; | |
34 | uint32_t debug; | |
35 | uint32_t guestdebug; | |
36 | uint32_t cmdlog; | |
087e6a42 AL |
37 | |
38 | uint32_t guest_bug; | |
39 | ||
a19cbfb3 GH |
40 | enum qxl_mode mode; |
41 | uint32_t cmdflags; | |
42 | int generation; | |
43 | uint32_t revision; | |
44 | ||
45 | int32_t num_memslots; | |
a19cbfb3 | 46 | |
5ff4e36c AL |
47 | uint32_t current_async; |
48 | QemuMutex async_lock; | |
49 | ||
a19cbfb3 GH |
50 | struct guest_slots { |
51 | QXLMemSlot slot; | |
52 | void *ptr; | |
53 | uint64_t size; | |
54 | uint64_t delta; | |
55 | uint32_t active; | |
56 | } guest_slots[NUM_MEMSLOTS]; | |
57 | ||
58 | struct guest_primary { | |
59 | QXLSurfaceCreate surface; | |
60 | uint32_t commands; | |
61 | uint32_t resized; | |
0e2487bd GH |
62 | int32_t qxl_stride; |
63 | uint32_t abs_stride; | |
a19cbfb3 GH |
64 | uint32_t bits_pp; |
65 | uint32_t bytes_pp; | |
4c19ebb5 | 66 | uint8_t *data; |
a19cbfb3 GH |
67 | } guest_primary; |
68 | ||
69 | struct surfaces { | |
ddd8fdc7 | 70 | QXLPHYSICAL *cmds; |
a19cbfb3 GH |
71 | uint32_t count; |
72 | uint32_t max; | |
73 | } guest_surfaces; | |
74 | QXLPHYSICAL guest_cursor; | |
75 | ||
020af1c4 AL |
76 | QXLPHYSICAL guest_monitors_config; |
77 | ||
14898cf6 GH |
78 | QemuMutex track_lock; |
79 | ||
a19cbfb3 | 80 | /* thread signaling */ |
691f5c7b | 81 | QemuThread main; |
a19cbfb3 GH |
82 | int pipe[2]; |
83 | ||
84 | /* ram pci bar */ | |
85 | QXLRam *ram; | |
86 | VGACommonState vga; | |
87 | uint32_t num_free_res; | |
88 | QXLReleaseInfo *last_release; | |
89 | uint32_t last_release_offset; | |
90 | uint32_t oom_running; | |
13d1fd44 | 91 | uint32_t vgamem_size; |
a19cbfb3 GH |
92 | |
93 | /* rom pci bar */ | |
94 | QXLRom shadow_rom; | |
95 | QXLRom *rom; | |
96 | QXLModes *modes; | |
97 | uint32_t rom_size; | |
b1950430 | 98 | MemoryRegion rom_bar; |
a19cbfb3 GH |
99 | |
100 | /* vram pci bar */ | |
101 | uint32_t vram_size; | |
b1950430 | 102 | MemoryRegion vram_bar; |
6f2b175a GH |
103 | uint32_t vram32_size; |
104 | MemoryRegion vram32_bar; | |
a19cbfb3 GH |
105 | |
106 | /* io bar */ | |
b1950430 | 107 | MemoryRegion io_bar; |
017438ee GH |
108 | |
109 | /* user-friendly properties (in megabytes) */ | |
110 | uint32_t ram_size_mb; | |
111 | uint32_t vram_size_mb; | |
6f2b175a | 112 | uint32_t vram32_size_mb; |
13d1fd44 | 113 | uint32_t vgamem_size_mb; |
81fb6f15 AL |
114 | |
115 | /* qxl_render_update state */ | |
116 | int render_update_cookie_num; | |
117 | int num_dirty_rects; | |
118 | QXLRect dirty[QXL_NUM_DIRTY_RECTS]; | |
119 | QEMUBH *update_area_bh; | |
a19cbfb3 GH |
120 | } PCIQXLDevice; |
121 | ||
122 | #define PANIC_ON(x) if ((x)) { \ | |
123 | printf("%s: PANIC %s failed\n", __FUNCTION__, #x); \ | |
2bce0400 | 124 | abort(); \ |
a19cbfb3 GH |
125 | } |
126 | ||
127 | #define dprint(_qxl, _level, _fmt, ...) \ | |
128 | do { \ | |
129 | if (_qxl->debug >= _level) { \ | |
130 | fprintf(stderr, "qxl-%d: ", _qxl->id); \ | |
131 | fprintf(stderr, _fmt, ## __VA_ARGS__); \ | |
132 | } \ | |
133 | } while (0) | |
134 | ||
020af1c4 | 135 | #define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V12 |
9197a7c8 | 136 | |
a19cbfb3 GH |
137 | /* qxl.c */ |
138 | void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id); | |
0a530548 AL |
139 | void qxl_set_guest_bug(PCIQXLDevice *qxl, const char *msg, ...) |
140 | GCC_FMT_ATTR(2, 3); | |
a19cbfb3 | 141 | |
aee32bf3 GH |
142 | void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id, |
143 | struct QXLRect *area, struct QXLRect *dirty_rects, | |
144 | uint32_t num_dirty_rects, | |
5ff4e36c | 145 | uint32_t clear_dirty_region, |
2e1a98c9 | 146 | qxl_async_io async, QXLCookie *cookie); |
aee32bf3 GH |
147 | void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext, |
148 | uint32_t count); | |
149 | void qxl_spice_oom(PCIQXLDevice *qxl); | |
150 | void qxl_spice_reset_memslots(PCIQXLDevice *qxl); | |
aee32bf3 GH |
151 | void qxl_spice_reset_image_cache(PCIQXLDevice *qxl); |
152 | void qxl_spice_reset_cursor(PCIQXLDevice *qxl); | |
153 | ||
a19cbfb3 | 154 | /* qxl-logger.c */ |
fae2afb1 AL |
155 | int qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id); |
156 | int qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext); | |
a19cbfb3 GH |
157 | |
158 | /* qxl-render.c */ | |
159 | void qxl_render_resize(PCIQXLDevice *qxl); | |
160 | void qxl_render_update(PCIQXLDevice *qxl); | |
fae2afb1 | 161 | int qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext); |
81fb6f15 AL |
162 | void qxl_render_update_area_done(PCIQXLDevice *qxl, QXLCookie *cookie); |
163 | void qxl_render_update_area_bh(void *opaque); | |
cb9c377f PB |
164 | |
165 | #endif |