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

glamor: Add fallbacks for glamor_copy_area().

parent ca58607a
......@@ -80,27 +80,22 @@ glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc,
RegionPtr region;
if (!GLEW_EXT_framebuffer_blit) {
ErrorF("EXT_framebuffer_blit unsupported\n");
glamor_fallback("glamor_copy_area(): "
"EXT_framebuffer_blit unsupported\n");
goto fail;
}
if (!glamor_set_destination_pixmap(dst_pixmap)) {
/*
return miDoCopy(pSrcDrawable, pDstDrawable, pGC,
srcx, srcy, width, height,
dstx, dsty, fbCopyNtoN, 0, NULL);
*/
return NULL;
}
if (!glamor_set_destination_pixmap(dst_pixmap))
goto fail;
if (src_priv == NULL) {
ErrorF("glamor_copy_area: no src pixmap priv?");
glamor_fallback("glamor_copy_area(): no src pixmap priv");
goto fail;
}
if (src_priv->fb == 0 && src_pixmap != screen_pixmap) {
ErrorF("glamor_copy_area: No src FBO\n");
return NULL;
glamor_fallback("glamor_copy_area(): no src fbo");
goto fail;
}
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, src_priv->fb);
......@@ -112,5 +107,17 @@ glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc,
return region;
fail:
return NULL;
glamor_fallback("glamor_copy_area from %p to %p (%c,%c)\n", src, dst,
glamor_get_drawable_location(src),
glamor_get_drawable_location(dst));
region = NULL;
if (glamor_prepare_access(dst, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access(src, GLAMOR_ACCESS_RO)) {
region = fbCopyArea(src, dst, gc, srcx, srcy, width, height,
dstx, dsty);
glamor_finish_access(src);
}
glamor_finish_access(dst);
}
return region;
}
......@@ -39,13 +39,26 @@
#include "glamor_priv.h"
const Bool
glamor_get_drawable_location(const DrawablePtr drawable)
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
if (pixmap_priv == NULL)
return 'm';
if (pixmap_priv->fb == 0)
return 's';
else
return 'f';
}
Bool
glamor_set_destination_pixmap(PixmapPtr pixmap)
{
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
if (pixmap_priv == NULL) {
ErrorF("no pixmap priv?");
glamor_fallback("glamor_set_destination_pixmap(): no pixmap priv");
return FALSE;
}
......@@ -54,7 +67,7 @@ glamor_set_destination_pixmap(PixmapPtr pixmap)
PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
if (pixmap != screen_pixmap) {
ErrorF("No FBO\n");
glamor_fallback("glamor_set_destination_pixmap(): no fbo");
return FALSE;
}
}
......
......@@ -117,6 +117,17 @@ glamor_pm_is_solid(DrawablePtr drawable, unsigned long planemask)
FbFullMask(drawable->depth);
}
static inline void
glamor_fallback(char *format, ...)
{
va_list ap;
va_start(ap, format);
LogMessageVerb(X_INFO, 1, "glamor fallback: ");
LogVMessageVerb(X_INFO, 1, format, ap);
va_end(ap);
}
/* glamor.c */
PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable);
......@@ -129,6 +140,7 @@ Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access);
void glamor_finish_access(DrawablePtr drawable);
Bool glamor_prepare_access_window(WindowPtr window);
void glamor_finish_access_window(WindowPtr window);
const Bool glamor_get_drawable_location(const DrawablePtr drawable);
Bool glamor_create_gc(GCPtr gc);
void glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,
int x, int y, int width, int height,
......
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