glamor: use gbm_format_for_depth instead of open-coding it
This way glamor_back_pixmap_from_fd deals with the same depth values as glamor_pixmap_from_fds. Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1764>
This commit is contained in:
		
							parent
							
								
									87afcc7699
								
							
						
					
					
						commit
						83b13387ab
					
				|  | @ -561,17 +561,14 @@ glamor_back_pixmap_from_fd(PixmapPtr pixmap, | ||||||
| 
 | 
 | ||||||
|     glamor_egl = glamor_egl_get_screen_private(scrn); |     glamor_egl = glamor_egl_get_screen_private(scrn); | ||||||
| 
 | 
 | ||||||
|     if (bpp != 32 || !(depth == 24 || depth == 32 || depth == 30) || width == 0 || height == 0) |     if (!gbm_format_for_depth(depth, &import_data.format) || | ||||||
|  |         width == 0 || height == 0) | ||||||
|         return FALSE; |         return FALSE; | ||||||
| 
 | 
 | ||||||
|     import_data.fd = fd; |     import_data.fd = fd; | ||||||
|     import_data.width = width; |     import_data.width = width; | ||||||
|     import_data.height = height; |     import_data.height = height; | ||||||
|     import_data.stride = stride; |     import_data.stride = stride; | ||||||
|     if (depth == 30) |  | ||||||
|         import_data.format = GBM_FORMAT_ARGB2101010; |  | ||||||
|     else |  | ||||||
|         import_data.format = GBM_FORMAT_ARGB8888; |  | ||||||
|     bo = gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_FD, &import_data, 0); |     bo = gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_FD, &import_data, 0); | ||||||
|     if (!bo) |     if (!bo) | ||||||
|         return FALSE; |         return FALSE; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue