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