Lines Matching refs:res
36 struct vmw_resource res; member
44 static void vmw_user_context_free(struct vmw_resource *res);
48 static int vmw_gb_context_create(struct vmw_resource *res);
49 static int vmw_gb_context_bind(struct vmw_resource *res,
51 static int vmw_gb_context_unbind(struct vmw_resource *res,
54 static int vmw_gb_context_destroy(struct vmw_resource *res);
55 static int vmw_dx_context_create(struct vmw_resource *res);
56 static int vmw_dx_context_bind(struct vmw_resource *res,
58 static int vmw_dx_context_unbind(struct vmw_resource *res,
61 static int vmw_dx_context_destroy(struct vmw_resource *res);
120 struct vmw_resource *res; in vmw_context_cotables_unref() local
127 res = uctx->cotables[i]; in vmw_context_cotables_unref()
131 if (res) in vmw_context_cotables_unref()
132 vmw_resource_unreference(&res); in vmw_context_cotables_unref()
136 static void vmw_hw_context_destroy(struct vmw_resource *res) in vmw_hw_context_destroy() argument
139 container_of(res, struct vmw_user_context, res); in vmw_hw_context_destroy()
140 struct vmw_private *dev_priv = res->dev_priv; in vmw_hw_context_destroy()
147 if (res->func->destroy == vmw_gb_context_destroy || in vmw_hw_context_destroy()
148 res->func->destroy == vmw_dx_context_destroy) { in vmw_hw_context_destroy()
153 (void) res->func->destroy(res); in vmw_hw_context_destroy()
170 cmd->body.cid = res->id; in vmw_hw_context_destroy()
178 struct vmw_resource *res, in vmw_gb_context_init() argument
179 void (*res_free)(struct vmw_resource *res)) in vmw_gb_context_init() argument
183 container_of(res, struct vmw_user_context, res); in vmw_gb_context_init()
185 res->backup_size = (dx ? sizeof(SVGADXContextMobFormat) : in vmw_gb_context_init()
187 ret = vmw_resource_init(dev_priv, res, true, in vmw_gb_context_init()
216 &uctx->res, i); in vmw_gb_context_init()
224 res->hw_destroy = vmw_hw_context_destroy; in vmw_gb_context_init()
231 res_free(res); in vmw_gb_context_init()
233 kfree(res); in vmw_gb_context_init()
238 struct vmw_resource *res, in vmw_context_init() argument
239 void (*res_free)(struct vmw_resource *res), in vmw_context_init() argument
250 return vmw_gb_context_init(dev_priv, dx, res, res_free); in vmw_context_init()
252 ret = vmw_resource_init(dev_priv, res, false, in vmw_context_init()
260 if (unlikely(res->id >= SVGA3D_HB_MAX_CONTEXT_IDS)) { in vmw_context_init()
262 vmw_resource_unreference(&res); in vmw_context_init()
268 vmw_resource_unreference(&res); in vmw_context_init()
274 cmd->body.cid = res->id; in vmw_context_init()
278 res->hw_destroy = vmw_hw_context_destroy; in vmw_context_init()
283 kfree(res); in vmw_context_init()
285 res_free(res); in vmw_context_init()
294 static int vmw_gb_context_create(struct vmw_resource *res) in vmw_gb_context_create() argument
296 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_create()
303 if (likely(res->id != -1)) in vmw_gb_context_create()
306 ret = vmw_resource_alloc_id(res); in vmw_gb_context_create()
312 if (unlikely(res->id >= VMWGFX_NUM_GB_CONTEXT)) { in vmw_gb_context_create()
325 cmd->body.cid = res->id; in vmw_gb_context_create()
332 vmw_resource_release_id(res); in vmw_gb_context_create()
337 static int vmw_gb_context_bind(struct vmw_resource *res, in vmw_gb_context_bind() argument
340 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_bind()
355 cmd->body.cid = res->id; in vmw_gb_context_bind()
357 cmd->body.validContents = res->backup_dirty; in vmw_gb_context_bind()
358 res->backup_dirty = false; in vmw_gb_context_bind()
364 static int vmw_gb_context_unbind(struct vmw_resource *res, in vmw_gb_context_unbind() argument
368 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_unbind()
372 container_of(res, struct vmw_user_context, res); in vmw_gb_context_unbind()
404 cmd1->body.cid = res->id; in vmw_gb_context_unbind()
409 cmd2->body.cid = res->id; in vmw_gb_context_unbind()
430 static int vmw_gb_context_destroy(struct vmw_resource *res) in vmw_gb_context_destroy() argument
432 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_destroy()
438 if (likely(res->id == -1)) in vmw_gb_context_destroy()
447 cmd->body.cid = res->id; in vmw_gb_context_destroy()
449 if (dev_priv->query_cid == res->id) in vmw_gb_context_destroy()
451 vmw_resource_release_id(res); in vmw_gb_context_destroy()
461 static int vmw_dx_context_create(struct vmw_resource *res) in vmw_dx_context_create() argument
463 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_create()
470 if (likely(res->id != -1)) in vmw_dx_context_create()
473 ret = vmw_resource_alloc_id(res); in vmw_dx_context_create()
479 if (unlikely(res->id >= VMWGFX_NUM_DXCONTEXT)) { in vmw_dx_context_create()
492 cmd->body.cid = res->id; in vmw_dx_context_create()
499 vmw_resource_release_id(res); in vmw_dx_context_create()
504 static int vmw_dx_context_bind(struct vmw_resource *res, in vmw_dx_context_bind() argument
507 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_bind()
522 cmd->body.cid = res->id; in vmw_dx_context_bind()
524 cmd->body.validContents = res->backup_dirty; in vmw_dx_context_bind()
525 res->backup_dirty = false; in vmw_dx_context_bind()
550 container_of(ctx, struct vmw_user_context, res); in vmw_dx_context_scrub_cotables()
557 struct vmw_resource *res; in vmw_dx_context_scrub_cotables() local
561 res = uctx->cotables[vmw_cotable_scrub_order[i]]; in vmw_dx_context_scrub_cotables()
562 if (res) in vmw_dx_context_scrub_cotables()
563 res = vmw_resource_reference_unless_doomed(res); in vmw_dx_context_scrub_cotables()
565 if (!res) in vmw_dx_context_scrub_cotables()
568 WARN_ON(vmw_cotable_scrub(res, readback)); in vmw_dx_context_scrub_cotables()
569 vmw_resource_unreference(&res); in vmw_dx_context_scrub_cotables()
573 static int vmw_dx_context_unbind(struct vmw_resource *res, in vmw_dx_context_unbind() argument
577 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_unbind()
581 container_of(res, struct vmw_user_context, res); in vmw_dx_context_unbind()
598 vmw_dx_context_scrub_cotables(res, readback); in vmw_dx_context_unbind()
602 WARN_ON(uctx->dx_query_mob->dx_query_ctx != res); in vmw_dx_context_unbind()
620 cmd1->body.cid = res->id; in vmw_dx_context_unbind()
625 cmd2->body.cid = res->id; in vmw_dx_context_unbind()
646 static int vmw_dx_context_destroy(struct vmw_resource *res) in vmw_dx_context_destroy() argument
648 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_destroy()
654 if (likely(res->id == -1)) in vmw_dx_context_destroy()
663 cmd->body.cid = res->id; in vmw_dx_context_destroy()
665 if (dev_priv->query_cid == res->id) in vmw_dx_context_destroy()
667 vmw_resource_release_id(res); in vmw_dx_context_destroy()
680 return &(container_of(base, struct vmw_user_context, base)->res); in vmw_user_context_base_to_res()
683 static void vmw_user_context_free(struct vmw_resource *res) in vmw_user_context_free() argument
686 container_of(res, struct vmw_user_context, res); in vmw_user_context_free()
691 (void) vmw_context_bind_dx_query(res, NULL); in vmw_user_context_free()
706 struct vmw_resource *res = &ctx->res; in vmw_user_context_base_release() local
709 vmw_resource_unreference(&res); in vmw_user_context_base_release()
726 struct vmw_resource *res; in vmw_context_define() local
743 res = &ctx->res; in vmw_context_define()
751 ret = vmw_context_init(dev_priv, res, vmw_user_context_free, dx); in vmw_context_define()
755 tmp = vmw_resource_reference(&ctx->res); in vmw_context_define()
766 vmw_resource_unreference(&res); in vmw_context_define()
805 container_of(ctx, struct vmw_user_context, res); in vmw_context_binding_list()
812 return container_of(ctx, struct vmw_user_context, res)->man; in vmw_context_res_man()
824 return container_of(ctx, struct vmw_user_context, res)-> in vmw_context_cotable()
840 return container_of(ctx, struct vmw_user_context, res)->cbs; in vmw_context_binding_state()
859 container_of(ctx_res, struct vmw_user_context, res); in vmw_context_bind_dx_query()
892 container_of(ctx_res, struct vmw_user_context, res); in vmw_context_get_dx_query_mob()