summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorRob Herring <[email protected]>2016-04-28 15:37:28 -0500
committerEmil Velikov <[email protected]>2016-05-01 12:31:28 +0100
commitd45884ef054eea539d4bf0018a99ed29e69d59c9 (patch)
tree296042921524cd0724f9a4800dbe3bb222acd73b /src/egl
parentdbbf7a8e618f06f59abbdc4c5be605a08886ed6a (diff)
egl: android: disable __DRI_DRI2_LOADER support on render nodes
Use of __DRI_DRI2_LOADER extension is only supported for card nodes. In order to support dmabufs, Android will be moving to using render nodes and we need to disable the DRI2 loader extension. This is based on the Wayland EGL code. Cc: Rob Clark <[email protected]> Signed-off-by: Rob Herring <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h3
-rw-r--r--src/egl/drivers/dri2/platform_android.c31
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";