[Mesa-dev,08/10] i965: Remove the blorp CTSI path.

Submitted by Eric Anholt on March 4, 2014, 10:17 p.m.

Details

Message ID 1393971464-12892-9-git-send-email-eric@anholt.net
State New
Headers show

Not browsing as part of any series.

Commit Message

Eric Anholt March 4, 2014, 10:17 p.m.
The meta patch supports all the same, except for the stencil case being
unaccelerated.
---
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 105 ---------------------------
 src/mesa/drivers/dri/i965/brw_context.h      |   9 ---
 src/mesa/drivers/dri/i965/intel_tex_copy.c   |   9 +--
 3 files changed, 1 insertion(+), 122 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index acdc9c7..fbed8ce 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -334,111 +334,6 @@  try_blorp_blit(struct brw_context *brw,
    return true;
 }
 
-bool
-brw_blorp_copytexsubimage(struct brw_context *brw,
-                          struct gl_renderbuffer *src_rb,
-                          struct gl_texture_image *dst_image,
-                          int slice,
-                          int srcX0, int srcY0,
-                          int dstX0, int dstY0,
-                          int width, int height)
-{
-   struct gl_context *ctx = &brw->ctx;
-   struct intel_renderbuffer *src_irb = intel_renderbuffer(src_rb);
-   struct intel_texture_image *intel_image = intel_texture_image(dst_image);
-
-   /* Sync up the state of window system buffers.  We need to do this before
-    * we go looking at the src renderbuffer's miptree.
-    */
-   intel_prepare_render(brw);
-
-   struct intel_mipmap_tree *src_mt = src_irb->mt;
-   struct intel_mipmap_tree *dst_mt = intel_image->mt;
-
-   /* BLORP is not supported before Gen6. */
-   if (brw->gen < 6 || brw->gen >= 8)
-      return false;
-
-   if (_mesa_get_format_base_format(src_mt->format) !=
-       _mesa_get_format_base_format(dst_mt->format)) {
-      return false;
-   }
-
-   /* We can't handle format conversions between Z24 and other formats since
-    * we have to lie about the surface format.  See the comments in
-    * brw_blorp_surface_info::set().
-    */
-   if ((src_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT) !=
-       (dst_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT)) {
-      return false;
-   }
-
-   if (!brw->format_supported_as_render_target[dst_mt->format])
-      return false;
-
-   /* Source clipping shouldn't be necessary, since copytexsubimage (in
-    * src/mesa/main/teximage.c) calls _mesa_clip_copytexsubimage() which
-    * takes care of it.
-    *
-    * Destination clipping shouldn't be necessary since the restrictions on
-    * glCopyTexSubImage prevent the user from specifying a destination rectangle
-    * that falls outside the bounds of the destination texture.
-    * See error_check_subtexture_dimensions().
-    */
-
-   int srcY1 = srcY0 + height;
-   int srcX1 = srcX0 + width;
-   int dstX1 = dstX0 + width;
-   int dstY1 = dstY0 + height;
-
-   /* Account for the fact that in the system framebuffer, the origin is at
-    * the lower left.
-    */
-   bool mirror_y = false;
-   if (_mesa_is_winsys_fbo(ctx->ReadBuffer)) {
-      GLint tmp = src_rb->Height - srcY0;
-      srcY0 = src_rb->Height - srcY1;
-      srcY1 = tmp;
-      mirror_y = true;
-   }
-
-   brw_blorp_blit_miptrees(brw,
-                           src_mt, src_irb->mt_level, src_irb->mt_layer,
-                           dst_mt, dst_image->Level, dst_image->Face + slice,
-                           srcX0, srcY0, srcX1, srcY1,
-                           dstX0, dstY0, dstX1, dstY1,
-                           GL_NEAREST, false, mirror_y);
-
-   /* If we're copying to a packed depth stencil texture and the source
-    * framebuffer has separate stencil, we need to also copy the stencil data
-    * over.
-    */
-   src_rb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
-   if (_mesa_get_format_bits(dst_image->TexFormat, GL_STENCIL_BITS) > 0 &&
-       src_rb != NULL) {
-      src_irb = intel_renderbuffer(src_rb);
-      src_mt = src_irb->mt;
-
-      if (src_mt->stencil_mt)
-         src_mt = src_mt->stencil_mt;
-      if (dst_mt->stencil_mt)
-         dst_mt = dst_mt->stencil_mt;
-
-      if (src_mt != dst_mt) {
-         brw_blorp_blit_miptrees(brw,
-                                 src_mt, src_irb->mt_level, src_irb->mt_layer,
-                                 dst_mt, dst_image->Level,
-                                 dst_image->Face + slice,
-                                 srcX0, srcY0, srcX1, srcY1,
-                                 dstX0, dstY0, dstX1, dstY1,
-                                 GL_NEAREST, false, mirror_y);
-      }
-   }
-
-   return true;
-}
-
-
 GLbitfield
 brw_blorp_framebuffer(struct brw_context *brw,
                       GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index ccbe9ea..5568fcb 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1710,15 +1710,6 @@  brw_blorp_framebuffer(struct brw_context *brw,
                       GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
                       GLbitfield mask, GLenum filter);
 
-bool
-brw_blorp_copytexsubimage(struct brw_context *brw,
-                          struct gl_renderbuffer *src_rb,
-                          struct gl_texture_image *dst_image,
-                          int slice,
-                          int srcX0, int srcY0,
-                          int dstX0, int dstY0,
-                          int width, int height);
-
 /* gen6_multisample_state.c */
 unsigned
 gen6_determine_sample_mask(struct brw_context *brw);
diff --git a/src/mesa/drivers/dri/i965/intel_tex_copy.c b/src/mesa/drivers/dri/i965/intel_tex_copy.c
index ca0b5b9..082437a 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_copy.c
@@ -99,12 +99,7 @@  intelCopyTexSubImage(struct gl_context *ctx, GLuint dims,
 {
    struct brw_context *brw = brw_context(ctx);
 
-   /* Try BLORP first.  It can handle almost everything. */
-   if (brw_blorp_copytexsubimage(brw, rb, texImage, slice, x, y,
-                                 xoffset, yoffset, width, height))
-      return;
-
-   /* Next, try the BLT engine. */
+   /* Try the BLT engine. */
    if (intel_copy_texsubimage(brw,
                               intel_texture_image(texImage),
                               xoffset, yoffset, slice,
@@ -112,8 +107,6 @@  intelCopyTexSubImage(struct gl_context *ctx, GLuint dims,
       return;
    }
 
-   /* Finally, fall back to meta.  This will likely be slow. */
-   perf_debug("%s - fallback to swrast\n", __FUNCTION__);
    _mesa_meta_CopyTexSubImage(ctx, dims, texImage,
                               xoffset, yoffset, slice,
                               rb, x, y, width, height);

Comments

On 03/04/2014 02:17 PM, Eric Anholt wrote:
> The meta patch supports all the same, except for the stencil case being
> unaccelerated.
> ---
>  src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 105 ---------------------------
>  src/mesa/drivers/dri/i965/brw_context.h      |   9 ---
>  src/mesa/drivers/dri/i965/intel_tex_copy.c   |   9 +--
>  3 files changed, 1 insertion(+), 122 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
> index acdc9c7..fbed8ce 100644
> --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
> @@ -334,111 +334,6 @@ try_blorp_blit(struct brw_context *brw,
>     return true;
>  }
>  
> -bool
> -brw_blorp_copytexsubimage(struct brw_context *brw,
> -                          struct gl_renderbuffer *src_rb,
> -                          struct gl_texture_image *dst_image,
> -                          int slice,
> -                          int srcX0, int srcY0,
> -                          int dstX0, int dstY0,
> -                          int width, int height)
> -{
> -   struct gl_context *ctx = &brw->ctx;
> -   struct intel_renderbuffer *src_irb = intel_renderbuffer(src_rb);
> -   struct intel_texture_image *intel_image = intel_texture_image(dst_image);
> -
> -   /* Sync up the state of window system buffers.  We need to do this before
> -    * we go looking at the src renderbuffer's miptree.
> -    */
> -   intel_prepare_render(brw);
> -
> -   struct intel_mipmap_tree *src_mt = src_irb->mt;
> -   struct intel_mipmap_tree *dst_mt = intel_image->mt;
> -
> -   /* BLORP is not supported before Gen6. */
> -   if (brw->gen < 6 || brw->gen >= 8)
> -      return false;
> -
> -   if (_mesa_get_format_base_format(src_mt->format) !=
> -       _mesa_get_format_base_format(dst_mt->format)) {
> -      return false;
> -   }
> -
> -   /* We can't handle format conversions between Z24 and other formats since
> -    * we have to lie about the surface format.  See the comments in
> -    * brw_blorp_surface_info::set().
> -    */
> -   if ((src_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT) !=
> -       (dst_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT)) {
> -      return false;
> -   }
> -
> -   if (!brw->format_supported_as_render_target[dst_mt->format])
> -      return false;
> -
> -   /* Source clipping shouldn't be necessary, since copytexsubimage (in
> -    * src/mesa/main/teximage.c) calls _mesa_clip_copytexsubimage() which
> -    * takes care of it.
> -    *
> -    * Destination clipping shouldn't be necessary since the restrictions on
> -    * glCopyTexSubImage prevent the user from specifying a destination rectangle
> -    * that falls outside the bounds of the destination texture.
> -    * See error_check_subtexture_dimensions().
> -    */
> -
> -   int srcY1 = srcY0 + height;
> -   int srcX1 = srcX0 + width;
> -   int dstX1 = dstX0 + width;
> -   int dstY1 = dstY0 + height;
> -
> -   /* Account for the fact that in the system framebuffer, the origin is at
> -    * the lower left.
> -    */
> -   bool mirror_y = false;
> -   if (_mesa_is_winsys_fbo(ctx->ReadBuffer)) {
> -      GLint tmp = src_rb->Height - srcY0;
> -      srcY0 = src_rb->Height - srcY1;
> -      srcY1 = tmp;
> -      mirror_y = true;
> -   }
> -
> -   brw_blorp_blit_miptrees(brw,
> -                           src_mt, src_irb->mt_level, src_irb->mt_layer,
> -                           dst_mt, dst_image->Level, dst_image->Face + slice,
> -                           srcX0, srcY0, srcX1, srcY1,
> -                           dstX0, dstY0, dstX1, dstY1,
> -                           GL_NEAREST, false, mirror_y);
> -
> -   /* If we're copying to a packed depth stencil texture and the source
> -    * framebuffer has separate stencil, we need to also copy the stencil data
> -    * over.
> -    */
> -   src_rb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
> -   if (_mesa_get_format_bits(dst_image->TexFormat, GL_STENCIL_BITS) > 0 &&
> -       src_rb != NULL) {
> -      src_irb = intel_renderbuffer(src_rb);
> -      src_mt = src_irb->mt;
> -
> -      if (src_mt->stencil_mt)
> -         src_mt = src_mt->stencil_mt;
> -      if (dst_mt->stencil_mt)
> -         dst_mt = dst_mt->stencil_mt;
> -
> -      if (src_mt != dst_mt) {
> -         brw_blorp_blit_miptrees(brw,
> -                                 src_mt, src_irb->mt_level, src_irb->mt_layer,
> -                                 dst_mt, dst_image->Level,
> -                                 dst_image->Face + slice,
> -                                 srcX0, srcY0, srcX1, srcY1,
> -                                 dstX0, dstY0, dstX1, dstY1,
> -                                 GL_NEAREST, false, mirror_y);
> -      }
> -   }
> -
> -   return true;
> -}
> -
> -
>  GLbitfield
>  brw_blorp_framebuffer(struct brw_context *brw,
>                        GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index ccbe9ea..5568fcb 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -1710,15 +1710,6 @@ brw_blorp_framebuffer(struct brw_context *brw,
>                        GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
>                        GLbitfield mask, GLenum filter);
>  
> -bool
> -brw_blorp_copytexsubimage(struct brw_context *brw,
> -                          struct gl_renderbuffer *src_rb,
> -                          struct gl_texture_image *dst_image,
> -                          int slice,
> -                          int srcX0, int srcY0,
> -                          int dstX0, int dstY0,
> -                          int width, int height);
> -
>  /* gen6_multisample_state.c */
>  unsigned
>  gen6_determine_sample_mask(struct brw_context *brw);
> diff --git a/src/mesa/drivers/dri/i965/intel_tex_copy.c b/src/mesa/drivers/dri/i965/intel_tex_copy.c
> index ca0b5b9..082437a 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex_copy.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex_copy.c
> @@ -99,12 +99,7 @@ intelCopyTexSubImage(struct gl_context *ctx, GLuint dims,
>  {
>     struct brw_context *brw = brw_context(ctx);
>  
> -   /* Try BLORP first.  It can handle almost everything. */
> -   if (brw_blorp_copytexsubimage(brw, rb, texImage, slice, x, y,
> -                                 xoffset, yoffset, width, height))
> -      return;
> -
> -   /* Next, try the BLT engine. */
> +   /* Try the BLT engine. */
>     if (intel_copy_texsubimage(brw,
>                                intel_texture_image(texImage),
>                                xoffset, yoffset, slice,
> @@ -112,8 +107,6 @@ intelCopyTexSubImage(struct gl_context *ctx, GLuint dims,
>        return;
>     }
>  
> -   /* Finally, fall back to meta.  This will likely be slow. */
> -   perf_debug("%s - fallback to swrast\n", __FUNCTION__);
>     _mesa_meta_CopyTexSubImage(ctx, dims, texImage,
>                                xoffset, yoffset, slice,
>                                rb, x, y, width, height);
> 

Sadly, this looks like a slight performance regression in Xonotic:

+--------------------------------------------------------------------------+
|                            +           +        +   x                    |
|                     ++     +  x   x++x ++ * x x+*+  x  x   xx            |
|+                  + ++ x* ** +x+  *+*x+++ * * x*** x*xxx+x xxx  xx      +|
|                        |__________|_A_M_______A_M_|_______|              |
+--------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x  37     156.87213     159.97879     158.69534     158.58011    0.88627101
+  37     155.08178     160.50746     157.95545     157.86242    0.99051368
Difference at 95.0% confidence
        -0.717688 +/- 0.435487
        -0.452571% +/- 0.274616%
        (Student's t, pooled s = 0.939839)

After 37 runs my GPU hung, so I wasn't able to benchmark further.