[Mesa-dev] [PATCH 05/10] egl/android: Respect buffer mask in droid_image_get_buffers

Tomasz Figa tfiga at chromium.org
Fri Jul 15 07:53:51 UTC 2016


Drivers can request different set of buffers depending on the buffer
mask they pass to the get_buffers callback. This patch makes
droid_image_get_buffers() respect this mask.

Signed-off-by: Tomasz Figa <tfiga at chromium.org>
---
 src/egl/drivers/dri2/platform_android.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index de1e5e6..7495445 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -434,16 +434,23 @@ droid_image_get_buffers(__DRIdrawable *driDrawable,
 {
    struct dri2_egl_surface *dri2_surf = loaderPrivate;
 
+   images->image_mask = 0;
+
    if (update_buffers(dri2_surf) < 0)
       return 0;
 
-   if (get_back_bo(dri2_surf) < 0) {
-      _eglError(EGL_BAD_PARAMETER, "get_back_bo");
+   if (buffer_mask & __DRI_IMAGE_BUFFER_FRONT) {
+      _eglLog(_EGL_WARNING, "Front buffer is not supported for window surfaces");
       return 0;
    }
 
-   images->image_mask = __DRI_IMAGE_BUFFER_BACK;
-   images->back = dri2_surf->dri_image;
+   if (buffer_mask & __DRI_IMAGE_BUFFER_BACK) {
+      if (get_back_bo(dri2_surf) < 0)
+         return 0;
+
+      images->back = dri2_surf->dri_image;
+      images->image_mask |= __DRI_IMAGE_BUFFER_BACK;
+   }
 
    return 1;
 }
-- 
2.8.0.rc3.226.g39d4020



More information about the mesa-dev mailing list