X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/189951a708baba71f01d07e048e6f67501414c63..a34b416832c4fc3e662679437ead3ece25111e86:/sys/dev/drm/include/drm/ttm/ttm_bo_api.h diff --git a/sys/dev/drm/include/drm/ttm/ttm_bo_api.h b/sys/dev/drm/include/drm/ttm/ttm_bo_api.h index 0576ca22e5..a5a1000555 100644 --- a/sys/dev/drm/include/drm/ttm/ttm_bo_api.h +++ b/sys/dev/drm/include/drm/ttm/ttm_bo_api.h @@ -27,17 +27,19 @@ /* * Authors: Thomas Hellstrom */ -/* $FreeBSD: head/sys/dev/drm2/ttm/ttm_bo_api.h 247835 2013-03-05 09:49:34Z kib $ */ #ifndef _TTM_BO_API_H_ #define _TTM_BO_API_H_ #include #include +#include #include #include #include #include +#include +#include #include struct ttm_bo_device; @@ -47,9 +49,9 @@ struct drm_mm_node; /** * struct ttm_place * - * @fpfn: first valid page frame number to put the object - * @lpfn: last valid page frame number to put the object - * @flags: memory domain and caching flags for the object + * @fpfn: first valid page frame number to put the object + * @lpfn: last valid page frame number to put the object + * @flags: memory domain and caching flags for the object * * Structure indicating a possible place to put an object. */ @@ -62,6 +64,8 @@ struct ttm_place { /** * struct ttm_placement * + * @fpfn: first valid page frame number to put the object + * @lpfn: last valid page frame number to put the object * @num_placement: number of preferred placements * @placement: preferred placements * @num_busy_placement: number of preferred placements when need to evict buffer @@ -70,9 +74,11 @@ struct ttm_place { * Structure indicating the placement you request for an object. */ struct ttm_placement { - unsigned num_placement; - const struct ttm_place *placement; - unsigned num_busy_placement; + unsigned fpfn; + unsigned lpfn; + unsigned num_placement; + const struct ttm_place *placement; + unsigned num_busy_placement; const struct ttm_place *busy_placement; }; @@ -154,7 +160,6 @@ struct ttm_tt; * @type: The bo type. * @destroy: Destruction function. If NULL, kfree is used. * @num_pages: Actual number of pages. - * @addr_space_offset: Address space offset. * @acc_size: Accounted size for this object. * @kref: Reference count of this buffer object. When this refcount reaches * zero, the object is put on the delayed delete list. @@ -163,7 +168,6 @@ struct ttm_tt; * Lru lists may keep one refcount, the delayed delete list, and kref != 0 * keeps one refcount. When this refcount reaches zero, * the object is destroyed. - * @event_queue: Queue for processes waiting on buffer object status change. * @mem: structure describing current placement. * @persistent_swap_storage: Usually the swap storage is deleted for buffers * pinned in physical memory. If this behaviour is not desired, this member @@ -174,16 +178,9 @@ struct ttm_tt; * @lru: List head for the lru list. * @ddestroy: List head for the delayed destroy list. * @swap: List head for swap LRU list. - * @val_seq: Sequence of the validation holding the @reserved lock. - * Used to avoid starvation when many processes compete to validate the - * buffer. This member is protected by the bo_device::lru_lock. - * @seq_valid: The value of @val_seq is valid. This value is protected by - * the bo_device::lru_lock. - * @reserved: Deadlock-free lock used for synchronization state transitions. * @sync_obj: Pointer to a synchronization object. * @priv_flags: Flags describing buffer object internal state. - * @vm_rb: Rb node for the vm rb tree. - * @vm_node: Address space manager node. + * @vma_node: Address space manager node. * @offset: The current GPU offset, which can have different meanings * depending on the memory type. For SYSTEM type memory, it should be 0. * @cur_placement: Hint of current placement. @@ -210,7 +207,6 @@ struct ttm_buffer_object { enum ttm_bo_type type; void (*destroy) (struct ttm_buffer_object *); unsigned long num_pages; - uint64_t addr_space_offset; size_t acc_size; /** @@ -221,7 +217,7 @@ struct ttm_buffer_object { struct kref list_kref; /** - * Members protected by the bo::reserved lock. + * Members protected by the bo::resv::reserved lock. */ struct ttm_mem_reg mem; @@ -254,13 +250,8 @@ struct ttm_buffer_object { void *sync_obj; unsigned long priv_flags; - /** - * Members protected by the bdev::vm_lock - */ - - RB_ENTRY(ttm_buffer_object) vm_rb; - struct drm_mm_node *vm_node; - + RB_ENTRY(ttm_buffer_object) vm_rb; /* DragonFly */ + struct drm_vma_offset_node vma_node; /** * Special members that are protected by the reserve lock @@ -508,12 +499,13 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev, void (*destroy) (struct ttm_buffer_object *)); /** - * ttm_bo_create + * ttm_bo_synccpu_object_init * * @bdev: Pointer to a ttm_bo_device struct. + * @bo: Pointer to a ttm_buffer_object to be initialized. * @size: Requested size of buffer object. * @type: Requested type of buffer object. - * @placement: Initial placement. + * @flags: Initial placement flags. * @page_alignment: Data alignment in pages. * @interruptible: If needing to sleep while waiting for GPU resources, * sleep interruptible. @@ -541,6 +533,20 @@ extern int ttm_bo_create(struct ttm_bo_device *bdev, struct vm_object *persistent_swap_storage, struct ttm_buffer_object **p_bo); +/** + * ttm_bo_check_placement + * + * @bo: the buffer object. + * @placement: placements + * + * Performs minimal validity checking on an intended change of + * placement flags. + * Returns + * -EINVAL: Intended change is invalid or not allowed. + */ +extern int ttm_bo_check_placement(struct ttm_buffer_object *bo, + struct ttm_placement *placement); + /** * ttm_bo_init_mm * @@ -669,10 +675,9 @@ extern void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map); * if the fbdev address space is to be backed by a bo. */ -/* XXXKIB extern int ttm_fbdev_mmap(struct vm_area_struct *vma, struct ttm_buffer_object *bo); -*/ + /** * ttm_bo_mmap - mmap out of the ttm device address space. * @@ -683,10 +688,10 @@ extern int ttm_fbdev_mmap(struct vm_area_struct *vma, * This function is intended to be called by the device mmap method. * if the device address space is to be backed by the bo manager. */ -/* XXXKIB + extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma, struct ttm_bo_device *bdev); -*/ + /** * ttm_bo_io * @@ -709,23 +714,14 @@ extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma, */ extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, - const char *wbuf, char *rbuf, - size_t count, off_t *f_pos, bool write); + const char __user *wbuf, char __user *rbuf, + size_t count, loff_t *f_pos, bool write); -extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); +extern ssize_t ttm_bo_fbdev_io(struct ttm_buffer_object *bo, + const char __user *wbuf, + char __user *rbuf, size_t count, loff_t *f_pos, + bool write); -/** - * ttm_bo_is_reserved - return an indication if a ttm buffer object is reserved - * - * @bo: The buffer object to check. - * - * This function returns an indication if a bo is reserved or not, and should - * only be used to print an error when it is not from incorrect api usage, since - * there's no guarantee that it is the caller that is holding the reservation. - */ -static inline bool ttm_bo_is_reserved(struct ttm_buffer_object *bo) -{ - return ww_mutex_is_locked(&bo->resv->lock); -} +extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); #endif