[Mesa-dev] [PATCH 1/2] intel: Avoid double copy with MapBufferRange's explicit flushing case.
Eric Anholt
eric at anholt.net
Mon Oct 29 14:22:38 PDT 2012
Kenneth Graunke <kenneth at whitecape.org> writes:
> When mapping a buffer object with GL_MAP_INVALIDATE_RANGE_BIT and
> GL_MAP_FLUSH_EXPLICIT_BIT and encountering a busy BO, we malloc'd
> a temporary buffer. Then, on FlushMappedBufferRange, we'd allocate
> a second temporary BO, immediately pwrite the data to that (copy #1),
> then use the BLT ring to write it into the original buffer (copy #2).
>
> This is unnecessary. Just use a BO in the first place, like the
> non-explicit-flushing case, and set a flag to control when we should
> do the linear blit.
> @@ -388,27 +384,20 @@ intel_bufferobj_flush_mapped_range(struct gl_context *ctx,
> {
> struct intel_context *intel = intel_context(ctx);
> struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
> - drm_intel_bo *temp_bo;
>
> /* Unless we're in the range map using a temporary system buffer,
> * there's no work to do.
> */
> - if (intel_obj->range_map_buffer == NULL)
> + if (!intel_obj->explicit_flush)
> return;
>
> if (length == 0)
> return;
>
> - temp_bo = drm_intel_bo_alloc(intel->bufmgr, "range map flush", length, 64);
> -
> - drm_intel_bo_subdata(temp_bo, 0, length, intel_obj->range_map_buffer);
> -
> intel_emit_linear_blit(intel,
> intel_obj->buffer, obj->Offset + offset,
> - temp_bo, 0,
> + intel_obj->range_map_bo, 0,
I think that's supposed to be "intel_obj->range_map_bo, offset"
Also wow I think we need more ARB_mbr tests.
> length);
-------------- 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/20121029/857bea9c/attachment.pgp>
More information about the mesa-dev
mailing list