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