Statistics
| Branch: | Revision:

root / ui / spice-display.h @ d4970b07

History | View | Annotate | Download (2.4 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 a3e22260 Gerd Hoffmann
26 a3e22260 Gerd Hoffmann
#define NUM_MEMSLOTS 8
27 a3e22260 Gerd Hoffmann
#define MEMSLOT_GENERATION_BITS 8
28 a3e22260 Gerd Hoffmann
#define MEMSLOT_SLOT_BITS 8
29 a3e22260 Gerd Hoffmann
30 a3e22260 Gerd Hoffmann
#define MEMSLOT_GROUP_HOST  0
31 a3e22260 Gerd Hoffmann
#define MEMSLOT_GROUP_GUEST 1
32 a3e22260 Gerd Hoffmann
#define NUM_MEMSLOTS_GROUPS 2
33 a3e22260 Gerd Hoffmann
34 a3e22260 Gerd Hoffmann
#define NUM_SURFACES 1024
35 a3e22260 Gerd Hoffmann
36 e0c64d08 Gerd Hoffmann
typedef struct SimpleSpiceDisplay SimpleSpiceDisplay;
37 e0c64d08 Gerd Hoffmann
typedef struct SimpleSpiceUpdate SimpleSpiceUpdate;
38 e0c64d08 Gerd Hoffmann
39 e0c64d08 Gerd Hoffmann
struct SimpleSpiceDisplay {
40 a3e22260 Gerd Hoffmann
    DisplayState *ds;
41 a3e22260 Gerd Hoffmann
    void *buf;
42 a3e22260 Gerd Hoffmann
    int bufsize;
43 a3e22260 Gerd Hoffmann
    QXLWorker *worker;
44 a3e22260 Gerd Hoffmann
    QXLInstance qxl;
45 a3e22260 Gerd Hoffmann
    uint32_t unique;
46 a3e22260 Gerd Hoffmann
    QemuPfConv *conv;
47 a3e22260 Gerd Hoffmann
48 a3e22260 Gerd Hoffmann
    QXLRect dirty;
49 a3e22260 Gerd Hoffmann
    int notify;
50 a3e22260 Gerd Hoffmann
    int running;
51 a3e22260 Gerd Hoffmann
52 e0c64d08 Gerd Hoffmann
    /*
53 e0c64d08 Gerd Hoffmann
     * All struct members below this comment can be accessed from
54 e0c64d08 Gerd Hoffmann
     * both spice server and qemu (iothread) context and any access
55 e0c64d08 Gerd Hoffmann
     * to them must be protected by the lock.
56 e0c64d08 Gerd Hoffmann
     */
57 e0c64d08 Gerd Hoffmann
    QemuMutex lock;
58 e0c64d08 Gerd Hoffmann
    SimpleSpiceUpdate *update;
59 07536094 Gerd Hoffmann
    QEMUCursor *cursor;
60 07536094 Gerd Hoffmann
    int mouse_x, mouse_y;
61 e0c64d08 Gerd Hoffmann
};
62 e0c64d08 Gerd Hoffmann
63 e0c64d08 Gerd Hoffmann
struct SimpleSpiceUpdate {
64 a3e22260 Gerd Hoffmann
    QXLDrawable drawable;
65 a3e22260 Gerd Hoffmann
    QXLImage image;
66 a3e22260 Gerd Hoffmann
    QXLCommandExt ext;
67 a3e22260 Gerd Hoffmann
    uint8_t *bitmap;
68 e0c64d08 Gerd Hoffmann
};
69 a3e22260 Gerd Hoffmann
70 a3e22260 Gerd Hoffmann
int qemu_spice_rect_is_empty(const QXLRect* r);
71 a3e22260 Gerd Hoffmann
void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r);
72 a3e22260 Gerd Hoffmann
73 a3e22260 Gerd Hoffmann
void qemu_spice_destroy_update(SimpleSpiceDisplay *sdpy, SimpleSpiceUpdate *update);
74 a3e22260 Gerd Hoffmann
void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd);
75 a3e22260 Gerd Hoffmann
void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd);
76 a3e22260 Gerd Hoffmann
void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd);
77 a3e22260 Gerd Hoffmann
void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason);
78 a3e22260 Gerd Hoffmann
79 a3e22260 Gerd Hoffmann
void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
80 a3e22260 Gerd Hoffmann
                               int x, int y, int w, int h);
81 a3e22260 Gerd Hoffmann
void qemu_spice_display_resize(SimpleSpiceDisplay *ssd);
82 a3e22260 Gerd Hoffmann
void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd);