aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-04-20 00:15:09 -0400
committerDave Airlie <airlied@redhat.com>2010-04-20 00:15:09 -0400
commit7547a917fa5f3b2406f52c7dcf7ec9ad3c8532eb (patch)
tree59b0d0e9b6c251c4df5799b93395454592004d57 /include
parenta8089e849a32c5b6bfd6c88dbd09c0ea4a779b71 (diff)
parent6b8b1786a8c29ce6e32298b93ac8d4a18a2b11c4 (diff)
Merge branch 'drm-ttm-unmappable' into drm-core-next
* drm-ttm-unmappable: drm/radeon/kms: enable use of unmappable VRAM V2 drm/ttm: remove io_ field from TTM V6 drm/vmwgfx: add support for new TTM fault callback V5 drm/nouveau/kms: add support for new TTM fault callback V5 drm/radeon/kms: add support for new fault callback V7 drm/ttm: ttm_fault callback to allow driver to handle bo placement V6 drm/ttm: split no_wait argument in 2 GPU or reserve wait Conflicts: drivers/gpu/drm/nouveau/nouveau_bo.c
Diffstat (limited to 'include')
-rw-r--r--include/drm/ttm/ttm_bo_api.h29
-rw-r--r--include/drm/ttm/ttm_bo_driver.h57
2 files changed, 60 insertions, 26 deletions
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 81eb9f45883c..3e273e0b9417 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -66,6 +66,26 @@ struct ttm_placement {
66 const uint32_t *busy_placement; 66 const uint32_t *busy_placement;
67}; 67};
68 68
69/**
70 * struct ttm_bus_placement
71 *
72 * @addr: mapped virtual address
73 * @base: bus base address
74 * @is_iomem: is this io memory ?
75 * @size: size in byte
76 * @offset: offset from the base address
77 *
78 * Structure indicating the bus placement of an object.
79 */
80struct ttm_bus_placement {
81 void *addr;
82 unsigned long base;
83 unsigned long size;
84 unsigned long offset;
85 bool is_iomem;
86 bool io_reserved;
87};
88
69 89
70/** 90/**
71 * struct ttm_mem_reg 91 * struct ttm_mem_reg
@@ -75,6 +95,7 @@ struct ttm_placement {
75 * @num_pages: Actual size of memory region in pages. 95 * @num_pages: Actual size of memory region in pages.
76 * @page_alignment: Page alignment. 96 * @page_alignment: Page alignment.
77 * @placement: Placement flags. 97 * @placement: Placement flags.
98 * @bus: Placement on io bus accessible to the CPU
78 * 99 *
79 * Structure indicating the placement and space resources used by a 100 * Structure indicating the placement and space resources used by a
80 * buffer object. 101 * buffer object.
@@ -87,6 +108,7 @@ struct ttm_mem_reg {
87 uint32_t page_alignment; 108 uint32_t page_alignment;
88 uint32_t mem_type; 109 uint32_t mem_type;
89 uint32_t placement; 110 uint32_t placement;
111 struct ttm_bus_placement bus;
90}; 112};
91 113
92/** 114/**
@@ -274,6 +296,7 @@ struct ttm_bo_kmap_obj {
274 ttm_bo_map_kmap = 3, 296 ttm_bo_map_kmap = 3,
275 ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK, 297 ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK,
276 } bo_kmap_type; 298 } bo_kmap_type;
299 struct ttm_buffer_object *bo;
277}; 300};
278 301
279/** 302/**
@@ -313,7 +336,8 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
313 * @bo: The buffer object. 336 * @bo: The buffer object.
314 * @placement: Proposed placement for the buffer object. 337 * @placement: Proposed placement for the buffer object.
315 * @interruptible: Sleep interruptible if sleeping. 338 * @interruptible: Sleep interruptible if sleeping.
316 * @no_wait: Return immediately if the buffer is busy. 339 * @no_wait_reserve: Return immediately if other buffers are busy.
340 * @no_wait_gpu: Return immediately if the GPU is busy.
317 * 341 *
318 * Changes placement and caching policy of the buffer object 342 * Changes placement and caching policy of the buffer object
319 * according proposed placement. 343 * according proposed placement.
@@ -325,7 +349,8 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
325 */ 349 */
326extern int ttm_bo_validate(struct ttm_buffer_object *bo, 350extern int ttm_bo_validate(struct ttm_buffer_object *bo,
327 struct ttm_placement *placement, 351 struct ttm_placement *placement,
328 bool interruptible, bool no_wait); 352 bool interruptible, bool no_wait_reserve,
353 bool no_wait_gpu);
329 354
330/** 355/**
331 * ttm_bo_unref 356 * ttm_bo_unref
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index e929c27ede22..7720b1787e23 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -176,8 +176,6 @@ struct ttm_tt {
176 176
177#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ 177#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
178#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ 178#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */
179#define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap
180 before kernel access. */
181#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ 179#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */
182 180
183/** 181/**
@@ -189,13 +187,6 @@ struct ttm_tt {
189 * managed by this memory type. 187 * managed by this memory type.
190 * @gpu_offset: If used, the GPU offset of the first managed page of 188 * @gpu_offset: If used, the GPU offset of the first managed page of
191 * fixed memory or the first managed location in an aperture. 189 * fixed memory or the first managed location in an aperture.
192 * @io_offset: The io_offset of the first managed page of IO memory or
193 * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA
194 * memory, this should be set to NULL.
195 * @io_size: The size of a managed IO region (fixed memory or aperture).
196 * @io_addr: Virtual kernel address if the io region is pre-mapped. For
197 * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and
198 * @io_addr should be set to NULL.
199 * @size: Size of the managed region. 190 * @size: Size of the managed region.
200 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, 191 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
201 * as defined in ttm_placement_common.h 192 * as defined in ttm_placement_common.h
@@ -221,9 +212,6 @@ struct ttm_mem_type_manager {
221 bool use_type; 212 bool use_type;
222 uint32_t flags; 213 uint32_t flags;
223 unsigned long gpu_offset; 214 unsigned long gpu_offset;
224 unsigned long io_offset;
225 unsigned long io_size;
226 void *io_addr;
227 uint64_t size; 215 uint64_t size;
228 uint32_t available_caching; 216 uint32_t available_caching;
229 uint32_t default_caching; 217 uint32_t default_caching;
@@ -311,7 +299,8 @@ struct ttm_bo_driver {
311 */ 299 */
312 int (*move) (struct ttm_buffer_object *bo, 300 int (*move) (struct ttm_buffer_object *bo,
313 bool evict, bool interruptible, 301 bool evict, bool interruptible,
314 bool no_wait, struct ttm_mem_reg *new_mem); 302 bool no_wait_reserve, bool no_wait_gpu,
303 struct ttm_mem_reg *new_mem);
315 304
316 /** 305 /**
317 * struct ttm_bo_driver_member verify_access 306 * struct ttm_bo_driver_member verify_access
@@ -351,12 +340,21 @@ struct ttm_bo_driver {
351 struct ttm_mem_reg *new_mem); 340 struct ttm_mem_reg *new_mem);
352 /* notify the driver we are taking a fault on this BO 341 /* notify the driver we are taking a fault on this BO
353 * and have reserved it */ 342 * and have reserved it */
354 void (*fault_reserve_notify)(struct ttm_buffer_object *bo); 343 int (*fault_reserve_notify)(struct ttm_buffer_object *bo);
355 344
356 /** 345 /**
357 * notify the driver that we're about to swap out this bo 346 * notify the driver that we're about to swap out this bo
358 */ 347 */
359 void (*swap_notify) (struct ttm_buffer_object *bo); 348 void (*swap_notify) (struct ttm_buffer_object *bo);
349
350 /**
351 * Driver callback on when mapping io memory (for bo_move_memcpy
352 * for instance). TTM will take care to call io_mem_free whenever
353 * the mapping is not use anymore. io_mem_reserve & io_mem_free
354 * are balanced.
355 */
356 int (*io_mem_reserve)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
357 void (*io_mem_free)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
360}; 358};
361 359
362/** 360/**
@@ -633,7 +631,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
633 * @proposed_placement: Proposed new placement for the buffer object. 631 * @proposed_placement: Proposed new placement for the buffer object.
634 * @mem: A struct ttm_mem_reg. 632 * @mem: A struct ttm_mem_reg.
635 * @interruptible: Sleep interruptible when sliping. 633 * @interruptible: Sleep interruptible when sliping.
636 * @no_wait: Don't sleep waiting for space to become available. 634 * @no_wait_reserve: Return immediately if other buffers are busy.
635 * @no_wait_gpu: Return immediately if the GPU is busy.
637 * 636 *
638 * Allocate memory space for the buffer object pointed to by @bo, using 637 * Allocate memory space for the buffer object pointed to by @bo, using
639 * the placement flags in @mem, potentially evicting other idle buffer objects. 638 * the placement flags in @mem, potentially evicting other idle buffer objects.
@@ -647,7 +646,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
647extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, 646extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
648 struct ttm_placement *placement, 647 struct ttm_placement *placement,
649 struct ttm_mem_reg *mem, 648 struct ttm_mem_reg *mem,
650 bool interruptible, bool no_wait); 649 bool interruptible,
650 bool no_wait_reserve, bool no_wait_gpu);
651/** 651/**
652 * ttm_bo_wait_for_cpu 652 * ttm_bo_wait_for_cpu
653 * 653 *
@@ -682,6 +682,11 @@ extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
682 unsigned long *bus_offset, 682 unsigned long *bus_offset,
683 unsigned long *bus_size); 683 unsigned long *bus_size);
684 684
685extern int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
686 struct ttm_mem_reg *mem);
687extern void ttm_mem_io_free(struct ttm_bo_device *bdev,
688 struct ttm_mem_reg *mem);
689
685extern void ttm_bo_global_release(struct ttm_global_reference *ref); 690extern void ttm_bo_global_release(struct ttm_global_reference *ref);
686extern int ttm_bo_global_init(struct ttm_global_reference *ref); 691extern int ttm_bo_global_init(struct ttm_global_reference *ref);
687 692
@@ -826,7 +831,8 @@ extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
826 * 831 *
827 * @bo: A pointer to a struct ttm_buffer_object. 832 * @bo: A pointer to a struct ttm_buffer_object.
828 * @evict: 1: This is an eviction. Don't try to pipeline. 833 * @evict: 1: This is an eviction. Don't try to pipeline.
829 * @no_wait: Never sleep, but rather return with -EBUSY. 834 * @no_wait_reserve: Return immediately if other buffers are busy.
835 * @no_wait_gpu: Return immediately if the GPU is busy.
830 * @new_mem: struct ttm_mem_reg indicating where to move. 836 * @new_mem: struct ttm_mem_reg indicating where to move.
831 * 837 *
832 * Optimized move function for a buffer object with both old and 838 * Optimized move function for a buffer object with both old and
@@ -840,15 +846,16 @@ extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
840 */ 846 */
841 847
842extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, 848extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
843 bool evict, bool no_wait, 849 bool evict, bool no_wait_reserve,
844 struct ttm_mem_reg *new_mem); 850 bool no_wait_gpu, struct ttm_mem_reg *new_mem);
845 851
846/** 852/**
847 * ttm_bo_move_memcpy 853 * ttm_bo_move_memcpy
848 * 854 *
849 * @bo: A pointer to a struct ttm_buffer_object. 855 * @bo: A pointer to a struct ttm_buffer_object.
850 * @evict: 1: This is an eviction. Don't try to pipeline. 856 * @evict: 1: This is an eviction. Don't try to pipeline.
851 * @no_wait: Never sleep, but rather return with -EBUSY. 857 * @no_wait_reserve: Return immediately if other buffers are busy.
858 * @no_wait_gpu: Return immediately if the GPU is busy.
852 * @new_mem: struct ttm_mem_reg indicating where to move. 859 * @new_mem: struct ttm_mem_reg indicating where to move.
853 * 860 *
854 * Fallback move function for a mappable buffer object in mappable memory. 861 * Fallback move function for a mappable buffer object in mappable memory.
@@ -862,8 +869,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
862 */ 869 */
863 870
864extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, 871extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
865 bool evict, 872 bool evict, bool no_wait_reserve,
866 bool no_wait, struct ttm_mem_reg *new_mem); 873 bool no_wait_gpu, struct ttm_mem_reg *new_mem);
867 874
868/** 875/**
869 * ttm_bo_free_old_node 876 * ttm_bo_free_old_node
@@ -882,7 +889,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
882 * @sync_obj_arg: An argument to pass to the sync object idle / wait 889 * @sync_obj_arg: An argument to pass to the sync object idle / wait
883 * functions. 890 * functions.
884 * @evict: This is an evict move. Don't return until the buffer is idle. 891 * @evict: This is an evict move. Don't return until the buffer is idle.
885 * @no_wait: Never sleep, but rather return with -EBUSY. 892 * @no_wait_reserve: Return immediately if other buffers are busy.
893 * @no_wait_gpu: Return immediately if the GPU is busy.
886 * @new_mem: struct ttm_mem_reg indicating where to move. 894 * @new_mem: struct ttm_mem_reg indicating where to move.
887 * 895 *
888 * Accelerated move function to be called when an accelerated move 896 * Accelerated move function to be called when an accelerated move
@@ -896,7 +904,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
896extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, 904extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
897 void *sync_obj, 905 void *sync_obj,
898 void *sync_obj_arg, 906 void *sync_obj_arg,
899 bool evict, bool no_wait, 907 bool evict, bool no_wait_reserve,
908 bool no_wait_gpu,
900 struct ttm_mem_reg *new_mem); 909 struct ttm_mem_reg *new_mem);
901/** 910/**
902 * ttm_io_prot 911 * ttm_io_prot