struct vc4_bo_exec_state *bo;
uint32_t bo_count;
+ /* List of other BOs used in the job that need to be released
+ * once the job is complete.
+ */
+ struct list_head unref_list;
+
/* Current unvalidated indices into @bo loaded by the non-hardware
* VC4_PACKET_GEM_HANDLES.
*/
{
struct vc4_context *vc4 = dev->vc4;
struct vc4_screen *screen = vc4->screen;
- struct drm_gem_cma_object *obj = CALLOC_STRUCT(drm_gem_cma_object);
+ struct drm_vc4_bo *drm_bo = CALLOC_STRUCT(drm_vc4_bo);
+ struct drm_gem_cma_object *obj = &drm_bo->base;
uint32_t size = align(bo->size, 4096);
- obj->bo = bo;
+ drm_bo->bo = bo;
obj->base.size = size;
obj->vaddr = screen->simulator_mem_base + dev->simulator_mem_next;
obj->paddr = simpenrose_hw_addr(obj->vaddr);
{
for (int i = 0; i < exec->bo_count; i++) {
struct drm_gem_cma_object *obj = exec->bo[i].bo;
- struct vc4_bo *bo = obj->bo;
+ struct vc4_bo *bo = to_vc4_bo(&obj->base)->bo;
memcpy(bo->map, obj->vaddr, bo->size);
int ret;
memset(&exec, 0, sizeof(exec));
+ list_inithead(&exec.unref_list);
if (ctex && ctex->bo->simulator_winsys_map) {
#if 0
if (ret)
return ret;
- vc4_bo_unreference(&exec.exec_bo->bo);
- free(exec.exec_bo);
+ list_for_each_entry_safe(struct drm_vc4_bo, bo, &exec.unref_list,
+ unref_head) {
+ list_del(&bo->unref_head);
+ vc4_bo_unreference(&bo->bo);
+ free(bo);
+ }
if (ctex && ctex->bo->simulator_winsys_map) {
for (int y = 0; y < ctex->base.b.height0; y++) {
uint32_t simulator_mem_next;
};
-struct drm_gem_cma_object {
- struct vc4_bo *bo;
+struct drm_gem_object {
+ uint32_t size;
+};
- struct {
- uint32_t size;
- } base;
+struct drm_gem_cma_object {
+ struct drm_gem_object base;
uint32_t paddr;
void *vaddr;
};
+struct drm_vc4_bo {
+ struct drm_gem_cma_object base;
+ struct vc4_bo *bo;
+ struct list_head unref_head;
+};
+
+static inline struct drm_vc4_bo *to_vc4_bo(struct drm_gem_object *obj)
+{
+ return (struct drm_vc4_bo *)obj;
+}
struct drm_gem_cma_object *
drm_gem_cma_create(struct drm_device *dev, size_t size);