From 1f83411c9a69a44944fd8afe0c167cece60c1ecb Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Thu, 26 Apr 2012 19:59:58 +0800 Subject: [PATCH] glamor_copyarea: Return earlier if have zero nbox. Almost all callers will check whether the regions is empty before call to this internal API, but it seems the glamor_composite_with_copy may call into here with a zero nbox. A little weird, as the miComputeCompositeRegion return a Non-NULL, but the region is empty. Also remove a unecessary glflush. So let's check it here. Signed-off-by: Zhigang Gong --- glamor/glamor_copyarea.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/glamor/glamor_copyarea.c b/glamor/glamor_copyarea.c index d19e28b3c..f28206791 100644 --- a/glamor/glamor_copyarea.c +++ b/glamor/glamor_copyarea.c @@ -150,7 +150,6 @@ glamor_copy_n_to_n_textured(DrawablePtr src, int src_x_off, src_y_off, dst_x_off, dst_y_off; enum glamor_pixmap_status src_status = GLAMOR_NONE; GLfloat dst_xscale, dst_yscale, src_xscale, src_yscale; - int flush_needed = 0; int alu = GXcopy; src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); @@ -172,8 +171,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src, src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); #endif - } else - flush_needed = 1; + } if (gc) { if (!glamor_set_planemask(dst_pixmap, gc->planemask)) @@ -265,8 +263,6 @@ glamor_copy_n_to_n_textured(DrawablePtr src, #endif dispatch->glUseProgram(0); /* The source texture is bound to a fbo, we have to flush it here. */ - if (flush_needed) - dispatch->glFlush(); glamor_put_dispatch(glamor_priv); return TRUE; } @@ -297,12 +293,13 @@ _glamor_copy_n_to_n(DrawablePtr src, int overlaped = 0; Bool ret = FALSE; + if (nbox == 0) + return TRUE; dst_pixmap = glamor_get_drawable_pixmap(dst); dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap); src_pixmap = glamor_get_drawable_pixmap(src); src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); screen = dst_pixmap->drawable.pScreen; - glamor_priv = glamor_get_screen_private(dst->pScreen); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv)) {