#include <sys/ioctl.h>
#include "util/u_inlines.h"
#include "util/u_debug.h"
+#include "util/u_hash_table.h"
#include <pipebuffer/pb_bufmgr.h>
#include "r600.h"
#include "r600_priv.h"
uint32_t clock_crystal_freq;
int r;
- radeon->device = 0;
info.request = RADEON_INFO_CLOCK_CRYSTAL_FREQ;
info.value = (uintptr_t)&clock_crystal_freq;
r = drmCommandWriteRead(radeon->fd, DRM_RADEON_INFO, &info,
uint32_t num_backends;
int r;
- radeon->device = 0;
info.request = RADEON_INFO_NUM_BACKENDS;
info.value = (uintptr_t)&num_backends;
r = drmCommandWriteRead(radeon->fd, DRM_RADEON_INFO, &info,
return 0;
}
+#define PTR_TO_UINT(x) ((unsigned)((intptr_t)(x)))
+
+static unsigned handle_hash(void *key)
+{
+ return PTR_TO_UINT(key);
+}
+
+static int handle_compare(void *key1, void *key2)
+{
+ return PTR_TO_UINT(key1) != PTR_TO_UINT(key2);
+}
+
static struct radeon *radeon_new(int fd, unsigned device)
{
struct radeon *radeon;
radeon_decref(radeon);
return NULL;
}
+
+ radeon->bo_handles = util_hash_table_create(handle_hash, handle_compare);
+ pipe_mutex_init(radeon->bo_handles_mutex);
return radeon;
}
return NULL;
}
+ util_hash_table_destroy(radeon->bo_handles);
+ pipe_mutex_destroy(radeon->bo_handles_mutex);
if (radeon->fence_bo) {
r600_bo_reference(radeon, &radeon->fence_bo, NULL);
}
if (radeon->bomgr)
r600_bomgr_destroy(radeon->bomgr);
- if (radeon->fd >= 0)
- drmClose(radeon->fd);
-
free(radeon);
return NULL;
}