[Mesa-dev] [PATCH 17/23] i965/gen9: Use _mesa_meta_pbo_GetTexSubImage() to read YF/YS tiled buffers

Anuj Phogat anuj.phogat at gmail.com
Mon Mar 30 14:04:48 PDT 2015


Currently, that's the only path that supports reading data from these buffers.

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 src/mesa/drivers/dri/i965/intel_pixel_read.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c
index 9ab5ed1..4d256df 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
@@ -221,15 +221,33 @@ intelReadPixels(struct gl_context * ctx,
 
    struct brw_context *brw = brw_context(ctx);
    bool dirty;
+   bool create_pbo = false;
+   uint32_t tr_mode = INTEL_MIPTREE_TRMODE_NONE;
 
    DBG("%s\n", __FUNCTION__);
 
+   if (brw->gen >= 9) {
+      const struct gl_framebuffer *readFb = ctx->ReadBuffer;
+      const int att_index = readFb->_ColorReadBufferIndex;
+      const struct gl_renderbuffer_attachment *readAtt =
+         &readFb->Attachment[att_index];
+      struct gl_renderbuffer *rb = readAtt->Renderbuffer;
+      const struct intel_renderbuffer *irb = intel_renderbuffer(rb);
+      tr_mode = irb->mt->tr_mode;
+      create_pbo = irb->mt->tr_mode != INTEL_MIPTREE_TRMODE_NONE;
+   }
+
    if (_mesa_meta_pbo_GetTexSubImage(ctx, 2, NULL, x, y, 0, width,
                                      height, 1, format, type, pixels,
-                                     false /*create_pbo*/,
-                                     true /*for_readpixels*/, pack))
+                                     create_pbo, true /*for_readpixels*/,
+                                     pack))
       return;
 
+   /* Currently there are no fallback paths to read data from surfaces with
+    * tr_mode != INTEL_MIPTREE_TRMODE_NONE.
+    */
+   assert(tr_mode == INTEL_MIPTREE_TRMODE_NONE);
+
    if (_mesa_is_bufferobj(ctx->Pack.BufferObj))
       perf_debug("%s: fallback to CPU mapping in PBO case\n", __FUNCTION__);
 
-- 
2.3.4



More information about the mesa-dev mailing list