rust/cargo-c: update to 0.10.7+cargo-0.84.0
[oi-userland.git] / components / x11 / libdga / src / pix_update.c
blob6304e86338b011f1e3a1dde762d7d3d60b6eef81
1 /* Copyright (c) 1993, 2002, Oracle and/or its affiliates. All rights reserved.
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice (including the next
11 * paragraph) shall be included in all copies or substantial portions of the
12 * Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
25 ** pix_update.c
27 ** Routines of the update phase for pixmaps.
30 #ifdef SERVER_DGA
31 #include <X11/Xlib.h>
32 #endif /* SERVER_DGA */
33 #include "dga_incls.h"
34 #include "pix_grab.h"
36 void
37 dgai_pix_notify(_Dga_pixmap dgapix)
39 if (dgapix->siteNotifyFunc && (dgapix->changeMask & DGA_CHANGE_SITE)) {
40 (*dgapix->siteNotifyFunc)((Dga_drawable)dgapix, -1,
41 dgapix->siteNotifyClientData,
42 dgapix->siteChgReason);
43 dgapix->changeMask &= ~DGA_CHANGE_SITE;
47 int
48 dgai_pix_update(Dga_drawable dgadraw, short bufIndex)
50 _Dga_pixmap dgapix = (_Dga_pixmap)dgadraw;
51 SHARED_PIXMAP_INFO *infop;
53 #ifdef MT
54 if (dgaMTOn) {
55 mutex_lock(dgapix->mutexp);
56 DGA_LOCK(dgadraw);
57 /* check the real change count that we saved away */
58 if (dgapix->shadow_chngcnt[0] == *dgapix->s_chngcnt_p) {
59 mutex_unlock(dgapix->mutexp);
60 DGA_UNLOCK(dgadraw);
61 return (0);
64 #endif
66 infop = PIX_INFOP(dgapix);
68 dgapix->changeMask = 0;
70 /* first, see if the shared info is still valid */
71 if (infop->obsolete) {
72 dgapix->changeMask |= DGA_CHANGE_ZOMBIE;
74 if (dgapix->changeMask & DGA_CHANGE_ZOMBIE) {
75 dgapix->changeMask |= (DGA_CHANGE_SITE | DGA_CHANGE_CLIP);
76 dgapix->siteChgReason = DGA_SITECHG_ZOMBIE;
79 /* see if the dev_info has changed */
80 if (dgapix->c_devinfocnt != *dgapix->s_devinfocnt_p) {
81 dgapix->changeMask |= DGA_CHANGE_DEVINFO;
82 dgapix->c_devinfocnt = *dgapix->s_devinfocnt_p;
85 /* Has the cache changed? */
86 if (dgapix->c_cachecnt != *dgapix->s_cachecnt_p) {
87 dgapix->changeMask |= (DGA_CHANGE_CACHE | DGA_CHANGE_SITE);
88 dgapix->siteChgReason = DGA_SITECHG_CACHE;
89 dgapix->c_cached = *dgapix->s_cached_p;
90 dgapix->c_cachecnt = *dgapix->s_cachecnt_p;
93 dgai_pix_notify(dgapix);
95 #ifdef MT
96 if (dgaMTOn) {
97 /* save the real change count */
98 dgapix->shadow_chngcnt[0] = *dgapix->s_chngcnt_p;
99 /* For the MT case, make sure that this update function gets called
100 * the next time around, so make the change count different.
102 dgapix->c_chngcnt[0] = *dgapix->s_chngcnt_p - 1;
103 mutex_unlock(dgapix->mutexp);
104 DGA_UNLOCK(dgadraw);
105 } else {
106 dgapix->c_chngcnt[0] = *dgapix->s_chngcnt_p;
108 #else
109 dgapix->c_chngcnt[0] = *dgapix->s_chngcnt_p;
110 #endif
111 return(dgapix->changeMask);