[Glamor] [PATCH 14/15] glamor_gles2: Consolidate gles2 pixmap format readable check to one function.

zhigang.gong at linux.intel.com zhigang.gong at linux.intel.com
Fri Jan 20 00:52:12 PST 2012


From: Zhigang Gong <zhigang.gong at linux.intel.com>

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/glamor_getimage.c |    3 ++-
 src/glamor_getspans.c |    4 +++-
 src/glamor_pixmap.c   |    6 +-----
 src/glamor_utils.h    |    6 ++++++
 4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/glamor_getimage.c b/src/glamor_getimage.c
index 086ec4b..377783c 100644
--- a/src/glamor_getimage.c
+++ b/src/glamor_getimage.c
@@ -78,7 +78,8 @@ _glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h,
 	glamor_set_destination_pixmap_priv_nc(pixmap_priv);
 	glamor_validate_pixmap(pixmap);
 
-	if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) {
+	if (glamor_priv->gl_flavor == GLAMOR_GL_ES2
+	    && (glamor_tex_format_is_readable(format) || !no_revert)) {
 		/* XXX prepare whole pixmap is not efficient. */
 		temp_pixmap =
 		    glamor_es2_pixmap_read_prepare(pixmap, &tex_format,
diff --git a/src/glamor_getspans.c b/src/glamor_getspans.c
index be81fbb..92c278f 100644
--- a/src/glamor_getspans.c
+++ b/src/glamor_getspans.c
@@ -66,7 +66,9 @@ _glamor_get_spans(DrawablePtr drawable,
 	glamor_set_destination_pixmap_priv_nc(pixmap_priv);
 	glamor_validate_pixmap(pixmap);
 
-	if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) {
+	if (glamor_priv->gl_flavor == GLAMOR_GL_ES2
+	    && (glamor_tex_format_is_readable(format) || !no_revert)) {
+
 		/* XXX prepare whole pixmap is not efficient. */
 		temp_pixmap =
 		    glamor_es2_pixmap_read_prepare(pixmap, &format,
diff --git a/src/glamor_pixmap.c b/src/glamor_pixmap.c
index 673971c..69c8e0f 100644
--- a/src/glamor_pixmap.c
+++ b/src/glamor_pixmap.c
@@ -671,15 +671,11 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
 	glamor_validate_pixmap(pixmap);
 
 	if (glamor_priv->gl_flavor == GLAMOR_GL_ES2
-	    &&
-	    ((format != GL_RGBA && format != GL_RGB && format != GL_ALPHA)
-	     || no_revert != 1)) {
-
+	    && (glamor_tex_format_is_readable(format) || !no_revert)) {
 		temp_pixmap =
 		    glamor_es2_pixmap_read_prepare(pixmap, &format,
 						   &type, no_alpha,
 						   no_revert);
-
 	}
 	switch (access) {
 	case GLAMOR_ACCESS_RO:
diff --git a/src/glamor_utils.h b/src/glamor_utils.h
index c7d1c29..b292928 100644
--- a/src/glamor_utils.h
+++ b/src/glamor_utils.h
@@ -603,4 +603,10 @@ inline static Bool glamor_ddx_fallback_check_gc(GCPtr gc)
 	return (!pixmap || glamor_ddx_fallback_check_pixmap(&pixmap->drawable));
 }
 
+inline static Bool glamor_tex_format_is_readable(GLenum format)
+{
+	return ((format == GL_RGBA || format == GL_RGB || format == GL_ALPHA));
+
+}
+
 #endif
-- 
1.7.4.4



More information about the Glamor mailing list