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_set_destination_pixmap_priv_nc(pixmap_priv);
 | 
				
			||||||
	glamor_validate_pixmap(pixmap);
 | 
						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. */
 | 
							/* XXX prepare whole pixmap is not efficient. */
 | 
				
			||||||
		temp_pixmap =
 | 
							temp_pixmap =
 | 
				
			||||||
		    glamor_es2_pixmap_read_prepare(pixmap, &tex_format,
 | 
							    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_set_destination_pixmap_priv_nc(pixmap_priv);
 | 
				
			||||||
	glamor_validate_pixmap(pixmap);
 | 
						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. */
 | 
							/* XXX prepare whole pixmap is not efficient. */
 | 
				
			||||||
		temp_pixmap =
 | 
							temp_pixmap =
 | 
				
			||||||
		    glamor_es2_pixmap_read_prepare(pixmap, &format,
 | 
							    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);
 | 
						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)) {
 | 
				
			||||||
	    ((format != GL_RGBA && format != GL_RGB && format != GL_ALPHA)
 | 
					 | 
				
			||||||
	     || no_revert != 1)) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		temp_pixmap =
 | 
							temp_pixmap =
 | 
				
			||||||
		    glamor_es2_pixmap_read_prepare(pixmap, &format,
 | 
							    glamor_es2_pixmap_read_prepare(pixmap, &format,
 | 
				
			||||||
						   &type, no_alpha,
 | 
											   &type, no_alpha,
 | 
				
			||||||
						   no_revert);
 | 
											   no_revert);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	switch (access) {
 | 
						switch (access) {
 | 
				
			||||||
	case GLAMOR_ACCESS_RO:
 | 
						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));
 | 
						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
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue