Add checkpatch.pl from Linux kernel
[qemu/lumag.git] / hw / qxl.h
blob98e11ce8d12d20a142b3971e716f4ba9a7673f56
1 #include "qemu-common.h"
3 #include "console.h"
4 #include "hw.h"
5 #include "pci.h"
6 #include "vga_int.h"
8 #include "ui/qemu-spice.h"
9 #include "ui/spice-display.h"
11 enum qxl_mode {
12 QXL_MODE_UNDEFINED,
13 QXL_MODE_VGA,
14 QXL_MODE_COMPAT, /* spice 0.4.x */
15 QXL_MODE_NATIVE,
18 typedef struct PCIQXLDevice {
19 PCIDevice pci;
20 SimpleSpiceDisplay ssd;
21 int id;
22 uint32_t debug;
23 uint32_t guestdebug;
24 uint32_t cmdlog;
25 enum qxl_mode mode;
26 uint32_t cmdflags;
27 int generation;
28 uint32_t revision;
30 int32_t num_memslots;
31 int32_t num_surfaces;
33 struct guest_slots {
34 QXLMemSlot slot;
35 void *ptr;
36 uint64_t size;
37 uint64_t delta;
38 uint32_t active;
39 } guest_slots[NUM_MEMSLOTS];
41 struct guest_primary {
42 QXLSurfaceCreate surface;
43 uint32_t commands;
44 uint32_t resized;
45 int32_t stride;
46 uint32_t bits_pp;
47 uint32_t bytes_pp;
48 uint8_t *data, *flipped;
49 } guest_primary;
51 struct surfaces {
52 QXLPHYSICAL cmds[NUM_SURFACES];
53 uint32_t count;
54 uint32_t max;
55 } guest_surfaces;
56 QXLPHYSICAL guest_cursor;
58 /* thread signaling */
59 pthread_t main;
60 int pipe[2];
62 /* ram pci bar */
63 QXLRam *ram;
64 VGACommonState vga;
65 uint32_t num_free_res;
66 QXLReleaseInfo *last_release;
67 uint32_t last_release_offset;
68 uint32_t oom_running;
70 /* rom pci bar */
71 QXLRom shadow_rom;
72 QXLRom *rom;
73 QXLModes *modes;
74 uint32_t rom_size;
75 uint64_t rom_offset;
77 /* vram pci bar */
78 uint32_t vram_size;
79 uint64_t vram_offset;
81 /* io bar */
82 uint32_t io_base;
84 /* spice 0.4 loadvm compatibility */
85 void *worker_data;
86 uint32_t worker_data_size;
87 } PCIQXLDevice;
89 #define PANIC_ON(x) if ((x)) { \
90 printf("%s: PANIC %s failed\n", __FUNCTION__, #x); \
91 exit(-1); \
94 #define dprint(_qxl, _level, _fmt, ...) \
95 do { \
96 if (_qxl->debug >= _level) { \
97 fprintf(stderr, "qxl-%d: ", _qxl->id); \
98 fprintf(stderr, _fmt, ## __VA_ARGS__); \
99 } \
100 } while (0)
102 /* qxl.c */
103 void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id);
105 /* qxl-logger.c */
106 void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id);
107 void qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext);
109 /* qxl-render.c */
110 void qxl_render_resize(PCIQXLDevice *qxl);
111 void qxl_render_update(PCIQXLDevice *qxl);
112 void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext);