pix_update.c revision 943
943N/A/* Copyright (c) 1993, 2002, Oracle and/or its affiliates. All rights reserved.
830N/A *
830N/A * Permission is hereby granted, free of charge, to any person obtaining a
919N/A * copy of this software and associated documentation files (the "Software"),
919N/A * to deal in the Software without restriction, including without limitation
919N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense,
919N/A * and/or sell copies of the Software, and to permit persons to whom the
919N/A * Software is furnished to do so, subject to the following conditions:
830N/A *
919N/A * The above copyright notice and this permission notice (including the next
919N/A * paragraph) shall be included in all copies or substantial portions of the
919N/A * Software.
830N/A *
919N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
919N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
919N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
919N/A * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
919N/A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
919N/A * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
919N/A * DEALINGS IN THE SOFTWARE.
830N/A */
830N/A
830N/A
830N/A/*
830N/A** pix_update.c
830N/A**
830N/A** Routines of the update phase for pixmaps.
830N/A*/
830N/A
830N/A#ifdef SERVER_DGA
830N/A#include <X11/Xlib.h>
830N/A#endif /* SERVER_DGA */
830N/A#include "dga_incls.h"
830N/A#include "pix_grab.h"
830N/A
830N/Avoid
830N/Adgai_pix_notify(_Dga_pixmap dgapix)
830N/A{
830N/A if (dgapix->siteNotifyFunc && (dgapix->changeMask & DGA_CHANGE_SITE)) {
830N/A (*dgapix->siteNotifyFunc)((Dga_drawable)dgapix, -1,
830N/A dgapix->siteNotifyClientData,
830N/A dgapix->siteChgReason);
830N/A dgapix->changeMask &= ~DGA_CHANGE_SITE;
830N/A }
830N/A}
830N/A
830N/Aint
830N/Adgai_pix_update(Dga_drawable dgadraw, short bufIndex)
830N/A{
830N/A _Dga_pixmap dgapix = (_Dga_pixmap)dgadraw;
830N/A SHARED_PIXMAP_INFO *infop;
830N/A
830N/A#ifdef MT
830N/A if (dgaMTOn) {
830N/A mutex_lock(dgapix->mutexp);
830N/A DGA_LOCK(dgadraw);
830N/A /* check the real change count that we saved away */
830N/A if (dgapix->shadow_chngcnt[0] == *dgapix->s_chngcnt_p) {
830N/A mutex_unlock(dgapix->mutexp);
830N/A DGA_UNLOCK(dgadraw);
830N/A return (0);
830N/A }
830N/A }
830N/A#endif
830N/A
830N/A infop = PIX_INFOP(dgapix);
830N/A
830N/A dgapix->changeMask = 0;
830N/A
830N/A /* first, see if the shared info is still valid */
830N/A if (infop->obsolete) {
830N/A dgapix->changeMask |= DGA_CHANGE_ZOMBIE;
830N/A }
830N/A if (dgapix->changeMask & DGA_CHANGE_ZOMBIE) {
830N/A dgapix->changeMask |= (DGA_CHANGE_SITE | DGA_CHANGE_CLIP);
830N/A dgapix->siteChgReason = DGA_SITECHG_ZOMBIE;
830N/A }
830N/A
830N/A /* see if the dev_info has changed */
830N/A if (dgapix->c_devinfocnt != *dgapix->s_devinfocnt_p) {
830N/A dgapix->changeMask |= DGA_CHANGE_DEVINFO;
830N/A dgapix->c_devinfocnt = *dgapix->s_devinfocnt_p;
830N/A }
830N/A
830N/A /* Has the cache changed? */
830N/A if (dgapix->c_cachecnt != *dgapix->s_cachecnt_p) {
830N/A dgapix->changeMask |= (DGA_CHANGE_CACHE | DGA_CHANGE_SITE);
830N/A dgapix->siteChgReason = DGA_SITECHG_CACHE;
830N/A dgapix->c_cached = *dgapix->s_cached_p;
830N/A dgapix->c_cachecnt = *dgapix->s_cachecnt_p;
830N/A }
830N/A
830N/A dgai_pix_notify(dgapix);
830N/A
830N/A#ifdef MT
830N/A if (dgaMTOn) {
830N/A /* save the real change count */
830N/A dgapix->shadow_chngcnt[0] = *dgapix->s_chngcnt_p;
830N/A /* For the MT case, make sure that this update function gets called
830N/A * the next time around, so make the change count different.
830N/A */
830N/A dgapix->c_chngcnt[0] = *dgapix->s_chngcnt_p - 1;
830N/A mutex_unlock(dgapix->mutexp);
830N/A DGA_UNLOCK(dgadraw);
830N/A } else {
830N/A dgapix->c_chngcnt[0] = *dgapix->s_chngcnt_p;
830N/A }
830N/A#else
830N/A dgapix->c_chngcnt[0] = *dgapix->s_chngcnt_p;
830N/A#endif
830N/A return(dgapix->changeMask);
830N/A
830N/A}