summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-05-11 13:14:16 +1000
committerDave Airlie <[email protected]>2011-05-13 09:22:39 +1000
commit5e15497452cf3e4d2fc76fdc6ed8113d0891b467 (patch)
treeaa00f39af35369ca53a87e43ece52650904304a1 /src
parent5de2c67ba7d62882fe2c5e2a307e58f4f637fadd (diff)
r600g: delay mapping until first map request. (v2)
Currently r600g always maps every bo, this is quite pointless as it wastes VM and on 32-bit with wine running VM space is quite useful. So with this patch we don't create the mappings until first use, without tiling enabled this probably won't make a major difference on its own, but with tiled staged uploads it should avoid keeping maps for most of the textures unnecessarily. v2: add bo data ptr check Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/winsys/r600/drm/r600_priv.h3
-rw-r--r--src/gallium/winsys/r600/drm/radeon_bo.c7
2 files changed, 4 insertions, 6 deletions
diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h
index f8363f9272b..2ca122ac59a 100644
--- a/src/gallium/winsys/r600/drm/r600_priv.h
+++ b/src/gallium/winsys/r600/drm/r600_priv.h
@@ -145,6 +145,7 @@ int radeon_bo_get_tiling_flags(struct radeon *radeon,
int radeon_bo_get_name(struct radeon *radeon,
struct radeon_bo *bo,
uint32_t *name);
+int radeon_bo_fixed_map(struct radeon *radeon, struct radeon_bo *bo);
/*
* r600_hw_context.c
@@ -192,6 +193,8 @@ struct r600_bo *r600_bomgr_bo_create(struct r600_bomgr *mgr,
*/
static inline int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo)
{
+ if (bo->map_count == 0 && !bo->data)
+ return radeon_bo_fixed_map(radeon, bo);
bo->map_count++;
return 0;
}
diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c
index 13b1d50b6e5..9a534dddf32 100644
--- a/src/gallium/winsys/r600/drm/radeon_bo.c
+++ b/src/gallium/winsys/r600/drm/radeon_bo.c
@@ -33,7 +33,7 @@
#include "xf86drm.h"
#include "radeon_drm.h"
-static int radeon_bo_fixed_map(struct radeon *radeon, struct radeon_bo *bo)
+int radeon_bo_fixed_map(struct radeon *radeon, struct radeon_bo *bo)
{
struct drm_radeon_gem_mmap args;
void *ptr;
@@ -127,11 +127,6 @@ struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle,
return NULL;
}
}
- if (radeon_bo_fixed_map(radeon, bo)) {
- R600_ERR("failed to map bo\n");
- radeon_bo_reference(radeon, &bo, NULL);
- return bo;
- }
if (handle)
util_hash_table_set(radeon->bo_handles, (void *)(uintptr_t)handle, bo);