Lines Matching refs:res

50 	struct vmw_resource res;  member
106 static int vmw_cotable_bind(struct vmw_resource *res,
108 static int vmw_cotable_unbind(struct vmw_resource *res,
111 static int vmw_cotable_create(struct vmw_resource *res);
112 static int vmw_cotable_destroy(struct vmw_resource *res);
132 static struct vmw_cotable *vmw_cotable(struct vmw_resource *res) in vmw_cotable() argument
134 return container_of(res, struct vmw_cotable, res); in vmw_cotable()
145 static int vmw_cotable_destroy(struct vmw_resource *res) in vmw_cotable_destroy() argument
147 res->id = -1; in vmw_cotable_destroy()
160 static int vmw_cotable_unscrub(struct vmw_resource *res) in vmw_cotable_unscrub() argument
162 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_unscrub()
163 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_unscrub()
164 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()
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 (list_empty(&res->mob_head)) 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()
364 vcotbl->size_read_back = res->backup_size; in vmw_cotable_readback()
369 vmw_fence_single_bo(&res->backup->base, fence); in vmw_cotable_readback()
387 static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) in vmw_cotable_resize() argument
389 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_resize()
390 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_resize()
391 struct vmw_dma_buffer *buf, *old_buf = res->backup; in vmw_cotable_resize()
392 struct ttm_buffer_object *bo, *old_bo = &res->backup->base; in vmw_cotable_resize()
393 size_t old_size = res->backup_size; in vmw_cotable_resize()
400 ret = vmw_cotable_readback(res); in vmw_cotable_resize()
463 res->backup = buf; in vmw_cotable_resize()
464 res->backup_size = new_size; in vmw_cotable_resize()
471 ret = vmw_cotable_unscrub(res); in vmw_cotable_resize()
474 res->backup = old_buf; in vmw_cotable_resize()
475 res->backup_size = old_size; in vmw_cotable_resize()
481 list_del(&res->mob_head); in vmw_cotable_resize()
482 list_add_tail(&res->mob_head, &buf->res_list); in vmw_cotable_resize()
484 res->id = vcotbl->type; in vmw_cotable_resize()
509 static int vmw_cotable_create(struct vmw_resource *res) in vmw_cotable_create() argument
511 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_create()
512 size_t new_size = res->backup_size; in vmw_cotable_create()
521 if (likely(new_size <= res->backup_size)) { in vmw_cotable_create()
522 if (vcotbl->scrubbed && !list_empty(&res->mob_head)) { in vmw_cotable_create()
523 ret = vmw_cotable_unscrub(res); in vmw_cotable_create()
527 res->id = vcotbl->type; in vmw_cotable_create()
531 return vmw_cotable_resize(res, new_size); in vmw_cotable_create()
541 static void vmw_hw_cotable_destroy(struct vmw_resource *res) in vmw_hw_cotable_destroy() argument
543 (void) vmw_cotable_destroy(res); in vmw_hw_cotable_destroy()
553 static void vmw_cotable_free(struct vmw_resource *res) in vmw_cotable_free() argument
555 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_free()
557 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 vmw_resource_activate(&vcotbl->res, 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()