static struct drm_i915_op_arg *
-intel_setup_validate_list(int fd, struct intel_bo_list *list,
- struct intel_bo_list *reloc_list, GLuint *count_p)
+intel_setup_validate_list(dri_bufmgr_ttm *bufmgr_ttm, GLuint *count_p)
{
+ struct intel_bo_list *list = &bufmgr_ttm->list;
+ struct intel_bo_list *reloc_list = &bufmgr_ttm->reloc_list;
struct intel_bo_node *node;
struct intel_bo_reloc_node *rl_node;
drmMMListHead *l, *rl;
}
static void
-intel_free_validate_list(int fd, struct intel_bo_list *list)
+intel_free_validate_list(dri_bufmgr_ttm *bufmgr_ttm)
{
+ struct intel_bo_list *list = &bufmgr_ttm->list;
struct intel_bo_node *node;
drmMMListHead *l;
}
static void
-intel_free_reloc_list(int fd, struct intel_bo_list *reloc_list)
+intel_free_reloc_list(dri_bufmgr_ttm *bufmgr_ttm)
{
+ struct intel_bo_list *reloc_list = &bufmgr_ttm->reloc_list;
struct intel_bo_reloc_node *reloc_node;
drmMMListHead *rl, *tmp;
/* TODO */
}
- drmBOUnmap(fd, &reloc_node->type_list.buf);
- drmBOUnreference(fd, &reloc_node->type_list.buf);
+ drmBOUnmap(bufmgr_ttm->fd, &reloc_node->type_list.buf);
+ drmBOUnreference(bufmgr_ttm->fd, &reloc_node->type_list.buf);
free(reloc_node);
}
}
uint64_t flags, uint64_t mask,
int *itemLoc, void (*destroy_cb)(void *))
{
+ struct intel_bo_list *list = &bufmgr_ttm->list;
struct intel_bo_node *node, *cur;
drmMMListHead *l;
int count = 0;
sizeof(uint32_t))
static int
-intel_create_new_reloc_type_list(int fd, struct intel_bo_reloc_list *cur_type,
- int max_relocs)
+intel_create_new_reloc_type_list(dri_bufmgr_ttm *bufmgr_ttm,
+ struct intel_bo_reloc_list *cur_type)
{
int ret;
/* should allocate a drmBO here */
- ret = drmBOCreate(fd, RELOC_BUF_SIZE(max_relocs), 0,
+ ret = drmBOCreate(bufmgr_ttm->fd, RELOC_BUF_SIZE(bufmgr_ttm->max_relocs), 0,
NULL,
DRM_BO_FLAG_MEM_LOCAL |
DRM_BO_FLAG_READ |
if (ret)
return ret;
- ret = drmBOMap(fd, &cur_type->buf,
+ ret = drmBOMap(bufmgr_ttm->fd, &cur_type->buf,
DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE,
0, (void **)&cur_type->relocs);
if (ret)
}
static int
-intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list,
- struct intel_reloc_info *reloc_info,
- uint32_t max_relocs)
+intel_add_validate_reloc(dri_bufmgr_ttm *bufmgr_ttm,
+ struct intel_reloc_info *reloc_info)
{
+ struct intel_bo_list *reloc_list = &bufmgr_ttm->reloc_list;
struct intel_bo_reloc_node *rl_node, *cur;
drmMMListHead *rl, *l;
int ret = 0;
cur_type = &cur->type_list;
DRMINITLISTHEAD(&cur->type_list.head);
- ret = intel_create_new_reloc_type_list(fd, cur_type, max_relocs);
+ ret = intel_create_new_reloc_type_list(bufmgr_ttm, cur_type);
if (ret) {
return -1;
}
return -ENOMEM;
}
- ret = intel_create_new_reloc_type_list(fd, cur_type, max_relocs);
+ ret = intel_create_new_reloc_type_list(bufmgr_ttm, cur_type);
DRMLISTADDTAIL(&cur_type->head, &cur->type_list.head);
cur_type->relocs[0] = (reloc_info->type << 16);
reloc_start[num_relocs * I915_RELOC0_STRIDE + I915_RELOC_HEADER + 2] =
reloc_info->index;
reloc_start[0]++;
- if (((reloc_start[0] & 0xffff)) > (max_relocs)) {
+ if (((reloc_start[0] & 0xffff)) > (bufmgr_ttm->max_relocs)) {
return -ENOMEM;
}
return 0;
mask = DRM_BO_MASK_MEM;
mask |= flags & (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE);
- ret = intel_add_validate_buffer(&bufmgr_ttm->list, target_buf, flags, mask,
+ ret = intel_add_validate_buffer(bufmgr_ttm, target_buf, flags, mask,
&newItem, intel_dribo_destroy_callback);
if (ret < 0)
return;
reloc.index = newItem;
reloc.handle = ttm_buf->drm_bo.handle;
- intel_add_validate_reloc(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list, &reloc,
- bufmgr_ttm->max_relocs);
+ intel_add_validate_reloc(bufmgr_ttm, &reloc);
}
dri_bo_unmap(batch_buf);
- intel_add_validate_buffer(&bufmgr_ttm->list, batch_buf,
+ intel_add_validate_buffer(bufmgr_ttm, batch_buf,
DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE,
DRM_BO_MASK_MEM | DRM_BO_FLAG_EXE,
&itemLoc, NULL);
- ptr = intel_setup_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list,
- &bufmgr_ttm->reloc_list, count);
+ ptr = intel_setup_validate_list(bufmgr_ttm, count);
return ptr;
}
{
dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr;
- intel_free_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list);
- intel_free_reloc_list(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list);
+ intel_free_validate_list(bufmgr_ttm);
+ intel_free_reloc_list(bufmgr_ttm);
intel_bo_free_list(&bufmgr_ttm->list);
}