Пример #1
0
/// On Linux, according to eglplatform.h, EGLNativeDisplayType and intptr_t
/// have the same size regardless of platform.
bool
wegl_display_init(struct wegl_display *dpy,
                  struct wcore_platform *wc_plat,
                  intptr_t native_display)
{
    bool ok;
    EGLint major, minor;

    ok = wcore_display_init(&dpy->wcore, wc_plat);
    if (!ok)
        goto fail;

    dpy->egl = eglGetDisplay((EGLNativeDisplayType) native_display);
    if (!dpy->egl) {
        wegl_emit_error("eglGetDisplay");
        goto fail;
    }

    ok = eglInitialize(dpy->egl, &major, &minor);
    if (!ok) {
        wegl_emit_error("eglInitialize");
        goto fail;
    }

    ok = get_extensions(dpy);
    if (!ok)
	goto fail;

    return true;

fail:
    wegl_display_teardown(dpy);
    return false;
}
Пример #2
0
bool
droid_display_disconnect(struct wcore_display *wc_self)
{
    struct droid_display *self = droid_display(wc_self);
    bool ok = true;

    if (!self)
        return true;

    if (self->pSFContainer)
        droid_deinit_gl(self->pSFContainer);

    ok &= wegl_display_teardown(&self->wegl);
    free(self);
    return ok;
}
Пример #3
0
bool
wgbm_display_destroy(struct wcore_display *wc_self)
{
    struct wgbm_display *self = wgbm_display(wc_self);
    struct wcore_platform *wc_plat = wc_self->platform;
    struct wgbm_platform *plat = wgbm_platform(wegl_platform(wc_plat));
    bool ok = true;
    int fd;

    if (!self)
        return ok;


    ok &= wegl_display_teardown(&self->wegl);

    if (self->gbm_device) {
        fd = plat->gbm_device_get_fd(self->gbm_device);
        plat->gbm_device_destroy(self->gbm_device);
        close(fd);
    }

    free(self);
    return ok;
}