Lines Matching defs:view
42 * to it, and all context bindings of that view. Similarly we must restore
43 * the view bindings, views and surfaces pointed to by the views when a
48 * struct vmw_view - view metadata
51 * @ctx: Non-refcounted pointer to the context this view belongs to.
52 * @srf: Refcounted pointer to the surface pointed to by this view.
53 * @cotable: Refcounted pointer to the cotable holding this view.
54 * @srf_head: List head for the surface-to-view list.
56 * @view_type: View type.
57 * @view_id: User-space per context view id. Currently used also as per
58 * context device view id.
59 * @cmd_size: Size of the SVGA3D define view command that we've copied from the
61 * @committed: Whether the view is actually created or pending creation at the
63 * @cmd: The SVGA3D define view command copied from the command stream.
90 .type_name = "DX view",
97 * struct vmw_view - view define command body stub
99 * @view_id: The device id of the view being defined
100 * @sid: The surface id of the view being defined
103 * saved view define command.
123 * vmw_view_commit_notify - Notify that a view operation has been committed to
126 * @res: Pointer to the view resource.
133 struct vmw_view *view = vmw_view(res);
138 struct vmw_surface *srf = vmw_res_to_srf(view->srf);
140 list_add_tail(&view->srf_head, &srf->view_list);
141 vmw_cotable_add_resource(view->cotable, &view->cotable_head);
142 view->committed = true;
143 res->id = view->view_id;
146 list_del_init(&view->cotable_head);
147 list_del_init(&view->srf_head);
148 view->committed = false;
155 * vmw_view_create - Create a hardware view.
157 * @res: Pointer to the view resource.
159 * Create a hardware view. Typically used if that view has previously been
164 struct vmw_view *view = vmw_view(res);
165 struct vmw_surface *srf = vmw_res_to_srf(view->srf);
173 if (!view->committed) {
178 cmd = VMW_FIFO_RESERVE_DX(res->dev_priv, view->cmd_size, view->ctx->id);
184 memcpy(cmd, &view->cmd, view->cmd_size);
185 WARN_ON(cmd->body.view_id != view->view_id);
187 WARN_ON(view->srf->id == SVGA3D_INVALID_ID);
188 cmd->body.sid = view->srf->id;
189 vmw_fifo_commit(res->dev_priv, view->cmd_size);
190 res->id = view->view_id;
191 list_add_tail(&view->srf_head, &srf->view_list);
192 vmw_cotable_add_resource(view->cotable, &view->cotable_head);
199 * vmw_view_destroy - Destroy a hardware view.
201 * @res: Pointer to the view resource.
203 * Destroy a hardware view. Typically used on unexpected termination of the
204 * owning process or if the surface the view is pointing to is destroyed.
209 struct vmw_view *view = vmw_view(res);
218 if (!view->committed || res->id == -1)
221 cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), view->ctx->id);
225 cmd->header.id = vmw_view_destroy_cmds[view->view_type];
227 cmd->body.view_id = view->view_id;
230 list_del_init(&view->cotable_head);
231 list_del_init(&view->srf_head);
237 * vmw_hw_view_destroy - Destroy a hardware view as part of resource cleanup.
239 * @res: Pointer to the view resource.
241 * Destroy a hardware view if it's still present.
254 * vmw_view_key - Compute a view key suitable for the cmdbuf resource manager
256 * @user_key: The user-space id used for the view.
257 * @view_type: The view type.
259 * Destroy a hardware view if it's still present.
267 * vmw_view_id_ok - Basic view id and type range checks.
269 * @user_key: The user-space id used for the view.
270 * @view_type: The view type.
272 * Checks that the view id and type (typically provided by user-space) is
282 * vmw_view_res_free - resource res_free callback for view resources
290 struct vmw_view *view = vmw_view(res);
291 size_t size = offsetof(struct vmw_view, cmd) + view->cmd_size;
294 vmw_resource_unreference(&view->cotable);
295 vmw_resource_unreference(&view->srf);
296 kfree_rcu(view, rcu);
301 * vmw_view_add - Create a view resource and stage it for addition
306 * @srf: Pointer to a struct vmw_resource identifying the surface the view
308 * @view_type: The view type deduced from the view create command.
310 * unique to the view type and to the context.
311 * @cmd: Pointer to the view create command in the command stream.
312 * @cmd_size: Size of the view create command in the command stream.
332 struct vmw_view *view;
342 VMW_DEBUG_USER("Illegal view create command size.\n");
347 VMW_DEBUG_USER("Illegal view add view id.\n");
356 DRM_ERROR("Out of graphics memory for view creation\n");
360 view = kmalloc(size, GFP_KERNEL);
361 if (!view) {
366 res = &view->res;
367 view->ctx = ctx;
368 view->srf = vmw_resource_reference(srf);
369 view->cotable = vmw_resource_reference
371 view->view_type = view_type;
372 view->view_id = user_key;
373 view->cmd_size = cmd_size;
374 view->committed = false;
375 INIT_LIST_HEAD(&view->srf_head);
376 INIT_LIST_HEAD(&view->cotable_head);
377 memcpy(&view->cmd, cmd, cmd_size);
389 res->id = view->view_id;
399 * vmw_view_remove - Stage a view for removal.
401 * @man: Pointer to the view manager identifying the shader namespace.
402 * @user_key: The key that is used to identify the view. The key is
403 * unique to the view type.
404 * @view_type: View type
416 VMW_DEBUG_USER("Illegal view remove view id.\n");
434 * a reference to the view resource. This is typically called before the
470 * vmw_view_srf - Return a non-refcounted pointer to the surface a view is
473 * @res: pointer to a view resource.
475 * Note that the view itself is holding a reference, so as long
476 * the view resource is alive, the surface resource will be.
484 * vmw_view_lookup - Look up a view.
487 * @view_type: The view type.
488 * @user_key: The view user id.
490 * returns a refcounted pointer to a view or an error pointer if not found.
501 * vmw_view_dirtying - Return whether a view type is dirtying its resource
502 * @res: Pointer to the view
505 * view pointing to it, we need to determine whether that resource will
510 * Return: Whether the view type of @res dirties the resource it points to.
519 /* Update this function as we add more view types */
571 /* Assert that the view key space can hold all view ids. */
575 * Assert that the offset of sid in all view define commands