This lets us avoid allocing new buffers for renderbuffers, finalized miptrees,
and PBO-uploaded textures when there's an unreferenced but still active one
cached, while also avoiding CPU waits for batchbuffers and CPU-uploaded
textures. The size of BOs allocated for a desktop running current GL
cairogears on i915 is cut in half with this.
Note that this means we require libdrm 2.4.5.
DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width,
height, pitch);
DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width,
height, pitch);
- irb->region = intel_region_alloc(intel, cpp, width, height, pitch);
+ irb->region = intel_region_alloc(intel, cpp, width, height, pitch,
+ GL_TRUE);
if (!irb->region)
return GL_FALSE; /* out of memory? */
if (!irb->region)
return GL_FALSE; /* out of memory? */
GLuint last_level,
GLuint width0,
GLuint height0,
GLuint last_level,
GLuint width0,
GLuint height0,
- GLuint depth0, GLuint cpp, GLuint compress_byte)
+ GLuint depth0, GLuint cpp, GLuint compress_byte,
+ GLboolean expect_accelerated_upload)
{
struct intel_mipmap_tree *mt;
{
struct intel_mipmap_tree *mt;
mt->cpp,
mt->pitch,
mt->total_height,
mt->cpp,
mt->pitch,
mt->total_height,
+ mt->pitch,
+ expect_accelerated_upload);
if (!mt->region) {
free(mt);
if (!mt->region) {
free(mt);
GLuint height0,
GLuint depth0,
GLuint cpp,
GLuint height0,
GLuint depth0,
GLuint cpp,
+ GLuint compress_byte,
+ GLboolean expect_accelerated_upload);
struct intel_mipmap_tree *
intel_miptree_create_for_region(struct intel_context *intel,
struct intel_mipmap_tree *
intel_miptree_create_for_region(struct intel_context *intel,
struct intel_region *
intel_region_alloc(struct intel_context *intel,
struct intel_region *
intel_region_alloc(struct intel_context *intel,
- GLuint cpp, GLuint width, GLuint height, GLuint pitch)
+ GLuint cpp, GLuint width, GLuint height, GLuint pitch,
+ GLboolean expect_accelerated_upload)
- buffer = dri_bo_alloc(intel->bufmgr, "region",
- pitch * cpp * height, 64);
+ if (expect_accelerated_upload) {
+ buffer = drm_intel_bo_alloc_for_render(intel->bufmgr, "region",
+ pitch * cpp * height, 64);
+ } else {
+ buffer = drm_intel_bo_alloc(intel->bufmgr, "region",
+ pitch * cpp * height, 64);
+ }
return intel_region_alloc_internal(intel, cpp, width, height, pitch, buffer);
}
return intel_region_alloc_internal(intel, cpp, width, height, pitch, buffer);
}
*/
struct intel_region *intel_region_alloc(struct intel_context *intel,
GLuint cpp, GLuint width,
*/
struct intel_region *intel_region_alloc(struct intel_context *intel,
GLuint cpp, GLuint width,
- GLuint height, GLuint pitch);
+ GLuint height, GLuint pitch,
+ GLboolean expect_accelerated_upload);
struct intel_region *
intel_region_alloc_for_handle(struct intel_context *intel,
struct intel_region *
intel_region_alloc_for_handle(struct intel_context *intel,
static void
guess_and_alloc_mipmap_tree(struct intel_context *intel,
struct intel_texture_object *intelObj,
static void
guess_and_alloc_mipmap_tree(struct intel_context *intel,
struct intel_texture_object *intelObj,
- struct intel_texture_image *intelImage)
+ struct intel_texture_image *intelImage,
+ GLboolean expect_accelerated_upload)
{
GLuint firstLevel;
GLuint lastLevel;
{
GLuint firstLevel;
GLuint lastLevel;
height,
depth,
intelImage->base.TexFormat->TexelBytes,
height,
depth,
intelImage->base.TexFormat->TexelBytes,
+ comp_byte,
+ expect_accelerated_upload);
DBG("%s - success\n", __FUNCTION__);
}
DBG("%s - success\n", __FUNCTION__);
}
- guess_and_alloc_mipmap_tree(intel, intelObj, intelImage);
+ guess_and_alloc_mipmap_tree(intel, intelObj, intelImage, pixels == NULL);
if (!intelObj->mt) {
DBG("guess_and_alloc_mipmap_tree: failed\n");
}
if (!intelObj->mt) {
DBG("guess_and_alloc_mipmap_tree: failed\n");
}
level, level,
width, height, depth,
intelImage->base.TexFormat->TexelBytes,
level, level,
width, height, depth,
intelImage->base.TexFormat->TexelBytes,
+ comp_byte, pixels == NULL);
firstImage->base.Height,
firstImage->base.Depth,
cpp,
firstImage->base.Height,
firstImage->base.Depth,
cpp,
}
/* Pull in any images not in the object's tree:
}
/* Pull in any images not in the object's tree: