root / hw / qxl.h @ 691f5c7b
History | View | Annotate | Download (4.3 kB)
1 |
#include "qemu-common.h" |
---|---|
2 |
|
3 |
#include "console.h" |
4 |
#include "hw.h" |
5 |
#include "pci.h" |
6 |
#include "vga_int.h" |
7 |
#include "qemu-thread.h" |
8 |
|
9 |
#include "ui/qemu-spice.h" |
10 |
#include "ui/spice-display.h" |
11 |
|
12 |
enum qxl_mode {
|
13 |
QXL_MODE_UNDEFINED, |
14 |
QXL_MODE_VGA, |
15 |
QXL_MODE_COMPAT, /* spice 0.4.x */
|
16 |
QXL_MODE_NATIVE, |
17 |
}; |
18 |
|
19 |
#define QXL_UNDEFINED_IO UINT32_MAX
|
20 |
|
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; |
32 |
|
33 |
int32_t num_memslots; |
34 |
int32_t num_surfaces; |
35 |
|
36 |
uint32_t current_async; |
37 |
QemuMutex async_lock; |
38 |
|
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]; |
46 |
|
47 |
struct guest_primary {
|
48 |
QXLSurfaceCreate surface; |
49 |
uint32_t commands; |
50 |
uint32_t resized; |
51 |
int32_t stride; |
52 |
uint32_t bits_pp; |
53 |
uint32_t bytes_pp; |
54 |
uint8_t *data, *flipped; |
55 |
} guest_primary; |
56 |
|
57 |
struct surfaces {
|
58 |
QXLPHYSICAL cmds[NUM_SURFACES]; |
59 |
uint32_t count; |
60 |
uint32_t max; |
61 |
} guest_surfaces; |
62 |
QXLPHYSICAL guest_cursor; |
63 |
|
64 |
QemuMutex track_lock; |
65 |
|
66 |
/* thread signaling */
|
67 |
QemuThread main; |
68 |
int pipe[2]; |
69 |
|
70 |
/* ram pci bar */
|
71 |
QXLRam *ram; |
72 |
VGACommonState vga; |
73 |
uint32_t num_free_res; |
74 |
QXLReleaseInfo *last_release; |
75 |
uint32_t last_release_offset; |
76 |
uint32_t oom_running; |
77 |
|
78 |
/* rom pci bar */
|
79 |
QXLRom shadow_rom; |
80 |
QXLRom *rom; |
81 |
QXLModes *modes; |
82 |
uint32_t rom_size; |
83 |
MemoryRegion rom_bar; |
84 |
|
85 |
/* vram pci bar */
|
86 |
uint32_t vram_size; |
87 |
MemoryRegion vram_bar; |
88 |
|
89 |
/* io bar */
|
90 |
MemoryRegion io_bar; |
91 |
} PCIQXLDevice; |
92 |
|
93 |
#define PANIC_ON(x) if ((x)) { \ |
94 |
printf("%s: PANIC %s failed\n", __FUNCTION__, #x); \ |
95 |
abort(); \ |
96 |
} |
97 |
|
98 |
#define dprint(_qxl, _level, _fmt, ...) \
|
99 |
do { \
|
100 |
if (_qxl->debug >= _level) { \
|
101 |
fprintf(stderr, "qxl-%d: ", _qxl->id); \
|
102 |
fprintf(stderr, _fmt, ## __VA_ARGS__); \ |
103 |
} \ |
104 |
} while (0) |
105 |
|
106 |
#if SPICE_INTERFACE_QXL_MINOR >= 1 |
107 |
#define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V10
|
108 |
#else
|
109 |
#define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V06
|
110 |
#endif
|
111 |
|
112 |
/* qxl.c */
|
113 |
void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id); |
114 |
void qxl_guest_bug(PCIQXLDevice *qxl, const char *msg, ...); |
115 |
|
116 |
void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id,
|
117 |
struct QXLRect *area, struct QXLRect *dirty_rects, |
118 |
uint32_t num_dirty_rects, |
119 |
uint32_t clear_dirty_region, |
120 |
qxl_async_io async); |
121 |
void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext, |
122 |
uint32_t count); |
123 |
void qxl_spice_oom(PCIQXLDevice *qxl);
|
124 |
void qxl_spice_reset_memslots(PCIQXLDevice *qxl);
|
125 |
void qxl_spice_reset_image_cache(PCIQXLDevice *qxl);
|
126 |
void qxl_spice_reset_cursor(PCIQXLDevice *qxl);
|
127 |
|
128 |
/* qxl-logger.c */
|
129 |
void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id); |
130 |
void qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext); |
131 |
|
132 |
/* qxl-render.c */
|
133 |
void qxl_render_resize(PCIQXLDevice *qxl);
|
134 |
void qxl_render_update(PCIQXLDevice *qxl);
|
135 |
void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext);
|
136 |
#if SPICE_INTERFACE_QXL_MINOR >= 1 |
137 |
void qxl_spice_update_area_async(PCIQXLDevice *qxl, uint32_t surface_id,
|
138 |
struct QXLRect *area,
|
139 |
uint32_t clear_dirty_region, |
140 |
int is_vga);
|
141 |
#endif
|