mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	render/gles2: set has_alpha for DMA-BUFs
Use our internal pixel format table to figure out whether an imported DMA-BUF has alpha.
This commit is contained in:
		
							parent
							
								
									9b70eab194
								
							
						
					
					
						commit
						9dba176e8d
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		| 
						 | 
					@ -248,11 +248,19 @@ static struct wlr_texture *gles2_texture_from_dmabuf(
 | 
				
			||||||
	if (texture == NULL) {
 | 
						if (texture == NULL) {
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	texture->has_alpha = true;
 | 
					 | 
				
			||||||
	texture->drm_format = DRM_FORMAT_INVALID; // texture can't be written anyways
 | 
						texture->drm_format = DRM_FORMAT_INVALID; // texture can't be written anyways
 | 
				
			||||||
	texture->inverted_y =
 | 
						texture->inverted_y =
 | 
				
			||||||
		(attribs->flags & WLR_DMABUF_ATTRIBUTES_FLAGS_Y_INVERT) != 0;
 | 
							(attribs->flags & WLR_DMABUF_ATTRIBUTES_FLAGS_Y_INVERT) != 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const struct wlr_pixel_format_info *drm_fmt =
 | 
				
			||||||
 | 
							drm_get_pixel_format_info(attribs->format);
 | 
				
			||||||
 | 
						if (drm_fmt != NULL) {
 | 
				
			||||||
 | 
							texture->has_alpha = drm_fmt->has_alpha;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							// We don't know, assume the texture has an alpha channel
 | 
				
			||||||
 | 
							texture->has_alpha = true;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_egl_context prev_ctx;
 | 
						struct wlr_egl_context prev_ctx;
 | 
				
			||||||
	wlr_egl_save_context(&prev_ctx);
 | 
						wlr_egl_save_context(&prev_ctx);
 | 
				
			||||||
	wlr_egl_make_current(renderer->egl);
 | 
						wlr_egl_make_current(renderer->egl);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue