uint32_t domains,
uint32_t flags);
void (*bo_ref)(struct radeon_bo *bo);
- void (*bo_unref)(struct radeon_bo *bo);
+ struct radeon_bo *(*bo_unref)(struct radeon_bo *bo);
int (*bo_map)(struct radeon_bo *bo, int write);
int (*bo_unmap)(struct radeon_bo *bo);
};
bo->bom->funcs->bo_ref(bo);
}
-static inline void _radeon_bo_unref(struct radeon_bo *bo,
- const char *file,
- const char *func,
- int line)
+static inline struct radeon_bo *_radeon_bo_unref(struct radeon_bo *bo,
+ const char *file,
+ const char *func,
+ int line)
{
bo->cref--;
#ifdef RADEON_BO_TRACK
bo->track = NULL;
}
#endif
- bo->bom->funcs->bo_unref(bo);
+ return bo->bom->funcs->bo_unref(bo);
}
static inline int _radeon_bo_map(struct radeon_bo *bo,
{
}
-static void bo_unref(struct radeon_bo *bo)
+static struct radeon_bo *bo_unref(struct radeon_bo *bo)
{
struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)bo;
struct drm_gem_close args;
if (bo == NULL) {
- return;
+ return NULL;
}
if (bo->cref) {
- return;
+ return bo;
}
if (bo_gem->map_count) {
munmap(bo->ptr, bo->size);
args.handle = bo->handle;
ioctl(bo->bom->fd, DRM_IOCTL_GEM_CLOSE, &args);
free(bo_gem);
+ return NULL;
}
static int bo_map(struct radeon_bo *bo, int write)
bo_unmap
};
-struct radeon_bo_manager *radeon_bo_manager_gem(int fd)
+struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd)
{
struct bo_manager_gem *bomg;
return (struct radeon_bo_manager*)bomg;
}
-void radeon_bo_manager_gem_shutdown(struct radeon_bo_manager *bom)
+void radeon_bo_manager_gem_dtor(struct radeon_bo_manager *bom)
{
struct bo_manager_gem *bomg = (struct bo_manager_gem*)bom;
#include "radeon_bo.h"
-struct radeon_bo_manager *radeon_bo_manager_gem(int fd);
-void radeon_bo_manager_gem_shutdown(struct radeon_bo_manager *bom);
+struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd);
+void radeon_bo_manager_gem_dtor(struct radeon_bo_manager *bom);
#endif
{
struct cs_gem *csg = (struct cs_gem*)cs;
uint64_t chunk_array[2];
- int r, i;
+ unsigned i;
+ int r;
chunk_array[0] = (uint64_t)(intptr_t)&csg->chunks[0];
chunk_array[1] = (uint64_t)(intptr_t)&csg->chunks[1];
static int cs_gem_erase(struct radeon_cs *cs)
{
struct cs_gem *csg = (struct cs_gem*)cs;
- int i;
+ unsigned i;
if (csg->relocs_bo) {
for (i = 0; i < csg->base.crelocs; i++) {
cs_gem_need_flush
};
-struct radeon_cs_manager *radeon_cs_manager_gem(int fd)
+struct radeon_cs_manager *radeon_cs_manager_gem_ctor(int fd)
{
struct radeon_cs_manager *csm;
return csm;
}
-void radeon_cs_manager_gem_shutdown(struct radeon_cs_manager *csm)
+void radeon_cs_manager_gem_dtor(struct radeon_cs_manager *csm)
{
free(csm);
}
#include "radeon_cs.h"
-struct radeon_cs_manager *radeon_cs_manager_gem(int fd);
-void radeon_cs_manager_gem_shutdown(struct radeon_cs_manager *csm);
+struct radeon_cs_manager *radeon_cs_manager_gem_ctor(int fd);
+void radeon_cs_manager_gem_dtor(struct radeon_cs_manager *csm);
#endif