Lines Matching refs:res
51 struct vmw_resource res; member
109 static int vmw_cotable_bind(struct vmw_resource *res,
111 static int vmw_cotable_unbind(struct vmw_resource *res,
114 static int vmw_cotable_create(struct vmw_resource *res);
115 static int vmw_cotable_destroy(struct vmw_resource *res);
137 static struct vmw_cotable *vmw_cotable(struct vmw_resource *res) in vmw_cotable() argument
139 return container_of(res, struct vmw_cotable, res); in vmw_cotable()
150 static int vmw_cotable_destroy(struct vmw_resource *res) in vmw_cotable_destroy() argument
152 res->id = -1; in vmw_cotable_destroy()
165 static int vmw_cotable_unscrub(struct vmw_resource *res) in vmw_cotable_unscrub() argument
167 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_unscrub()
168 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_unscrub()
169 struct ttm_buffer_object *bo = &res->backup->base; in vmw_cotable_unscrub()
207 static int vmw_cotable_bind(struct vmw_resource *res, in vmw_cotable_bind() argument
217 val_buf->bo = &res->backup->base; in vmw_cotable_bind()
219 return vmw_cotable_unscrub(res); in vmw_cotable_bind()
240 int vmw_cotable_scrub(struct vmw_resource *res, bool readback) in vmw_cotable_scrub() argument
242 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_scrub()
243 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_scrub()
278 vcotbl->size_read_back = res->backup_size; in vmw_cotable_scrub()
290 res->id = -1; in vmw_cotable_scrub()
305 static int vmw_cotable_unbind(struct vmw_resource *res, in vmw_cotable_unbind() argument
309 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_unbind()
310 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_unbind()
314 if (!vmw_resource_mob_attached(res)) in vmw_cotable_unbind()
340 static int vmw_cotable_readback(struct vmw_resource *res) in vmw_cotable_readback() argument
342 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_readback()
343 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_readback()
360 vcotbl->size_read_back = res->backup_size; in vmw_cotable_readback()
365 vmw_bo_fence_single(&res->backup->base, fence); in vmw_cotable_readback()
383 static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) in vmw_cotable_resize() argument
386 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_resize()
387 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_resize()
388 struct vmw_buffer_object *buf, *old_buf = res->backup; in vmw_cotable_resize()
389 struct ttm_buffer_object *bo, *old_bo = &res->backup->base; in vmw_cotable_resize()
390 size_t old_size = res->backup_size; in vmw_cotable_resize()
397 ret = vmw_cotable_readback(res); in vmw_cotable_resize()
460 vmw_resource_mob_detach(res); in vmw_cotable_resize()
461 res->backup = buf; in vmw_cotable_resize()
462 res->backup_size = new_size; in vmw_cotable_resize()
469 ret = vmw_cotable_unscrub(res); in vmw_cotable_resize()
472 res->backup = old_buf; in vmw_cotable_resize()
473 res->backup_size = old_size; in vmw_cotable_resize()
475 vmw_resource_mob_attach(res); in vmw_cotable_resize()
479 vmw_resource_mob_attach(res); in vmw_cotable_resize()
482 res->id = vcotbl->type; in vmw_cotable_resize()
507 static int vmw_cotable_create(struct vmw_resource *res) in vmw_cotable_create() argument
509 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_create()
510 size_t new_size = res->backup_size; in vmw_cotable_create()
519 if (likely(new_size <= res->backup_size)) { in vmw_cotable_create()
520 if (vcotbl->scrubbed && vmw_resource_mob_attached(res)) { in vmw_cotable_create()
521 ret = vmw_cotable_unscrub(res); in vmw_cotable_create()
525 res->id = vcotbl->type; in vmw_cotable_create()
529 return vmw_cotable_resize(res, new_size); in vmw_cotable_create()
539 static void vmw_hw_cotable_destroy(struct vmw_resource *res) in vmw_hw_cotable_destroy() argument
541 (void) vmw_cotable_destroy(res); in vmw_hw_cotable_destroy()
551 static void vmw_cotable_free(struct vmw_resource *res) in vmw_cotable_free() argument
553 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_free()
555 kfree(res); in vmw_cotable_free()
593 ret = vmw_resource_init(dev_priv, &vcotbl->res, true, in vmw_cotable_alloc()
599 vcotbl->res.id = type; in vmw_cotable_alloc()
600 vcotbl->res.backup_size = PAGE_SIZE; in vmw_cotable_alloc()
603 vcotbl->res.backup_size = co_info[type].min_initial_entries * in vmw_cotable_alloc()
605 vcotbl->res.backup_size = in vmw_cotable_alloc()
606 (vcotbl->res.backup_size + PAGE_SIZE - 1) & PAGE_MASK; in vmw_cotable_alloc()
614 vcotbl->res.hw_destroy = vmw_hw_cotable_destroy; in vmw_cotable_alloc()
616 return &vcotbl->res; in vmw_cotable_alloc()
631 int vmw_cotable_notify(struct vmw_resource *res, int id) in vmw_cotable_notify() argument
633 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_notify()
643 res->id = -1; in vmw_cotable_notify()
657 void vmw_cotable_add_resource(struct vmw_resource *res, struct list_head *head) in vmw_cotable_add_resource() argument
660 container_of(res, struct vmw_cotable, res); in vmw_cotable_add_resource()