summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/radeon
diff options
context:
space:
mode:
authorGrigori Goronzy <[email protected]>2015-06-24 03:38:02 +0200
committerGrigori Goronzy <[email protected]>2015-06-24 14:33:14 +0200
commit29aaab2b5f55cc6d9a84f58ce2bb8607e76a9dde (patch)
tree6e35ff29374730a54f3a56a9c186cfa443e9804f /src/gallium/winsys/radeon
parent32a220f1f60980de50ecefb3b9ab1f754ade8c83 (diff)
winsys/radeon: align BO size to page size
This is the basic granularity for BO allocations. The alignment also helps with BO reuse by the cached bufmgr. This results in a huge 45% speedup in Metro 2033 Redux on my test system. The game relies on buffer orphaning with very small buffers (hundreds of bytes in size) and that did not work efficiently before. This change may also affect other applications and games. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/winsys/radeon')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_bo.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 78c95b15eb2..1f0caf60197 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -840,6 +840,12 @@ radeon_winsys_bo_create(struct radeon_winsys *rws,
memset(&desc, 0, sizeof(desc));
desc.base.alignment = alignment;
+ /* Align size to page size. This is the minimum alignment for normal
+ * BOs. Aligning this here helps the cached bufmgr. Especially small BOs,
+ * like constant/uniform buffers, can benefit from better and more reuse.
+ */
+ size = align(size, 4096);
+
/* Only set one usage bit each for domains and flags, or the cache manager
* might consider different sets of domains / flags compatible
*/