diff options
author | Eric Anholt <[email protected]> | 2011-09-21 09:32:57 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-09-22 11:03:20 -0700 |
commit | 0ba23909475c085d81a5b181744c167ccbe53482 (patch) | |
tree | b58392fe4fb0cedc7e69ef207486d74b987d0341 /src/mesa | |
parent | d58a3182b1e680105731897fe2d84928daf89fce (diff) |
intel: Move more of the PBO blit upload logic into that function.
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.
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_image.c | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 6db27bca851..9a1249548d7 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -156,26 +156,43 @@ 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); GLuint src_offset, src_stride; GLuint dst_x, dst_y, dst_stride; - drm_intel_bo *dst_buffer = intel_region_buffer(intel, - intelImage->mt->region, - INTEL_WRITE_FULL); + drm_intel_bo *dst_buffer, *src_buffer; + + if (!_mesa_is_bufferobj(unpack->BufferObj)) + return false; + + DBG("trying pbo upload\n"); - if (!_mesa_is_bufferobj(unpack->BufferObj) || - intel->ctx._ImageTransferState || + 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; + } + + dst_buffer = intel_region_buffer(intel, intelImage->mt->region, INTEL_WRITE_FULL); /* note: potential 64-bit ptr to 32-bit int cast */ src_offset = (GLuint) (unsigned long) pixels; @@ -206,11 +223,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 +417,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 |