Ian Romanick <[email protected]> writes: > On 05/24/2013 01:56 PM, Eric Anholt wrote: >> - temp_bo = drm_intel_bo_alloc_tiled(intel->bufmgr, >> - "subimage blit bo", >> - width, height, >> - intelImage->mt->cpp, >> - &tiling_mode, >> - &pitch, >> - 0); >> - if (temp_bo == NULL) { >> - _mesa_error(ctx, GL_OUT_OF_MEMORY, "intelTexSubImage"); >> - return false; >> - } >> + struct intel_mipmap_tree *temp_mt = >> + intel_miptree_create(intel, GL_TEXTURE_2D, texImage->TexFormat, >> + 0, 0, >> + width, height, 1, >> + false, 0, >> + (1 << I915_TILING_NONE) /* force_tiling_mask */); > > The old code did error checking. Should we continue to error check > temp_mt and dst (below)?
Fixed both. We generally don't error-check mapping buffers, but given
that you could fail when running out of address space on 32-bit, I added
it here.
>> - if (drm_intel_gem_bo_map_gtt(temp_bo)) {
>> - _mesa_error(ctx, GL_OUT_OF_MEMORY, "intelTexSubImage");
>> - return false;
>> - }
>> -
>> - dstMap = temp_bo->virtual;
>> - dstRowStride = pitch;
>> -
>> - intel_miptree_get_image_offset(intelImage->mt, texImage->Level,
>> - intelImage->base.Base.Face,
>> - &blit_x, &blit_y);
>> - blit_x += xoffset;
>> - blit_y += yoffset;
>> + GLubyte *dst = intel_miptree_map_raw(intel, temp_mt);
>>
>> if (!_mesa_texstore(ctx, 2, texImage->_BaseFormat,
>> texImage->TexFormat,
>> - dstRowStride,
>> - &dstMap,
>> + temp_mt->region->pitch,
>> + &dst,
>> width, height, 1,
>> format, type, pixels, packing)) {
>> _mesa_error(ctx, GL_OUT_OF_MEMORY, "intelTexSubImage");
>
> Since this code doesn't bail (and never has), we blit garbage into the
> texture, right?
Well, your store probably just didn't happen at all.
pgpFRZSVl0EjG.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
