Rev 4075 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4075 | Rev 6296 | ||
---|---|---|---|
1 | /************************************************************************** |
1 | /************************************************************************** |
2 | * |
2 | * |
3 | * Copyright © 2012 VMware, Inc., Palo Alto, CA., USA |
3 | * Copyright © 2012-2014 VMware, Inc., Palo Alto, CA., USA |
4 | * All Rights Reserved. |
4 | * All Rights Reserved. |
5 | * |
5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a |
6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the |
7 | * copy of this software and associated documentation files (the |
8 | * "Software"), to deal in the Software without restriction, including |
8 | * "Software"), to deal in the Software without restriction, including |
9 | * without limitation the rights to use, copy, modify, merge, publish, |
9 | * without limitation the rights to use, copy, modify, merge, publish, |
10 | * distribute, sub license, and/or sell copies of the Software, and to |
10 | * distribute, sub license, and/or sell copies of the Software, and to |
11 | * permit persons to whom the Software is furnished to do so, subject to |
11 | * permit persons to whom the Software is furnished to do so, subject to |
12 | * the following conditions: |
12 | * the following conditions: |
13 | * |
13 | * |
14 | * The above copyright notice and this permission notice (including the |
14 | * The above copyright notice and this permission notice (including the |
15 | * next paragraph) shall be included in all copies or substantial portions |
15 | * next paragraph) shall be included in all copies or substantial portions |
16 | * of the Software. |
16 | * of the Software. |
17 | * |
17 | * |
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, |
21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, |
22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. |
24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. |
25 | * |
25 | * |
26 | **************************************************************************/ |
26 | **************************************************************************/ |
27 | 27 | ||
28 | #ifndef _VMWGFX_RESOURCE_PRIV_H_ |
28 | #ifndef _VMWGFX_RESOURCE_PRIV_H_ |
29 | #define _VMWGFX_RESOURCE_PRIV_H_ |
29 | #define _VMWGFX_RESOURCE_PRIV_H_ |
30 | 30 | ||
31 | #include "vmwgfx_drv.h" |
31 | #include "vmwgfx_drv.h" |
- | 32 | ||
- | 33 | enum vmw_cmdbuf_res_state { |
|
- | 34 | VMW_CMDBUF_RES_COMMITTED, |
|
- | 35 | VMW_CMDBUF_RES_ADD, |
|
- | 36 | VMW_CMDBUF_RES_DEL |
|
- | 37 | }; |
|
32 | 38 | ||
33 | /** |
39 | /** |
34 | * struct vmw_user_resource_conv - Identify a derived user-exported resource |
40 | * struct vmw_user_resource_conv - Identify a derived user-exported resource |
35 | * type and provide a function to convert its ttm_base_object pointer to |
41 | * type and provide a function to convert its ttm_base_object pointer to |
36 | * a struct vmw_resource |
42 | * a struct vmw_resource |
37 | */ |
43 | */ |
38 | struct vmw_user_resource_conv { |
44 | struct vmw_user_resource_conv { |
39 | enum ttm_object_type object_type; |
45 | enum ttm_object_type object_type; |
40 | struct vmw_resource *(*base_obj_to_res)(struct ttm_base_object *base); |
46 | struct vmw_resource *(*base_obj_to_res)(struct ttm_base_object *base); |
41 | void (*res_free) (struct vmw_resource *res); |
47 | void (*res_free) (struct vmw_resource *res); |
42 | }; |
48 | }; |
43 | 49 | ||
44 | /** |
50 | /** |
45 | * struct vmw_res_func - members and functions common for a resource type |
51 | * struct vmw_res_func - members and functions common for a resource type |
46 | * |
52 | * |
47 | * @res_type: Enum that identifies the lru list to use for eviction. |
53 | * @res_type: Enum that identifies the lru list to use for eviction. |
48 | * @needs_backup: Whether the resource is guest-backed and needs |
54 | * @needs_backup: Whether the resource is guest-backed and needs |
49 | * persistent buffer storage. |
55 | * persistent buffer storage. |
50 | * @type_name: String that identifies the resource type. |
56 | * @type_name: String that identifies the resource type. |
51 | * @backup_placement: TTM placement for backup buffers. |
57 | * @backup_placement: TTM placement for backup buffers. |
52 | * @may_evict Whether the resource may be evicted. |
58 | * @may_evict Whether the resource may be evicted. |
53 | * @create: Create a hardware resource. |
59 | * @create: Create a hardware resource. |
54 | * @destroy: Destroy a hardware resource. |
60 | * @destroy: Destroy a hardware resource. |
55 | * @bind: Bind a hardware resource to persistent buffer storage. |
61 | * @bind: Bind a hardware resource to persistent buffer storage. |
56 | * @unbind: Unbind a hardware resource from persistent |
62 | * @unbind: Unbind a hardware resource from persistent |
57 | * buffer storage. |
63 | * buffer storage. |
- | 64 | * @commit_notify: If the resource is a command buffer managed resource, |
|
- | 65 | * callback to notify that a define or remove command |
|
- | 66 | * has been committed to the device. |
|
58 | */ |
67 | */ |
59 | - | ||
60 | struct vmw_res_func { |
68 | struct vmw_res_func { |
61 | enum vmw_res_type res_type; |
69 | enum vmw_res_type res_type; |
62 | bool needs_backup; |
70 | bool needs_backup; |
63 | const char *type_name; |
71 | const char *type_name; |
64 | struct ttm_placement *backup_placement; |
72 | struct ttm_placement *backup_placement; |
65 | bool may_evict; |
73 | bool may_evict; |
66 | 74 | ||
67 | int (*create) (struct vmw_resource *res); |
75 | int (*create) (struct vmw_resource *res); |
68 | int (*destroy) (struct vmw_resource *res); |
76 | int (*destroy) (struct vmw_resource *res); |
69 | int (*bind) (struct vmw_resource *res, |
77 | int (*bind) (struct vmw_resource *res, |
70 | struct ttm_validate_buffer *val_buf); |
78 | struct ttm_validate_buffer *val_buf); |
71 | int (*unbind) (struct vmw_resource *res, |
79 | int (*unbind) (struct vmw_resource *res, |
72 | bool readback, |
80 | bool readback, |
73 | struct ttm_validate_buffer *val_buf); |
81 | struct ttm_validate_buffer *val_buf); |
- | 82 | void (*commit_notify)(struct vmw_resource *res, |
|
- | 83 | enum vmw_cmdbuf_res_state state); |
|
74 | }; |
84 | }; |
75 | 85 | ||
76 | int vmw_resource_alloc_id(struct vmw_resource *res); |
86 | int vmw_resource_alloc_id(struct vmw_resource *res); |
77 | void vmw_resource_release_id(struct vmw_resource *res); |
87 | void vmw_resource_release_id(struct vmw_resource *res); |
78 | int vmw_resource_init(struct vmw_private *dev_priv, struct vmw_resource *res, |
88 | int vmw_resource_init(struct vmw_private *dev_priv, struct vmw_resource *res, |
79 | bool delay_id, |
89 | bool delay_id, |
80 | void (*res_free) (struct vmw_resource *res), |
90 | void (*res_free) (struct vmw_resource *res), |
81 | const struct vmw_res_func *func); |
91 | const struct vmw_res_func *func); |
82 | void vmw_resource_activate(struct vmw_resource *res, |
92 | void vmw_resource_activate(struct vmw_resource *res, |
83 | void (*hw_destroy) (struct vmw_resource *)); |
93 | void (*hw_destroy) (struct vmw_resource *)); |
84 | #endif |
94 | #endif |