Lines Matching refs:res

34 	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);
105 static void vmw_hw_context_destroy(struct vmw_resource *res) in vmw_hw_context_destroy() argument
108 container_of(res, struct vmw_user_context, res); in vmw_hw_context_destroy()
109 struct vmw_private *dev_priv = res->dev_priv; in vmw_hw_context_destroy()
116 if (res->func->destroy == vmw_gb_context_destroy) { in vmw_hw_context_destroy()
121 (void) vmw_gb_context_destroy(res); in vmw_hw_context_destroy()
140 cmd->body.cid = cpu_to_le32(res->id); in vmw_hw_context_destroy()
147 struct vmw_resource *res, in vmw_gb_context_init() argument
148 void (*res_free) (struct vmw_resource *res)) in vmw_gb_context_init()
152 container_of(res, struct vmw_user_context, res); in vmw_gb_context_init()
154 ret = vmw_resource_init(dev_priv, res, true, in vmw_gb_context_init()
156 res->backup_size = SVGA3D_CONTEXT_DATA_SIZE; in vmw_gb_context_init()
172 vmw_resource_activate(res, vmw_hw_context_destroy); in vmw_gb_context_init()
177 res_free(res); in vmw_gb_context_init()
179 kfree(res); in vmw_gb_context_init()
184 struct vmw_resource *res, in vmw_context_init() argument
185 void (*res_free) (struct vmw_resource *res)) in vmw_context_init()
195 return vmw_gb_context_init(dev_priv, res, res_free); in vmw_context_init()
197 ret = vmw_resource_init(dev_priv, res, false, in vmw_context_init()
205 if (unlikely(res->id >= SVGA3D_MAX_CONTEXT_IDS)) { in vmw_context_init()
207 vmw_resource_unreference(&res); in vmw_context_init()
214 vmw_resource_unreference(&res); in vmw_context_init()
220 cmd->body.cid = cpu_to_le32(res->id); in vmw_context_init()
224 vmw_resource_activate(res, vmw_hw_context_destroy); in vmw_context_init()
229 kfree(res); in vmw_context_init()
231 res_free(res); in vmw_context_init()
237 struct vmw_resource *res = kmalloc(sizeof(*res), GFP_KERNEL); in vmw_context_alloc() local
240 if (unlikely(res == NULL)) in vmw_context_alloc()
243 ret = vmw_context_init(dev_priv, res, NULL); in vmw_context_alloc()
245 return (ret == 0) ? res : NULL; in vmw_context_alloc()
249 static int vmw_gb_context_create(struct vmw_resource *res) in vmw_gb_context_create() argument
251 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_create()
258 if (likely(res->id != -1)) in vmw_gb_context_create()
261 ret = vmw_resource_alloc_id(res); in vmw_gb_context_create()
267 if (unlikely(res->id >= VMWGFX_NUM_GB_CONTEXT)) { in vmw_gb_context_create()
282 cmd->body.cid = res->id; in vmw_gb_context_create()
289 vmw_resource_release_id(res); in vmw_gb_context_create()
294 static int vmw_gb_context_bind(struct vmw_resource *res, in vmw_gb_context_bind() argument
297 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_bind()
315 cmd->body.cid = res->id; in vmw_gb_context_bind()
317 cmd->body.validContents = res->backup_dirty; in vmw_gb_context_bind()
318 res->backup_dirty = false; in vmw_gb_context_bind()
324 static int vmw_gb_context_unbind(struct vmw_resource *res, in vmw_gb_context_unbind() argument
328 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_unbind()
332 container_of(res, struct vmw_user_context, res); in vmw_gb_context_unbind()
366 cmd1->body.cid = res->id; in vmw_gb_context_unbind()
371 cmd2->body.cid = res->id; in vmw_gb_context_unbind()
392 static int vmw_gb_context_destroy(struct vmw_resource *res) in vmw_gb_context_destroy() argument
394 struct vmw_private *dev_priv = res->dev_priv; in vmw_gb_context_destroy()
400 if (likely(res->id == -1)) in vmw_gb_context_destroy()
412 cmd->body.cid = res->id; in vmw_gb_context_destroy()
414 if (dev_priv->query_cid == res->id) in vmw_gb_context_destroy()
416 vmw_resource_release_id(res); in vmw_gb_context_destroy()
429 return &(container_of(base, struct vmw_user_context, base)->res); in vmw_user_context_base_to_res()
432 static void vmw_user_context_free(struct vmw_resource *res) in vmw_user_context_free() argument
435 container_of(res, struct vmw_user_context, res); in vmw_user_context_free()
436 struct vmw_private *dev_priv = res->dev_priv; in vmw_user_context_free()
453 struct vmw_resource *res = &ctx->res; in vmw_user_context_base_release() local
456 vmw_resource_unreference(&res); in vmw_user_context_base_release()
473 struct vmw_resource *res; in vmw_context_define_ioctl() local
511 res = &ctx->res; in vmw_context_define_ioctl()
519 ret = vmw_context_init(dev_priv, res, vmw_user_context_free); in vmw_context_define_ioctl()
523 tmp = vmw_resource_reference(&ctx->res); in vmw_context_define_ioctl()
534 vmw_resource_unreference(&res); in vmw_context_define_ioctl()
566 cmd->body.shid = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID); in vmw_context_scrub_shader()
599 cmd->body.target.sid = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID); in vmw_context_scrub_render_target()
641 cmd->body.s1.value = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID); in vmw_context_scrub_texture()
750 if (bi->res != NULL) { in vmw_context_binding_transfer()
753 list_add_tail(&loc->res_list, &bi->res->binding_head); in vmw_context_binding_transfer()
864 container_of(ctx, struct vmw_user_context, res); in vmw_context_binding_state_transfer()
883 container_of(ctx, struct vmw_user_context, res); in vmw_context_rebind_all()
891 if (WARN_ON(entry->bi.res == NULL || entry->bi.res->id == in vmw_context_rebind_all()
915 return &(container_of(ctx, struct vmw_user_context, res)->cbs.list); in vmw_context_binding_list()
920 return container_of(ctx, struct vmw_user_context, res)->man; in vmw_context_res_man()