[Mesa-dev] [PATCH 10/17] intel: Make a temporary miptree when doing blit uploads for glTexSubImage().

Eric Anholt eric at anholt.net
Tue May 28 10:15:01 PDT 2013


Ian Romanick <idr at freedesktop.org> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130528/e235ba87/attachment-0001.pgp>


More information about the mesa-dev mailing list