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

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2012-01-20 15:56:25 +08:00 committed by Eric Anholt
parent 3373d2c696
commit 68789b23e7
4 changed files with 12 additions and 7 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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:

View File

@ -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