aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vc4/vc4_drv.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-10-09 20:25:07 -0700
committerEric Anholt <eric@anholt.net>2015-12-07 20:01:56 -0800
commitc826a6e1064419f78855463cf29ce9e8b9d25bf4 (patch)
tree5e14c5eccefaaf37b87684737e852ba87a621d89 /drivers/gpu/drm/vc4/vc4_drv.c
parentdrm: Create a driver hook for allocating GEM object structs. (diff)
downloadlinux-dev-c826a6e1064419f78855463cf29ce9e8b9d25bf4.tar.xz
linux-dev-c826a6e1064419f78855463cf29ce9e8b9d25bf4.zip
drm/vc4: Add a BO cache.
We need to allocate new BOs in the kernel as part of each frame, but the CMA allocator is way too slow for that. As an optimization, keep track of recently-freed BOs and reuse them, with a 1 second timeout to fully free them back to the system. This improves 3D performance by about 15%. Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/vc4/vc4_drv.c')
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 6e730605edcc..da041fac0731 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -92,7 +92,8 @@ static struct drm_driver vc4_drm_driver = {
.debugfs_cleanup = vc4_debugfs_cleanup,
#endif
- .gem_free_object = drm_gem_cma_free_object,
+ .gem_create_object = vc4_create_object,
+ .gem_free_object = vc4_free_object,
.gem_vm_ops = &drm_gem_cma_vm_ops,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
@@ -170,6 +171,8 @@ static int vc4_drm_bind(struct device *dev)
drm_dev_set_unique(drm, dev_name(dev));
+ vc4_bo_cache_init(drm);
+
drm_mode_config_init(drm);
if (ret)
goto unref;
@@ -202,6 +205,7 @@ unbind_all:
component_unbind_all(dev, drm);
unref:
drm_dev_unref(drm);
+ vc4_bo_cache_destroy(drm);
return ret;
}