]>
Commit | Line | Data |
---|---|---|
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" | |
7 | ||
8 | #include "ui/qemu-spice.h" | |
9 | #include "ui/spice-display.h" | |
10 | ||
11 | enum qxl_mode { | |
12 | QXL_MODE_UNDEFINED, | |
13 | QXL_MODE_VGA, | |
14 | QXL_MODE_COMPAT, /* spice 0.4.x */ | |
15 | QXL_MODE_NATIVE, | |
16 | }; | |
17 | ||
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; | |
29 | ||
30 | int32_t num_memslots; | |
31 | int32_t num_surfaces; | |
32 | ||
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]; | |
40 | ||
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; | |
50 | ||
51 | struct surfaces { | |
52 | QXLPHYSICAL cmds[NUM_SURFACES]; | |
53 | uint32_t count; | |
54 | uint32_t max; | |
55 | } guest_surfaces; | |
56 | QXLPHYSICAL guest_cursor; | |
57 | ||
58 | /* thread signaling */ | |
59 | pthread_t main; | |
60 | int pipe[2]; | |
61 | ||
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; | |
69 | ||
70 | /* rom pci bar */ | |
71 | QXLRom shadow_rom; | |
72 | QXLRom *rom; | |
73 | QXLModes *modes; | |
74 | uint32_t rom_size; | |
75 | uint64_t rom_offset; | |
76 | ||
77 | /* vram pci bar */ | |
78 | uint32_t vram_size; | |
79 | uint64_t vram_offset; | |
80 | ||
81 | /* io bar */ | |
82 | uint32_t io_base; | |
a19cbfb3 GH |
83 | } PCIQXLDevice; |
84 | ||
85 | #define PANIC_ON(x) if ((x)) { \ | |
86 | printf("%s: PANIC %s failed\n", __FUNCTION__, #x); \ | |
87 | exit(-1); \ | |
88 | } | |
89 | ||
90 | #define dprint(_qxl, _level, _fmt, ...) \ | |
91 | do { \ | |
92 | if (_qxl->debug >= _level) { \ | |
93 | fprintf(stderr, "qxl-%d: ", _qxl->id); \ | |
94 | fprintf(stderr, _fmt, ## __VA_ARGS__); \ | |
95 | } \ | |
96 | } while (0) | |
97 | ||
98 | /* qxl.c */ | |
99 | void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id); | |
100 | ||
101 | /* qxl-logger.c */ | |
102 | void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id); | |
103 | void qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext); | |
104 | ||
105 | /* qxl-render.c */ | |
106 | void qxl_render_resize(PCIQXLDevice *qxl); | |
107 | void qxl_render_update(PCIQXLDevice *qxl); | |
108 | void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext); |