]> git.proxmox.com Git - qemu.git/blame - hw/qxl.h
Merge remote-tracking branch 'kraxel/usb.31' into staging
[qemu.git] / hw / qxl.h
CommitLineData
a19cbfb3
GH
1#include "qemu-common.h"
2
3#include "console.h"
4#include "hw.h"
5#include "pci.h"
6#include "vga_int.h"
691f5c7b 7#include "qemu-thread.h"
a19cbfb3
GH
8
9#include "ui/qemu-spice.h"
10#include "ui/spice-display.h"
11
12enum qxl_mode {
13 QXL_MODE_UNDEFINED,
14 QXL_MODE_VGA,
15 QXL_MODE_COMPAT, /* spice 0.4.x */
16 QXL_MODE_NATIVE,
17};
18
5ff4e36c
AL
19#define QXL_UNDEFINED_IO UINT32_MAX
20
a19cbfb3
GH
21typedef 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
5ff4e36c
AL
36 uint32_t current_async;
37 QemuMutex async_lock;
38
a19cbfb3
GH
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;
0e2487bd
GH
51 int32_t qxl_stride;
52 uint32_t abs_stride;
a19cbfb3
GH
53 uint32_t bits_pp;
54 uint32_t bytes_pp;
55 uint8_t *data, *flipped;
56 } guest_primary;
57
58 struct surfaces {
59 QXLPHYSICAL cmds[NUM_SURFACES];
60 uint32_t count;
61 uint32_t max;
62 } guest_surfaces;
63 QXLPHYSICAL guest_cursor;
64
14898cf6
GH
65 QemuMutex track_lock;
66
a19cbfb3 67 /* thread signaling */
691f5c7b 68 QemuThread main;
a19cbfb3
GH
69 int pipe[2];
70
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;
78
79 /* rom pci bar */
80 QXLRom shadow_rom;
81 QXLRom *rom;
82 QXLModes *modes;
83 uint32_t rom_size;
b1950430 84 MemoryRegion rom_bar;
a19cbfb3
GH
85
86 /* vram pci bar */
87 uint32_t vram_size;
b1950430 88 MemoryRegion vram_bar;
a19cbfb3
GH
89
90 /* io bar */
b1950430 91 MemoryRegion io_bar;
a19cbfb3
GH
92} PCIQXLDevice;
93
94#define PANIC_ON(x) if ((x)) { \
95 printf("%s: PANIC %s failed\n", __FUNCTION__, #x); \
2bce0400 96 abort(); \
a19cbfb3
GH
97}
98
99#define dprint(_qxl, _level, _fmt, ...) \
100 do { \
101 if (_qxl->debug >= _level) { \
102 fprintf(stderr, "qxl-%d: ", _qxl->id); \
103 fprintf(stderr, _fmt, ## __VA_ARGS__); \
104 } \
105 } while (0)
106
9197a7c8
GH
107#if SPICE_INTERFACE_QXL_MINOR >= 1
108#define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V10
109#else
110#define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V06
111#endif
112
a19cbfb3
GH
113/* qxl.c */
114void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id);
7635392c 115void qxl_guest_bug(PCIQXLDevice *qxl, const char *msg, ...);
a19cbfb3 116
aee32bf3
GH
117void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id,
118 struct QXLRect *area, struct QXLRect *dirty_rects,
119 uint32_t num_dirty_rects,
5ff4e36c
AL
120 uint32_t clear_dirty_region,
121 qxl_async_io async);
aee32bf3
GH
122void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext,
123 uint32_t count);
124void qxl_spice_oom(PCIQXLDevice *qxl);
125void qxl_spice_reset_memslots(PCIQXLDevice *qxl);
aee32bf3
GH
126void qxl_spice_reset_image_cache(PCIQXLDevice *qxl);
127void qxl_spice_reset_cursor(PCIQXLDevice *qxl);
128
a19cbfb3
GH
129/* qxl-logger.c */
130void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id);
131void qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext);
132
133/* qxl-render.c */
134void qxl_render_resize(PCIQXLDevice *qxl);
135void qxl_render_update(PCIQXLDevice *qxl);
136void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext);
5ff4e36c
AL
137#if SPICE_INTERFACE_QXL_MINOR >= 1
138void qxl_spice_update_area_async(PCIQXLDevice *qxl, uint32_t surface_id,
139 struct QXLRect *area,
140 uint32_t clear_dirty_region,
141 int is_vga);
142#endif