135c4bbdfSmrg/*
235c4bbdfSmrg * Copyright © 2008 Intel Corporation
335c4bbdfSmrg * Copyright © 1998 Keith Packard
435c4bbdfSmrg *
535c4bbdfSmrg * Permission to use, copy, modify, distribute, and sell this software and its
635c4bbdfSmrg * documentation for any purpose is hereby granted without fee, provided that
735c4bbdfSmrg * the above copyright notice appear in all copies and that both that
835c4bbdfSmrg * copyright notice and this permission notice appear in supporting
935c4bbdfSmrg * documentation, and that the name of Keith Packard not be used in
1035c4bbdfSmrg * advertising or publicity pertaining to distribution of the software without
1135c4bbdfSmrg * specific, written prior permission.  Keith Packard makes no
1235c4bbdfSmrg * representations about the suitability of this software for any purpose.  It
1335c4bbdfSmrg * is provided "as is" without express or implied warranty.
1435c4bbdfSmrg *
1535c4bbdfSmrg * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1635c4bbdfSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
1735c4bbdfSmrg * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1835c4bbdfSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
1935c4bbdfSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
2035c4bbdfSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2135c4bbdfSmrg * PERFORMANCE OF THIS SOFTWARE.
2235c4bbdfSmrg */
2335c4bbdfSmrg
2435c4bbdfSmrg#include "glamor_priv.h"
2535c4bbdfSmrg
2635c4bbdfSmrg/** @file glamor_window.c
2735c4bbdfSmrg *
2835c4bbdfSmrg * Screen Change Window Attribute implementation.
2935c4bbdfSmrg */
3035c4bbdfSmrg
3135c4bbdfSmrgstatic void
3235c4bbdfSmrgglamor_fixup_window_pixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
3335c4bbdfSmrg{
3435c4bbdfSmrg    PixmapPtr pPixmap = *ppPixmap;
3535c4bbdfSmrg    glamor_pixmap_private *pixmap_priv;
3635c4bbdfSmrg
3735c4bbdfSmrg    if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
3835c4bbdfSmrg        pixmap_priv = glamor_get_pixmap_private(pPixmap);
3935c4bbdfSmrg        if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
4035c4bbdfSmrg            glamor_fallback("pixmap %p has no fbo\n", pPixmap);
4135c4bbdfSmrg            goto fail;
4235c4bbdfSmrg        }
4335c4bbdfSmrg        glamor_debug_output(GLAMOR_DEBUG_UNIMPL, "To be implemented.\n");
4435c4bbdfSmrg    }
4535c4bbdfSmrg    return;
4635c4bbdfSmrg
4735c4bbdfSmrg fail:
4835c4bbdfSmrg    GLAMOR_PANIC
4935c4bbdfSmrg        (" We can't fall back to fbFixupWindowPixmap, as the fb24_32ReformatTile"
5035c4bbdfSmrg         " is broken for glamor. \n");
5135c4bbdfSmrg}
5235c4bbdfSmrg
5335c4bbdfSmrgBool
5435c4bbdfSmrgglamor_change_window_attributes(WindowPtr pWin, unsigned long mask)
5535c4bbdfSmrg{
5635c4bbdfSmrg    if (mask & CWBackPixmap) {
5735c4bbdfSmrg        if (pWin->backgroundState == BackgroundPixmap)
5835c4bbdfSmrg            glamor_fixup_window_pixmap(&pWin->drawable,
5935c4bbdfSmrg                                       &pWin->background.pixmap);
6035c4bbdfSmrg    }
6135c4bbdfSmrg
6235c4bbdfSmrg    if (mask & CWBorderPixmap) {
6335c4bbdfSmrg        if (pWin->borderIsPixel == FALSE)
6435c4bbdfSmrg            glamor_fixup_window_pixmap(&pWin->drawable, &pWin->border.pixmap);
6535c4bbdfSmrg    }
6635c4bbdfSmrg    return TRUE;
6735c4bbdfSmrg}
68