[Mesa-dev] [PATCH 2/2] i965: Use the blitter in intel_bufferobj_subdata for busy BOs on Gen6+.
Eric Anholt
eric at anholt.net
Mon Jul 9 13:03:43 PDT 2012
Kenneth Graunke <kenneth at whitecape.org> writes:
> Previously we only did this pre-Gen6, and used pwrite on Gen6+.
> In one workload, this cuts significant amount of overhead.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/mesa/drivers/dri/intel/intel_buffer_objects.c | 26 +++++++++------------
> 1 file changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
> index 200fce3..169d777 100644
> --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
> +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
> @@ -178,26 +178,22 @@ intel_bufferobj_subdata(struct gl_context * ctx,
> drm_intel_bo_unreference(intel_obj->buffer);
> intel_bufferobj_alloc_buffer(intel, intel_obj);
> drm_intel_bo_subdata(intel_obj->buffer, 0, size, data);
> - } else if (intel->gen < 6) {
> - if (busy) {
> - drm_intel_bo *temp_bo;
> + } else if (busy) {
> + drm_intel_bo *temp_bo;
>
> - temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64);
> + temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64);
>
> - drm_intel_bo_subdata(temp_bo, 0, size, data);
> + drm_intel_bo_subdata(temp_bo, 0, size, data);
>
> - intel_emit_linear_blit(intel,
> - intel_obj->buffer, offset,
> - temp_bo, 0,
> - size);
> + intel_emit_linear_blit(intel,
> + intel_obj->buffer, offset,
> + temp_bo, 0,
> + size);
>
> - drm_intel_bo_unreference(temp_bo);
> - } else {
> - drm_intel_bo_subdata(intel_obj->buffer, offset, size, data);
> - }
> + drm_intel_bo_unreference(temp_bo);
> } else {
> - /* Can't use the blit to modify the buffer in the middle of batch. */
> - if (drm_intel_bo_references(intel->batch.bo, intel_obj->buffer)) {
> + if (intel->gen >= 6 &&
> + drm_intel_bo_references(intel->batch.bo, intel_obj->buffer)) {
> intel_batchbuffer_flush(intel);
> }
I don't think we need any bo_references check for flushing in this path
any more, since bo_references implies the "if (busy)" path being taken.
The function might be rewritten in fewer lines of change to be:
if (busy) {
if (size == obj->size) {
realloc, subdata
} else {
blit
}
} else {
subdata
}
-------------- 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/20120709/a4e74f61/attachment.pgp>
More information about the mesa-dev
mailing list