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);
}
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;
/** 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);
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
* 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) {
* 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);
* \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);
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;
* 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);
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 "
}
drm_intel_bo_subdata(intel_obj->buffer, offset, size, data);
- intel_bufferobj_mark_inactive(intel_obj);
+ mark_buffer_inactive(intel_obj);
}
* 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);
}
drm_intel_bo_get_subdata(intel_obj->buffer, offset, size, data);
- intel_bufferobj_mark_inactive(intel_obj);
+ mark_buffer_inactive(intel_obj);
}
* 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);
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");
} 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);
}
}
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;
* 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);
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);
}
* 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);
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
* 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;
}
* 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);
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;
}