diff options
author | Dave Airlie <airlied@redhat.com> | 2012-04-02 06:46:06 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-05-23 05:46:27 -0400 |
commit | 129b78bfca591e736e56a294f0e357d73d938f7e (patch) | |
tree | b5754d4b12346b67077ac3b2239c04bda37bf6a0 /include/drm | |
parent | 96503f592fd729f296f5870a57be0417eeffc92a (diff) |
ttm: add prime sharing support to TTM (v2)
This adds the ability for ttm common code to take an SG table
and use it as the backing for a slave TTM object.
The drivers can then populate their GTT tables using the SG object.
v2: make sure to setup VM for sg bos as well.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/ttm/ttm_bo_api.h | 9 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 974c8f801c39..e15f2a89a270 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
@@ -124,11 +124,15 @@ struct ttm_mem_reg { | |||
124 | * | 124 | * |
125 | * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, | 125 | * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, |
126 | * but they cannot be accessed from user-space. For kernel-only use. | 126 | * but they cannot be accessed from user-space. For kernel-only use. |
127 | * | ||
128 | * @ttm_bo_type_sg: Buffer made from dmabuf sg table shared with another | ||
129 | * driver. | ||
127 | */ | 130 | */ |
128 | 131 | ||
129 | enum ttm_bo_type { | 132 | enum ttm_bo_type { |
130 | ttm_bo_type_device, | 133 | ttm_bo_type_device, |
131 | ttm_bo_type_kernel | 134 | ttm_bo_type_kernel, |
135 | ttm_bo_type_sg | ||
132 | }; | 136 | }; |
133 | 137 | ||
134 | struct ttm_tt; | 138 | struct ttm_tt; |
@@ -271,6 +275,8 @@ struct ttm_buffer_object { | |||
271 | 275 | ||
272 | unsigned long offset; | 276 | unsigned long offset; |
273 | uint32_t cur_placement; | 277 | uint32_t cur_placement; |
278 | |||
279 | struct sg_table *sg; | ||
274 | }; | 280 | }; |
275 | 281 | ||
276 | /** | 282 | /** |
@@ -503,6 +509,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev, | |||
503 | bool interrubtible, | 509 | bool interrubtible, |
504 | struct file *persistent_swap_storage, | 510 | struct file *persistent_swap_storage, |
505 | size_t acc_size, | 511 | size_t acc_size, |
512 | struct sg_table *sg, | ||
506 | void (*destroy) (struct ttm_buffer_object *)); | 513 | void (*destroy) (struct ttm_buffer_object *)); |
507 | 514 | ||
508 | /** | 515 | /** |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index d43e892307ff..a05f1b55714d 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -81,6 +81,7 @@ struct ttm_backend_func { | |||
81 | #define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5) | 81 | #define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5) |
82 | #define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6) | 82 | #define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6) |
83 | #define TTM_PAGE_FLAG_DMA32 (1 << 7) | 83 | #define TTM_PAGE_FLAG_DMA32 (1 << 7) |
84 | #define TTM_PAGE_FLAG_SG (1 << 8) | ||
84 | 85 | ||
85 | enum ttm_caching_state { | 86 | enum ttm_caching_state { |
86 | tt_uncached, | 87 | tt_uncached, |
@@ -116,6 +117,7 @@ struct ttm_tt { | |||
116 | struct page **pages; | 117 | struct page **pages; |
117 | uint32_t page_flags; | 118 | uint32_t page_flags; |
118 | unsigned long num_pages; | 119 | unsigned long num_pages; |
120 | struct sg_table *sg; /* for SG objects via dma-buf */ | ||
119 | struct ttm_bo_global *glob; | 121 | struct ttm_bo_global *glob; |
120 | struct ttm_backend *be; | 122 | struct ttm_backend *be; |
121 | struct file *swap_storage; | 123 | struct file *swap_storage; |