Mesa (master): egl_dri2: add pbuffer support to platform_android

Chia-I Wu olv at kemper.freedesktop.org
Tue Aug 30 21:09:23 PDT 2011


Module: Mesa
Branch: master
Commit: 93d59637446ba98802fa349afc1f365d71a66c9d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=93d59637446ba98802fa349afc1f365d71a66c9d

Author: Chia-I Wu <olv at lunarg.com>
Date:   Sat Aug 27 00:00:18 2011 +0800

egl_dri2: add pbuffer support to platform_android

This is a simple change thanks to allocateBuffer.

Reviewed-by: Chad Versace <chad at chad-versace.us>

---

 src/egl/drivers/dri2/platform_android.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index a5374b4..a0e4c65 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -222,7 +222,8 @@ static _EGLSurface *
 droid_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
 			    _EGLConfig *conf, const EGLint *attrib_list)
 {
-   return NULL;
+   return droid_create_surface(drv, disp, EGL_PBUFFER_BIT, conf,
+			      NULL, attrib_list);
 }
 
 static EGLBoolean
@@ -401,8 +402,10 @@ droid_get_buffers_parse_attachments(struct dri2_egl_surface *dri2_surf,
 
             if (buf->name)
                num_buffers++;
+
+            break;
          }
-         break;
+         /* fall through for pbuffers */
       case __DRI_BUFFER_DEPTH:
       case __DRI_BUFFER_STENCIL:
       case __DRI_BUFFER_ACCUM:
@@ -491,10 +494,11 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
       int format_count = 0;
 
       for (j = 0; dri2_dpy->driver_configs[j]; j++) {
+         const EGLint surface_type = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
          struct dri2_egl_config *dri2_conf;
 
          dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[j],
-               count + 1, visuals[i].size, EGL_WINDOW_BIT, NULL,
+               count + 1, visuals[i].size, surface_type, NULL,
                visuals[i].rgba_masks);
          if (dri2_conf) {
             dri2_conf->base.NativeVisualID = visuals[i].format;
@@ -518,9 +522,16 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
       dri2_conf->base.RenderableType &= ~EGL_OPENGL_BIT;
       dri2_conf->base.Conformant &= ~EGL_OPENGL_BIT;
 
-      /* and we want to make sure GL_DRAW_BUFFER is always GL_BACK */
+      /*
+       * We want to make sure GL_DRAW_BUFFER for windows or pbuffers is always
+       * GL_BACK.  For EGL configs that do not have a double DRI config, clear
+       * the surface type.
+       *
+       * This is just to be on the safe side.  dri2_add_config never sets
+       * EGL_WINDOW_BIT or EGL_PBUFFER_BIT for such configs.
+       */
       if (!dri2_conf->dri_double_config)
-         dri2_conf->base.SurfaceType &= ~EGL_WINDOW_BIT;
+         dri2_conf->base.SurfaceType = 0;
    }
 
    return (count != 0);



More information about the mesa-commit mailing list