Lines Matching refs:res

51 	struct vmw_resource res;  member
110 static int vmw_cotable_bind(struct vmw_resource *res,
112 static int vmw_cotable_unbind(struct vmw_resource *res,
115 static int vmw_cotable_create(struct vmw_resource *res);
116 static int vmw_cotable_destroy(struct vmw_resource *res);
138 static struct vmw_cotable *vmw_cotable(struct vmw_resource *res) in vmw_cotable() argument
140 return container_of(res, struct vmw_cotable, res); in vmw_cotable()
151 static int vmw_cotable_destroy(struct vmw_resource *res) in vmw_cotable_destroy() argument
153 res->id = -1; in vmw_cotable_destroy()
166 static int vmw_cotable_unscrub(struct vmw_resource *res) in vmw_cotable_unscrub() argument
168 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_unscrub()
169 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_unscrub()
170 struct ttm_buffer_object *bo = &res->backup->base; in vmw_cotable_unscrub()
208 static int vmw_cotable_bind(struct vmw_resource *res, in vmw_cotable_bind() argument
218 val_buf->bo = &res->backup->base; in vmw_cotable_bind()
220 return vmw_cotable_unscrub(res); in vmw_cotable_bind()
241 int vmw_cotable_scrub(struct vmw_resource *res, bool readback) in vmw_cotable_scrub() argument
243 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_scrub()
244 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_scrub()
279 vcotbl->size_read_back = res->backup_size; in vmw_cotable_scrub()
291 res->id = -1; in vmw_cotable_scrub()
306 static int vmw_cotable_unbind(struct vmw_resource *res, in vmw_cotable_unbind() argument
310 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_unbind()
311 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_unbind()
315 if (!vmw_resource_mob_attached(res)) in vmw_cotable_unbind()
341 static int vmw_cotable_readback(struct vmw_resource *res) in vmw_cotable_readback() argument
343 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_readback()
344 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_readback()
361 vcotbl->size_read_back = res->backup_size; in vmw_cotable_readback()
366 vmw_bo_fence_single(&res->backup->base, fence); in vmw_cotable_readback()
384 static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) in vmw_cotable_resize() argument
387 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_resize()
388 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_resize()
389 struct vmw_buffer_object *buf, *old_buf = res->backup; in vmw_cotable_resize()
390 struct ttm_buffer_object *bo, *old_bo = &res->backup->base; in vmw_cotable_resize()
391 size_t old_size = res->backup_size; in vmw_cotable_resize()
398 ret = vmw_cotable_readback(res); in vmw_cotable_resize()
461 vmw_resource_mob_detach(res); in vmw_cotable_resize()
462 res->backup = buf; in vmw_cotable_resize()
463 res->backup_size = new_size; in vmw_cotable_resize()
470 ret = vmw_cotable_unscrub(res); in vmw_cotable_resize()
473 res->backup = old_buf; in vmw_cotable_resize()
474 res->backup_size = old_size; in vmw_cotable_resize()
476 vmw_resource_mob_attach(res); in vmw_cotable_resize()
480 vmw_resource_mob_attach(res); in vmw_cotable_resize()
483 res->id = vcotbl->type; in vmw_cotable_resize()
512 static int vmw_cotable_create(struct vmw_resource *res) in vmw_cotable_create() argument
514 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_create()
515 size_t new_size = res->backup_size; in vmw_cotable_create()
524 if (likely(new_size <= res->backup_size)) { in vmw_cotable_create()
525 if (vcotbl->scrubbed && vmw_resource_mob_attached(res)) { in vmw_cotable_create()
526 ret = vmw_cotable_unscrub(res); in vmw_cotable_create()
530 res->id = vcotbl->type; in vmw_cotable_create()
534 return vmw_cotable_resize(res, new_size); in vmw_cotable_create()
544 static void vmw_hw_cotable_destroy(struct vmw_resource *res) in vmw_hw_cotable_destroy() argument
546 (void) vmw_cotable_destroy(res); in vmw_hw_cotable_destroy()
556 static void vmw_cotable_free(struct vmw_resource *res) in vmw_cotable_free() argument
558 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_free()
560 kfree(res); in vmw_cotable_free()
598 ret = vmw_resource_init(dev_priv, &vcotbl->res, true, in vmw_cotable_alloc()
604 vcotbl->res.id = type; in vmw_cotable_alloc()
605 vcotbl->res.backup_size = PAGE_SIZE; in vmw_cotable_alloc()
608 vcotbl->res.backup_size = co_info[type].min_initial_entries * in vmw_cotable_alloc()
610 vcotbl->res.backup_size = PFN_ALIGN(vcotbl->res.backup_size); in vmw_cotable_alloc()
618 vcotbl->res.hw_destroy = vmw_hw_cotable_destroy; in vmw_cotable_alloc()
620 return &vcotbl->res; in vmw_cotable_alloc()
635 int vmw_cotable_notify(struct vmw_resource *res, int id) in vmw_cotable_notify() argument
637 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_notify()
647 res->id = -1; in vmw_cotable_notify()
661 void vmw_cotable_add_resource(struct vmw_resource *res, struct list_head *head) in vmw_cotable_add_resource() argument
664 container_of(res, struct vmw_cotable, res); in vmw_cotable_add_resource()