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
84 | 84 |
void (*draw)(unsigned i);
|
85 | 85 |
};
|
86 | 86 |
|
|
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 |
|
87 | 98 |
int init_egl(struct egl *egl, const struct gbm *gbm);
|
88 | 99 |
int create_program(const char *vs_src, const char *fs_src);
|
89 | 100 |
int link_program(unsigned program);
|
506 | 506 |
if (ret)
|
507 | 507 |
return NULL;
|
508 | 508 |
|
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))
|
511 | 512 |
return NULL;
|
512 | |
}
|
513 | 513 |
|
514 | 514 |
gl.aspect = (GLfloat)(gbm->height) / (GLfloat)(gbm->width);
|
515 | 515 |
gl.mode = mode;
|
299 | 299 |
if (ret)
|
300 | 300 |
return NULL;
|
301 | 301 |
|
302 | |
if (!gl.egl.eglCreateImageKHR) {
|
303 | |
printf("no eglCreateImageKHR\n");
|
304 | |
return NULL;
|
305 | |
}
|
|
302 |
if (egl_check(&gl.egl, glEGLImageTargetTexture2DOES))
|
|
303 |
return NULL;
|
306 | 304 |
|
307 | 305 |
fnames = strdup(filenames);
|
308 | 306 |
while ((s = strstr(fnames, ","))) {
|
180 | 180 |
uint32_t flags = DRM_MODE_ATOMIC_NONBLOCK;
|
181 | 181 |
int ret;
|
182 | 182 |
|
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))
|
185 | 188 |
return -1;
|
186 | |
}
|
187 | 189 |
|
188 | 190 |
/* Allow a modeset change for the first commit only. */
|
189 | 191 |
flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
|
259 | 259 |
GstPad *pad;
|
260 | 260 |
GstBus *bus;
|
261 | 261 |
|
|
262 |
if (egl_check(egl, eglCreateImageKHR) ||
|
|
263 |
egl_check(egl, eglDestroyImageKHR))
|
|
264 |
return NULL;
|
|
265 |
|
262 | 266 |
dec = calloc(1, sizeof(*dec));
|
263 | 267 |
dec->loop = g_main_loop_new(NULL, FALSE);
|
264 | 268 |
dec->gbm = gbm;
|