diff options
| author | Dave Airlie <airlied@redhat.com> | 2011-02-22 21:06:39 -0500 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2011-02-22 21:06:39 -0500 |
| commit | de1e7cd63a8ec26a3bd3740708cfd72dd76509e2 (patch) | |
| tree | 52bc82a71f34e92895d22821543a2be011834505 /include/drm/ttm | |
| parent | 7811bddb6654337fd85837ef14c1a96a0c264745 (diff) | |
| parent | 5a893fc28f0393adb7c885a871b8c59e623fd528 (diff) | |
Merge branch 'stable/ttm.pci-api.v5' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen into drm-next
* 'stable/ttm.pci-api.v5' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
ttm: Include the 'struct dev' when using the DMA API.
nouveau/ttm/PCIe: Use dma_addr if TTM has set it.
radeon/ttm/PCIe: Use dma_addr if TTM has set it.
ttm: Expand (*populate) to support an array of DMA addresses.
ttm: Utilize the DMA API for pages that have TTM_PAGE_FLAG_DMA32 set.
ttm: Introduce a placeholder for DMA (bus) addresses.
Diffstat (limited to 'include/drm/ttm')
| -rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 7 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_page_alloc.h | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 1da8af6ac88..38ff0682260 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
| @@ -50,13 +50,15 @@ struct ttm_backend_func { | |||
| 50 | * @pages: Array of pointers to ttm pages. | 50 | * @pages: Array of pointers to ttm pages. |
| 51 | * @dummy_read_page: Page to be used instead of NULL pages in the | 51 | * @dummy_read_page: Page to be used instead of NULL pages in the |
| 52 | * array @pages. | 52 | * array @pages. |
| 53 | * @dma_addrs: Array of DMA (bus) address of the ttm pages. | ||
| 53 | * | 54 | * |
| 54 | * Populate the backend with ttm pages. Depending on the backend, | 55 | * Populate the backend with ttm pages. Depending on the backend, |
| 55 | * it may or may not copy the @pages array. | 56 | * it may or may not copy the @pages array. |
| 56 | */ | 57 | */ |
| 57 | int (*populate) (struct ttm_backend *backend, | 58 | int (*populate) (struct ttm_backend *backend, |
| 58 | unsigned long num_pages, struct page **pages, | 59 | unsigned long num_pages, struct page **pages, |
| 59 | struct page *dummy_read_page); | 60 | struct page *dummy_read_page, |
| 61 | dma_addr_t *dma_addrs); | ||
| 60 | /** | 62 | /** |
| 61 | * struct ttm_backend_func member clear | 63 | * struct ttm_backend_func member clear |
| 62 | * | 64 | * |
| @@ -149,6 +151,7 @@ enum ttm_caching_state { | |||
| 149 | * @swap_storage: Pointer to shmem struct file for swap storage. | 151 | * @swap_storage: Pointer to shmem struct file for swap storage. |
| 150 | * @caching_state: The current caching state of the pages. | 152 | * @caching_state: The current caching state of the pages. |
| 151 | * @state: The current binding state of the pages. | 153 | * @state: The current binding state of the pages. |
| 154 | * @dma_address: The DMA (bus) addresses of the pages (if TTM_PAGE_FLAG_DMA32) | ||
| 152 | * | 155 | * |
| 153 | * This is a structure holding the pages, caching- and aperture binding | 156 | * This is a structure holding the pages, caching- and aperture binding |
| 154 | * status for a buffer object that isn't backed by fixed (VRAM / AGP) | 157 | * status for a buffer object that isn't backed by fixed (VRAM / AGP) |
| @@ -173,6 +176,7 @@ struct ttm_tt { | |||
| 173 | tt_unbound, | 176 | tt_unbound, |
| 174 | tt_unpopulated, | 177 | tt_unpopulated, |
| 175 | } state; | 178 | } state; |
| 179 | dma_addr_t *dma_address; | ||
| 176 | }; | 180 | }; |
| 177 | 181 | ||
| 178 | #define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ | 182 | #define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ |
| @@ -547,6 +551,7 @@ struct ttm_bo_device { | |||
| 547 | struct list_head device_list; | 551 | struct list_head device_list; |
| 548 | struct ttm_bo_global *glob; | 552 | struct ttm_bo_global *glob; |
| 549 | struct ttm_bo_driver *driver; | 553 | struct ttm_bo_driver *driver; |
| 554 | struct device *dev; | ||
| 550 | rwlock_t vm_lock; | 555 | rwlock_t vm_lock; |
| 551 | struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; | 556 | struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; |
| 552 | spinlock_t fence_lock; | 557 | spinlock_t fence_lock; |
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h index 116821448c3..ccb6b7a240e 100644 --- a/include/drm/ttm/ttm_page_alloc.h +++ b/include/drm/ttm/ttm_page_alloc.h | |||
| @@ -36,11 +36,15 @@ | |||
| 36 | * @flags: ttm flags for page allocation. | 36 | * @flags: ttm flags for page allocation. |
| 37 | * @cstate: ttm caching state for the page. | 37 | * @cstate: ttm caching state for the page. |
| 38 | * @count: number of pages to allocate. | 38 | * @count: number of pages to allocate. |
| 39 | * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set). | ||
| 40 | * @dev: struct device for appropiate DMA accounting. | ||
| 39 | */ | 41 | */ |
| 40 | int ttm_get_pages(struct list_head *pages, | 42 | int ttm_get_pages(struct list_head *pages, |
| 41 | int flags, | 43 | int flags, |
| 42 | enum ttm_caching_state cstate, | 44 | enum ttm_caching_state cstate, |
| 43 | unsigned count); | 45 | unsigned count, |
| 46 | dma_addr_t *dma_address, | ||
| 47 | struct device *dev); | ||
| 44 | /** | 48 | /** |
| 45 | * Put linked list of pages to pool. | 49 | * Put linked list of pages to pool. |
| 46 | * | 50 | * |
| @@ -49,11 +53,15 @@ int ttm_get_pages(struct list_head *pages, | |||
| 49 | * count. | 53 | * count. |
| 50 | * @flags: ttm flags for page allocation. | 54 | * @flags: ttm flags for page allocation. |
| 51 | * @cstate: ttm caching state. | 55 | * @cstate: ttm caching state. |
| 56 | * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set). | ||
| 57 | * @dev: struct device for appropiate DMA accounting. | ||
| 52 | */ | 58 | */ |
| 53 | void ttm_put_pages(struct list_head *pages, | 59 | void ttm_put_pages(struct list_head *pages, |
| 54 | unsigned page_count, | 60 | unsigned page_count, |
| 55 | int flags, | 61 | int flags, |
| 56 | enum ttm_caching_state cstate); | 62 | enum ttm_caching_state cstate, |
| 63 | dma_addr_t *dma_address, | ||
| 64 | struct device *dev); | ||
| 57 | /** | 65 | /** |
| 58 | * Initialize pool allocator. | 66 | * Initialize pool allocator. |
| 59 | */ | 67 | */ |
