Lines Matching refs:res
51 struct vmw_resource res; member
107 static int vmw_cotable_bind(struct vmw_resource *res,
109 static int vmw_cotable_unbind(struct vmw_resource *res,
112 static int vmw_cotable_create(struct vmw_resource *res);
113 static int vmw_cotable_destroy(struct vmw_resource *res);
135 static struct vmw_cotable *vmw_cotable(struct vmw_resource *res) in vmw_cotable() argument
137 return container_of(res, struct vmw_cotable, res); in vmw_cotable()
148 static int vmw_cotable_destroy(struct vmw_resource *res) in vmw_cotable_destroy() argument
150 res->id = -1; in vmw_cotable_destroy()
163 static int vmw_cotable_unscrub(struct vmw_resource *res) in vmw_cotable_unscrub() argument
165 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_unscrub()
166 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_unscrub()
167 struct ttm_buffer_object *bo = &res->backup->base; in vmw_cotable_unscrub()
205 static int vmw_cotable_bind(struct vmw_resource *res, in vmw_cotable_bind() argument
215 val_buf->bo = &res->backup->base; in vmw_cotable_bind()
217 return vmw_cotable_unscrub(res); in vmw_cotable_bind()
238 int vmw_cotable_scrub(struct vmw_resource *res, bool readback) in vmw_cotable_scrub() argument
240 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_scrub()
241 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_scrub()
276 vcotbl->size_read_back = res->backup_size; in vmw_cotable_scrub()
288 res->id = -1; in vmw_cotable_scrub()
303 static int vmw_cotable_unbind(struct vmw_resource *res, in vmw_cotable_unbind() argument
307 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_unbind()
308 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_unbind()
312 if (!vmw_resource_mob_attached(res)) in vmw_cotable_unbind()
338 static int vmw_cotable_readback(struct vmw_resource *res) in vmw_cotable_readback() argument
340 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_readback()
341 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_readback()
358 vcotbl->size_read_back = res->backup_size; in vmw_cotable_readback()
363 vmw_bo_fence_single(&res->backup->base, fence); in vmw_cotable_readback()
381 static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) in vmw_cotable_resize() argument
384 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_resize()
385 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_resize()
386 struct vmw_buffer_object *buf, *old_buf = res->backup; in vmw_cotable_resize()
387 struct ttm_buffer_object *bo, *old_bo = &res->backup->base; in vmw_cotable_resize()
388 size_t old_size = res->backup_size; in vmw_cotable_resize()
395 ret = vmw_cotable_readback(res); in vmw_cotable_resize()
458 vmw_resource_mob_detach(res); in vmw_cotable_resize()
459 res->backup = buf; in vmw_cotable_resize()
460 res->backup_size = new_size; in vmw_cotable_resize()
467 ret = vmw_cotable_unscrub(res); in vmw_cotable_resize()
470 res->backup = old_buf; in vmw_cotable_resize()
471 res->backup_size = old_size; in vmw_cotable_resize()
473 vmw_resource_mob_attach(res); in vmw_cotable_resize()
477 vmw_resource_mob_attach(res); in vmw_cotable_resize()
480 res->id = vcotbl->type; in vmw_cotable_resize()
505 static int vmw_cotable_create(struct vmw_resource *res) in vmw_cotable_create() argument
507 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_create()
508 size_t new_size = res->backup_size; in vmw_cotable_create()
517 if (likely(new_size <= res->backup_size)) { in vmw_cotable_create()
518 if (vcotbl->scrubbed && vmw_resource_mob_attached(res)) { in vmw_cotable_create()
519 ret = vmw_cotable_unscrub(res); in vmw_cotable_create()
523 res->id = vcotbl->type; in vmw_cotable_create()
527 return vmw_cotable_resize(res, new_size); in vmw_cotable_create()
537 static void vmw_hw_cotable_destroy(struct vmw_resource *res) in vmw_hw_cotable_destroy() argument
539 (void) vmw_cotable_destroy(res); in vmw_hw_cotable_destroy()
549 static void vmw_cotable_free(struct vmw_resource *res) in vmw_cotable_free() argument
551 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_free()
553 kfree(res); in vmw_cotable_free()
591 ret = vmw_resource_init(dev_priv, &vcotbl->res, true, in vmw_cotable_alloc()
597 vcotbl->res.id = type; in vmw_cotable_alloc()
598 vcotbl->res.backup_size = PAGE_SIZE; in vmw_cotable_alloc()
601 vcotbl->res.backup_size = co_info[type].min_initial_entries * in vmw_cotable_alloc()
603 vcotbl->res.backup_size = in vmw_cotable_alloc()
604 (vcotbl->res.backup_size + PAGE_SIZE - 1) & PAGE_MASK; in vmw_cotable_alloc()
612 vcotbl->res.hw_destroy = vmw_hw_cotable_destroy; in vmw_cotable_alloc()
614 return &vcotbl->res; in vmw_cotable_alloc()
629 int vmw_cotable_notify(struct vmw_resource *res, int id) in vmw_cotable_notify() argument
631 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_notify()
641 res->id = -1; in vmw_cotable_notify()
655 void vmw_cotable_add_resource(struct vmw_resource *res, struct list_head *head) in vmw_cotable_add_resource() argument
658 container_of(res, struct vmw_cotable, res); in vmw_cotable_add_resource()