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:
		
							parent
							
								
									3373d2c696
								
							
						
					
					
						commit
						68789b23e7
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue