From 63b9790a55038c262b57c846a5f7067ea33fc60f Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 11 Jan 2011 14:29:33 -0500 Subject: r600g: move user fence into base radeon structure This avoid any issue when context is free and we still try to access fence through radeon structure. Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/r600_drm.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/gallium/winsys/r600/drm/r600_drm.c') diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index 36ec583cce..ee262c3ea5 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -30,6 +30,7 @@ #include #include "util/u_inlines.h" #include "util/u_debug.h" +#include #include "r600.h" #include "r600_priv.h" #include "r600_drm_public.h" @@ -125,6 +126,18 @@ static int radeon_drm_get_tiling(struct radeon *radeon) return 0; } +static int radeon_init_fence(struct radeon *radeon) +{ + radeon->fence = 1; + radeon->fence_bo = r600_bo(radeon, 4096, 0, 0, 0); + if (radeon->fence_bo == NULL) { + return -ENOMEM; + } + radeon->cfence = r600_bo_map(radeon, radeon->fence_bo, PB_USAGE_UNSYNCHRONIZED, NULL); + *radeon->cfence = 0; + return 0; +} + static struct radeon *radeon_new(int fd, unsigned device) { struct radeon *radeon; @@ -198,6 +211,11 @@ static struct radeon *radeon_new(int fd, unsigned device) if (radeon->bomgr == NULL) { return NULL; } + r = radeon_init_fence(radeon); + if (r) { + radeon_decref(radeon); + return NULL; + } return radeon; } @@ -214,6 +232,10 @@ struct radeon *radeon_decref(struct radeon *radeon) return NULL; } + if (radeon->fence_bo) { + r600_bo_reference(radeon, &radeon->fence_bo, NULL); + } + if (radeon->bomgr) r600_bomgr_destroy(radeon->bomgr); -- cgit v1.2.3