[Glamor] [V2 PATCH 6/6] Fix the problem because of GLAMOR_CREATE_PIXMAP_FIXUP deleted when pixman createing.

junyan.he at linux.intel.com junyan.he at linux.intel.com
Mon May 14 19:08:13 PDT 2012


From: Junyan He <junyan.he at linux.intel.com>

 A bug is caused by change the pixmap's creating logic.
 The flag GLAMOR_CREATE_PIXMAP_FIXUP is deleted when
 creates the pixman which will be used to contain the
 gradient picture. Without this flag, the FBO can be
 re-used and the performance will be improved but the
 size of FBO may be bigger than the picture's real size.
 This will cause the caculation for xscale and yscale
 using pixmap_priv_get_scale get a wrong scale. The
 result is that the gradient picture seems to have some
 offset comparing to the right one. Fix this bug.


Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
 src/glamor_gradient.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/glamor_gradient.c b/src/glamor_gradient.c
index 8d4a108..d6f902b 100644
--- a/src/glamor_gradient.c
+++ b/src/glamor_gradient.c
@@ -797,9 +797,21 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
 		return 0;
 	}
 
-	glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+	dispatch = glamor_get_dispatch(glamor_priv);
+
+	dispatch->glBindFramebuffer(GL_FRAMEBUFFER, pixmap_priv->fbo->fb);
+#ifndef GLAMOR_GLES2
+	dispatch->glMatrixMode(GL_PROJECTION);
+	dispatch->glLoadIdentity();
+	dispatch->glMatrixMode(GL_MODELVIEW);
+	dispatch->glLoadIdentity();
+#endif
+	dispatch->glViewport(0, 0,
+	                     dst_picture->pDrawable->width,
+	                     dst_picture->pDrawable->height);
 
-	pixmap_priv_get_scale(pixmap_priv, xscale, yscale);
+	*xscale = 1.0 / (dst_picture->pDrawable->width);
+	*yscale = 1.0 / (INT16)(dst_picture->pDrawable->height);
 
 	DEBUGF("xscale = %f, yscale = %f,"
 	       " x_source = %d, y_source = %d, width = %d, height = %d\n",
@@ -851,8 +863,6 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
 	tex_vertices[5] = tex_vertices[7];
 	tex_vertices[7] = tmp;
 
-	dispatch = glamor_get_dispatch(glamor_priv);
-
 	dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
 					GL_FALSE, 0, vertices);
 	dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT,
-- 
1.7.7.6



More information about the Glamor mailing list