render/egl: support formats with zero modifiers

This commit is contained in:
Simon Ser 2019-10-06 17:37:15 -04:00 committed by Scott Anderson
parent 3b4824a2fe
commit 11bf87d678

View file

@ -576,8 +576,7 @@ static int get_egl_dmabuf_modifiers(struct wlr_egl *egl, int format,
wlr_log(WLR_DEBUG, "DMA-BUF extension not present"); wlr_log(WLR_DEBUG, "DMA-BUF extension not present");
return -1; return -1;
} }
if (!egl->exts.image_dmabuf_import_modifiers_ext) {
if(!egl->exts.image_dmabuf_import_modifiers_ext) {
*modifiers = NULL; *modifiers = NULL;
return 0; return 0;
} }
@ -588,6 +587,10 @@ static int get_egl_dmabuf_modifiers(struct wlr_egl *egl, int format,
wlr_log(WLR_ERROR, "Failed to query dmabuf number of modifiers"); wlr_log(WLR_ERROR, "Failed to query dmabuf number of modifiers");
return -1; return -1;
} }
if (num == 0) {
*modifiers = NULL;
return 0;
}
*modifiers = calloc(num, sizeof(uint64_t)); *modifiers = calloc(num, sizeof(uint64_t));
if (*modifiers == NULL) { if (*modifiers == NULL) {