Lines Matching refs:res

35 	struct vmw_resource res;  member
43 static void vmw_user_context_free(struct vmw_resource *res);
47 static int vmw_gb_context_create(struct vmw_resource *res);
48 static int vmw_gb_context_bind(struct vmw_resource *res,
50 static int vmw_gb_context_unbind(struct vmw_resource *res,
53 static int vmw_gb_context_destroy(struct vmw_resource *res);
54 static int vmw_dx_context_create(struct vmw_resource *res);
55 static int vmw_dx_context_bind(struct vmw_resource *res,
57 static int vmw_dx_context_unbind(struct vmw_resource *res,
60 static int vmw_dx_context_destroy(struct vmw_resource *res);
116 struct vmw_resource *res; in vmw_context_cotables_unref() local
121 res = uctx->cotables[i]; in vmw_context_cotables_unref()
125 if (res) in vmw_context_cotables_unref()
126 vmw_resource_unreference(&res); in vmw_context_cotables_unref()
130 static void vmw_hw_context_destroy(struct vmw_resource *res) in vmw_hw_context_destroy() argument
133 container_of(res, struct vmw_user_context, res); in vmw_hw_context_destroy()
134 struct vmw_private *dev_priv = res->dev_priv; in vmw_hw_context_destroy()
141 if (res->func->destroy == vmw_gb_context_destroy || in vmw_hw_context_destroy()
142 res->func->destroy == vmw_dx_context_destroy) { in vmw_hw_context_destroy()
147 (void) res->func->destroy(res); in vmw_hw_context_destroy()
167 cmd->body.cid = res->id; in vmw_hw_context_destroy()
175 struct vmw_resource *res, in vmw_gb_context_init() argument
176 void (*res_free)(struct vmw_resource *res)) in vmw_gb_context_init() argument
180 container_of(res, struct vmw_user_context, res); in vmw_gb_context_init()
182 res->backup_size = (dx ? sizeof(SVGADXContextMobFormat) : in vmw_gb_context_init()
184 ret = vmw_resource_init(dev_priv, res, true, in vmw_gb_context_init()
211 &uctx->res, i); in vmw_gb_context_init()
221 vmw_resource_activate(res, vmw_hw_context_destroy); in vmw_gb_context_init()
228 res_free(res); in vmw_gb_context_init()
230 kfree(res); in vmw_gb_context_init()
235 struct vmw_resource *res, in vmw_context_init() argument
236 void (*res_free)(struct vmw_resource *res), in vmw_context_init() argument
247 return vmw_gb_context_init(dev_priv, dx, res, res_free); in vmw_context_init()
249 ret = vmw_resource_init(dev_priv, res, false, in vmw_context_init()
257 if (unlikely(res->id >= SVGA3D_MAX_CONTEXT_IDS)) { in vmw_context_init()
259 vmw_resource_unreference(&res); in vmw_context_init()
266 vmw_resource_unreference(&res); in vmw_context_init()
272 cmd->body.cid = res->id; in vmw_context_init()
276 vmw_resource_activate(res, vmw_hw_context_destroy); in vmw_context_init()
281 kfree(res); in vmw_context_init()
283 res_free(res); in vmw_context_init()
292 static int vmw_gb_context_create(struct vmw_resource *res) in vmw_gb_context_create() argument
294 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_create()
301 if (likely(res->id != -1)) in vmw_gb_context_create()
304 ret = vmw_resource_alloc_id(res); in vmw_gb_context_create()
310 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()
357 cmd->body.cid = res->id; in vmw_gb_context_bind()
359 cmd->body.validContents = res->backup_dirty; in vmw_gb_context_bind()
360 res->backup_dirty = false; in vmw_gb_context_bind()
366 static int vmw_gb_context_unbind(struct vmw_resource *res, in vmw_gb_context_unbind() argument
370 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_unbind()
374 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()
454 cmd->body.cid = res->id; in vmw_gb_context_destroy()
456 if (dev_priv->query_cid == res->id) in vmw_gb_context_destroy()
458 vmw_resource_release_id(res); in vmw_gb_context_destroy()
468 static int vmw_dx_context_create(struct vmw_resource *res) in vmw_dx_context_create() argument
470 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_create()
477 if (likely(res->id != -1)) in vmw_dx_context_create()
480 ret = vmw_resource_alloc_id(res); in vmw_dx_context_create()
486 if (unlikely(res->id >= VMWGFX_NUM_DXCONTEXT)) { in vmw_dx_context_create()
501 cmd->body.cid = res->id; in vmw_dx_context_create()
508 vmw_resource_release_id(res); in vmw_dx_context_create()
513 static int vmw_dx_context_bind(struct vmw_resource *res, in vmw_dx_context_bind() argument
516 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_bind()
534 cmd->body.cid = res->id; in vmw_dx_context_bind()
536 cmd->body.validContents = res->backup_dirty; in vmw_dx_context_bind()
537 res->backup_dirty = false; in vmw_dx_context_bind()
562 container_of(ctx, struct vmw_user_context, res); in vmw_dx_context_scrub_cotables()
567 struct vmw_resource *res; in vmw_dx_context_scrub_cotables() local
571 res = uctx->cotables[vmw_cotable_scrub_order[i]]; in vmw_dx_context_scrub_cotables()
572 if (res) in vmw_dx_context_scrub_cotables()
573 res = vmw_resource_reference_unless_doomed(res); in vmw_dx_context_scrub_cotables()
575 if (!res) in vmw_dx_context_scrub_cotables()
578 WARN_ON(vmw_cotable_scrub(res, readback)); in vmw_dx_context_scrub_cotables()
579 vmw_resource_unreference(&res); in vmw_dx_context_scrub_cotables()
583 static int vmw_dx_context_unbind(struct vmw_resource *res, in vmw_dx_context_unbind() argument
587 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_unbind()
591 container_of(res, struct vmw_user_context, res); in vmw_dx_context_unbind()
608 vmw_dx_context_scrub_cotables(res, readback); in vmw_dx_context_unbind()
612 WARN_ON(uctx->dx_query_mob->dx_query_ctx != res); in vmw_dx_context_unbind()
632 cmd1->body.cid = res->id; in vmw_dx_context_unbind()
637 cmd2->body.cid = res->id; in vmw_dx_context_unbind()
658 static int vmw_dx_context_destroy(struct vmw_resource *res) in vmw_dx_context_destroy() argument
660 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_destroy()
666 if (likely(res->id == -1)) in vmw_dx_context_destroy()
678 cmd->body.cid = res->id; in vmw_dx_context_destroy()
680 if (dev_priv->query_cid == res->id) in vmw_dx_context_destroy()
682 vmw_resource_release_id(res); in vmw_dx_context_destroy()
695 return &(container_of(base, struct vmw_user_context, base)->res); in vmw_user_context_base_to_res()
698 static void vmw_user_context_free(struct vmw_resource *res) in vmw_user_context_free() argument
701 container_of(res, struct vmw_user_context, res); in vmw_user_context_free()
702 struct vmw_private *dev_priv = res->dev_priv; in vmw_user_context_free()
707 (void) vmw_context_bind_dx_query(res, NULL); in vmw_user_context_free()
724 struct vmw_resource *res = &ctx->res; in vmw_user_context_base_release() local
727 vmw_resource_unreference(&res); in vmw_user_context_base_release()
744 struct vmw_resource *res; in vmw_context_define() local
786 res = &ctx->res; in vmw_context_define()
794 ret = vmw_context_init(dev_priv, res, vmw_user_context_free, dx); in vmw_context_define()
798 tmp = vmw_resource_reference(&ctx->res); in vmw_context_define()
809 vmw_resource_unreference(&res); in vmw_context_define()
849 container_of(ctx, struct vmw_user_context, res); in vmw_context_binding_list()
856 return container_of(ctx, struct vmw_user_context, res)->man; in vmw_context_res_man()
866 (container_of(ctx, struct vmw_user_context, res)-> in vmw_context_cotable()
882 return container_of(ctx, struct vmw_user_context, res)->cbs; in vmw_context_binding_state()
901 container_of(ctx_res, struct vmw_user_context, res); in vmw_context_bind_dx_query()
934 container_of(ctx_res, struct vmw_user_context, res); in vmw_context_get_dx_query_mob()