diff options
author | Kenneth Graunke <[email protected]> | 2014-10-28 01:05:12 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-10-29 12:38:28 -0700 |
commit | 1480814173f940a1a24c7242e31662e73efb064f (patch) | |
tree | e50eec9a39a090ab3d4ecf5f25f209b109690080 /src/mesa | |
parent | 993e2922c922f88a2eeed4f30751f3e3ad63aed0 (diff) |
i965: Rename intel_bufferobj_* functions to match GL and DD hooks.
The GL functions and driver hooks use corresponding names---for example,
glMapBufferRange and Driver.MapBufferRange. But our implementation was
called "intel_bufferobj_map_range," which has the words "map" and
"buffer" swapped, as well as randomly adding "obj."
FlushMappedBufferRange was even trickier: it ordered the words
3, "obj", 1, 2, 4: intel_bufferobj_flush_mapped_range.
Even though the old names were consistent, I always had trouble
rearranging the jumble of words when searching for a function,
and it took a few tries to eventually land there.
The new names match the word order of GL and the driver hooks;
FlushMappedBufferRange is simply brw_flush_mapped_buffer_range.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_buffer_objects.c | 129 |
1 files changed, 64 insertions, 65 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c b/src/mesa/drivers/dri/i965/intel_buffer_objects.c index a7242b0ee64..f2d2bcbe996 100644 --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c @@ -81,12 +81,8 @@ brw_bo_map_gtt(struct brw_context *brw, drm_intel_bo *bo, const char *bo_name) return ret; } -static GLboolean -intel_bufferobj_unmap(struct gl_context * ctx, struct gl_buffer_object *obj, - gl_map_buffer_index index); - static void -intel_bufferobj_mark_gpu_usage(struct intel_buffer_object *intel_obj, +mark_buffer_gpu_usage(struct intel_buffer_object *intel_obj, uint32_t offset, uint32_t size) { intel_obj->gpu_active_start = MIN2(intel_obj->gpu_active_start, offset); @@ -94,7 +90,7 @@ intel_bufferobj_mark_gpu_usage(struct intel_buffer_object *intel_obj, } static void -intel_bufferobj_mark_inactive(struct intel_buffer_object *intel_obj) +mark_buffer_inactive(struct intel_buffer_object *intel_obj) { intel_obj->gpu_active_start = ~0; intel_obj->gpu_active_end = 0; @@ -102,8 +98,8 @@ intel_bufferobj_mark_inactive(struct intel_buffer_object *intel_obj) /** Allocates a new drm_intel_bo to store the data for the buffer object. */ static void -intel_bufferobj_alloc_buffer(struct brw_context *brw, - struct intel_buffer_object *intel_obj) +alloc_buffer_object(struct brw_context *brw, + struct intel_buffer_object *intel_obj) { intel_obj->buffer = drm_intel_bo_alloc(brw->bufmgr, "bufferobj", intel_obj->Base.Size, 64); @@ -117,7 +113,7 @@ intel_bufferobj_alloc_buffer(struct brw_context *brw, if (intel_obj->Base.UsageHistory & USAGE_ATOMIC_COUNTER_BUFFER) brw->state.dirty.brw |= BRW_NEW_ATOMIC_BUFFER; - intel_bufferobj_mark_inactive(intel_obj); + mark_buffer_inactive(intel_obj); } static void @@ -138,7 +134,7 @@ release_buffer(struct intel_buffer_object *intel_obj) * internal structure where somehow shared. */ static struct gl_buffer_object * -intel_bufferobj_alloc(struct gl_context * ctx, GLuint name) +brw_new_buffer_object(struct gl_context * ctx, GLuint name) { struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object); if (!obj) { @@ -158,7 +154,7 @@ intel_bufferobj_alloc(struct gl_context * ctx, GLuint name) * Deletes a single OpenGL buffer object. Used by glDeleteBuffers(). */ static void -intel_bufferobj_free(struct gl_context * ctx, struct gl_buffer_object *obj) +brw_delete_buffer(struct gl_context * ctx, struct gl_buffer_object *obj) { struct intel_buffer_object *intel_obj = intel_buffer_object(obj); @@ -186,13 +182,13 @@ intel_bufferobj_free(struct gl_context * ctx, struct gl_buffer_object *obj) * \return true for success, false if out of memory */ static GLboolean -intel_bufferobj_data(struct gl_context * ctx, - GLenum target, - GLsizeiptrARB size, - const GLvoid * data, - GLenum usage, - GLbitfield storageFlags, - struct gl_buffer_object *obj) +brw_buffer_data(struct gl_context *ctx, + GLenum target, + GLsizeiptrARB size, + const GLvoid *data, + GLenum usage, + GLbitfield storageFlags, + struct gl_buffer_object *obj) { struct brw_context *brw = brw_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); @@ -212,7 +208,7 @@ intel_bufferobj_data(struct gl_context * ctx, release_buffer(intel_obj); if (size != 0) { - intel_bufferobj_alloc_buffer(brw, intel_obj); + alloc_buffer_object(brw, intel_obj); if (!intel_obj->buffer) return false; @@ -234,10 +230,11 @@ intel_bufferobj_data(struct gl_context * ctx, * the buffer or if data is NULL, no copy is performed. */ static void -intel_bufferobj_subdata(struct gl_context * ctx, - GLintptrARB offset, - GLsizeiptrARB size, - const GLvoid * data, struct gl_buffer_object *obj) +brw_buffer_subdata(struct gl_context *ctx, + GLintptrARB offset, + GLsizeiptrARB size, + const GLvoid *data, + struct gl_buffer_object *obj) { struct brw_context *brw = brw_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); @@ -278,7 +275,7 @@ intel_bufferobj_subdata(struct gl_context * ctx, if (size == intel_obj->Base.Size) { /* Replace the current busy bo so the subdata doesn't stall. */ drm_intel_bo_unreference(intel_obj->buffer); - intel_bufferobj_alloc_buffer(brw, intel_obj); + alloc_buffer_object(brw, intel_obj); } else if (!intel_obj->prefer_stall_to_blit) { perf_debug("Using a blit copy to avoid stalling on " "glBufferSubData(%ld, %ld) (%ldkb) to a busy " @@ -310,7 +307,7 @@ intel_bufferobj_subdata(struct gl_context * ctx, } drm_intel_bo_subdata(intel_obj->buffer, offset, size, data); - intel_bufferobj_mark_inactive(intel_obj); + mark_buffer_inactive(intel_obj); } @@ -321,10 +318,11 @@ intel_bufferobj_subdata(struct gl_context * ctx, * object into user memory. */ static void -intel_bufferobj_get_subdata(struct gl_context * ctx, - GLintptrARB offset, - GLsizeiptrARB size, - GLvoid * data, struct gl_buffer_object *obj) +brw_get_buffer_subdata(struct gl_context *ctx, + GLintptrARB offset, + GLsizeiptrARB size, + GLvoid *data, + struct gl_buffer_object *obj) { struct intel_buffer_object *intel_obj = intel_buffer_object(obj); struct brw_context *brw = brw_context(ctx); @@ -335,7 +333,7 @@ intel_bufferobj_get_subdata(struct gl_context * ctx, } drm_intel_bo_get_subdata(intel_obj->buffer, offset, size, data); - intel_bufferobj_mark_inactive(intel_obj); + mark_buffer_inactive(intel_obj); } @@ -358,10 +356,10 @@ intel_bufferobj_get_subdata(struct gl_context * ctx, * and blit it into the real BO at unmap time. */ static void * -intel_bufferobj_map_range(struct gl_context * ctx, - GLintptr offset, GLsizeiptr length, - GLbitfield access, struct gl_buffer_object *obj, - gl_map_buffer_index index) +brw_map_buffer_range(struct gl_context *ctx, + GLintptr offset, GLsizeiptr length, + GLbitfield access, struct gl_buffer_object *obj, + gl_map_buffer_index index) { struct brw_context *brw = brw_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); @@ -392,7 +390,7 @@ intel_bufferobj_map_range(struct gl_context * ctx, if (drm_intel_bo_references(brw->batch.bo, intel_obj->buffer)) { if (access & GL_MAP_INVALIDATE_BUFFER_BIT) { drm_intel_bo_unreference(intel_obj->buffer); - intel_bufferobj_alloc_buffer(brw, intel_obj); + alloc_buffer_object(brw, intel_obj); } else { perf_debug("Stalling on the GPU for mapping a busy buffer " "object\n"); @@ -401,7 +399,7 @@ intel_bufferobj_map_range(struct gl_context * ctx, } else if (drm_intel_bo_busy(intel_obj->buffer) && (access & GL_MAP_INVALIDATE_BUFFER_BIT)) { drm_intel_bo_unreference(intel_obj->buffer); - intel_bufferobj_alloc_buffer(brw, intel_obj); + alloc_buffer_object(brw, intel_obj); } } @@ -444,11 +442,11 @@ intel_bufferobj_map_range(struct gl_context * ctx, else if (!brw->has_llc && (!(access & GL_MAP_READ_BIT) || (access & GL_MAP_PERSISTENT_BIT))) { drm_intel_gem_bo_map_gtt(intel_obj->buffer); - intel_bufferobj_mark_inactive(intel_obj); + mark_buffer_inactive(intel_obj); } else { brw_bo_map(brw, intel_obj->buffer, (access & GL_MAP_WRITE_BIT) != 0, "MapBufferRange"); - intel_bufferobj_mark_inactive(intel_obj); + mark_buffer_inactive(intel_obj); } obj->Mappings[index].Pointer = intel_obj->buffer->virtual + offset; @@ -469,10 +467,10 @@ intel_bufferobj_map_range(struct gl_context * ctx, * would defeat the point. */ static void -intel_bufferobj_flush_mapped_range(struct gl_context *ctx, - GLintptr offset, GLsizeiptr length, - struct gl_buffer_object *obj, - gl_map_buffer_index index) +brw_flush_mapped_buffer_range(struct gl_context *ctx, + GLintptr offset, GLsizeiptr length, + struct gl_buffer_object *obj, + gl_map_buffer_index index) { struct brw_context *brw = brw_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); @@ -517,9 +515,9 @@ intel_bufferobj_flush_mapped_range(struct gl_context *ctx, intel_obj->range_map_bo[index], intel_obj->map_extra[index] + offset, length); - intel_bufferobj_mark_gpu_usage(intel_obj, - obj->Mappings[index].Offset + offset, - length); + mark_buffer_gpu_usage(intel_obj, + obj->Mappings[index].Offset + offset, + length); } @@ -529,8 +527,9 @@ intel_bufferobj_flush_mapped_range(struct gl_context *ctx, * Implements glUnmapBuffer(). */ static GLboolean -intel_bufferobj_unmap(struct gl_context * ctx, struct gl_buffer_object *obj, - gl_map_buffer_index index) +brw_unmap_buffer(struct gl_context *ctx, + struct gl_buffer_object *obj, + gl_map_buffer_index index) { struct brw_context *brw = brw_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); @@ -546,8 +545,8 @@ intel_bufferobj_unmap(struct gl_context * ctx, struct gl_buffer_object *obj, intel_obj->range_map_bo[index], intel_obj->map_extra[index], obj->Mappings[index].Length); - intel_bufferobj_mark_gpu_usage(intel_obj, obj->Mappings[index].Offset, - obj->Mappings[index].Length); + mark_buffer_gpu_usage(intel_obj, obj->Mappings[index].Offset, + obj->Mappings[index].Length); } /* Since we've emitted some blits to buffers that will (likely) be used @@ -586,9 +585,9 @@ intel_bufferobj_buffer(struct brw_context *brw, * draw-time validation can just always get a BO from a GL buffer object. */ if (intel_obj->buffer == NULL) - intel_bufferobj_alloc_buffer(brw, intel_obj); + alloc_buffer_object(brw, intel_obj); - intel_bufferobj_mark_gpu_usage(intel_obj, offset, size); + mark_buffer_gpu_usage(intel_obj, offset, size); return intel_obj->buffer; } @@ -601,11 +600,11 @@ intel_bufferobj_buffer(struct brw_context *brw, * are allowed. */ static void -intel_bufferobj_copy_subdata(struct gl_context *ctx, - struct gl_buffer_object *src, - struct gl_buffer_object *dst, - GLintptr read_offset, GLintptr write_offset, - GLsizeiptr size) +brw_copy_buffer_subdata(struct gl_context *ctx, + struct gl_buffer_object *src, + struct gl_buffer_object *dst, + GLintptr read_offset, GLintptr write_offset, + GLsizeiptr size) { struct brw_context *brw = brw_context(ctx); struct intel_buffer_object *intel_src = intel_buffer_object(src); @@ -633,13 +632,13 @@ intel_bufferobj_copy_subdata(struct gl_context *ctx, void intelInitBufferObjectFuncs(struct dd_function_table *functions) { - functions->NewBufferObject = intel_bufferobj_alloc; - functions->DeleteBuffer = intel_bufferobj_free; - functions->BufferData = intel_bufferobj_data; - functions->BufferSubData = intel_bufferobj_subdata; - functions->GetBufferSubData = intel_bufferobj_get_subdata; - functions->MapBufferRange = intel_bufferobj_map_range; - functions->FlushMappedBufferRange = intel_bufferobj_flush_mapped_range; - functions->UnmapBuffer = intel_bufferobj_unmap; - functions->CopyBufferSubData = intel_bufferobj_copy_subdata; + functions->NewBufferObject = brw_new_buffer_object; + functions->DeleteBuffer = brw_delete_buffer; + functions->BufferData = brw_buffer_data; + functions->BufferSubData = brw_buffer_subdata; + functions->GetBufferSubData = brw_get_buffer_subdata; + functions->MapBufferRange = brw_map_buffer_range; + functions->FlushMappedBufferRange = brw_flush_mapped_buffer_range; + functions->UnmapBuffer = brw_unmap_buffer; + functions->CopyBufferSubData = brw_copy_buffer_subdata; } |