[Mesa-dev] [PATCH 07/17] mesa: add & use a new driver flag for UBO updates instead of _NEW_BUFFER_OBJECT

Marek Olšák maraeo at gmail.com
Tue May 7 16:42:18 PDT 2013


On Thu, May 2, 2013 at 8:12 PM, Eric Anholt <eric at anholt.net> wrote:
> Marek Olšák <maraeo at gmail.com> writes:
>> diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
>> index 996518b..f941c56 100644
>> --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
>> +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
>> @@ -39,6 +39,10 @@
>>  #include "intel_mipmap_tree.h"
>>  #include "intel_regions.h"
>>
>> +#ifndef I915
>> +#include "brw_context.h"
>> +#endif
>> +
>>  static GLboolean
>>  intel_bufferobj_unmap(struct gl_context * ctx, struct gl_buffer_object *obj);
>>
>> @@ -160,6 +164,14 @@ intel_bufferobj_data(struct gl_context * ctx,
>>        drm_intel_bo_subdata(intel_obj->buffer, 0, size, data);
>>     }
>>
>> +#ifndef I915
>> +   /* BufferData may change a uniform buffer, need to update it */
>> +   {
>> +      struct brw_context *brw = brw_context(ctx);
>> +      brw->state.dirty.brw |= BRW_NEW_UNIFORM_BUFFER;
>> +   }
>> +#endif
>> +
>>     return true;
>>  }
>
> There are also cases where the BO get replaced in subdata, and in
> map_range with INVALIDATE_BUFFER.  If those get fixed by moving this
> block into intel_bufferobj_alloc_buffer(), then this (and patch 2-6)
> are:
>
> Reviewed-by: Eric Anholt <eric at anholt.net>
>
>> diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
>> index 8ff32c8..d166fe6 100644
>> --- a/src/mesa/state_tracker/st_cb_bufferobjects.c
>> +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
>> @@ -247,9 +247,11 @@ st_bufferobj_data(struct gl_context *ctx,
>>
>>        if (data)
>>           pipe_buffer_write(pipe, st_obj->buffer, 0, size, data);
>> -      return GL_TRUE;
>>     }
>>
>> +   /* BufferData may change a uniform buffer, need to update it */
>> +   st->dirty.st |= ST_NEW_UNIFORM_BUFFER;
>> +
>>     return GL_TRUE;
>>  }
>
> Do you need to also flag in the case where you've
> PIPE_TRANSFER_DISCARD_BUFFER mapped the BO?  I don't know how exactly
> this state gets used, just a possible issue.

No, gallium drivers are responsible for flagging their own internal
states if they decide to discard the buffer.

Marek


More information about the mesa-dev mailing list