diff options
author | Jason Ekstrand <[email protected]> | 2016-05-11 17:11:52 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-05-14 14:18:21 -0700 |
commit | 64f29070302507e39f50aeeef0472b4d78d2b0cc (patch) | |
tree | ea9a2b677fca7c211b3b4c44eee4470f04cf3367 /src/mesa | |
parent | f5febc83a7ea3b41435828e40ab8266ce96d7600 (diff) |
i965: Use blorp for all updownsample blits
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 <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/Makefile.sources | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c | 38 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_meta_updownsample.c | 107 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 34 |
5 files changed, 10 insertions, 178 deletions
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources index e94605e4714..a732b9ee8b3 100644 --- a/src/mesa/drivers/dri/i965/Makefile.sources +++ b/src/mesa/drivers/dri/i965/Makefile.sources @@ -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 \ diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 69cedbc2faf..179bba15e6b 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -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, diff --git a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c index e311760646f..28b01c86ad6 100644 --- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c +++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c @@ -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 index 91c92bdbacd..00000000000 --- a/src/mesa/drivers/dri/i965/brw_meta_updownsample.c +++ /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); -} diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 45569fca800..cc7ecf8eb0e 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -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, |