[Mesa-dev] [RFC] i965: Stop supporting GL_ARB_copy_image on gen5 and below

Jason Ekstrand jason at jlekstrand.net
Wed Nov 30 01:54:44 UTC 2016


When I originally implemented support for the ARB_copy_image extension, I
did so with a meta-based path that used texture views to smash surface
formats to match.  Because this doesn't actually work for all cases
(compressed textures come to mind), we had a blit-based fallback path and,
because that doesn't always work, we could further fall back to CPU-only.
Because these were all things that gen4 could, in theory, do, we turned it
on all the way back to gen4.

A little while ago, we added a blorp-based path for gen6+ (we don't have
blorp on gen4) that correctly handles all cases and all of these other
terrible paths are now used on gen4-5 only.  So now we have three different
paths that only get triggered on gen4-5.  On top of that, I know the
blitter path is broken (it suffers from the image-too-tall problem), we've
had quite a few problems in the pasts with the meta path (maybe they're all
fixed now?), and the CPU fallback path is just a terrible idea in the first
place.  My recommendation is to just torch it all.

If we really don't like this, I think the other solution is to fix the
blitter path to work in all cases (which we should be able to do since
there's no MSAA on gen4-5) and get rid of the other two.  In either case,
the meta and CPU paths badly need to go.
---
 src/mesa/Makefile.sources                    |   1 -
 src/mesa/drivers/common/meta.h               |  10 -
 src/mesa/drivers/common/meta_copy_image.c    | 307 ---------------------------
 src/mesa/drivers/dri/i965/intel_copy_image.c | 256 +---------------------
 src/mesa/drivers/dri/i965/intel_extensions.c |   2 +-
 5 files changed, 11 insertions(+), 565 deletions(-)
 delete mode 100644 src/mesa/drivers/common/meta_copy_image.c

diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 410a61a..ee737b0 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -621,7 +621,6 @@ COMMON_DRIVER_FILES =			\
 	drivers/common/driverfuncs.c	\
 	drivers/common/driverfuncs.h	\
 	drivers/common/meta_blit.c	\
-	drivers/common/meta_copy_image.c	\
 	drivers/common/meta_generate_mipmap.c	\
 	drivers/common/meta_tex_subimage.c	\
 	drivers/common/meta.c \
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index a7018f5..0a913e9 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -492,16 +492,6 @@ _mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
                                       GLint dstX1, GLint dstY1,
                                       GLbitfield mask, GLenum filter);
 
-bool
-_mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
-                                         struct gl_texture_image *src_tex_image,
-                                         struct gl_renderbuffer *src_renderbuffer,
-                                         int src_x, int src_y, int src_z,
-                                         struct gl_texture_image *dst_tex_image,
-                                         struct gl_renderbuffer *dst_renderbuffer,
-                                         int dst_x, int dst_y, int dst_z,
-                                         int src_width, int src_height);
-
 extern void
 _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers);
 
diff --git a/src/mesa/drivers/common/meta_copy_image.c b/src/mesa/drivers/common/meta_copy_image.c
deleted file mode 100644
index e1c90a3..0000000
--- a/src/mesa/drivers/common/meta_copy_image.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2014 Intel Corporation.  All Rights Reserved.
- *
- * 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 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 "glheader.h"
-#include "context.h"
-#include "enums.h"
-#include "imports.h"
-#include "macros.h"
-#include "teximage.h"
-#include "texobj.h"
-#include "fbobject.h"
-#include "framebuffer.h"
-#include "buffers.h"
-#include "state.h"
-#include "mtypes.h"
-#include "meta.h"
-
-/**
- * Create a texture image that wraps a renderbuffer.
- */
-static struct gl_texture_image *
-wrap_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
-{
-   GLenum texTarget;
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-
-   if (rb->NumSamples > 1)
-      texTarget = GL_TEXTURE_2D_MULTISAMPLE;
-   else
-      texTarget = GL_TEXTURE_2D;
-
-   /* Texture ID is not significant since it never goes into the hash table */
-   texObj = ctx->Driver.NewTextureObject(ctx, 0, texTarget);
-   assert(texObj);
-   if (!texObj)
-      return NULL;
-
-   texImage = _mesa_get_tex_image(ctx, texObj, texTarget, 0);
-   assert(texImage);
-   if (!texImage)
-      return NULL;
-
-   if (!ctx->Driver.BindRenderbufferTexImage(ctx, rb, texImage)) {
-      _mesa_problem(ctx, "Failed to create texture from renderbuffer");
-      return NULL;
-   }
-
-   if (ctx->Driver.FinishRenderTexture && !rb->NeedsFinishRenderTexture) {
-      rb->NeedsFinishRenderTexture = true;
-      ctx->Driver.FinishRenderTexture(ctx, rb);
-   }
-
-   return texImage;
-}
-
-
-/* This function makes a texture view without bothering with all of the API
- * checks.  Most of them are the same for CopyTexSubImage so checking would
- * be redundant.  The one major difference is that we don't check for
- * whether the texture is immutable or not.  However, since the view will
- * be created and then immediately destroyed, this should not be a problem.
- */
-static bool
-make_view(struct gl_context *ctx, struct gl_texture_image *tex_image,
-          struct gl_texture_image **view_tex_image, GLuint *view_tex_name,
-          GLenum internal_format)
-{
-   struct gl_texture_object *tex_obj = tex_image->TexObject;
-   struct gl_texture_object *view_tex_obj;
-   mesa_format tex_format;
-
-   /* Set up the new texture object */
-   _mesa_GenTextures(1, view_tex_name);
-   view_tex_obj = _mesa_lookup_texture(ctx, *view_tex_name);
-   if (!view_tex_obj)
-      return false;
-
-   tex_format = _mesa_choose_texture_format(ctx, view_tex_obj, tex_obj->Target,
-                                           0, internal_format,
-                                           GL_NONE, GL_NONE);
-
-   if (!ctx->Driver.TestProxyTexImage(ctx, tex_obj->Target, 1, 0, tex_format,
-                                      1, tex_image->Width, tex_image->Height,
-                                      tex_image->Depth)) {
-      _mesa_DeleteTextures(1, view_tex_name);
-      *view_tex_name = 0;
-      return false;
-   }
-
-   assert(tex_obj->Target != 0);
-   assert(tex_obj->TargetIndex < NUM_TEXTURE_TARGETS);
-
-   view_tex_obj->Target = tex_obj->Target;
-   view_tex_obj->TargetIndex = tex_obj->TargetIndex;
-
-   *view_tex_image = _mesa_get_tex_image(ctx, view_tex_obj, tex_obj->Target, 0);
-
-   if (!*view_tex_image) {
-      _mesa_DeleteTextures(1, view_tex_name);
-      *view_tex_name = 0;
-      return false;
-   }
-
-   _mesa_init_teximage_fields(ctx, *view_tex_image,
-                              tex_image->Width, tex_image->Height,
-                              tex_image->Depth,
-                              0, internal_format, tex_format);
-
-   view_tex_obj->MinLevel = tex_image->Level;
-   view_tex_obj->NumLevels = 1;
-   view_tex_obj->MinLayer = tex_obj->MinLayer;
-   view_tex_obj->NumLayers = tex_obj->NumLayers;
-   view_tex_obj->Immutable = tex_obj->Immutable;
-   view_tex_obj->ImmutableLevels = tex_obj->ImmutableLevels;
-
-   if (ctx->Driver.TextureView != NULL &&
-       !ctx->Driver.TextureView(ctx, view_tex_obj, tex_obj)) {
-      _mesa_DeleteTextures(1, view_tex_name);
-      *view_tex_name = 0;
-      return false; /* driver recorded error */
-   }
-
-   return true;
-}
-
-/** A partial implementation of glCopyImageSubData
- *
- * This is a partial implementation of glCopyImageSubData that works only
- * if both textures are uncompressed and the destination texture is
- * renderable.  It uses a slight abuse of a texture view (see make_view) to
- * turn the source texture into the destination texture type and then uses
- * _mesa_meta_BlitFramebuffers to do the copy.
- */
-bool
-_mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
-                                         struct gl_texture_image *src_tex_image,
-                                         struct gl_renderbuffer *src_renderbuffer,
-                                         int src_x, int src_y, int src_z,
-                                         struct gl_texture_image *dst_tex_image,
-                                         struct gl_renderbuffer *dst_renderbuffer,
-                                         int dst_x, int dst_y, int dst_z,
-                                         int src_width, int src_height)
-{
-   mesa_format src_format, dst_format;
-   GLint src_internal_format, dst_internal_format;
-   GLuint src_view_texture = 0;
-   struct gl_texture_image *src_view_tex_image;
-   struct gl_framebuffer *readFb;
-   struct gl_framebuffer *drawFb = NULL;
-   bool success = false;
-   GLbitfield mask;
-   GLenum status, attachment;
-
-   if (src_renderbuffer) {
-      src_format = src_renderbuffer->Format;
-      src_internal_format = src_renderbuffer->InternalFormat;
-   } else {
-      assert(src_tex_image);
-      src_format = src_tex_image->TexFormat;
-      src_internal_format = src_tex_image->InternalFormat;
-   }
-
-   if (dst_renderbuffer) {
-      dst_format = dst_renderbuffer->Format;
-      dst_internal_format = dst_renderbuffer->InternalFormat;
-   } else {
-      assert(dst_tex_image);
-      dst_format = dst_tex_image->TexFormat;
-      dst_internal_format = dst_tex_image->InternalFormat;
-   }
-
-   if (_mesa_is_format_compressed(src_format))
-      return false;
-
-   if (_mesa_is_format_compressed(dst_format))
-      return false;
-
-   if (src_internal_format == dst_internal_format) {
-      src_view_tex_image = src_tex_image;
-   } else {
-      if (src_renderbuffer) {
-         assert(src_tex_image == NULL);
-         src_tex_image = wrap_renderbuffer(ctx, src_renderbuffer);
-      }
-      if (!make_view(ctx, src_tex_image, &src_view_tex_image, &src_view_texture,
-                     dst_internal_format))
-         goto cleanup;
-   }
-
-   /* We really only need to stash the bound framebuffers and scissor. */
-   _mesa_meta_begin(ctx, MESA_META_SCISSOR);
-
-   readFb = ctx->Driver.NewFramebuffer(ctx, 0xDEADBEEF);
-   if (readFb == NULL)
-      goto meta_end;
-
-   drawFb = ctx->Driver.NewFramebuffer(ctx, 0xDEADBEEF);
-   if (drawFb == NULL)
-      goto meta_end;
-
-   _mesa_bind_framebuffers(ctx, drawFb, readFb);
-
-   switch (_mesa_get_format_base_format(src_format)) {
-   case GL_DEPTH_COMPONENT:
-      attachment = GL_DEPTH_ATTACHMENT;
-      mask = GL_DEPTH_BUFFER_BIT;
-      break;
-   case GL_DEPTH_STENCIL:
-      attachment = GL_DEPTH_STENCIL_ATTACHMENT;
-      mask = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
-      break;
-   case GL_STENCIL_INDEX:
-      attachment = GL_STENCIL_ATTACHMENT;
-      mask = GL_STENCIL_BUFFER_BIT;
-      break;
-   default:
-      attachment = GL_COLOR_ATTACHMENT0;
-      mask = GL_COLOR_BUFFER_BIT;
-      _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
-      _mesa_ReadBuffer(GL_COLOR_ATTACHMENT0);
-   }
-
-   if (src_view_tex_image) {
-      /* Prefer the tex image because, even if we have a renderbuffer, we may
-       * have had to wrap it in a texture view.
-       */
-      _mesa_meta_framebuffer_texture_image(ctx, ctx->ReadBuffer, attachment,
-                                           src_view_tex_image, src_z);
-   } else {
-      _mesa_framebuffer_renderbuffer(ctx, ctx->ReadBuffer, attachment,
-                                     src_renderbuffer);
-   }
-
-   status = _mesa_check_framebuffer_status(ctx, ctx->ReadBuffer);
-   if (status != GL_FRAMEBUFFER_COMPLETE)
-      goto meta_end;
-
-   if (dst_renderbuffer) {
-      _mesa_framebuffer_renderbuffer(ctx, ctx->DrawBuffer, attachment,
-                                     dst_renderbuffer);
-   } else {
-      _mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer, attachment,
-                                           dst_tex_image, dst_z);
-   }
-
-   status = _mesa_check_framebuffer_status(ctx, ctx->DrawBuffer);
-   if (status != GL_FRAMEBUFFER_COMPLETE)
-      goto meta_end;
-
-   /* Explicitly disable sRGB encoding */
-   ctx->DrawBuffer->Visual.sRGBCapable = false;
-
-   /* Since we've bound a new draw framebuffer, we need to update its
-    * derived state -- _Xmin, etc -- for BlitFramebuffer's clipping to
-    * be correct.
-    */
-   _mesa_update_state(ctx);
-
-   /* We skip the core BlitFramebuffer checks for format consistency.
-    * We have already created views to ensure that the texture formats
-    * match.
-    */
-   ctx->Driver.BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
-                               src_x, src_y,
-                               src_x + src_width, src_y + src_height,
-                               dst_x, dst_y,
-                               dst_x + src_width, dst_y + src_height,
-                               mask, GL_NEAREST);
-
-   success = true;
-
-meta_end:
-   _mesa_reference_framebuffer(&readFb, NULL);
-   _mesa_reference_framebuffer(&drawFb, NULL);
-   _mesa_meta_end(ctx);
-
-cleanup:
-   _mesa_DeleteTextures(1, &src_view_texture);
-
-   /* If we got a renderbuffer source, delete the temporary texture */
-   if (src_renderbuffer && src_tex_image)
-      ctx->Driver.DeleteTexture(ctx, src_tex_image->TexObject);
-
-   return success;
-}
diff --git a/src/mesa/drivers/dri/i965/intel_copy_image.c b/src/mesa/drivers/dri/i965/intel_copy_image.c
index 3b5bf31..b4395d5 100644
--- a/src/mesa/drivers/dri/i965/intel_copy_image.c
+++ b/src/mesa/drivers/dri/i965/intel_copy_image.c
@@ -32,236 +32,6 @@
 #include "intel_mipmap_tree.h"
 #include "main/formats.h"
 #include "main/teximage.h"
-#include "drivers/common/meta.h"
-
-static bool
-copy_image_with_blitter(struct brw_context *brw,
-                        struct intel_mipmap_tree *src_mt, int src_level,
-                        int src_x, int src_y, int src_z,
-                        struct intel_mipmap_tree *dst_mt, int dst_level,
-                        int dst_x, int dst_y, int dst_z,
-                        int src_width, int src_height)
-{
-   GLuint bw, bh;
-   uint32_t src_image_x, src_image_y, dst_image_x, dst_image_y;
-
-   /* The blitter doesn't understand multisampling at all. */
-   if (src_mt->num_samples > 0 || dst_mt->num_samples > 0)
-      return false;
-
-   if (src_mt->format == MESA_FORMAT_S_UINT8)
-      return false;
-
-   /* According to the Ivy Bridge PRM, Vol1 Part4, section 1.2.1.2 (Graphics
-    * Data Size Limitations):
-    *
-    *    The BLT engine is capable of transferring very large quantities of
-    *    graphics data. Any graphics data read from and written to the
-    *    destination is permitted to represent a number of pixels that
-    *    occupies up to 65,536 scan lines and up to 32,768 bytes per scan line
-    *    at the destination. The maximum number of pixels that may be
-    *    represented per scan line’s worth of graphics data depends on the
-    *    color depth.
-    *
-    * Furthermore, intelEmitCopyBlit (which is called below) uses a signed
-    * 16-bit integer to represent buffer pitch, so it can only handle buffer
-    * pitches < 32k.
-    *
-    * As a result of these two limitations, we can only use the blitter to do
-    * this copy when the miptree's pitch is less than 32k.
-    */
-   if (src_mt->pitch >= 32768 ||
-       dst_mt->pitch >= 32768) {
-      perf_debug("Falling back due to >=32k pitch\n");
-      return false;
-   }
-
-   intel_miptree_get_image_offset(src_mt, src_level, src_z,
-                                  &src_image_x, &src_image_y);
-
-   if (_mesa_is_format_compressed(src_mt->format)) {
-      _mesa_get_format_block_size(src_mt->format, &bw, &bh);
-
-      assert(src_x % bw == 0);
-      assert(src_y % bh == 0);
-      assert(src_width % bw == 0);
-      assert(src_height % bh == 0);
-
-      src_x /= (int)bw;
-      src_y /= (int)bh;
-      src_width /= (int)bw;
-      src_height /= (int)bh;
-   }
-   src_x += src_image_x;
-   src_y += src_image_y;
-
-   intel_miptree_get_image_offset(dst_mt, dst_level, dst_z,
-                                  &dst_image_x, &dst_image_y);
-
-   if (_mesa_is_format_compressed(dst_mt->format)) {
-      _mesa_get_format_block_size(dst_mt->format, &bw, &bh);
-
-      assert(dst_x % bw == 0);
-      assert(dst_y % bh == 0);
-
-      dst_x /= (int)bw;
-      dst_y /= (int)bh;
-   }
-   dst_x += dst_image_x;
-   dst_y += dst_image_y;
-
-   return intelEmitCopyBlit(brw,
-                            src_mt->cpp,
-                            src_mt->pitch,
-                            src_mt->bo, src_mt->offset,
-                            src_mt->tiling,
-                            src_mt->tr_mode,
-                            dst_mt->pitch,
-                            dst_mt->bo, dst_mt->offset,
-                            dst_mt->tiling,
-                            dst_mt->tr_mode,
-                            src_x, src_y,
-                            dst_x, dst_y,
-                            src_width, src_height,
-                            GL_COPY);
-}
-
-static void
-copy_image_with_memcpy(struct brw_context *brw,
-                       struct intel_mipmap_tree *src_mt, int src_level,
-                       int src_x, int src_y, int src_z,
-                       struct intel_mipmap_tree *dst_mt, int dst_level,
-                       int dst_x, int dst_y, int dst_z,
-                       int src_width, int src_height)
-{
-   bool same_slice;
-   void *mapped, *src_mapped, *dst_mapped;
-   ptrdiff_t src_stride, dst_stride, cpp;
-   int map_x1, map_y1, map_x2, map_y2;
-   GLuint src_bw, src_bh;
-
-   cpp = _mesa_get_format_bytes(src_mt->format);
-   _mesa_get_format_block_size(src_mt->format, &src_bw, &src_bh);
-
-   assert(src_width % src_bw == 0);
-   assert(src_height % src_bh == 0);
-   assert(src_x % src_bw == 0);
-   assert(src_y % src_bh == 0);
-
-   /* If we are on the same miptree, same level, and same slice, then
-    * intel_miptree_map won't let us map it twice.  We have to do things a
-    * bit differently.  In particular, we do a single map large enough for
-    * both portions and in read-write mode.
-    */
-   same_slice = src_mt == dst_mt && src_level == dst_level && src_z == dst_z;
-
-   if (same_slice) {
-      assert(dst_x % src_bw == 0);
-      assert(dst_y % src_bh == 0);
-
-      map_x1 = MIN2(src_x, dst_x);
-      map_y1 = MIN2(src_y, dst_y);
-      map_x2 = MAX2(src_x, dst_x) + src_width;
-      map_y2 = MAX2(src_y, dst_y) + src_height;
-
-      intel_miptree_map(brw, src_mt, src_level, src_z,
-                        map_x1, map_y1, map_x2 - map_x1, map_y2 - map_y1,
-                        GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
-                        &mapped, &src_stride);
-
-      dst_stride = src_stride;
-
-      /* Set the offsets here so we don't have to think about while looping */
-      src_mapped = mapped + ((src_y - map_y1) / src_bh) * src_stride +
-                            ((src_x - map_x1) / src_bw) * cpp;
-      dst_mapped = mapped + ((dst_y - map_y1) / src_bh) * dst_stride +
-                            ((dst_x - map_x1) / src_bw) * cpp;
-   } else {
-      intel_miptree_map(brw, src_mt, src_level, src_z,
-                        src_x, src_y, src_width, src_height,
-                        GL_MAP_READ_BIT, &src_mapped, &src_stride);
-      intel_miptree_map(brw, dst_mt, dst_level, dst_z,
-                        dst_x, dst_y, src_width, src_height,
-                        GL_MAP_WRITE_BIT, &dst_mapped, &dst_stride);
-   }
-
-   src_width /= (int)src_bw;
-   src_height /= (int)src_bh;
-
-   for (int i = 0; i < src_height; ++i) {
-      memcpy(dst_mapped, src_mapped, src_width * cpp);
-      src_mapped += src_stride;
-      dst_mapped += dst_stride;
-   }
-
-   if (same_slice) {
-      intel_miptree_unmap(brw, src_mt, src_level, src_z);
-   } else {
-      intel_miptree_unmap(brw, dst_mt, dst_level, dst_z);
-      intel_miptree_unmap(brw, src_mt, src_level, src_z);
-   }
-}
-
-static void
-copy_miptrees(struct brw_context *brw,
-              struct intel_mipmap_tree *src_mt,
-              int src_x, int src_y, int src_z, unsigned src_level,
-              struct intel_mipmap_tree *dst_mt,
-              int dst_x, int dst_y, int dst_z, unsigned dst_level,
-              int src_width, int src_height)
-{
-   unsigned bw, bh;
-
-   if (brw->gen >= 6) {
-      brw_blorp_copy_miptrees(brw,
-                              src_mt, src_level, src_z,
-                              dst_mt, dst_level, dst_z,
-                              src_x, src_y, dst_x, dst_y,
-                              src_width, src_height);
-      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.
-    */
-   intel_miptree_all_slices_resolve_hiz(brw, src_mt);
-   intel_miptree_all_slices_resolve_depth(brw, src_mt);
-   intel_miptree_all_slices_resolve_color(brw, src_mt, 0);
-
-   intel_miptree_all_slices_resolve_hiz(brw, dst_mt);
-   intel_miptree_all_slices_resolve_depth(brw, dst_mt);
-   intel_miptree_all_slices_resolve_color(brw, dst_mt, 0);
-
-   _mesa_get_format_block_size(src_mt->format, &bw, &bh);
-
-   /* It's legal to have a WxH that's smaller than a compressed block. This
-    * happens for example when you are using a higher level LOD. For this case,
-    * we still want to copy the entire block, or else the decompression will be
-    * incorrect.
-    */
-   if (src_width < bw)
-      src_width = ALIGN_NPOT(src_width, bw);
-
-   if (src_height < bh)
-      src_height = ALIGN_NPOT(src_height, bh);
-
-   if (copy_image_with_blitter(brw, src_mt, src_level,
-                               src_x, src_y, src_z,
-                               dst_mt, dst_level,
-                               dst_x, dst_y, dst_z,
-                               src_width, src_height))
-      return;
-
-   /* This is a worst-case scenario software fallback that maps the two
-    * textures and does a memcpy between them.
-    */
-   copy_image_with_memcpy(brw, src_mt, src_level,
-                          src_x, src_y, src_z,
-                          dst_mt, dst_level,
-                          dst_x, dst_y, dst_z,
-                          src_width, src_height);
-}
 
 static void
 intel_copy_image_sub_data(struct gl_context *ctx,
@@ -277,16 +47,6 @@ intel_copy_image_sub_data(struct gl_context *ctx,
    struct intel_mipmap_tree *src_mt, *dst_mt;
    unsigned src_level, dst_level;
 
-   if (brw->gen < 6 &&
-       _mesa_meta_CopyImageSubData_uncompressed(ctx,
-                                                src_image, src_renderbuffer,
-                                                src_x, src_y, src_z,
-                                                dst_image, dst_renderbuffer,
-                                                dst_x, dst_y, dst_z,
-                                                src_width, src_height)) {
-      return;
-   }
-
    if (src_image) {
       src_mt = intel_texture_image(src_image)->mt;
       src_level = src_image->Level + src_image->TexObject->MinLevel;
@@ -320,9 +80,11 @@ intel_copy_image_sub_data(struct gl_context *ctx,
       dst_level = 0;
    }
 
-   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);
+   brw_blorp_copy_miptrees(brw,
+                           src_mt, src_level, src_z,
+                           dst_mt, dst_level, dst_z,
+                           src_x, src_y, dst_x, dst_y,
+                           src_width, src_height);
 
    /* CopyImage only works for equal formats, texture view equivalence
     * classes, and a couple special cases for compressed textures.
@@ -334,9 +96,11 @@ intel_copy_image_sub_data(struct gl_context *ctx,
    assert((src_mt->stencil_mt != NULL) == (dst_mt->stencil_mt != NULL));
 
    if (dst_mt->stencil_mt) {
-      copy_miptrees(brw, src_mt->stencil_mt, src_x, src_y, src_z, src_level,
-                    dst_mt->stencil_mt, dst_x, dst_y, dst_z, dst_level,
-                    src_width, src_height);
+      brw_blorp_copy_miptrees(brw,
+                              src_mt->stencil_mt, src_level, src_z,
+                              dst_mt->stencil_mt, dst_level, dst_z,
+                              src_x, src_y, dst_x, dst_y,
+                              src_width, src_height);
    }
 }
 
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index 66079b5..b329960 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -180,7 +180,6 @@ intelInitExtensions(struct gl_context *ctx)
    ctx->Extensions.ARB_buffer_storage = true;
    ctx->Extensions.ARB_clear_texture = true;
    ctx->Extensions.ARB_clip_control = true;
-   ctx->Extensions.ARB_copy_image = true;
    ctx->Extensions.ARB_depth_buffer_float = true;
    ctx->Extensions.ARB_depth_clamp = true;
    ctx->Extensions.ARB_depth_texture = true;
@@ -301,6 +300,7 @@ intelInitExtensions(struct gl_context *ctx)
       ctx->Extensions.ARB_blend_func_extended =
          !driQueryOptionb(&brw->optionCache, "disable_blend_func_extended");
       ctx->Extensions.ARB_conditional_render_inverted = true;
+      ctx->Extensions.ARB_copy_image = true;
       ctx->Extensions.ARB_cull_distance = true;
       ctx->Extensions.ARB_draw_buffers_blend = true;
       ctx->Extensions.ARB_enhanced_layouts = true;
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list