i965: Use blorp for all updownsample blits
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 12 May 2016 00:11:52 +0000 (17:11 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 14 May 2016 21:18:21 +0000 (14:18 -0700)
We used to use a meta path because blorp didn't support 16x MSAA.  Now it
does, so we don't need the meta paths anymore.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/Makefile.sources
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
src/mesa/drivers/dri/i965/brw_meta_updownsample.c [deleted file]
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index e94605e47142b82e8afbe269bc19b0f628c0854e..a732b9ee8b311b84414de7449026ad2c368d1495 100644 (file)
@@ -138,7 +138,6 @@ i965_FILES = \
        brw_lower_unnormalized_offset.cpp \
        brw_meta_fast_clear.c \
        brw_meta_stencil_blit.c \
-       brw_meta_updownsample.c \
        brw_meta_util.c \
        brw_meta_util.h \
        brw_misc_state.c \
index 69cedbc2faf1517f9a3a8ad2f4e80640b1dfc913..179bba15e6b86a4a56fb2d40818b37be9f1a3605 100644 (file)
@@ -1372,10 +1372,6 @@ GLboolean brwCreateContext(gl_api api,
 /*======================================================================
  * brw_misc_state.c
  */
-void brw_meta_updownsample(struct brw_context *brw,
-                           struct intel_mipmap_tree *src,
-                           struct intel_mipmap_tree *dst);
-
 void brw_meta_fbo_stencil_blit(struct brw_context *brw,
                                struct gl_framebuffer *read_fb,
                                struct gl_framebuffer *draw_fb,
@@ -1384,10 +1380,6 @@ void brw_meta_fbo_stencil_blit(struct brw_context *brw,
                                GLfloat dstX0, GLfloat dstY0,
                                GLfloat dstX1, GLfloat dstY1);
 
-void brw_meta_stencil_updownsample(struct brw_context *brw,
-                                   struct intel_mipmap_tree *src,
-                                   struct intel_mipmap_tree *dst);
-
 bool brw_meta_fast_clear(struct brw_context *brw,
                          struct gl_framebuffer *fb,
                          GLbitfield mask,
index e311760646f69555156e3a7e3bca3aaa518a619d..28b01c86ad60b2855c22a1af10c343ebb05e1bb9 100644 (file)
@@ -526,41 +526,3 @@ brw_meta_fbo_stencil_blit(struct brw_context *brw,
                          dst_mt, dst_irb->mt_level, dst_irb->mt_layer, &dims);
    brw_emit_mi_flush(brw);
 }
-
-void
-brw_meta_stencil_updownsample(struct brw_context *brw,
-                              struct intel_mipmap_tree *src,
-                              struct intel_mipmap_tree *dst)
-{
-   struct gl_context *ctx = &brw->ctx;
-   struct blit_dims dims = {
-      .src_x0 = 0, .src_y0 = 0,
-      .src_x1 = src->logical_width0, .src_y1 = src->logical_height0,
-      .dst_x0 = 0, .dst_y0 = 0,
-      .dst_x1 = dst->logical_width0, .dst_y1 = dst->logical_height0,
-      .mirror_x = 0, .mirror_y = 0 };
-   struct gl_framebuffer *readFb;
-   struct gl_renderbuffer *rb;
-
-   if (dst->stencil_mt)
-      dst = dst->stencil_mt;
-
-   readFb = ctx->Driver.NewFramebuffer(ctx, 0xDEADBEEF);
-   if (readFb == NULL)
-      return;
-
-   brw_emit_mi_flush(brw);
-   _mesa_meta_begin(ctx, MESA_META_ALL);
-
-   rb = brw_get_rb_for_slice(brw, src, 0, 0, false);
-
-   _mesa_bind_framebuffers(ctx, ctx->DrawBuffer, readFb);
-   _mesa_framebuffer_renderbuffer(ctx, ctx->ReadBuffer, GL_STENCIL_ATTACHMENT,
-                                  rb);
-
-   brw_meta_stencil_blit(brw, dst, 0, 0, &dims);
-   brw_emit_mi_flush(brw);
-
-   _mesa_reference_renderbuffer(&rb, NULL);
-   _mesa_reference_framebuffer(&readFb, NULL);
-}
diff --git a/src/mesa/drivers/dri/i965/brw_meta_updownsample.c b/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
deleted file mode 100644 (file)
index 91c92bd..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright © 2014 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#include "brw_context.h"
-#include "intel_batchbuffer.h"
-#include "intel_fbo.h"
-#include "brw_meta_util.h"
-
-#include "main/blit.h"
-#include "main/buffers.h"
-#include "main/enums.h"
-#include "main/fbobject.h"
-#include "main/framebuffer.h"
-#include "main/renderbuffer.h"
-
-#include "drivers/common/meta.h"
-
-/**
- * @file brw_meta_updownsample.c
- *
- * Implements upsampling and downsampling of miptrees for window system
- * framebuffers.
- */
-
-/**
- * Implementation of up or downsampling for window-system MSAA miptrees.
- */
-void
-brw_meta_updownsample(struct brw_context *brw,
-                      struct intel_mipmap_tree *src_mt,
-                      struct intel_mipmap_tree *dst_mt)
-{
-   struct gl_context *ctx = &brw->ctx;
-   struct gl_framebuffer *src_fb;
-   struct gl_framebuffer *dst_fb;
-   struct gl_renderbuffer *src_rb;
-   struct gl_renderbuffer *dst_rb;
-   GLenum drawbuffer;
-   GLbitfield attachment, blit_bit;
-
-   if (_mesa_get_format_base_format(src_mt->format) == GL_DEPTH_COMPONENT ||
-       _mesa_get_format_base_format(src_mt->format) == GL_DEPTH_STENCIL) {
-      attachment = GL_DEPTH_ATTACHMENT;
-      drawbuffer = GL_NONE;
-      blit_bit = GL_DEPTH_BUFFER_BIT;
-   } else {
-      attachment = GL_COLOR_ATTACHMENT0;
-      drawbuffer = GL_COLOR_ATTACHMENT0;
-      blit_bit = GL_COLOR_BUFFER_BIT;
-   }
-
-   brw_emit_mi_flush(brw);
-
-   _mesa_meta_begin(ctx, MESA_META_ALL);
-   src_rb = brw_get_rb_for_slice(brw, src_mt, 0, 0, false);
-   dst_rb = brw_get_rb_for_slice(brw, dst_mt, 0, 0, false);
-   src_fb = ctx->Driver.NewFramebuffer(ctx, 0xDEADBEEF);
-   dst_fb = ctx->Driver.NewFramebuffer(ctx, 0xDEADBEEF);
-
-   if (src_fb == NULL || dst_fb == NULL || src_rb == NULL || dst_rb == NULL) {
-      _mesa_error(ctx, GL_OUT_OF_MEMORY, "in %s", __func__);
-      goto error;
-   }
-
-   _mesa_bind_framebuffers(ctx, dst_fb, src_fb);
-   _mesa_framebuffer_renderbuffer(ctx, ctx->ReadBuffer, attachment, src_rb);
-   _mesa_ReadBuffer(drawbuffer);
-
-   _mesa_framebuffer_renderbuffer(ctx, ctx->DrawBuffer, attachment, dst_rb);
-   _mesa_DrawBuffer(drawbuffer);
-
-   _mesa_BlitFramebuffer(0, 0,
-                         src_mt->logical_width0, src_mt->logical_height0,
-                         0, 0,
-                         dst_mt->logical_width0, dst_mt->logical_height0,
-                         blit_bit, GL_NEAREST);
-
-error:
-   _mesa_reference_renderbuffer(&src_rb, NULL);
-   _mesa_reference_renderbuffer(&dst_rb, NULL);
-   _mesa_reference_framebuffer(&src_fb, NULL);
-   _mesa_reference_framebuffer(&dst_fb, NULL);
-
-   _mesa_meta_end(ctx);
-
-   brw_emit_mi_flush(brw);
-}
index 45569fca8006b8e6640a99a7ddaac4596cdb49bf..cc7ecf8eb0eb514319e59f5a6c9b596cca3f30e4 100644 (file)
@@ -2273,32 +2273,18 @@ intel_miptree_updownsample(struct brw_context *brw,
                            struct intel_mipmap_tree *src,
                            struct intel_mipmap_tree *dst)
 {
-   /* There is support for only up to eight samples. */
-   const bool use_blorp = src->num_samples <= 8 && dst->num_samples <= 8;
-
-   if (use_blorp) {
-      brw_blorp_blit_miptrees(brw,
-                              src, 0 /* level */, 0 /* layer */,
-                              src->format, SWIZZLE_XYZW,
-                              dst, 0 /* level */, 0 /* layer */, dst->format,
-                              0, 0,
-                              src->logical_width0, src->logical_height0,
-                              0, 0,
-                              dst->logical_width0, dst->logical_height0,
-                              GL_NEAREST, false, false /*mirror x, y*/,
-                              false, false);
-   } else if (src->format == MESA_FORMAT_S_UINT8) {
-      brw_meta_stencil_updownsample(brw, src, dst);
-   } else {
-      brw_meta_updownsample(brw, src, dst);
-   }
+   brw_blorp_blit_miptrees(brw,
+                           src, 0 /* level */, 0 /* layer */,
+                           src->format, SWIZZLE_XYZW,
+                           dst, 0 /* level */, 0 /* layer */, dst->format,
+                           0, 0,
+                           src->logical_width0, src->logical_height0,
+                           0, 0,
+                           dst->logical_width0, dst->logical_height0,
+                           GL_NEAREST, false, false /*mirror x, y*/,
+                           false, false);
 
    if (src->stencil_mt) {
-      if (!use_blorp) {
-         brw_meta_stencil_updownsample(brw, src->stencil_mt, dst);
-         return;
-      }
-
       brw_blorp_blit_miptrees(brw,
                               src->stencil_mt, 0 /* level */, 0 /* layer */,
                               src->stencil_mt->format, SWIZZLE_XYZW,