Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5055 → Rev 5056

/drivers/include/drm/ttm/ttm_bo_driver.h
37,12 → 37,11
#include <drm/drm_mm.h>
#include <drm/drm_global.h>
#include <drm/drm_vma_manager.h>
//#include <linux/workqueue.h>
#include <linux/workqueue.h>
#include <linux/fs.h>
#include <linux/spinlock.h>
#include <linux/reservation.h>
 
struct ww_acquire_ctx;
 
struct ttm_backend_func {
/**
* struct ttm_backend_func member bind
134,6 → 133,7
* struct ttm_dma_tt
*
* @ttm: Base ttm_tt struct.
* @cpu_address: The CPU address of the pages
* @dma_address: The DMA (bus) addresses of the pages
* @pages_list: used by some page allocation backend
*
143,6 → 143,7
*/
struct ttm_dma_tt {
struct ttm_tt ttm;
void **cpu_address;
dma_addr_t *dma_address;
struct list_head pages_list;
};
183,6 → 184,7
* @man: Pointer to a memory type manager.
* @bo: Pointer to the buffer object we're allocating space for.
* @placement: Placement details.
* @flags: Additional placement flags.
* @mem: Pointer to a struct ttm_mem_reg to be filled in.
*
* This function should allocate space in the memory type managed
207,6 → 209,7
int (*get_node)(struct ttm_mem_type_manager *man,
struct ttm_buffer_object *bo,
struct ttm_placement *placement,
uint32_t flags,
struct ttm_mem_reg *mem);
 
/**
654,18 → 657,6
extern int ttm_tt_swapin(struct ttm_tt *ttm);
 
/**
* ttm_tt_cache_flush:
*
* @pages: An array of pointers to struct page:s to flush.
* @num_pages: Number of pages to flush.
*
* Flush the data of the indicated pages from the cpu caches.
* This is used when changing caching attributes of the pages from
* cache-coherent.
*/
extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages);
 
/**
* ttm_tt_set_placement_caching:
*
* @ttm A struct ttm_tt the backing pages of which will change caching policy.
748,6 → 739,7
* @bdev: A pointer to a struct ttm_bo_device to initialize.
* @glob: A pointer to an initialized struct ttm_bo_global.
* @driver: A pointer to a struct ttm_bo_driver set up by the caller.
* @mapping: The address space to use for this bo.
* @file_page_offset: Offset into the device address space that is available
* for buffer data. This ensures compatibility with other users of the
* address space.
759,6 → 751,7
extern int ttm_bo_device_init(struct ttm_bo_device *bdev,
struct ttm_bo_global *glob,
struct ttm_bo_driver *driver,
struct address_space *mapping,
uint64_t file_page_offset, bool need_dma32);
 
/**
787,7 → 780,7
extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo);
 
/**
* ttm_bo_reserve_nolru:
* __ttm_bo_reserve:
*
* @bo: A pointer to a struct ttm_buffer_object.
* @interruptible: Sleep interruptible if waiting.
808,13 → 801,13
* -EALREADY: Bo already reserved using @ticket. This error code will only
* be returned if @use_ticket is set to true.
*/
static inline int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo,
static inline int __ttm_bo_reserve(struct ttm_buffer_object *bo,
bool interruptible,
bool no_wait, bool use_ticket,
struct ww_acquire_ctx *ticket)
{
int ret = 0;
/*
 
if (no_wait) {
bool success;
if (WARN_ON(ticket))
830,7 → 823,6
ret = ww_mutex_lock(&bo->resv->lock, ticket);
if (ret == -EINTR)
return -ERESTARTSYS;
*/
return ret;
}
 
888,8 → 880,7
 
WARN_ON(!atomic_read(&bo->kref.refcount));
 
ret = ttm_bo_reserve_nolru(bo, interruptible, no_wait, use_ticket,
ticket);
ret = __ttm_bo_reserve(bo, interruptible, no_wait, use_ticket, ticket);
if (likely(ret == 0))
ttm_bo_del_sub_from_lru(bo);
 
914,10 → 905,6
 
WARN_ON(!atomic_read(&bo->kref.refcount));
 
if (interruptible)
ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
ticket);
else
ww_mutex_lock_slow(&bo->resv->lock, ticket);
 
if (likely(ret == 0))
929,33 → 916,45
}
 
/**
* ttm_bo_unreserve_ticket
* __ttm_bo_unreserve
* @bo: A pointer to a struct ttm_buffer_object.
* @ticket: ww_acquire_ctx used for reserving
*
* Unreserve a previous reservation of @bo made with @ticket.
* Unreserve a previous reservation of @bo where the buffer object is
* already on lru lists.
*/
static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo,
struct ww_acquire_ctx *t)
static inline void __ttm_bo_unreserve(struct ttm_buffer_object *bo)
{
ww_mutex_unlock(&bo->resv->lock);
}
 
/**
* ttm_bo_unreserve
*
* @bo: A pointer to a struct ttm_buffer_object.
*
* Unreserve a previous reservation of @bo.
*/
static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo)
{
if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
spin_lock(&bo->glob->lru_lock);
ttm_bo_add_to_lru(bo);
spin_unlock(&bo->glob->lru_lock);
}
// ww_mutex_unlock(&bo->resv->lock);
__ttm_bo_unreserve(bo);
}
 
/**
* ttm_bo_unreserve
*
* ttm_bo_unreserve_ticket
* @bo: A pointer to a struct ttm_buffer_object.
* @ticket: ww_acquire_ctx used for reserving
*
* Unreserve a previous reservation of @bo.
* Unreserve a previous reservation of @bo made with @ticket.
*/
static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo)
static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo,
struct ww_acquire_ctx *t)
{
ttm_bo_unreserve_ticket(bo, NULL);
ttm_bo_unreserve(bo);
}
 
/*