From: Jason Ekstrand Date: Tue, 6 Jun 2017 16:58:07 +0000 (-0700) Subject: i965: Use blorp instead of meta for PBO texture uploads X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dffda6cbbbc1a8c2f7125db1b9cf15fbcdc8eb11;p=mesa.git i965: Use blorp instead of meta for PBO texture uploads Reviewed-by: Topi Pohjolainen Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c index 69860e28e3b..9ae27c70280 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_image.c +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c @@ -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,