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);
121 struct vmw_resource *res; in vmw_context_cotables_unref() local
126 res = uctx->cotables[i]; in vmw_context_cotables_unref()
130 if (res) in vmw_context_cotables_unref()
131 vmw_resource_unreference(&res); in vmw_context_cotables_unref()
135 static void vmw_hw_context_destroy(struct vmw_resource *res) in vmw_hw_context_destroy() argument
138 container_of(res, struct vmw_user_context, res); in vmw_hw_context_destroy()
139 struct vmw_private *dev_priv = res->dev_priv; in vmw_hw_context_destroy()
146 if (res->func->destroy == vmw_gb_context_destroy || in vmw_hw_context_destroy()
147 res->func->destroy == vmw_dx_context_destroy) { in vmw_hw_context_destroy()
152 (void) res->func->destroy(res); in vmw_hw_context_destroy()
169 cmd->body.cid = res->id; in vmw_hw_context_destroy()
177 struct vmw_resource *res, in vmw_gb_context_init() argument
178 void (*res_free)(struct vmw_resource *res)) in vmw_gb_context_init() argument
182 container_of(res, struct vmw_user_context, res); in vmw_gb_context_init()
184 res->backup_size = (dx ? sizeof(SVGADXContextMobFormat) : in vmw_gb_context_init()
186 ret = vmw_resource_init(dev_priv, res, true, in vmw_gb_context_init()
213 &uctx->res, i); in vmw_gb_context_init()
221 res->hw_destroy = 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()
265 vmw_resource_unreference(&res); in vmw_context_init()
271 cmd->body.cid = res->id; in vmw_context_init()
275 res->hw_destroy = vmw_hw_context_destroy; in vmw_context_init()
280 kfree(res); in vmw_context_init()
282 res_free(res); in vmw_context_init()
291 static int vmw_gb_context_create(struct vmw_resource *res) in vmw_gb_context_create() argument
293 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_create()
300 if (likely(res->id != -1)) in vmw_gb_context_create()
303 ret = vmw_resource_alloc_id(res); in vmw_gb_context_create()
309 if (unlikely(res->id >= VMWGFX_NUM_GB_CONTEXT)) { in vmw_gb_context_create()
322 cmd->body.cid = res->id; in vmw_gb_context_create()
329 vmw_resource_release_id(res); in vmw_gb_context_create()
334 static int vmw_gb_context_bind(struct vmw_resource *res, in vmw_gb_context_bind() argument
337 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_bind()
352 cmd->body.cid = res->id; in vmw_gb_context_bind()
354 cmd->body.validContents = res->backup_dirty; in vmw_gb_context_bind()
355 res->backup_dirty = false; in vmw_gb_context_bind()
361 static int vmw_gb_context_unbind(struct vmw_resource *res, in vmw_gb_context_unbind() argument
365 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_unbind()
369 container_of(res, struct vmw_user_context, res); in vmw_gb_context_unbind()
401 cmd1->body.cid = res->id; in vmw_gb_context_unbind()
406 cmd2->body.cid = res->id; in vmw_gb_context_unbind()
427 static int vmw_gb_context_destroy(struct vmw_resource *res) in vmw_gb_context_destroy() argument
429 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_destroy()
435 if (likely(res->id == -1)) in vmw_gb_context_destroy()
444 cmd->body.cid = res->id; in vmw_gb_context_destroy()
446 if (dev_priv->query_cid == res->id) in vmw_gb_context_destroy()
448 vmw_resource_release_id(res); in vmw_gb_context_destroy()
458 static int vmw_dx_context_create(struct vmw_resource *res) in vmw_dx_context_create() argument
460 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_create()
467 if (likely(res->id != -1)) in vmw_dx_context_create()
470 ret = vmw_resource_alloc_id(res); in vmw_dx_context_create()
476 if (unlikely(res->id >= VMWGFX_NUM_DXCONTEXT)) { in vmw_dx_context_create()
489 cmd->body.cid = res->id; in vmw_dx_context_create()
496 vmw_resource_release_id(res); in vmw_dx_context_create()
501 static int vmw_dx_context_bind(struct vmw_resource *res, in vmw_dx_context_bind() argument
504 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_bind()
519 cmd->body.cid = res->id; in vmw_dx_context_bind()
521 cmd->body.validContents = res->backup_dirty; in vmw_dx_context_bind()
522 res->backup_dirty = false; in vmw_dx_context_bind()
547 container_of(ctx, struct vmw_user_context, res); in vmw_dx_context_scrub_cotables()
552 struct vmw_resource *res; in vmw_dx_context_scrub_cotables() local
556 res = uctx->cotables[vmw_cotable_scrub_order[i]]; in vmw_dx_context_scrub_cotables()
557 if (res) in vmw_dx_context_scrub_cotables()
558 res = vmw_resource_reference_unless_doomed(res); in vmw_dx_context_scrub_cotables()
560 if (!res) in vmw_dx_context_scrub_cotables()
563 WARN_ON(vmw_cotable_scrub(res, readback)); in vmw_dx_context_scrub_cotables()
564 vmw_resource_unreference(&res); in vmw_dx_context_scrub_cotables()
568 static int vmw_dx_context_unbind(struct vmw_resource *res, in vmw_dx_context_unbind() argument
572 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_unbind()
576 container_of(res, struct vmw_user_context, res); in vmw_dx_context_unbind()
593 vmw_dx_context_scrub_cotables(res, readback); in vmw_dx_context_unbind()
597 WARN_ON(uctx->dx_query_mob->dx_query_ctx != res); in vmw_dx_context_unbind()
615 cmd1->body.cid = res->id; in vmw_dx_context_unbind()
620 cmd2->body.cid = res->id; in vmw_dx_context_unbind()
641 static int vmw_dx_context_destroy(struct vmw_resource *res) in vmw_dx_context_destroy() argument
643 struct vmw_private *dev_priv = res->dev_priv; in vmw_dx_context_destroy()
649 if (likely(res->id == -1)) in vmw_dx_context_destroy()
658 cmd->body.cid = res->id; in vmw_dx_context_destroy()
660 if (dev_priv->query_cid == res->id) in vmw_dx_context_destroy()
662 vmw_resource_release_id(res); in vmw_dx_context_destroy()
675 return &(container_of(base, struct vmw_user_context, base)->res); in vmw_user_context_base_to_res()
678 static void vmw_user_context_free(struct vmw_resource *res) in vmw_user_context_free() argument
681 container_of(res, struct vmw_user_context, res); in vmw_user_context_free()
682 struct vmw_private *dev_priv = res->dev_priv; in vmw_user_context_free()
687 (void) vmw_context_bind_dx_query(res, NULL); in vmw_user_context_free()
704 struct vmw_resource *res = &ctx->res; in vmw_user_context_base_release() local
707 vmw_resource_unreference(&res); in vmw_user_context_base_release()
724 struct vmw_resource *res; in vmw_context_define() local
766 res = &ctx->res; in vmw_context_define()
774 ret = vmw_context_init(dev_priv, res, vmw_user_context_free, dx); in vmw_context_define()
778 tmp = vmw_resource_reference(&ctx->res); in vmw_context_define()
789 vmw_resource_unreference(&res); in vmw_context_define()
829 container_of(ctx, struct vmw_user_context, res); in vmw_context_binding_list()
836 return container_of(ctx, struct vmw_user_context, res)->man; in vmw_context_res_man()
845 return container_of(ctx, struct vmw_user_context, res)-> in vmw_context_cotable()
861 return container_of(ctx, struct vmw_user_context, res)->cbs; in vmw_context_binding_state()
880 container_of(ctx_res, struct vmw_user_context, res); in vmw_context_bind_dx_query()
913 container_of(ctx_res, struct vmw_user_context, res); in vmw_context_get_dx_query_mob()