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

Author: Kenneth Graunke <kenn...@whitecape.org>
Date:   Thu May 19 21:13:29 2016 -0700

i965: Implement a BLORP path for CopyImage and prefer it over Meta.

We're dropping Meta in favor of BLORP everywhere we can.

This also fixes bugs when copying cubemaps to 2D, which is currently
broken in the meta pass.  BLORP just works.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94198
Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.pho...@gmail.com>
Reviewed-by: Chris Forbes <chrisfor...@google.com>

---

 src/mesa/drivers/dri/i965/intel_copy_image.c | 34 +++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_copy_image.c 
b/src/mesa/drivers/dri/i965/intel_copy_image.c
index fdc6c8c..1ca6003 100644
--- a/src/mesa/drivers/dri/i965/intel_copy_image.c
+++ b/src/mesa/drivers/dri/i965/intel_copy_image.c
@@ -25,6 +25,7 @@
  *    Jason Ekstrand <jason.ekstr...@intel.com>
  */
 
+#include "brw_blorp.h"
 #include "intel_fbo.h"
 #include "intel_tex.h"
 #include "intel_blit.h"
@@ -209,8 +210,33 @@ copy_miptrees(struct brw_context *brw,
               int dst_x, int dst_y, int dst_z, unsigned dst_level,
               int src_width, int src_height)
 {
+   struct gl_context *ctx = &brw->ctx;
    unsigned bw, bh;
 
+   if (brw->gen >= 6 &&
+       brw->format_supported_as_render_target[dst_mt->format] &&
+       !_mesa_is_format_compressed(src_mt->format)) {
+
+      /* We'll use the destination format for both images */
+      mesa_format format = dst_mt->format;
+
+      brw_blorp_blit_miptrees(brw,
+                              src_mt, src_level, src_z, format, SWIZZLE_XYZW,
+                              dst_mt, dst_level, dst_z, format,
+                              src_x, src_y,
+                              src_x + src_width, src_y + src_height,
+                              dst_x, dst_y,
+                              dst_x + src_width, dst_y + src_height,
+                              GL_NEAREST, false, false, /* mirror */
+                              false, false);
+      return;
+   }
+
+   if (src_mt->num_samples > 0 || dst_mt->num_samples > 0) {
+      _mesa_problem(ctx, "Failed to copy multisampled texture with BLORP\n");
+      return;
+   }
+
    /* We are now going to try and copy the texture using the blitter.  If
     * that fails, we will fall back mapping the texture and using memcpy.
     * In either case, we need to do a full resolve.
@@ -267,7 +293,8 @@ intel_copy_image_sub_data(struct gl_context *ctx,
    struct intel_mipmap_tree *src_mt, *dst_mt;
    unsigned src_level, dst_level;
 
-   if (_mesa_meta_CopyImageSubData_uncompressed(ctx,
+   if (brw->gen < 6 &&
+       _mesa_meta_CopyImageSubData_uncompressed(ctx,
                                                 src_image, src_renderbuffer,
                                                 src_x, src_y, src_z,
                                                 dst_image, dst_renderbuffer,
@@ -309,11 +336,6 @@ intel_copy_image_sub_data(struct gl_context *ctx,
       dst_level = 0;
    }
 
-   if (src_mt->num_samples > 0 || dst_mt->num_samples > 0) {
-      _mesa_problem(ctx, "Failed to copy multisampled texture with BLORP\n");
-      return;
-   }
-
    copy_miptrees(brw, src_mt, src_x, src_y, src_z, src_level,
                  dst_mt, dst_x, dst_y, dst_z, dst_level,
                  src_width, src_height);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to