1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * Copyright © 2008 Intel Corporation
3*4882a593Smuzhiyun * Copyright © 1998 Keith Packard
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Permission to use, copy, modify, distribute, and sell this software and its
6*4882a593Smuzhiyun * documentation for any purpose is hereby granted without fee, provided that
7*4882a593Smuzhiyun * the above copyright notice appear in all copies and that both that
8*4882a593Smuzhiyun * copyright notice and this permission notice appear in supporting
9*4882a593Smuzhiyun * documentation, and that the name of Keith Packard not be used in
10*4882a593Smuzhiyun * advertising or publicity pertaining to distribution of the software without
11*4882a593Smuzhiyun * specific, written prior permission. Keith Packard makes no
12*4882a593Smuzhiyun * representations about the suitability of this software for any purpose. It
13*4882a593Smuzhiyun * is provided "as is" without express or implied warranty.
14*4882a593Smuzhiyun *
15*4882a593Smuzhiyun * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16*4882a593Smuzhiyun * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17*4882a593Smuzhiyun * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18*4882a593Smuzhiyun * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19*4882a593Smuzhiyun * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20*4882a593Smuzhiyun * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21*4882a593Smuzhiyun * PERFORMANCE OF THIS SOFTWARE.
22*4882a593Smuzhiyun */
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun #include "glamor_priv.h"
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun /** @file glamor_window.c
27*4882a593Smuzhiyun *
28*4882a593Smuzhiyun * Screen Change Window Attribute implementation.
29*4882a593Smuzhiyun */
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun static void
glamor_fixup_window_pixmap(DrawablePtr pDrawable,PixmapPtr * ppPixmap)32*4882a593Smuzhiyun glamor_fixup_window_pixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
33*4882a593Smuzhiyun {
34*4882a593Smuzhiyun PixmapPtr pPixmap = *ppPixmap;
35*4882a593Smuzhiyun glamor_pixmap_private *pixmap_priv;
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
38*4882a593Smuzhiyun pixmap_priv = glamor_get_pixmap_private(pPixmap);
39*4882a593Smuzhiyun if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
40*4882a593Smuzhiyun glamor_fallback("pixmap %p has no fbo\n", pPixmap);
41*4882a593Smuzhiyun goto fail;
42*4882a593Smuzhiyun }
43*4882a593Smuzhiyun glamor_debug_output(GLAMOR_DEBUG_UNIMPL, "To be implemented.\n");
44*4882a593Smuzhiyun }
45*4882a593Smuzhiyun return;
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun fail:
48*4882a593Smuzhiyun GLAMOR_PANIC
49*4882a593Smuzhiyun (" We can't fall back to fbFixupWindowPixmap, as the fb24_32ReformatTile"
50*4882a593Smuzhiyun " is broken for glamor. \n");
51*4882a593Smuzhiyun }
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun Bool
glamor_change_window_attributes(WindowPtr pWin,unsigned long mask)54*4882a593Smuzhiyun glamor_change_window_attributes(WindowPtr pWin, unsigned long mask)
55*4882a593Smuzhiyun {
56*4882a593Smuzhiyun if (mask & CWBackPixmap) {
57*4882a593Smuzhiyun if (pWin->backgroundState == BackgroundPixmap)
58*4882a593Smuzhiyun glamor_fixup_window_pixmap(&pWin->drawable,
59*4882a593Smuzhiyun &pWin->background.pixmap);
60*4882a593Smuzhiyun }
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun if (mask & CWBorderPixmap) {
63*4882a593Smuzhiyun if (pWin->borderIsPixel == FALSE)
64*4882a593Smuzhiyun glamor_fixup_window_pixmap(&pWin->drawable, &pWin->border.pixmap);
65*4882a593Smuzhiyun }
66*4882a593Smuzhiyun return TRUE;
67*4882a593Smuzhiyun }
68