[Mesa-dev] [PATCH kmscube 1/2] gbm: fix fallback for drivers that don't support modifiers

Rob Clark robdclark at gmail.com
Mon Jun 18 12:04:17 UTC 2018


Gallium drivers that do not implement resource_create_with_modifiers()
will fail gbm_surface_create_with_modifiers() so fall back to the old
way.

Fixes: 4f7cec0 Use weak functions to handle lack of gbm modifiers
Signed-off-by: Rob Clark <robdclark at gmail.com>
---
 common.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common.c b/common.c
index faecd42..931fc06 100644
--- a/common.c
+++ b/common.c
@@ -44,13 +44,16 @@ const struct gbm * init_gbm(int drm_fd, int w, int h, uint64_t modifier)
 {
 	gbm.dev = gbm_create_device(drm_fd);
 	gbm.format = GBM_FORMAT_XRGB8888;
+	gbm.surface = NULL;
 
 	if (gbm_surface_create_with_modifiers) {
 		gbm.surface = gbm_surface_create_with_modifiers(gbm.dev, w, h,
 								gbm.format,
 								&modifier, 1);
 
-	} else {
+	}
+
+	if (!gbm.surface) {
 		if (modifier != DRM_FORMAT_MOD_LINEAR) {
 			fprintf(stderr, "Modifiers requested but support isn't available\n");
 			return NULL;
-- 
2.17.1



More information about the mesa-dev mailing list