Lines Matching refs:view

38  * to it, and all context bindings of that view. Similarly we must restore
39 * the view bindings, views and surfaces pointed to by the views when a
44 * struct vmw_view - view metadata
48 * @ctx: Non-refcounted pointer to the context this view belongs to.
49 * @srf: Refcounted pointer to the surface pointed to by this view.
50 * @cotable: Refcounted pointer to the cotable holding this view.
51 * @srf_head: List head for the surface-to-view list.
54 * @view_id: User-space per context view id. Currently used also as per
55 * context device view id.
56 * @cmd_size: Size of the SVGA3D define view command that we've copied from the
58 * @committed: Whether the view is actually created or pending creation at the
60 * @cmd: The SVGA3D define view command copied from the command stream.
87 .type_name = "DX view",
95 * struct vmw_view_define - view define command body stub
97 * @view_id: The device id of the view being defined
98 * @sid: The surface id of the view being defined
101 * saved view define command.
121 * vmw_view_commit_notify - Notify that a view operation has been committed to
124 * @res: Pointer to the view resource.
131 struct vmw_view *view = vmw_view(res);
136 struct vmw_surface *srf = vmw_res_to_srf(view->srf);
138 list_add_tail(&view->srf_head, &srf->view_list);
139 vmw_cotable_add_resource(view->cotable, &view->cotable_head);
140 view->committed = true;
141 res->id = view->view_id;
144 list_del_init(&view->cotable_head);
145 list_del_init(&view->srf_head);
146 view->committed = false;
153 * vmw_view_create - Create a hardware view.
155 * @res: Pointer to the view resource.
157 * Create a hardware view. Typically used if that view has previously been
162 struct vmw_view *view = vmw_view(res);
163 struct vmw_surface *srf = vmw_res_to_srf(view->srf);
171 if (!view->committed) {
176 cmd = VMW_CMD_CTX_RESERVE(res->dev_priv, view->cmd_size, view->ctx->id);
182 memcpy(cmd, &view->cmd, view->cmd_size);
183 WARN_ON(cmd->body.view_id != view->view_id);
185 WARN_ON(view->srf->id == SVGA3D_INVALID_ID);
186 cmd->body.sid = view->srf->id;
187 vmw_cmd_commit(res->dev_priv, view->cmd_size);
188 res->id = view->view_id;
189 list_add_tail(&view->srf_head, &srf->view_list);
190 vmw_cotable_add_resource(view->cotable, &view->cotable_head);
197 * vmw_view_destroy - Destroy a hardware view.
199 * @res: Pointer to the view resource.
201 * Destroy a hardware view. Typically used on unexpected termination of the
202 * owning process or if the surface the view is pointing to is destroyed.
207 struct vmw_view *view = vmw_view(res);
216 if (!view->committed || res->id == -1)
219 cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), view->ctx->id);
223 cmd->header.id = vmw_view_destroy_cmds[view->view_type];
225 cmd->body.view_id = view->view_id;
228 list_del_init(&view->cotable_head);
229 list_del_init(&view->srf_head);
235 * vmw_hw_view_destroy - Destroy a hardware view as part of resource cleanup.
237 * @res: Pointer to the view resource.
239 * Destroy a hardware view if it's still present.
252 * vmw_view_key - Compute a view key suitable for the cmdbuf resource manager
254 * @user_key: The user-space id used for the view.
255 * @view_type: The view type.
257 * Destroy a hardware view if it's still present.
265 * vmw_view_id_ok - Basic view id and type range checks.
267 * @user_key: The user-space id used for the view.
268 * @view_type: The view type.
270 * Checks that the view id and type (typically provided by user-space) is
280 * vmw_view_res_free - resource res_free callback for view resources
288 struct vmw_view *view = vmw_view(res);
290 vmw_resource_unreference(&view->cotable);
291 vmw_resource_unreference(&view->srf);
292 kfree_rcu(view, rcu);
296 * vmw_view_add - Create a view resource and stage it for addition
301 * @srf: Pointer to a struct vmw_resource identifying the surface the view
303 * @view_type: The view type deduced from the view create command.
305 * unique to the view type and to the context.
306 * @cmd: Pointer to the view create command in the command stream.
307 * @cmd_size: Size of the view create command in the command stream.
328 struct vmw_view *view;
334 VMW_DEBUG_USER("Illegal view create command size.\n");
339 VMW_DEBUG_USER("Illegal view add view id.\n");
345 view = kmalloc(size, GFP_KERNEL);
346 if (!view) {
350 res = &view->res;
351 view->ctx = ctx;
352 view->srf = vmw_resource_reference(srf);
353 view->cotable = vmw_resource_reference
355 view->view_type = view_type;
356 view->view_id = user_key;
357 view->cmd_size = cmd_size;
358 view->committed = false;
359 INIT_LIST_HEAD(&view->srf_head);
360 INIT_LIST_HEAD(&view->cotable_head);
361 memcpy(&view->cmd, cmd, cmd_size);
373 res->id = view->view_id;
383 * vmw_view_remove - Stage a view for removal.
385 * @man: Pointer to the view manager identifying the shader namespace.
386 * @user_key: The key that is used to identify the view. The key is
387 * unique to the view type.
400 VMW_DEBUG_USER("Illegal view remove view id.\n");
418 * a reference to the view resource. This is typically called before the
454 * vmw_view_srf - Return a non-refcounted pointer to the surface a view is
457 * @res: pointer to a view resource.
459 * Note that the view itself is holding a reference, so as long
460 * the view resource is alive, the surface resource will be.
468 * vmw_view_lookup - Look up a view.
471 * @view_type: The view type.
472 * @user_key: The view user id.
474 * returns a refcounted pointer to a view or an error pointer if not found.
485 * vmw_view_dirtying - Return whether a view type is dirtying its resource
486 * @res: Pointer to the view
489 * view pointing to it, we need to determine whether that resource will
494 * Return: Whether the view type of @res dirties the resource it points to.
504 /* Update this function as we add more view types */
559 /* Assert that the view key space can hold all view ids. */
563 * Assert that the offset of sid in all view define commands