Codebase list kmscube / b98f30e
helper to check for egl entrypoints Remove some boilerplate and check more specifically for all the entry- points that different modules need. Ok, I guess it isn't likely for a driver to expose eglCreateImageKHR but not eglDeleteImageKHR.. but otoh kmscube is useful for bringing up drivers. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Rob Clark 7 years ago
5 changed file(s) with 25 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
8484 void (*draw)(unsigned i);
8585 };
8686
87 static inline int __egl_check(void *ptr, const char *name)
88 {
89 if (!ptr) {
90 printf("no %s\n", name);
91 return -1;
92 }
93 return 0;
94 }
95
96 #define egl_check(egl, name) __egl_check((egl)->name, #name)
97
8798 int init_egl(struct egl *egl, const struct gbm *gbm);
8899 int create_program(const char *vs_src, const char *fs_src);
89100 int link_program(unsigned program);
506506 if (ret)
507507 return NULL;
508508
509 if (!gl.egl.eglCreateImageKHR) {
510 printf("no eglCreateImageKHR\n");
509 if (egl_check(&gl.egl, eglCreateImageKHR) ||
510 egl_check(&gl.egl, glEGLImageTargetTexture2DOES) ||
511 egl_check(&gl.egl, eglDestroyImageKHR))
511512 return NULL;
512 }
513513
514514 gl.aspect = (GLfloat)(gbm->height) / (GLfloat)(gbm->width);
515515 gl.mode = mode;
299299 if (ret)
300300 return NULL;
301301
302 if (!gl.egl.eglCreateImageKHR) {
303 printf("no eglCreateImageKHR\n");
304 return NULL;
305 }
302 if (egl_check(&gl.egl, glEGLImageTargetTexture2DOES))
303 return NULL;
306304
307305 fnames = strdup(filenames);
308306 while ((s = strstr(fnames, ","))) {
180180 uint32_t flags = DRM_MODE_ATOMIC_NONBLOCK;
181181 int ret;
182182
183 if (!egl->eglDupNativeFenceFDANDROID) {
184 printf("no eglDupNativeFenceFDANDROID\n");
183 if (egl_check(egl, eglDupNativeFenceFDANDROID) ||
184 egl_check(egl, eglCreateSyncKHR) ||
185 egl_check(egl, eglDestroySyncKHR) ||
186 egl_check(egl, eglWaitSyncKHR) ||
187 egl_check(egl, eglClientWaitSyncKHR))
185188 return -1;
186 }
187189
188190 /* Allow a modeset change for the first commit only. */
189191 flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
259259 GstPad *pad;
260260 GstBus *bus;
261261
262 if (egl_check(egl, eglCreateImageKHR) ||
263 egl_check(egl, eglDestroyImageKHR))
264 return NULL;
265
262266 dec = calloc(1, sizeof(*dec));
263267 dec->loop = g_main_loop_new(NULL, FALSE);
264268 dec->gbm = gbm;