Commit 647b9fb4 authored by Emma Anholt's avatar Emma Anholt Committed by Zhigang Gong
Browse files

glamor: Add CopyWindow implementation so it doesn't crash.

parent 95d4a5a6
......@@ -18,6 +18,7 @@ AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
libglamor_la_SOURCES = \
glamor.c \
glamor_copyarea.c \
glamor_copywindow.c \
glamor_core.c \
glamor_fill.c \
glamor_fillspans.c \
......
......@@ -210,6 +210,9 @@ glamor_init(ScreenPtr screen)
glamor_priv->saved_change_window_attributes = screen->ChangeWindowAttributes;
screen->ChangeWindowAttributes = glamor_change_window_attributes;
glamor_priv->saved_copy_window = screen->CopyWindow;
screen->CopyWindow = glamor_copy_window;
glamor_priv->saved_bitmap_to_region = screen->BitmapToRegion;
screen->BitmapToRegion = glamor_bitmap_to_region;
......@@ -247,6 +250,7 @@ glamor_fini(ScreenPtr screen)
screen->DestroyPixmap = glamor_priv->saved_destroy_pixmap;
screen->GetSpans = glamor_priv->saved_get_spans;
screen->ChangeWindowAttributes = glamor_priv->saved_change_window_attributes;
screen->CopyWindow = glamor_priv->saved_copy_window;
screen->BitmapToRegion = glamor_priv->saved_bitmap_to_region;
#ifdef RENDER
ps->Composite = glamor_priv->saved_composite;
......
......@@ -32,7 +32,7 @@
* GC CopyArea implementation
*/
static void
void
glamor_copy_n_to_n(DrawablePtr src,
DrawablePtr dst,
GCPtr gc,
......@@ -49,6 +49,8 @@ glamor_copy_n_to_n(DrawablePtr src,
PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst);
int i;
goto fail;
glamor_set_alu(gc->alu);
if (!glamor_set_planemask(dst_pixmap, gc->planemask))
goto fail;
......@@ -64,6 +66,18 @@ glamor_copy_n_to_n(DrawablePtr src,
}
fail:
glamor_fallback("from %p to %p (%c,%c)\n", src, dst,
glamor_get_drawable_location(src),
glamor_get_drawable_location(dst));
if (glamor_prepare_access(dst, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access(src, GLAMOR_ACCESS_RO)) {
fbCopyNtoN(src, dst, gc, box, nbox,
dx, dy, reverse, upsidedown, bitplane,
closure);
glamor_finish_access(src);
}
glamor_finish_access(dst);
}
glamor_set_alu(GXcopy);
glamor_set_planemask(dst_pixmap, ~0);
}
......@@ -79,8 +93,6 @@ glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc,
glamor_pixmap_private *src_priv = glamor_get_pixmap_private(src_pixmap);
RegionPtr region;
goto fail;
if (!GLEW_EXT_framebuffer_blit) {
glamor_fallback("glamor_copy_area(): "
"EXT_framebuffer_blit unsupported\n");
......
/*
* 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_copywindow.c
*
* Screen CopyWindow implementation.
*/
void glamor_copy_window(WindowPtr win, DDXPointRec old_origin,
RegionPtr src_region)
{
RegionRec dst_region;
int dx, dy;
PixmapPtr pixmap = win->drawable.pScreen->GetWindowPixmap(win);
dx = old_origin.x - win->drawable.x;
dy = old_origin.y - win->drawable.y;
REGION_TRANSLATE(win->drawable.pScreen, src_region, -dx, -dy);
REGION_INIT(win->drawable.pScreen, &dst_region, NullBox, 0);
REGION_INTERSECT(win->drawable.pScreen, &dst_region, &win->borderClip,
src_region);
#ifdef COMPOSITE
if (pixmap->screen_x || pixmap->screen_y)
REGION_TRANSLATE(win->drawable.pScreen, &dst_region,
-pixmap->screen_x, -pixmap->screen_y);
#endif
miCopyRegion(&pixmap->drawable, &pixmap->drawable,
NULL, &dst_region, dx, dy, glamor_copy_n_to_n, 0, NULL);
REGION_UNINIT(win->drawable.pScreen, &dst_region);
}
......@@ -61,6 +61,7 @@ typedef struct glamor_screen_private {
CompositeProcPtr saved_composite;
TrapezoidsProcPtr saved_trapezoids;
ChangeWindowAttributesProcPtr saved_change_window_attributes;
CopyWindowProcPtr saved_copy_window;
BitmapToRegionProcPtr saved_bitmap_to_region;
/* glamor_finishaccess */
......@@ -138,6 +139,23 @@ PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable);
RegionPtr
glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc,
int srcx, int srcy, int width, int height, int dstx, int dsty);
void
glamor_copy_n_to_n(DrawablePtr src,
DrawablePtr dst,
GCPtr gc,
BoxPtr box,
int nbox,
int dx,
int dy,
Bool reverse,
Bool upsidedown,
Pixel bitplane,
void *closure);
/* glamor_copywindow.c */
void glamor_copy_window(WindowPtr win, DDXPointRec old_origin,
RegionPtr src_region);
/* glamor_core.c */
Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access);
void glamor_finish_access(DrawablePtr drawable);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment