This also improves the debugging output in the failure paths so you get more than just "failed", and don't get spammed with "failed" when you didn't even have a PBO to try. --- src/mesa/drivers/dri/intel/intel_tex_image.c | 54 +++++++++++++++----------- 1 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 6db27bc..18fccba 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -156,10 +156,11 @@ check_pbo_format(GLint internalFormat, /* XXX: Do this for TexSubImage also: */ -static GLboolean +static bool try_pbo_upload(struct intel_context *intel, struct intel_texture_image *intelImage, const struct gl_pixelstore_attrib *unpack, + GLenum format, GLenum type, GLint width, GLint height, const void *pixels) { struct intel_buffer_object *pbo = intel_buffer_object(unpack->BufferObj); @@ -169,11 +170,28 @@ try_pbo_upload(struct intel_context *intel, intelImage->mt->region, INTEL_WRITE_FULL); - if (!_mesa_is_bufferobj(unpack->BufferObj) || - intel->ctx._ImageTransferState || + if (!_mesa_is_bufferobj(unpack->BufferObj)) + return false; + + DBG("trying pbo upload\n"); + + if (!intelImage->mt) { + DBG("%s: no miptree\n", __FUNCTION__); + return false; + } + + if (intel->ctx._ImageTransferState || unpack->SkipPixels || unpack->SkipRows) { - DBG("%s: failure 1\n", __FUNCTION__); - return GL_FALSE; + DBG("%s: image transfer\n", __FUNCTION__); + return false; + } + + if (!check_pbo_format(intelImage->base.Base.InternalFormat, format, + type, intelImage->base.Base.TexFormat)) { + DBG("%s: format mismatch (upload to %s with format 0x%x, type 0x%x)\n", + __FUNCTION__, _mesa_get_format_name(intelImage->base.Base.TexFormat), + format, type); + return false; } /* note: potential 64-bit ptr to 32-bit int cast */ @@ -206,11 +224,13 @@ try_pbo_upload(struct intel_context *intel, intelImage->mt->region->tiling, 0, 0, dst_x, dst_y, width, height, GL_COPY)) { - return GL_FALSE; + DBG("%s: blit failed\n", __FUNCTION__); + return false; } } - return GL_TRUE; + DBG("%s: success\n", __FUNCTION__); + return true; } /** @@ -398,24 +418,12 @@ intelTexImage(struct gl_context * ctx, } } - /* PBO fastpaths: + /* Attempt to use the blitter for PBO image uploads. */ if (dims <= 2 && - intelImage->mt && - _mesa_is_bufferobj(unpack->BufferObj) && - check_pbo_format(internalFormat, format, - type, intelImage->base.Base.TexFormat)) { - - DBG("trying pbo upload\n"); - - /* Otherwise, attempt to use the blitter for PBO image uploads. - */ - if (try_pbo_upload(intel, intelImage, unpack, width, height, pixels)) { - DBG("pbo upload succeeded\n"); - return; - } - - DBG("pbo upload failed\n"); + try_pbo_upload(intel, intelImage, unpack, format, type, + width, height, pixels)) { + return; } /* intelCopyTexImage calls this function with pixels == NULL, with -- 1.7.5.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev