Kenneth Graunke <kenn...@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 <kenn...@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
}

Attachment: pgpcA5dxaEF1e.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to