root / ui / spice-display.h @ e9f9d6b1
History | View | Annotate | Download (4.2 kB)
1 | a3e22260 | Gerd Hoffmann | /*
|
---|---|---|---|
2 | a3e22260 | Gerd Hoffmann | * Copyright (C) 2010 Red Hat, Inc.
|
3 | a3e22260 | Gerd Hoffmann | *
|
4 | a3e22260 | Gerd Hoffmann | * This program is free software; you can redistribute it and/or
|
5 | a3e22260 | Gerd Hoffmann | * modify it under the terms of the GNU General Public License as
|
6 | a3e22260 | Gerd Hoffmann | * published by the Free Software Foundation; either version 2 or
|
7 | a3e22260 | Gerd Hoffmann | * (at your option) version 3 of the License.
|
8 | a3e22260 | Gerd Hoffmann | *
|
9 | a3e22260 | Gerd Hoffmann | * This program is distributed in the hope that it will be useful,
|
10 | a3e22260 | Gerd Hoffmann | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 | a3e22260 | Gerd Hoffmann | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 | a3e22260 | Gerd Hoffmann | * GNU General Public License for more details.
|
13 | a3e22260 | Gerd Hoffmann | *
|
14 | a3e22260 | Gerd Hoffmann | * You should have received a copy of the GNU General Public License
|
15 | a3e22260 | Gerd Hoffmann | * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
16 | a3e22260 | Gerd Hoffmann | */
|
17 | a3e22260 | Gerd Hoffmann | |
18 | a3e22260 | Gerd Hoffmann | #include <spice/ipc_ring.h> |
19 | a3e22260 | Gerd Hoffmann | #include <spice/enums.h> |
20 | a3e22260 | Gerd Hoffmann | #include <spice/qxl_dev.h> |
21 | a3e22260 | Gerd Hoffmann | |
22 | e0c64d08 | Gerd Hoffmann | #include "qemu-thread.h" |
23 | 07536094 | Gerd Hoffmann | #include "console.h" |
24 | a3e22260 | Gerd Hoffmann | #include "pflib.h" |
25 | 1dfb4dd9 | Luiz Capitulino | #include "sysemu.h" |
26 | a3e22260 | Gerd Hoffmann | |
27 | a3e22260 | Gerd Hoffmann | #define NUM_MEMSLOTS 8 |
28 | a3e22260 | Gerd Hoffmann | #define MEMSLOT_GENERATION_BITS 8 |
29 | a3e22260 | Gerd Hoffmann | #define MEMSLOT_SLOT_BITS 8 |
30 | a3e22260 | Gerd Hoffmann | |
31 | a3e22260 | Gerd Hoffmann | #define MEMSLOT_GROUP_HOST 0 |
32 | a3e22260 | Gerd Hoffmann | #define MEMSLOT_GROUP_GUEST 1 |
33 | a3e22260 | Gerd Hoffmann | #define NUM_MEMSLOTS_GROUPS 2 |
34 | a3e22260 | Gerd Hoffmann | |
35 | 5ff4e36c | Alon Levy | /*
|
36 | 5ff4e36c | Alon Levy | * Internal enum to differenciate between options for
|
37 | 5ff4e36c | Alon Levy | * io calls that have a sync (old) version and an _async (new)
|
38 | 5ff4e36c | Alon Levy | * version:
|
39 | 5ff4e36c | Alon Levy | * QXL_SYNC: use the old version
|
40 | 5ff4e36c | Alon Levy | * QXL_ASYNC: use the new version and make sure there are no two
|
41 | 5ff4e36c | Alon Levy | * happening at the same time. This is used for guest initiated
|
42 | 5ff4e36c | Alon Levy | * calls
|
43 | 5ff4e36c | Alon Levy | */
|
44 | 5ff4e36c | Alon Levy | typedef enum qxl_async_io { |
45 | 5ff4e36c | Alon Levy | QXL_SYNC, |
46 | 5ff4e36c | Alon Levy | QXL_ASYNC, |
47 | 5ff4e36c | Alon Levy | } qxl_async_io; |
48 | 5ff4e36c | Alon Levy | |
49 | 2e1a98c9 | Alon Levy | enum {
|
50 | 2e1a98c9 | Alon Levy | QXL_COOKIE_TYPE_IO, |
51 | 81fb6f15 | Alon Levy | QXL_COOKIE_TYPE_RENDER_UPDATE_AREA, |
52 | 020af1c4 | Alon Levy | QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG, |
53 | 2e1a98c9 | Alon Levy | }; |
54 | 2e1a98c9 | Alon Levy | |
55 | 2e1a98c9 | Alon Levy | typedef struct QXLCookie { |
56 | 2e1a98c9 | Alon Levy | int type;
|
57 | 2e1a98c9 | Alon Levy | uint64_t io; |
58 | 2e1a98c9 | Alon Levy | union {
|
59 | 2e1a98c9 | Alon Levy | uint32_t surface_id; |
60 | 81fb6f15 | Alon Levy | QXLRect area; |
61 | 81fb6f15 | Alon Levy | struct {
|
62 | 81fb6f15 | Alon Levy | QXLRect area; |
63 | 81fb6f15 | Alon Levy | int redraw;
|
64 | 81fb6f15 | Alon Levy | } render; |
65 | 2e1a98c9 | Alon Levy | } u; |
66 | 2e1a98c9 | Alon Levy | } QXLCookie; |
67 | 2e1a98c9 | Alon Levy | |
68 | 2e1a98c9 | Alon Levy | QXLCookie *qxl_cookie_new(int type, uint64_t io);
|
69 | 2e1a98c9 | Alon Levy | |
70 | e0c64d08 | Gerd Hoffmann | typedef struct SimpleSpiceDisplay SimpleSpiceDisplay; |
71 | e0c64d08 | Gerd Hoffmann | typedef struct SimpleSpiceUpdate SimpleSpiceUpdate; |
72 | e0c64d08 | Gerd Hoffmann | |
73 | e0c64d08 | Gerd Hoffmann | struct SimpleSpiceDisplay {
|
74 | a3e22260 | Gerd Hoffmann | DisplayState *ds; |
75 | a7310dd3 | Gerd Hoffmann | uint8_t *ds_mirror; |
76 | a3e22260 | Gerd Hoffmann | void *buf;
|
77 | a3e22260 | Gerd Hoffmann | int bufsize;
|
78 | a3e22260 | Gerd Hoffmann | QXLWorker *worker; |
79 | a3e22260 | Gerd Hoffmann | QXLInstance qxl; |
80 | a3e22260 | Gerd Hoffmann | uint32_t unique; |
81 | a3e22260 | Gerd Hoffmann | QemuPfConv *conv; |
82 | ddd8fdc7 | Gerd Hoffmann | int32_t num_surfaces; |
83 | a3e22260 | Gerd Hoffmann | |
84 | a3e22260 | Gerd Hoffmann | QXLRect dirty; |
85 | a3e22260 | Gerd Hoffmann | int notify;
|
86 | a3e22260 | Gerd Hoffmann | |
87 | e0c64d08 | Gerd Hoffmann | /*
|
88 | e0c64d08 | Gerd Hoffmann | * All struct members below this comment can be accessed from
|
89 | e0c64d08 | Gerd Hoffmann | * both spice server and qemu (iothread) context and any access
|
90 | e0c64d08 | Gerd Hoffmann | * to them must be protected by the lock.
|
91 | e0c64d08 | Gerd Hoffmann | */
|
92 | e0c64d08 | Gerd Hoffmann | QemuMutex lock; |
93 | b1af98ba | Gerd Hoffmann | QTAILQ_HEAD(, SimpleSpiceUpdate) updates; |
94 | 07536094 | Gerd Hoffmann | QEMUCursor *cursor; |
95 | 07536094 | Gerd Hoffmann | int mouse_x, mouse_y;
|
96 | e0c64d08 | Gerd Hoffmann | }; |
97 | e0c64d08 | Gerd Hoffmann | |
98 | e0c64d08 | Gerd Hoffmann | struct SimpleSpiceUpdate {
|
99 | a3e22260 | Gerd Hoffmann | QXLDrawable drawable; |
100 | a3e22260 | Gerd Hoffmann | QXLImage image; |
101 | a3e22260 | Gerd Hoffmann | QXLCommandExt ext; |
102 | a3e22260 | Gerd Hoffmann | uint8_t *bitmap; |
103 | b1af98ba | Gerd Hoffmann | QTAILQ_ENTRY(SimpleSpiceUpdate) next; |
104 | e0c64d08 | Gerd Hoffmann | }; |
105 | a3e22260 | Gerd Hoffmann | |
106 | a3e22260 | Gerd Hoffmann | int qemu_spice_rect_is_empty(const QXLRect* r); |
107 | a3e22260 | Gerd Hoffmann | void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r); |
108 | a3e22260 | Gerd Hoffmann | |
109 | a3e22260 | Gerd Hoffmann | void qemu_spice_destroy_update(SimpleSpiceDisplay *sdpy, SimpleSpiceUpdate *update);
|
110 | a3e22260 | Gerd Hoffmann | void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd);
|
111 | a3e22260 | Gerd Hoffmann | void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd);
|
112 | a3e22260 | Gerd Hoffmann | void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd);
|
113 | 1dfb4dd9 | Luiz Capitulino | void qemu_spice_vm_change_state_handler(void *opaque, int running, |
114 | 1dfb4dd9 | Luiz Capitulino | RunState state); |
115 | a963f876 | Gerd Hoffmann | void qemu_spice_display_init_common(SimpleSpiceDisplay *ssd, DisplayState *ds);
|
116 | a3e22260 | Gerd Hoffmann | |
117 | a3e22260 | Gerd Hoffmann | void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
|
118 | a3e22260 | Gerd Hoffmann | int x, int y, int w, int h); |
119 | a3e22260 | Gerd Hoffmann | void qemu_spice_display_resize(SimpleSpiceDisplay *ssd);
|
120 | a3e22260 | Gerd Hoffmann | void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd);
|
121 | bb5a8cd5 | Alon Levy | void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd);
|
122 | 5c59d118 | Gerd Hoffmann | |
123 | 5ff4e36c | Alon Levy | void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot,
|
124 | 5ff4e36c | Alon Levy | qxl_async_io async); |
125 | 5c59d118 | Gerd Hoffmann | void qemu_spice_del_memslot(SimpleSpiceDisplay *ssd, uint32_t gid,
|
126 | 5c59d118 | Gerd Hoffmann | uint32_t sid); |
127 | 5c59d118 | Gerd Hoffmann | void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id,
|
128 | 5ff4e36c | Alon Levy | QXLDevSurfaceCreate *surface, |
129 | 5ff4e36c | Alon Levy | qxl_async_io async); |
130 | 5ff4e36c | Alon Levy | void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd,
|
131 | 5ff4e36c | Alon Levy | uint32_t id, qxl_async_io async); |
132 | 5c59d118 | Gerd Hoffmann | void qemu_spice_wakeup(SimpleSpiceDisplay *ssd);
|
133 | 71d388d4 | Yonit Halperin | void qemu_spice_display_start(void); |
134 | 71d388d4 | Yonit Halperin | void qemu_spice_display_stop(void); |
135 | 71d388d4 | Yonit Halperin | int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd); |