summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/egl/drivers/dri2/platform_android.c18
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c24
2 files changed, 39 insertions, 3 deletions
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[] = {
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 59a850b1423..890a8bff4c6 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -124,6 +124,21 @@ dri_fill_st_options(struct dri_screen *screen)
driComputeOptionsSha1(optionCache, options->config_options_sha1);
}
+static unsigned
+dri_loader_get_cap(struct dri_screen *screen, enum dri_loader_cap cap)
+{
+ const __DRIdri2LoaderExtension *dri2_loader = screen->sPriv->dri2.loader;
+ const __DRIimageLoaderExtension *image_loader = screen->sPriv->image.loader;
+
+ if (dri2_loader && dri2_loader->base.version >= 4)
+ return dri2_loader->getCapability(screen->sPriv->loaderPrivate, cap);
+
+ if (image_loader && image_loader->base.version >= 2)
+ return image_loader->getCapability(screen->sPriv->loaderPrivate, cap);
+
+ return 0;
+}
+
static const __DRIconfig **
dri_fill_in_modes(struct dri_screen *screen)
{
@@ -235,8 +250,15 @@ dri_fill_in_modes(struct dri_screen *screen)
assert(ARRAY_SIZE(mesa_formats) == ARRAY_SIZE(pipe_formats));
+ /* Expose only BGRA ordering if the loader doesn't support RGBA ordering. */
+ unsigned num_formats;
+ if (dri_loader_get_cap(screen, DRI_LOADER_CAP_RGBA_ORDERING))
+ num_formats = ARRAY_SIZE(mesa_formats);
+ else
+ num_formats = 5;
+
/* Add configs. */
- for (format = 0; format < ARRAY_SIZE(mesa_formats); format++) {
+ for (format = 0; format < num_formats; format++) {
__DRIconfig **new_configs = NULL;
unsigned num_msaa_modes = 0; /* includes a single-sample mode */
uint8_t msaa_modes[MSAA_VISUAL_MAX_SAMPLES];