pix_update.c revision 830
830N/A/* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
830N/A * Use is subject to license terms.
830N/A *
830N/A * Permission is hereby granted, free of charge, to any person obtaining a
830N/A * copy of this software and associated documentation files (the
830N/A * "Software"), to deal in the Software without restriction, including
830N/A * without limitation the rights to use, copy, modify, merge, publish,
830N/A * distribute, and/or sell copies of the Software, and to permit persons
830N/A * to whom the Software is furnished to do so, provided that the above
830N/A * copyright notice(s) and this permission notice appear in all copies of
830N/A * the Software and that both the above copyright notice(s) and this
830N/A * permission notice appear in supporting documentation.
830N/A *
830N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
830N/A * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
830N/A * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
830N/A * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
830N/A * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
830N/A * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
830N/A * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
830N/A * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
830N/A * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
830N/A *
830N/A * Except as contained in this notice, the name of a copyright holder
830N/A * shall not be used in advertising or otherwise to promote the sale, use
830N/A * or other dealings in this Software without prior written authorization
830N/A * of the copyright holder.
830N/A */
830N/A
830N/A#pragma ident "@(#)pix_update.c 35.6 09/11/09 SMI"
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}