From 1bf703e4ea5c4f742bc7ba55d01e5afc3f4e11f9 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Fri, 28 Jul 2017 17:30:34 +0200 Subject: dri_interface,egl,gallium: only expose RGBA visuals on Android MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X/GLX can't handle them. This removes almost 500 GLX visuals that were incorrectly exposed. Add an optional getCapability callback for querying what the loader can do. I'm not splitting this patch, because it's already too small. v2: also add the callback to __DRIimageLoaderExtension Reviewed-by: Nicolai Hähnle Cc: 17.2 --- src/egl/drivers/dri2/platform_android.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/egl/drivers/dri2') diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 300e2d9dbfb..bae42412b57 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -1013,6 +1013,18 @@ droid_get_buffers_with_format(__DRIdrawable * driDrawable, return dri2_surf->buffers; } +static unsigned +droid_get_capability(void *loaderPrivate, enum dri_loader_cap cap) +{ + /* Note: loaderPrivate is _EGLDisplay* */ + switch (cap) { + case DRI_LOADER_CAP_RGBA_ORDERING: + return 1; + default: + return 0; + } +} + static EGLBoolean droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy) { @@ -1125,18 +1137,20 @@ static const struct dri2_egl_display_vtbl droid_display_vtbl = { }; static const __DRIdri2LoaderExtension droid_dri2_loader_extension = { - .base = { __DRI_DRI2_LOADER, 3 }, + .base = { __DRI_DRI2_LOADER, 4 }, .getBuffers = NULL, .flushFrontBuffer = droid_flush_front_buffer, .getBuffersWithFormat = droid_get_buffers_with_format, + .getCapability = droid_get_capability; }; static const __DRIimageLoaderExtension droid_image_loader_extension = { - .base = { __DRI_IMAGE_LOADER, 1 }, + .base = { __DRI_IMAGE_LOADER, 2 }, .getBuffers = droid_image_get_buffers, .flushFrontBuffer = droid_flush_front_buffer, + .getCapability = droid_get_capability, }; static const __DRIextension *droid_dri2_loader_extensions[] = { -- cgit v1.2.3