Statistics
| Branch: | Revision:

root / ui / vnc-jobs.h @ bd023f95

History | View | Annotate | Download (2.5 kB)

1 bd023f95 Corentin Chary
/*
2 bd023f95 Corentin Chary
 * QEMU VNC display driver
3 bd023f95 Corentin Chary
 *
4 bd023f95 Corentin Chary
 * From libvncserver/rfb/rfbproto.h
5 bd023f95 Corentin Chary
 * Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin
6 bd023f95 Corentin Chary
 * Copyright (C) 2000-2002 Constantin Kaplinsky.  All Rights Reserved.
7 bd023f95 Corentin Chary
 * Copyright (C) 2000 Tridia Corporation.  All Rights Reserved.
8 bd023f95 Corentin Chary
 * Copyright (C) 1999 AT&T Laboratories Cambridge.  All Rights Reserved.
9 bd023f95 Corentin Chary
 *
10 bd023f95 Corentin Chary
 *
11 bd023f95 Corentin Chary
 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 bd023f95 Corentin Chary
 * of this software and associated documentation files (the "Software"), to deal
13 bd023f95 Corentin Chary
 * in the Software without restriction, including without limitation the rights
14 bd023f95 Corentin Chary
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 bd023f95 Corentin Chary
 * copies of the Software, and to permit persons to whom the Software is
16 bd023f95 Corentin Chary
 * furnished to do so, subject to the following conditions:
17 bd023f95 Corentin Chary
 *
18 bd023f95 Corentin Chary
 * The above copyright notice and this permission notice shall be included in
19 bd023f95 Corentin Chary
 * all copies or substantial portions of the Software.
20 bd023f95 Corentin Chary
 *
21 bd023f95 Corentin Chary
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 bd023f95 Corentin Chary
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 bd023f95 Corentin Chary
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 bd023f95 Corentin Chary
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 bd023f95 Corentin Chary
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 bd023f95 Corentin Chary
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 bd023f95 Corentin Chary
 * THE SOFTWARE.
28 bd023f95 Corentin Chary
 */
29 bd023f95 Corentin Chary
30 bd023f95 Corentin Chary
#ifndef VNC_JOBS_H
31 bd023f95 Corentin Chary
#define VNC_JOBS_H
32 bd023f95 Corentin Chary
33 bd023f95 Corentin Chary
/* Jobs */
34 bd023f95 Corentin Chary
VncJob *vnc_job_new(VncState *vs);
35 bd023f95 Corentin Chary
int vnc_job_add_rect(VncJob *job, int x, int y, int w, int h);
36 bd023f95 Corentin Chary
void vnc_job_push(VncJob *job);
37 bd023f95 Corentin Chary
bool vnc_has_job(VncState *vs);
38 bd023f95 Corentin Chary
void vnc_jobs_clear(VncState *vs);
39 bd023f95 Corentin Chary
void vnc_jobs_join(VncState *vs);
40 bd023f95 Corentin Chary
41 bd023f95 Corentin Chary
#ifdef CONFIG_VNC_THREAD
42 bd023f95 Corentin Chary
43 bd023f95 Corentin Chary
void vnc_start_worker_thread(void);
44 bd023f95 Corentin Chary
bool vnc_worker_thread_running(void);
45 bd023f95 Corentin Chary
void vnc_stop_worker_thread(void);
46 bd023f95 Corentin Chary
47 bd023f95 Corentin Chary
#endif /* CONFIG_VNC_THREAD */
48 bd023f95 Corentin Chary
49 bd023f95 Corentin Chary
/* Locks */
50 bd023f95 Corentin Chary
static inline int vnc_trylock_display(VncDisplay *vd)
51 bd023f95 Corentin Chary
{
52 bd023f95 Corentin Chary
#ifdef CONFIG_VNC_THREAD
53 bd023f95 Corentin Chary
    return qemu_mutex_trylock(&vd->mutex);
54 bd023f95 Corentin Chary
#else
55 bd023f95 Corentin Chary
    return 0;
56 bd023f95 Corentin Chary
#endif
57 bd023f95 Corentin Chary
}
58 bd023f95 Corentin Chary
59 bd023f95 Corentin Chary
static inline void vnc_lock_display(VncDisplay *vd)
60 bd023f95 Corentin Chary
{
61 bd023f95 Corentin Chary
#ifdef CONFIG_VNC_THREAD
62 bd023f95 Corentin Chary
    qemu_mutex_lock(&vd->mutex);
63 bd023f95 Corentin Chary
#endif
64 bd023f95 Corentin Chary
}
65 bd023f95 Corentin Chary
66 bd023f95 Corentin Chary
static inline void vnc_unlock_display(VncDisplay *vd)
67 bd023f95 Corentin Chary
{
68 bd023f95 Corentin Chary
#ifdef CONFIG_VNC_THREAD
69 bd023f95 Corentin Chary
    qemu_mutex_unlock(&vd->mutex);
70 bd023f95 Corentin Chary
#endif
71 bd023f95 Corentin Chary
}
72 bd023f95 Corentin Chary
73 bd023f95 Corentin Chary
static inline void vnc_lock_output(VncState *vs)
74 bd023f95 Corentin Chary
{
75 bd023f95 Corentin Chary
#ifdef CONFIG_VNC_THREAD
76 bd023f95 Corentin Chary
    qemu_mutex_lock(&vs->output_mutex);
77 bd023f95 Corentin Chary
#endif
78 bd023f95 Corentin Chary
}
79 bd023f95 Corentin Chary
80 bd023f95 Corentin Chary
static inline void vnc_unlock_output(VncState *vs)
81 bd023f95 Corentin Chary
{
82 bd023f95 Corentin Chary
#ifdef CONFIG_VNC_THREAD
83 bd023f95 Corentin Chary
    qemu_mutex_unlock(&vs->output_mutex);
84 bd023f95 Corentin Chary
#endif
85 bd023f95 Corentin Chary
}
86 bd023f95 Corentin Chary
87 bd023f95 Corentin Chary
#endif /* VNC_JOBS_H */