diff options
Diffstat (limited to 'src/egl')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 3 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_android.c | 31 |
2 files changed, 22 insertions, 12 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 3e9f9911d24..ddb5f39c59c 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -213,9 +213,9 @@ struct dri2_egl_display int authenticated; int formats; uint32_t capabilities; - int is_render_node; #endif + int is_render_node; int is_different_gpu; }; @@ -286,6 +286,7 @@ struct dri2_egl_surface #ifdef HAVE_ANDROID_PLATFORM struct ANativeWindow *window; struct ANativeWindowBuffer *buffer; + __DRIimage *dri_image; /* EGL-owned buffers */ __DRIbuffer *local_buffers[__DRI_BUFFER_COUNT]; diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index c00b2c2d89c..02122e3d583 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -29,6 +29,7 @@ #include <errno.h> #include <dlfcn.h> +#include <xf86drm.h> #if ANDROID_VERSION >= 0x402 #include <sync/sync.h> @@ -694,17 +695,25 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy) goto cleanup_driver_name; } - dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER; - dri2_dpy->dri2_loader_extension.base.version = 3; - dri2_dpy->dri2_loader_extension.getBuffers = NULL; - dri2_dpy->dri2_loader_extension.flushFrontBuffer = droid_flush_front_buffer; - dri2_dpy->dri2_loader_extension.getBuffersWithFormat = - droid_get_buffers_with_format; - - dri2_dpy->extensions[0] = &dri2_dpy->dri2_loader_extension.base; - dri2_dpy->extensions[1] = &image_lookup_extension.base; - dri2_dpy->extensions[2] = &use_invalidate.base; - dri2_dpy->extensions[3] = NULL; + dri2_dpy->is_render_node = drmGetNodeTypeFromFd(dri2_dpy->fd) == DRM_NODE_RENDER; + + dri2_dpy->extensions[0] = &image_lookup_extension.base; + dri2_dpy->extensions[1] = &use_invalidate.base; + + /* render nodes cannot use Gem names, and thus do not support + * the __DRI_DRI2_LOADER extension */ + if (!dri2_dpy->is_render_node) { + dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER; + dri2_dpy->dri2_loader_extension.base.version = 3; + dri2_dpy->dri2_loader_extension.getBuffers = NULL; + dri2_dpy->dri2_loader_extension.flushFrontBuffer = droid_flush_front_buffer; + dri2_dpy->dri2_loader_extension.getBuffersWithFormat = + droid_get_buffers_with_format; + dri2_dpy->extensions[2] = &dri2_dpy->dri2_loader_extension.base; + dri2_dpy->extensions[3] = NULL; + } else + dri2_dpy->extensions[2] = NULL; + if (!dri2_create_screen(dpy)) { err = "DRI2: failed to create screen"; |