glamor: Don't always fallback everything when change window attr.
Change the glamor_change_window_attributes's handling. We don't need to fallback every thing to cpu at the beginning. Only when there is a real need to change the pixmap's format, we need to do something. Otherwise, we need do nothing here. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
ca1908e11d
commit
ca36ada041
|
@ -33,6 +33,7 @@ libglamor_la_SOURCES = \
|
||||||
glamor_triangles.c\
|
glamor_triangles.c\
|
||||||
glamor_pixmap.c\
|
glamor_pixmap.c\
|
||||||
glamor_picture.c\
|
glamor_picture.c\
|
||||||
|
glamor_window.c\
|
||||||
glamor.h
|
glamor.h
|
||||||
libglamor_la_LIBADD = \
|
libglamor_la_LIBADD = \
|
||||||
glu3/libglu3.la
|
glu3/libglu3.la
|
||||||
|
|
|
@ -241,10 +241,13 @@ glamor_finish_access(DrawablePtr drawable)
|
||||||
Bool
|
Bool
|
||||||
glamor_prepare_access_gc(GCPtr gc)
|
glamor_prepare_access_gc(GCPtr gc)
|
||||||
{
|
{
|
||||||
if (gc->stipple)
|
if (gc->stipple) {
|
||||||
|
glamor_fallback("has stipple %p\n", gc->stipple);
|
||||||
if (!glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO))
|
if (!glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
if (gc->fillStyle == FillTiled) {
|
if (gc->fillStyle == FillTiled) {
|
||||||
|
glamor_fallback("has tile pixmap %p\n", gc->tile.pixmap);
|
||||||
if (!glamor_prepare_access (&gc->tile.pixmap->drawable,
|
if (!glamor_prepare_access (&gc->tile.pixmap->drawable,
|
||||||
GLAMOR_ACCESS_RO)) {
|
GLAMOR_ACCESS_RO)) {
|
||||||
if (gc->stipple)
|
if (gc->stipple)
|
||||||
|
@ -332,6 +335,8 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
|
||||||
/* fb24_32ReformatTile will do direct access of a newly-
|
/* fb24_32ReformatTile will do direct access of a newly-
|
||||||
* allocated pixmap.
|
* allocated pixmap.
|
||||||
*/
|
*/
|
||||||
|
glamor_fallback("GC %p tile FB_24_32 transformat %p.\n", gc, old_tile);
|
||||||
|
|
||||||
if (glamor_prepare_access(&old_tile->drawable,
|
if (glamor_prepare_access(&old_tile->drawable,
|
||||||
GLAMOR_ACCESS_RO)) {
|
GLAMOR_ACCESS_RO)) {
|
||||||
new_tile = fb24_32ReformatTile(old_tile,
|
new_tile = fb24_32ReformatTile(old_tile,
|
||||||
|
@ -351,6 +356,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
|
||||||
if (!gc->tileIsPixel && FbEvenTile(gc->tile.pixmap->drawable.width *
|
if (!gc->tileIsPixel && FbEvenTile(gc->tile.pixmap->drawable.width *
|
||||||
drawable->bitsPerPixel))
|
drawable->bitsPerPixel))
|
||||||
{
|
{
|
||||||
|
glamor_fallback("GC %p tile changed %p.\n", gc, gc->tile.pixmap);
|
||||||
if (glamor_prepare_access(&gc->tile.pixmap->drawable,
|
if (glamor_prepare_access(&gc->tile.pixmap->drawable,
|
||||||
GLAMOR_ACCESS_RW)) {
|
GLAMOR_ACCESS_RW)) {
|
||||||
fbPadPixmap(gc->tile.pixmap);
|
fbPadPixmap(gc->tile.pixmap);
|
||||||
|
@ -367,6 +373,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
|
||||||
/* We can't inline stipple handling like we do for GCTile because
|
/* We can't inline stipple handling like we do for GCTile because
|
||||||
* it sets fbgc privates.
|
* it sets fbgc privates.
|
||||||
*/
|
*/
|
||||||
|
glamor_fallback("GC %p stipple changed %p.\n", gc, gc->stipple);
|
||||||
if (glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RW)) {
|
if (glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RW)) {
|
||||||
fbValidateGC(gc, changes, drawable);
|
fbValidateGC(gc, changes, drawable);
|
||||||
glamor_finish_access(&gc->stipple->drawable);
|
glamor_finish_access(&gc->stipple->drawable);
|
||||||
|
@ -403,52 +410,11 @@ glamor_create_gc(GCPtr gc)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
|
||||||
glamor_prepare_access_window(WindowPtr window)
|
|
||||||
{
|
|
||||||
if (window->backgroundState == BackgroundPixmap) {
|
|
||||||
if (!glamor_prepare_access(&window->background.pixmap->drawable,
|
|
||||||
GLAMOR_ACCESS_RO))
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->borderIsPixel == FALSE) {
|
|
||||||
if (!glamor_prepare_access(&window->border.pixmap->drawable,
|
|
||||||
GLAMOR_ACCESS_RO)) {
|
|
||||||
if (window->backgroundState == BackgroundPixmap)
|
|
||||||
glamor_finish_access(&window->background.pixmap->drawable);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
glamor_finish_access_window(WindowPtr window)
|
|
||||||
{
|
|
||||||
if (window->backgroundState == BackgroundPixmap)
|
|
||||||
glamor_finish_access(&window->background.pixmap->drawable);
|
|
||||||
|
|
||||||
if (window->borderIsPixel == FALSE)
|
|
||||||
glamor_finish_access(&window->border.pixmap->drawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
glamor_change_window_attributes(WindowPtr window, unsigned long mask)
|
|
||||||
{
|
|
||||||
Bool ret;
|
|
||||||
|
|
||||||
if (!glamor_prepare_access_window(window))
|
|
||||||
return FALSE;
|
|
||||||
ret = fbChangeWindowAttributes(window, mask);
|
|
||||||
glamor_finish_access_window(window);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegionPtr
|
RegionPtr
|
||||||
glamor_bitmap_to_region(PixmapPtr pixmap)
|
glamor_bitmap_to_region(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
RegionPtr ret;
|
RegionPtr ret;
|
||||||
|
glamor_fallback("pixmap %p \n", pixmap);
|
||||||
if (!glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO))
|
if (!glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO))
|
||||||
return NULL;
|
return NULL;
|
||||||
ret = fbPixmapToRegion(pixmap);
|
ret = fbPixmapToRegion(pixmap);
|
||||||
|
|
|
@ -5,9 +5,24 @@
|
||||||
#define GLAMOR_DELAYED_STRING_MAX 64
|
#define GLAMOR_DELAYED_STRING_MAX 64
|
||||||
|
|
||||||
#define GLAMOR_DEBUG_NONE 0
|
#define GLAMOR_DEBUG_NONE 0
|
||||||
|
#define GLAMOR_DEBUG_UNIMPL 0
|
||||||
#define GLAMOR_DEBUG_FALLBACK 1
|
#define GLAMOR_DEBUG_FALLBACK 1
|
||||||
#define GLAMOR_DEBUG_TEXTURE_DYNAMIC_UPLOAD 2
|
#define GLAMOR_DEBUG_TEXTURE_DOWNLOAD 2
|
||||||
#define GLAMOR_DEBUG_TEXTURE_DOWNLOAD 3
|
#define GLAMOR_DEBUG_TEXTURE_DYNAMIC_UPLOAD 3
|
||||||
|
|
||||||
|
extern void
|
||||||
|
AbortServer(void) _X_NORETURN;
|
||||||
|
|
||||||
|
#define GLAMOR_PANIC(_format_, ...) \
|
||||||
|
do { \
|
||||||
|
LogMessageVerb(X_NONE, 0, "Glamor Fatal Error" \
|
||||||
|
" at %32s line %d: " _format_ "\n", \
|
||||||
|
__FUNCTION__, __LINE__, \
|
||||||
|
##__VA_ARGS__ ); \
|
||||||
|
AbortServer(); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define __debug_output_message(_format_, _prefix_, ...) \
|
#define __debug_output_message(_format_, _prefix_, ...) \
|
||||||
|
|
|
@ -748,6 +748,7 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
if (source->pSourcePict->type == SourcePictTypeSolidFill) {
|
if (source->pSourcePict->type == SourcePictTypeSolidFill) {
|
||||||
key.source = SHADER_SOURCE_SOLID;
|
key.source = SHADER_SOURCE_SOLID;
|
||||||
} else {
|
} else {
|
||||||
|
//key.source = SHADER_SOURCE_SOLID;
|
||||||
glamor_fallback("gradient source\n");
|
glamor_fallback("gradient source\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -1134,12 +1135,23 @@ glamor_composite(CARD8 op,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
glamor_fallback("glamor_composite(): "
|
|
||||||
"from picts %p/%p(%c,%c) to pict %p (%c)\n",
|
glamor_fallback(
|
||||||
source, mask,
|
"from picts %p:%p %dx%d / %p:%p %d x %d (%c,%c) to pict %p:%p %dx%d (%c)\n",
|
||||||
|
source,
|
||||||
|
source->pDrawable,
|
||||||
|
source->pDrawable ? source->pDrawable->width : 0,
|
||||||
|
source->pDrawable ? source->pDrawable->height : 0,
|
||||||
|
mask,
|
||||||
|
(!mask) ? NULL : mask->pDrawable,
|
||||||
|
(!mask || !mask->pDrawable)? 0 : mask->pDrawable->width,
|
||||||
|
(!mask || !mask->pDrawable)? 0 : mask->pDrawable->height,
|
||||||
glamor_get_picture_location(source),
|
glamor_get_picture_location(source),
|
||||||
glamor_get_picture_location(mask),
|
glamor_get_picture_location(mask),
|
||||||
dest,
|
dest,
|
||||||
|
dest->pDrawable,
|
||||||
|
dest->pDrawable->width,
|
||||||
|
dest->pDrawable->height,
|
||||||
glamor_get_picture_location(dest));
|
glamor_get_picture_location(dest));
|
||||||
|
|
||||||
glUseProgramObjectARB(0);
|
glUseProgramObjectARB(0);
|
||||||
|
|
|
@ -94,18 +94,17 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
||||||
glamor_pixmap_private *src_pixmap_priv;
|
glamor_pixmap_private *src_pixmap_priv;
|
||||||
glamor_pixmap_private *dst_pixmap_priv;
|
glamor_pixmap_private *dst_pixmap_priv;
|
||||||
|
|
||||||
|
|
||||||
src_pixmap_priv = glamor_get_pixmap_private(tile);
|
src_pixmap_priv = glamor_get_pixmap_private(tile);
|
||||||
dst_pixmap_priv = glamor_get_pixmap_private(pixmap);
|
dst_pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
|
|
||||||
if (glamor_priv->tile_prog == 0) {
|
if (glamor_priv->tile_prog == 0) {
|
||||||
glamor_fallback("Tiling unsupported\n");
|
glamor_fallback("Tiling unsupported\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv)) {
|
if (GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv)) {
|
||||||
glamor_fallback("dest has no fbo.");
|
glamor_fallback("dest has no fbo.\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2008 Intel Corporation
|
||||||
|
* Copyright © 1998 Keith Packard
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
|
* documentation for any purpose is hereby granted without fee, provided that
|
||||||
|
* the above copyright notice appear in all copies and that both that
|
||||||
|
* copyright notice and this permission notice appear in supporting
|
||||||
|
* documentation, and that the name of Keith Packard not be used in
|
||||||
|
* advertising or publicity pertaining to distribution of the software without
|
||||||
|
* specific, written prior permission. Keith Packard makes no
|
||||||
|
* representations about the suitability of this software for any purpose. It
|
||||||
|
* is provided "as is" without express or implied warranty.
|
||||||
|
*
|
||||||
|
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||||
|
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||||
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
#include <dix-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
|
/** @file glamor_window.c
|
||||||
|
*
|
||||||
|
* Screen Change Window Attribute implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
glamor_fixup_window_pixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
|
||||||
|
{
|
||||||
|
PixmapPtr pPixmap = *ppPixmap;
|
||||||
|
glamor_pixmap_private *pixmap_priv;
|
||||||
|
|
||||||
|
if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel)
|
||||||
|
{
|
||||||
|
pixmap_priv = glamor_get_pixmap_private(pPixmap);
|
||||||
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
|
||||||
|
glamor_fallback("pixmap %p has no fbo\n", pPixmap);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
glamor_debug_output(GLAMOR_DEBUG_UNIMPL, "To be implemented.\n");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
GLAMOR_PANIC(" We can't fall back to fbFixupWindowPixmap, as the fb24_32ReformatTile"
|
||||||
|
" is broken for glamor. \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
glamor_change_window_attributes(WindowPtr pWin, unsigned long mask)
|
||||||
|
{
|
||||||
|
if (mask & CWBackPixmap) {
|
||||||
|
if (pWin->backgroundState == BackgroundPixmap)
|
||||||
|
glamor_fixup_window_pixmap(&pWin->drawable, &pWin->background.pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & CWBorderPixmap) {
|
||||||
|
if (pWin->borderIsPixel == FALSE)
|
||||||
|
glamor_fixup_window_pixmap(&pWin->drawable, &pWin->border.pixmap);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue