i965: Use blorp instead of meta for PBO texture uploads
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 6 Jun 2017 16:58:07 +0000 (09:58 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 13 Oct 2017 02:58:40 +0000 (19:58 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/intel_tex_image.c

index 69860e28e3b6d124f72d0ab322cc644af139704e..9ae27c70280e82e9338f8d10364e340be91d943b 100644 (file)
@@ -26,6 +26,7 @@
 #include "intel_image.h"
 #include "intel_tiled_memcpy.h"
 #include "brw_context.h"
+#include "brw_blorp.h"
 
 #define FILE_DEBUG_FLAG DEBUG_TEXTURE
 
@@ -127,6 +128,28 @@ intel_miptree_create_for_teximage(struct brw_context *brw,
                                flags);
 }
 
+static bool
+intel_texsubimage_blorp(struct brw_context *brw, GLuint dims,
+                        struct gl_texture_image *tex_image,
+                        unsigned x, unsigned y, unsigned z,
+                        unsigned width, unsigned height, unsigned depth,
+                        GLenum format, GLenum type, const void *pixels,
+                        const struct gl_pixelstore_attrib *packing)
+{
+   struct intel_texture_image *intel_image = intel_texture_image(tex_image);
+   const unsigned mt_level = tex_image->Level + tex_image->TexObject->MinLevel;
+   const unsigned mt_z = tex_image->TexObject->MinLayer + tex_image->Face + z;
+
+   /* The blorp path can't understand crazy format hackery */
+   if (_mesa_base_tex_format(&brw->ctx, tex_image->InternalFormat) !=
+       _mesa_get_format_base_format(tex_image->TexFormat))
+      return false;
+
+   return brw_blorp_upload_miptree(brw, intel_image->mt, tex_image->TexFormat,
+                                   mt_level, x, y, mt_z, width, height, depth,
+                                   tex_image->TexObject->Target, format, type,
+                                   pixels, packing);
+}
 
 /**
  * \brief A fast path for glTexImage and glTexSubImage.
@@ -293,6 +316,7 @@ intel_upload_tex(struct gl_context * ctx,
                  const GLvoid * pixels,
                  const struct gl_pixelstore_attrib *packing)
 {
+   struct brw_context *brw = brw_context(ctx);
    struct intel_mipmap_tree *mt = intel_texture_image(texImage)->mt;
    bool ok;
 
@@ -305,12 +329,14 @@ intel_upload_tex(struct gl_context * ctx,
    if (mt && mt->format == MESA_FORMAT_S_UINT8)
       mt->r8stencil_needs_update = true;
 
-   ok = _mesa_meta_pbo_TexSubImage(ctx, dims, texImage,
+   if (_mesa_is_bufferobj(packing->BufferObj) || tex_busy) {
+      ok = intel_texsubimage_blorp(brw, dims, texImage,
                                    xoffset, yoffset, zoffset,
                                    width, height, depth, format, type,
-                                   pixels, tex_busy, packing);
-   if (ok)
-      return;
+                                   pixels, packing);
+      if (ok)
+         return;
+   }
 
    ok = intel_texsubimage_tiled_memcpy(ctx, dims, texImage,
                                        xoffset, yoffset, zoffset,