zstex->hiz_in_use[fb->zsbuf->level])) {
r300->hyperz_state.dirty = TRUE;
}
-
- /* XXX this flush "fixes" a hardlock in the cubestorm xscreensaver */
- if (r300->flush_counter == 0)
- pipe->flush(pipe, 0, NULL);
}
/* Clear a region of a color surface to a constant value. */
#include "radeon_cs_gem.h"
#include "radeon_buffer.h"
+#include "util/u_hash_table.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"
struct pb_manager base;
struct radeon_libdrm_winsys *rws;
struct radeon_drm_buffer buffer_map_list;
+ struct util_hash_table *buffer_handles;
};
static INLINE struct radeon_drm_bufmgr *
radeon_bo_unmap(buf->bo);
buf->bo->ptr = NULL;
}
+
+ util_hash_table_remove(buf->mgr->buffer_handles,
+ (void*)(uintptr_t)buf->bo->handle);
radeon_bo_unref(buf->bo);
FREE(buf);
struct radeon_drm_buffer *buf;
struct radeon_bo *bo;
+ buf = util_hash_table_get(mgr->buffer_handles, (void*)(uintptr_t)handle);
+ if (buf) {
+ struct pb_buffer *b = NULL;
+ pb_reference(&b, &buf->base);
+ return b;
+ }
+
bo = radeon_bo_open(rws->bom, handle, 0,
0, 0, 0);
if (bo == NULL)
buf->bo = bo;
+ util_hash_table_set(mgr->buffer_handles, (void*)(uintptr_t)handle, buf);
+
return &buf->base;
}
radeon_drm_bufmgr_destroy(struct pb_manager *_mgr)
{
struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
+ util_hash_table_destroy(mgr->buffer_handles);
FREE(mgr);
}
+static unsigned handle_hash(void *key)
+{
+ return (unsigned)key;
+}
+
+static int handle_compare(void *key1, void *key2)
+{
+ return !((int)key1 == (int)key2);
+}
+
struct pb_manager *
radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws)
{
mgr->rws = rws;
make_empty_list(&mgr->buffer_map_list);
+ mgr->buffer_handles = util_hash_table_create(handle_hash, handle_compare);
return &mgr->base;
}