[Mesa-dev] [PATCH 6/7] i965: Disable aux buffers for EGLImage-backed miptrees

Chad Versace chad.versace at intel.com
Thu Apr 9 20:57:07 PDT 2015


EGL does not yet have extensions to manage the flushing and invalidating
of driver-internal aux buffers. So we must disable aux buffers of
dma_buf-backed EGLImages in order to safely render into them.

This patch is obviously needed for renderbufers. It's also needed for
textures because the user can attach the texture to a framebuffer and
because the driver sometimes renders to textures for internal reasons.

Testing:
  - Tested on Ivybridge Chromebook Pixel with WebGL Aquarium and
    YouTube.
  - No Piglit regressions on Broadwell with `piglit run -p gbm
    tests/quick.py`.

Cc: Jordan Justen <jordan.l.justen at intel.com>
Cc: Tapani Pälli <tapani.palli at intel.com>
Cc: Zach Reizner <zachr at google.com>
Cc: Frank Henigman <fjhenigman at google.com>
Cc: Marta Lofstedt <marta.lofstedt at intel.com>
Cc: Haixia Shi <hshi at chromium.org>
---
 src/mesa/drivers/dri/i965/intel_fbo.c       |  8 +++++++-
 src/mesa/drivers/dri/i965/intel_tex_image.c | 16 ++++++++++++----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index 4c38583..fb26038 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -383,6 +383,12 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx,
 
    irb = intel_renderbuffer(rb);
    intel_miptree_release(&irb->mt);
+
+   /* Disable creation of the miptree's aux buffers because the driver exposes
+    * no EGL API to manage them. That is, there is no API for resolving the aux
+    * buffer's content to the main buffer nor for invalidating the aux buffer's
+    * content.
+    */
    irb->mt = intel_miptree_create_for_bo(brw,
                                          image->bo,
                                          image->format,
@@ -391,7 +397,7 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx,
                                          image->height,
                                          1,
                                          image->pitch,
-                                         false /*disable_aux_buffers*/);
+                                         true /*disable_aux_buffers*/);
    if (!irb->mt)
       return;
 
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index c581010..290d313 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -154,7 +154,8 @@ intel_set_texture_image_bo(struct gl_context *ctx,
                            uint32_t offset,
                            GLuint width, GLuint height,
                            GLuint pitch,
-                           GLuint tile_x, GLuint tile_y)
+                           GLuint tile_x, GLuint tile_y,
+                           bool disable_aux_buffers)
 {
    struct brw_context *brw = brw_context(ctx);
    struct intel_texture_image *intel_image = intel_texture_image(image);
@@ -170,7 +171,7 @@ intel_set_texture_image_bo(struct gl_context *ctx,
 
    intel_image->mt = intel_miptree_create_for_bo(brw, bo, image->TexFormat,
                                                  0, width, height, 1, pitch,
-                                                 false /*disable_aux_buffers*/);
+                                                 disable_aux_buffers);
    if (intel_image->mt == NULL)
        return;
    intel_image->mt->target = target;
@@ -254,7 +255,8 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
                               rb->Base.Base.Width,
                               rb->Base.Base.Height,
                               rb->mt->pitch,
-                              0, 0);
+                              0, 0,
+                              false /*disable_aux_buffers*/);
    _mesa_unlock_texture(&brw->ctx, texObj);
 }
 
@@ -344,12 +346,18 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
       return;
    }
 
+   /* Disable creation of the texture's aux buffers because the driver exposes
+    * no EGL API to manage them. That is, there is no API for resolving the aux
+    * buffer's content to the main buffer nor for invalidating the aux buffer's
+    * content.
+    */
    intel_set_texture_image_bo(ctx, texImage, image->bo,
                               target, image->internal_format,
                               image->format, image->offset,
                               image->width,  image->height,
                               image->pitch,
-                              image->tile_x, image->tile_y);
+                              image->tile_x, image->tile_y,
+                              true /*disable_aux_buffers*/);
 }
 
 /**
-- 
2.2.0



More information about the mesa-dev mailing list