Commit 68789b23 authored by Zhigang Gong's avatar Zhigang Gong Committed by Eric Anholt

glamor_gles2: Consolidate gles2 pixmap format readable check to one function.

Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent 3373d2c6
......@@ -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,
......
......@@ -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,
......
......@@ -681,15 +681,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:
......
......@@ -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
Markdown is supported
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