Lines Matching full:info

75 batch_next(struct intel_info *info)  in batch_next()  argument
77 info->cur = info->batch; in batch_next()
79 if (info->batch_ibo) in batch_next()
80 drm_intel_bo_unreference(info->batch_ibo); in batch_next()
82 info->batch_ibo = drm_intel_bo_alloc(info->bufmgr, in batch_next()
83 "gralloc-batchbuffer", info->size, 4096); in batch_next()
85 return (info->batch_ibo) ? 0 : -ENOMEM; in batch_next()
89 batch_count(struct intel_info *info) in batch_count() argument
91 return info->cur - info->batch; in batch_count()
95 batch_dword(struct intel_info *info, uint32_t dword) in batch_dword() argument
97 *info->cur++ = dword; in batch_dword()
101 batch_reloc(struct intel_info *info, struct gralloc_drm_bo_t *bo, in batch_reloc() argument
105 uint32_t offset = (info->cur - info->batch) * sizeof(info->batch[0]); in batch_reloc()
108 ret = drm_intel_bo_emit_reloc(info->batch_ibo, offset, in batch_reloc()
111 batch_dword(info, target->ibo->offset); in batch_reloc()
117 batch_flush(struct intel_info *info) in batch_flush() argument
121 batch_dword(info, MI_BATCH_BUFFER_END); in batch_flush()
122 size = batch_count(info); in batch_flush()
124 batch_dword(info, MI_NOOP); in batch_flush()
125 size = batch_count(info); in batch_flush()
128 size *= sizeof(info->batch[0]); in batch_flush()
129 ret = drm_intel_bo_subdata(info->batch_ibo, 0, size, info->batch); in batch_flush()
134 ret = drm_intel_bo_mrb_exec(info->batch_ibo, size, in batch_flush()
135 NULL, 0, 0, info->exec_blt); in batch_flush()
141 return batch_next(info); in batch_flush()
144 info->cur = info->batch; in batch_flush()
150 batch_reserve(struct intel_info *info, int count) in batch_reserve() argument
154 if (batch_count(info) + count > info->capacity) in batch_reserve()
155 ret = batch_flush(info); in batch_reserve()
161 batch_destroy(struct intel_info *info) in batch_destroy() argument
163 if (info->batch_ibo) { in batch_destroy()
164 drm_intel_bo_unreference(info->batch_ibo); in batch_destroy()
165 info->batch_ibo = NULL; in batch_destroy()
168 if (info->batch) { in batch_destroy()
169 free(info->batch); in batch_destroy()
170 info->batch = NULL; in batch_destroy()
175 batch_init(struct intel_info *info) in batch_init() argument
179 info->capacity = 512; in batch_init()
180 info->size = (info->capacity + 16) * sizeof(info->batch[0]); in batch_init()
182 info->batch = malloc(info->size); in batch_init()
183 if (!info->batch) in batch_init()
186 ret = batch_next(info); in batch_init()
188 free(info->batch); in batch_init()
189 info->batch = NULL; in batch_init()
241 static drm_intel_bo *alloc_ibo(struct intel_info *info, in alloc_ibo() argument
266 if (info->gen < 50) in alloc_ibo()
268 if (info->gen < 40) in alloc_ibo()
285 ibo = drm_intel_bo_alloc_tiled(info->bufmgr, name, in alloc_ibo()
330 ibo = drm_intel_bo_alloc_tiled(info->bufmgr, name, in alloc_ibo()
341 struct intel_info *info = (struct intel_info *) drv; in intel_alloc() local
351 ib->ibo = drm_intel_bo_gem_create_from_name(info->bufmgr, in intel_alloc()
370 ib->ibo = alloc_ibo(info, handle, &ib->tiling, &stride); in intel_alloc()
438 static void gen_init(struct intel_info *info) in gen_init() argument
446 if (drmCommandWriteRead(info->fd, DRM_I915_GETPARAM, &gp, sizeof(gp))) in gen_init()
452 if (drmCommandWriteRead(info->fd, DRM_I915_GETPARAM, &gp, sizeof(gp))) in gen_init()
454 info->exec_blt = has_blt ? I915_EXEC_BLT : 0; in gen_init()
459 info->gen = 70; in gen_init()
461 info->gen = 60; in gen_init()
463 info->gen = 50; in gen_init()
465 info->gen = 40; in gen_init()
468 info->gen = 30; in gen_init()
474 struct intel_info *info = (struct intel_info *) drv; in intel_destroy() local
476 batch_destroy(info); in intel_destroy()
477 drm_intel_bufmgr_destroy(info->bufmgr); in intel_destroy()
478 free(info); in intel_destroy()
483 struct intel_info *info; in gralloc_drm_drv_create_for_intel() local
485 info = calloc(1, sizeof(*info)); in gralloc_drm_drv_create_for_intel()
486 if (!info) { in gralloc_drm_drv_create_for_intel()
487 ALOGE("failed to allocate driver info"); in gralloc_drm_drv_create_for_intel()
491 info->fd = fd; in gralloc_drm_drv_create_for_intel()
492 info->bufmgr = drm_intel_bufmgr_gem_init(info->fd, 16 * 1024); in gralloc_drm_drv_create_for_intel()
493 if (!info->bufmgr) { in gralloc_drm_drv_create_for_intel()
495 free(info); in gralloc_drm_drv_create_for_intel()
499 batch_init(info); in gralloc_drm_drv_create_for_intel()
500 gen_init(info); in gralloc_drm_drv_create_for_intel()
502 info->base.destroy = intel_destroy; in gralloc_drm_drv_create_for_intel()
503 info->base.alloc = intel_alloc; in gralloc_drm_drv_create_for_intel()
504 info->base.free = intel_free; in gralloc_drm_drv_create_for_intel()
505 info->base.map = intel_map; in gralloc_drm_drv_create_for_intel()
506 info->base.unmap = intel_unmap; in gralloc_drm_drv_create_for_intel()
507 info->base.resolve_format = intel_resolve_format; in gralloc_drm_drv_create_for_intel()
509 return &info->base; in gralloc_drm_drv_create_for_intel()