From 0ef1698be22750fb14418bd418114fc63039db0c Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Thu, 21 Jul 2011 16:18:48 +0800 Subject: [PATCH] glamor: Fix one bug for Xephyr. Xephyr doesn't has a bounded valid texture. It seems that we can't load texture 0 directly sometimes. Especially in the copyarea, function if that is the case, we prefer to use fbo blit to read the screen pixmap rather than load the bound texture. Signed-off-by: Zhigang Gong --- glamor/glamor.c | 2 +- glamor/glamor_copyarea.c | 3 ++- glamor/glamor_render.c | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/glamor/glamor.c b/glamor/glamor.c index 33a33d690..f3a83fa04 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -200,7 +200,7 @@ glamor_create_screen_pixmap(ScreenPtr screen, int w, int h, int depth, pixmap_priv = glamor_get_pixmap_private(pixmap); pixmap_priv->tex = 0; pixmap_priv->gl_fbo = 1; - pixmap_priv->gl_tex = 1; + pixmap_priv->gl_tex = 0; pixmap_priv->container = pixmap; pixmap_priv->pending_op.type = GLAMOR_PENDING_NONE; diff --git a/glamor/glamor_copyarea.c b/glamor/glamor_copyarea.c index c8ccaaef1..c7d0d2163 100644 --- a/glamor/glamor_copyarea.c +++ b/glamor/glamor_copyarea.c @@ -293,7 +293,8 @@ glamor_copy_n_to_n(DrawablePtr src, } /* XXX need revisit to handle overlapped area copying. */ - if ( overlaped + if ((overlaped + || !src_pixmap_priv->gl_tex || !dst_pixmap_priv->gl_tex ) && glamor_copy_n_to_n_fbo_blit(src, dst, gc, box, nbox, dx, dy)) { goto done; return; diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c index f0a6e880c..a9015784e 100644 --- a/glamor/glamor_render.c +++ b/glamor/glamor_render.c @@ -765,7 +765,11 @@ glamor_composite_with_shader(CARD8 op, glamor_fallback("source == dest\n"); goto fail; } - if (!source_pixmap_priv || source_pixmap_priv->gl_tex == 0) { + if (!source_pixmap_priv || source_pixmap_priv->gl_fbo == 0) { + /* XXX in Xephyr, we may have gl_fbo equal to 1 but gl_tex + * equal to zero when the pixmap is screen pixmap. Then we may + * refer the tex zero directly latter in the composition. + * It seems that it works fine, but it may have potential problem*/ #ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD source_status = GLAMOR_UPLOAD_PENDING; #else @@ -786,7 +790,7 @@ glamor_composite_with_shader(CARD8 op, glamor_fallback("mask == dest\n"); goto fail; } - if (!mask_pixmap_priv || mask_pixmap_priv->gl_tex == 0) { + if (!mask_pixmap_priv || mask_pixmap_priv->gl_fbo == 0) { #ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD mask_status = GLAMOR_UPLOAD_PENDING; #else