Lines Matching refs:res
37 struct vmw_resource res; member
45 static void vmw_user_context_free(struct vmw_resource *res);
49 static int vmw_gb_context_create(struct vmw_resource *res);
50 static int vmw_gb_context_bind(struct vmw_resource *res,
52 static int vmw_gb_context_unbind(struct vmw_resource *res,
55 static int vmw_gb_context_destroy(struct vmw_resource *res);
56 static int vmw_dx_context_create(struct vmw_resource *res);
57 static int vmw_dx_context_bind(struct vmw_resource *res,
59 static int vmw_dx_context_unbind(struct vmw_resource *res,
62 static int vmw_dx_context_destroy(struct vmw_resource *res);
124 struct vmw_resource *res; in vmw_context_cotables_unref() local
131 res = uctx->cotables[i]; in vmw_context_cotables_unref()
135 if (res) in vmw_context_cotables_unref()
136 vmw_resource_unreference(&res); in vmw_context_cotables_unref()
140 static void vmw_hw_context_destroy(struct vmw_resource *res) in vmw_hw_context_destroy() argument
143 container_of(res, struct vmw_user_context, res); in vmw_hw_context_destroy()
144 struct vmw_private *dev_priv = res->dev_priv; in vmw_hw_context_destroy()
151 if (res->func->destroy == vmw_gb_context_destroy || in vmw_hw_context_destroy()
152 res->func->destroy == vmw_dx_context_destroy) { in vmw_hw_context_destroy()
157 (void) res->func->destroy(res); in vmw_hw_context_destroy()
174 cmd->body.cid = res->id; in vmw_hw_context_destroy()
182 struct vmw_resource *res, in vmw_gb_context_init() argument
183 void (*res_free)(struct vmw_resource *res)) in vmw_gb_context_init() argument
187 container_of(res, struct vmw_user_context, res); in vmw_gb_context_init()
189 res->guest_memory_size = (dx ? sizeof(SVGADXContextMobFormat) : in vmw_gb_context_init()
191 ret = vmw_resource_init(dev_priv, res, true, in vmw_gb_context_init()
220 &uctx->res, i); in vmw_gb_context_init()
228 res->hw_destroy = vmw_hw_context_destroy; in vmw_gb_context_init()
235 res_free(res); in vmw_gb_context_init()
237 kfree(res); in vmw_gb_context_init()
242 struct vmw_resource *res, in vmw_context_init() argument
243 void (*res_free)(struct vmw_resource *res), in vmw_context_init() argument
254 return vmw_gb_context_init(dev_priv, dx, res, res_free); in vmw_context_init()
256 ret = vmw_resource_init(dev_priv, res, false, in vmw_context_init()
264 if (unlikely(res->id >= SVGA3D_HB_MAX_CONTEXT_IDS)) { in vmw_context_init()
266 vmw_resource_unreference(&res); in vmw_context_init()
272 vmw_resource_unreference(&res); in vmw_context_init()
278 cmd->body.cid = res->id; in vmw_context_init()
282 res->hw_destroy = vmw_hw_context_destroy; in vmw_context_init()
287 kfree(res); in vmw_context_init()
289 res_free(res); in vmw_context_init()
298 static int vmw_gb_context_create(struct vmw_resource *res) in vmw_gb_context_create() argument
300 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_create()
307 if (likely(res->id != -1)) in vmw_gb_context_create()
310 ret = vmw_resource_alloc_id(res); in vmw_gb_context_create()
316 if (unlikely(res->id >= VMWGFX_NUM_GB_CONTEXT)) { in vmw_gb_context_create()
329 cmd->body.cid = res->id; in vmw_gb_context_create()
336 vmw_resource_release_id(res); in vmw_gb_context_create()
341 static int vmw_gb_context_bind(struct vmw_resource *res, in vmw_gb_context_bind() argument
344 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_bind()
359 cmd->body.cid = res->id; in vmw_gb_context_bind()
361 cmd->body.validContents = res->guest_memory_dirty; in vmw_gb_context_bind()
362 res->guest_memory_dirty = false; in vmw_gb_context_bind()
368 static int vmw_gb_context_unbind(struct vmw_resource *res, in vmw_gb_context_unbind() argument
372 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_unbind()
376 container_of(res, struct vmw_user_context, res); in vmw_gb_context_unbind()
408 cmd1->body.cid = res->id; in vmw_gb_context_unbind()
413 cmd2->body.cid = res->id; in vmw_gb_context_unbind()
434 static int vmw_gb_context_destroy(struct vmw_resource *res) in vmw_gb_context_destroy() argument
436 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_destroy()
442 if (likely(res->id == -1)) in vmw_gb_context_destroy()
451 cmd->body.cid = res->id; in vmw_gb_context_destroy()
453 if (dev_priv->query_cid == res->id) in vmw_gb_context_destroy()
455 vmw_resource_release_id(res); in vmw_gb_context_destroy()
465 static int vmw_dx_context_create(struct vmw_resource *res) in vmw_dx_context_create() argument
467 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_create()
474 if (likely(res->id != -1)) in vmw_dx_context_create()
477 ret = vmw_resource_alloc_id(res); in vmw_dx_context_create()
483 if (unlikely(res->id >= VMWGFX_NUM_DXCONTEXT)) { in vmw_dx_context_create()
496 cmd->body.cid = res->id; in vmw_dx_context_create()
503 vmw_resource_release_id(res); in vmw_dx_context_create()
508 static int vmw_dx_context_bind(struct vmw_resource *res, in vmw_dx_context_bind() argument
511 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_bind()
526 cmd->body.cid = res->id; in vmw_dx_context_bind()
528 cmd->body.validContents = res->guest_memory_dirty; in vmw_dx_context_bind()
529 res->guest_memory_dirty = false; in vmw_dx_context_bind()
554 container_of(ctx, struct vmw_user_context, res); in vmw_dx_context_scrub_cotables()
561 struct vmw_resource *res; in vmw_dx_context_scrub_cotables() local
565 res = uctx->cotables[vmw_cotable_scrub_order[i]]; in vmw_dx_context_scrub_cotables()
566 if (res) in vmw_dx_context_scrub_cotables()
567 res = vmw_resource_reference_unless_doomed(res); in vmw_dx_context_scrub_cotables()
569 if (!res) in vmw_dx_context_scrub_cotables()
572 WARN_ON(vmw_cotable_scrub(res, readback)); in vmw_dx_context_scrub_cotables()
573 vmw_resource_unreference(&res); in vmw_dx_context_scrub_cotables()
577 static int vmw_dx_context_unbind(struct vmw_resource *res, in vmw_dx_context_unbind() argument
581 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_unbind()
585 container_of(res, struct vmw_user_context, res); in vmw_dx_context_unbind()
602 vmw_dx_context_scrub_cotables(res, readback); in vmw_dx_context_unbind()
606 WARN_ON(uctx->dx_query_mob->dx_query_ctx != res); in vmw_dx_context_unbind()
624 cmd1->body.cid = res->id; in vmw_dx_context_unbind()
629 cmd2->body.cid = res->id; in vmw_dx_context_unbind()
650 static int vmw_dx_context_destroy(struct vmw_resource *res) in vmw_dx_context_destroy() argument
652 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_destroy()
658 if (likely(res->id == -1)) in vmw_dx_context_destroy()
667 cmd->body.cid = res->id; in vmw_dx_context_destroy()
669 if (dev_priv->query_cid == res->id) in vmw_dx_context_destroy()
671 vmw_resource_release_id(res); in vmw_dx_context_destroy()
684 return &(container_of(base, struct vmw_user_context, base)->res); in vmw_user_context_base_to_res()
687 static void vmw_user_context_free(struct vmw_resource *res) in vmw_user_context_free() argument
690 container_of(res, struct vmw_user_context, res); in vmw_user_context_free()
695 (void) vmw_context_bind_dx_query(res, NULL); in vmw_user_context_free()
710 struct vmw_resource *res = &ctx->res; in vmw_user_context_base_release() local
713 vmw_resource_unreference(&res); in vmw_user_context_base_release()
730 struct vmw_resource *res; in vmw_context_define() local
747 res = &ctx->res; in vmw_context_define()
755 ret = vmw_context_init(dev_priv, res, vmw_user_context_free, dx); in vmw_context_define()
759 tmp = vmw_resource_reference(&ctx->res); in vmw_context_define()
770 vmw_resource_unreference(&res); in vmw_context_define()
809 container_of(ctx, struct vmw_user_context, res); in vmw_context_binding_list()
816 return container_of(ctx, struct vmw_user_context, res)->man; in vmw_context_res_man()
828 return container_of(ctx, struct vmw_user_context, res)-> in vmw_context_cotable()
844 return container_of(ctx, struct vmw_user_context, res)->cbs; in vmw_context_binding_state()
863 container_of(ctx_res, struct vmw_user_context, res); in vmw_context_bind_dx_query()
896 container_of(ctx_res, struct vmw_user_context, res); in vmw_context_get_dx_query_mob()