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 <airlied@redhat.com>
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
*/
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;
}
#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;
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);