summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/r600/drm/r600_drm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/r600/drm/r600_drm.c')
-rw-r--r--src/gallium/winsys/r600/drm/r600_drm.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c
index 2fd09f085a9..0c9f6efe60c 100644
--- a/src/gallium/winsys/r600/drm/r600_drm.c
+++ b/src/gallium/winsys/r600/drm/r600_drm.c
@@ -30,6 +30,7 @@
#include <sys/ioctl.h>
#include "util/u_inlines.h"
#include "util/u_debug.h"
+#include <pipebuffer/pb_bufmgr.h>
#include "r600.h"
#include "r600_priv.h"
#include "r600_drm_public.h"
@@ -110,6 +111,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;
@@ -183,6 +196,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;
}
@@ -199,6 +217,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);