blob: 044bf9fbfd5688d10581dcc0a5066a8d6e683160 [file] [log] [blame]
Corentin Charybd023f92010-07-07 20:58:02 +02001/*
2 * QEMU VNC display driver
3 *
4 * From libvncserver/rfb/rfbproto.h
5 * Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin
6 * Copyright (C) 2000-2002 Constantin Kaplinsky. All Rights Reserved.
7 * Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
8 * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
9 *
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 * THE SOFTWARE.
28 */
29
30#ifndef VNC_JOBS_H
31#define VNC_JOBS_H
32
33/* Jobs */
34VncJob *vnc_job_new(VncState *vs);
35int vnc_job_add_rect(VncJob *job, int x, int y, int w, int h);
36void vnc_job_push(VncJob *job);
37bool vnc_has_job(VncState *vs);
38void vnc_jobs_clear(VncState *vs);
39void vnc_jobs_join(VncState *vs);
40
Corentin Chary175b2a62012-03-14 07:58:47 +010041void vnc_jobs_consume_buffer(VncState *vs);
Corentin Charybd023f92010-07-07 20:58:02 +020042void vnc_start_worker_thread(void);
Corentin Charybd023f92010-07-07 20:58:02 +020043
Corentin Charybd023f92010-07-07 20:58:02 +020044/* Locks */
45static inline int vnc_trylock_display(VncDisplay *vd)
46{
Corentin Charybd023f92010-07-07 20:58:02 +020047 return qemu_mutex_trylock(&vd->mutex);
Corentin Charybd023f92010-07-07 20:58:02 +020048}
49
50static inline void vnc_lock_display(VncDisplay *vd)
51{
Corentin Charybd023f92010-07-07 20:58:02 +020052 qemu_mutex_lock(&vd->mutex);
Corentin Charybd023f92010-07-07 20:58:02 +020053}
54
55static inline void vnc_unlock_display(VncDisplay *vd)
56{
Corentin Charybd023f92010-07-07 20:58:02 +020057 qemu_mutex_unlock(&vd->mutex);
Corentin Charybd023f92010-07-07 20:58:02 +020058}
59
60static inline void vnc_lock_output(VncState *vs)
61{
Corentin Charybd023f92010-07-07 20:58:02 +020062 qemu_mutex_lock(&vs->output_mutex);
Corentin Charybd023f92010-07-07 20:58:02 +020063}
64
65static inline void vnc_unlock_output(VncState *vs)
66{
Corentin Charybd023f92010-07-07 20:58:02 +020067 qemu_mutex_unlock(&vs->output_mutex);
Corentin Charybd023f92010-07-07 20:58:02 +020068}
69
70#endif /* VNC_JOBS_H */