]> Git Repo - qemu.git/blame - include/ui/spice-display.h
works with less than base ISA qemu-system-riscv32 -M virt -bios none -kernel output...
[qemu.git] / include / ui / spice-display.h
CommitLineData
a3e22260
GH
1/*
2 * Copyright (C) 2010 Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 or
7 * (at your option) version 3 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 */
17
f91005e1
MA
18#ifndef UI_SPICE_DISPLAY_H
19#define UI_SPICE_DISPLAY_H
20
ec150c7e 21#include <spice.h>
a3e22260
GH
22#include <spice/ipc_ring.h>
23#include <spice/enums.h>
24#include <spice/qxl_dev.h>
25
1de7afc9 26#include "qemu/thread.h"
28ecbaee 27#include "ui/qemu-pixman.h"
0b087861 28#include "ui/console.h"
a3e22260 29
bc6a3565 30#if defined(CONFIG_OPENGL) && defined(CONFIG_GBM)
9f5c6d06 31# if SPICE_SERVER_VERSION >= 0x000d01 /* release 0.13.1 */
474114b7
GH
32# define HAVE_SPICE_GL 1
33# include "ui/egl-helpers.h"
34# include "ui/egl-context.h"
35# endif
36#endif
37
a3e22260
GH
38#define NUM_MEMSLOTS 8
39#define MEMSLOT_GENERATION_BITS 8
40#define MEMSLOT_SLOT_BITS 8
41
42#define MEMSLOT_GROUP_HOST 0
43#define MEMSLOT_GROUP_GUEST 1
44#define NUM_MEMSLOTS_GROUPS 2
45
5ff4e36c
AL
46/*
47 * Internal enum to differenciate between options for
48 * io calls that have a sync (old) version and an _async (new)
49 * version:
50 * QXL_SYNC: use the old version
51 * QXL_ASYNC: use the new version and make sure there are no two
52 * happening at the same time. This is used for guest initiated
53 * calls
54 */
55typedef enum qxl_async_io {
56 QXL_SYNC,
57 QXL_ASYNC,
58} qxl_async_io;
59
2e1a98c9
AL
60enum {
61 QXL_COOKIE_TYPE_IO,
81fb6f15 62 QXL_COOKIE_TYPE_RENDER_UPDATE_AREA,
020af1c4 63 QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG,
474114b7 64 QXL_COOKIE_TYPE_GL_DRAW_DONE,
2e1a98c9
AL
65};
66
67typedef struct QXLCookie {
68 int type;
69 uint64_t io;
70 union {
71 uint32_t surface_id;
81fb6f15
AL
72 QXLRect area;
73 struct {
74 QXLRect area;
75 int redraw;
76 } render;
39414ef4 77 void *data;
2e1a98c9
AL
78 } u;
79} QXLCookie;
80
81QXLCookie *qxl_cookie_new(int type, uint64_t io);
82
e0c64d08
GH
83typedef struct SimpleSpiceDisplay SimpleSpiceDisplay;
84typedef struct SimpleSpiceUpdate SimpleSpiceUpdate;
5643fc01 85typedef struct SimpleSpiceCursor SimpleSpiceCursor;
e0c64d08
GH
86
87struct SimpleSpiceDisplay {
71874c17 88 DisplaySurface *ds;
5e79d516 89 DisplayGLCtx dgc;
7c20b4a3 90 DisplayChangeListener dcl;
a3e22260
GH
91 void *buf;
92 int bufsize;
a3e22260
GH
93 QXLInstance qxl;
94 uint32_t unique;
d9a86569
GH
95 pixman_image_t *surface;
96 pixman_image_t *mirror;
ddd8fdc7 97 int32_t num_surfaces;
a3e22260 98
a3e22260
GH
99 QXLRect dirty;
100 int notify;
a3e22260 101
e0c64d08
GH
102 /*
103 * All struct members below this comment can be accessed from
104 * both spice server and qemu (iothread) context and any access
105 * to them must be protected by the lock.
106 */
107 QemuMutex lock;
b1af98ba 108 QTAILQ_HEAD(, SimpleSpiceUpdate) updates;
5643fc01
GH
109
110 /* cursor (without qxl): displaychangelistener -> spice server */
111 SimpleSpiceCursor *ptr_define;
112 SimpleSpiceCursor *ptr_move;
dc8dceee
MAL
113 int16_t ptr_x, ptr_y;
114 int16_t hot_x, hot_y;
5643fc01
GH
115
116 /* cursor (with qxl): qxl local renderer -> displaychangelistener */
07536094
GH
117 QEMUCursor *cursor;
118 int mouse_x, mouse_y;
0b2824e5 119 QEMUBH *cursor_bh;
474114b7
GH
120
121#ifdef HAVE_SPICE_GL
122 /* opengl rendering */
123 QEMUBH *gl_unblock_bh;
8e388e90 124 QEMUTimer *gl_unblock_timer;
46e19e14 125 QemuGLShader *gls;
44231843
GH
126 int gl_updates;
127 bool have_scanout;
128 bool have_surface;
b153f901
GH
129
130 QemuDmaBuf *guest_dmabuf;
131 bool guest_dmabuf_refresh;
132 bool render_cursor;
133
134 egl_fb guest_fb;
135 egl_fb blit_fb;
136 egl_fb cursor_fb;
137 bool have_hot;
474114b7 138#endif
e0c64d08
GH
139};
140
141struct SimpleSpiceUpdate {
a3e22260
GH
142 QXLDrawable drawable;
143 QXLImage image;
144 QXLCommandExt ext;
145 uint8_t *bitmap;
b1af98ba 146 QTAILQ_ENTRY(SimpleSpiceUpdate) next;
e0c64d08 147};
a3e22260 148
5643fc01
GH
149struct SimpleSpiceCursor {
150 QXLCursorCmd cmd;
151 QXLCommandExt ext;
152 QXLCursor cursor;
153};
154
fe5c44f9
GH
155extern bool spice_opengl;
156
a3e22260
GH
157int qemu_spice_rect_is_empty(const QXLRect* r);
158void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r);
159
a3e22260
GH
160void qemu_spice_destroy_update(SimpleSpiceDisplay *sdpy, SimpleSpiceUpdate *update);
161void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd);
162void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd);
163void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd);
c78f7137 164void qemu_spice_display_init_common(SimpleSpiceDisplay *ssd);
a3e22260
GH
165
166void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
167 int x, int y, int w, int h);
c12aeb86
GH
168void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
169 DisplaySurface *surface);
a3e22260 170void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd);
0b2824e5 171void qemu_spice_cursor_refresh_bh(void *opaque);
5c59d118 172
5ff4e36c
AL
173void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot,
174 qxl_async_io async);
5c59d118
GH
175void qemu_spice_del_memslot(SimpleSpiceDisplay *ssd, uint32_t gid,
176 uint32_t sid);
177void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id,
5ff4e36c
AL
178 QXLDevSurfaceCreate *surface,
179 qxl_async_io async);
180void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd,
181 uint32_t id, qxl_async_io async);
5c59d118 182void qemu_spice_wakeup(SimpleSpiceDisplay *ssd);
71d388d4
YH
183void qemu_spice_display_start(void);
184void qemu_spice_display_stop(void);
71d388d4 185int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd);
be812c0a 186
f91005e1 187#endif
This page took 0.649009 seconds and 4 git commands to generate.