summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/platform_android.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 6ed0b416cf8..d1b50a3fa72 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -375,6 +375,7 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
if (type == EGL_WINDOW_BIT) {
int format;
int buffer_count;
+ const int min_buffers = 3;
if (window->common.magic != ANDROID_NATIVE_WINDOW_MAGIC) {
_eglError(EGL_BAD_NATIVE_WINDOW, "droid_create_surface");
@@ -393,17 +394,20 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
_eglError(EGL_BAD_NATIVE_WINDOW, "droid_create_surface");
goto cleanup_surface;
}
- if (native_window_set_buffer_count(window, buffer_count+1)) {
+
+ if (buffer_count < min_buffers)
+ buffer_count = min_buffers;
+ if (native_window_set_buffer_count(window, buffer_count)) {
_eglError(EGL_BAD_NATIVE_WINDOW, "droid_create_surface");
goto cleanup_surface;
}
- dri2_surf->color_buffers = calloc(buffer_count+1,
+ dri2_surf->color_buffers = calloc(buffer_count,
sizeof(*dri2_surf->color_buffers));
if (!dri2_surf->color_buffers) {
_eglError(EGL_BAD_ALLOC, "droid_create_surface");
goto cleanup_surface;
}
- dri2_surf->color_buffers_count = buffer_count+1;
+ dri2_surf->color_buffers_count = buffer_count;
if (format != dri2_conf->base.NativeVisualID) {
_eglLog(_EGL_WARNING, "Native format mismatch: 0x%x != 0x%x",