intel: Map write-only buffer objects through the GTT when possible.
This looks to be a win of a few percent in cairogears with new vbo code,
thanks to not polluting caches.
(cherry picked from commit aa422b2625)
This commit is contained in:
@@ -205,6 +205,7 @@ intel_bufferobj_map(GLcontext * ctx,
|
||||
struct intel_context *intel = intel_context(ctx);
|
||||
struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
|
||||
GLboolean read_only = (access == GL_READ_ONLY_ARB);
|
||||
GLboolean write_only = (access == GL_WRITE_ONLY_ARB);
|
||||
|
||||
assert(intel_obj);
|
||||
|
||||
@@ -216,7 +217,14 @@ intel_bufferobj_map(GLcontext * ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dri_bo_map(intel_obj->buffer, !read_only);
|
||||
if (write_only && intel->intelScreen->kernel_exec_fencing) {
|
||||
drm_intel_gem_bo_map_gtt(intel_obj->buffer);
|
||||
intel_obj->mapped_gtt = GL_TRUE;
|
||||
} else {
|
||||
drm_intel_bo_map(intel_obj->buffer, !read_only);
|
||||
intel_obj->mapped_gtt = GL_FALSE;
|
||||
}
|
||||
|
||||
obj->Pointer = intel_obj->buffer->virtual;
|
||||
return obj->Pointer;
|
||||
}
|
||||
@@ -234,7 +242,11 @@ intel_bufferobj_unmap(GLcontext * ctx,
|
||||
assert(intel_obj);
|
||||
if (intel_obj->buffer != NULL) {
|
||||
assert(obj->Pointer);
|
||||
dri_bo_unmap(intel_obj->buffer);
|
||||
if (intel_obj->mapped_gtt) {
|
||||
drm_intel_gem_bo_unmap_gtt(intel_obj->buffer);
|
||||
} else {
|
||||
drm_intel_bo_unmap(intel_obj->buffer);
|
||||
}
|
||||
obj->Pointer = NULL;
|
||||
}
|
||||
return GL_TRUE;
|
||||
|
||||
@@ -46,6 +46,7 @@ struct intel_buffer_object
|
||||
struct intel_region *region; /* Is there a zero-copy texture
|
||||
associated with this (pixel)
|
||||
buffer object? */
|
||||
GLboolean mapped_gtt;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user