Merge tag 'drm-misc-next-2019-08-08' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for 5.4: UAPI Changes: - HDCP: Add a Content protection type property Cross-subsystem Changes: Core Changes: - Continue to rework the include dependencies - fb: Remove the unused drm_gem_fbdev_fb_create function - drm-dp-helper: Make the link rate calculation more tolerant to non-explicitly defined, yet supported, rates - fb-helper: Map DRM client buffer only when required, and instanciate a shadow buffer when the device has a dirty function or says so - connector: Add a helper to link the DDC adapter used by that connector to the userspace - vblank: Switch from DRM_WAIT_ON to wait_event_interruptible_timeout - dma-buf: Fix a stack corruption - ttm: Embed a drm_gem_object struct to make ttm_buffer_object a superclass of GEM, and convert drivers to use it. - hdcp: Improvements to report the content protection type to the userspace Driver Changes: - Remove drm_gem_prime_import/export from being defined in the drivers - Drop DRM_AUTH usage from drivers - Continue to drop drmP.h - Convert drivers to the connector ddc helper - ingenic: Add support for more panel-related cases - komeda: Support for dual-link - lima: Reduce logging - mpag200: Fix the cursor support - panfrost: Export GPU features register to userspace through an ioctl - pl111: Remove the CLD pads wiring support from the DT - rockchip: Rework to use DRM PSR helpers, fix a bug in the VOP_WIN_GET macro - sun4i: Improve support for color encoding and range - tinydrm: Rework SPI support, improve MIPI-DBI support, move to drm/tiny - vkms: Rework of the CRC tracking - bridges: - sii902x: Add support for audio graph card - tc358767: Rework AUX data handling code - ti-sn65dsi86: Add Debugfs and proper DSI mode flags support - panels - Support for GiantPlus GPM940B0, Sharp LQ070Y3DG3B, Ortustech COM37H3M, Novatek NT39016, Sharp LS020B1DD01D, Raydium RM67191, Boe Himax8279d, Sharp LD-D5116Z01B - Conversion of the device tree bindings to the YAML description - jh057n00900: Rework the enable / disable path - fbdev: - ssd1307fb: Support more devices based on that controller Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190808121423.xzpedzkpyecvsiy4@flea
Este cometimento está contido em:
@@ -160,7 +160,8 @@ static void ttm_bo_release_list(struct kref *list_kref)
|
||||
ttm_tt_destroy(bo->ttm);
|
||||
atomic_dec(&bo->bdev->glob->bo_count);
|
||||
dma_fence_put(bo->moving);
|
||||
reservation_object_fini(&bo->ttm_resv);
|
||||
if (!ttm_bo_uses_embedded_gem_object(bo))
|
||||
reservation_object_fini(&bo->base._resv);
|
||||
mutex_destroy(&bo->wu_mutex);
|
||||
bo->destroy(bo);
|
||||
ttm_mem_global_free(bdev->glob->mem_glob, acc_size);
|
||||
@@ -172,7 +173,7 @@ static void ttm_bo_add_mem_to_lru(struct ttm_buffer_object *bo,
|
||||
struct ttm_bo_device *bdev = bo->bdev;
|
||||
struct ttm_mem_type_manager *man;
|
||||
|
||||
reservation_object_assert_held(bo->resv);
|
||||
reservation_object_assert_held(bo->base.resv);
|
||||
|
||||
if (!list_empty(&bo->lru))
|
||||
return;
|
||||
@@ -243,7 +244,7 @@ static void ttm_bo_bulk_move_set_pos(struct ttm_lru_bulk_move_pos *pos,
|
||||
void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo,
|
||||
struct ttm_lru_bulk_move *bulk)
|
||||
{
|
||||
reservation_object_assert_held(bo->resv);
|
||||
reservation_object_assert_held(bo->base.resv);
|
||||
|
||||
ttm_bo_del_from_lru(bo);
|
||||
ttm_bo_add_to_lru(bo);
|
||||
@@ -276,8 +277,8 @@ void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk)
|
||||
if (!pos->first)
|
||||
continue;
|
||||
|
||||
reservation_object_assert_held(pos->first->resv);
|
||||
reservation_object_assert_held(pos->last->resv);
|
||||
reservation_object_assert_held(pos->first->base.resv);
|
||||
reservation_object_assert_held(pos->last->base.resv);
|
||||
|
||||
man = &pos->first->bdev->man[TTM_PL_TT];
|
||||
list_bulk_move_tail(&man->lru[i], &pos->first->lru,
|
||||
@@ -291,8 +292,8 @@ void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk)
|
||||
if (!pos->first)
|
||||
continue;
|
||||
|
||||
reservation_object_assert_held(pos->first->resv);
|
||||
reservation_object_assert_held(pos->last->resv);
|
||||
reservation_object_assert_held(pos->first->base.resv);
|
||||
reservation_object_assert_held(pos->last->base.resv);
|
||||
|
||||
man = &pos->first->bdev->man[TTM_PL_VRAM];
|
||||
list_bulk_move_tail(&man->lru[i], &pos->first->lru,
|
||||
@@ -306,8 +307,8 @@ void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk)
|
||||
if (!pos->first)
|
||||
continue;
|
||||
|
||||
reservation_object_assert_held(pos->first->resv);
|
||||
reservation_object_assert_held(pos->last->resv);
|
||||
reservation_object_assert_held(pos->first->base.resv);
|
||||
reservation_object_assert_held(pos->last->base.resv);
|
||||
|
||||
lru = &pos->first->bdev->glob->swap_lru[i];
|
||||
list_bulk_move_tail(lru, &pos->first->swap, &pos->last->swap);
|
||||
@@ -438,14 +439,14 @@ static int ttm_bo_individualize_resv(struct ttm_buffer_object *bo)
|
||||
{
|
||||
int r;
|
||||
|
||||
if (bo->resv == &bo->ttm_resv)
|
||||
if (bo->base.resv == &bo->base._resv)
|
||||
return 0;
|
||||
|
||||
BUG_ON(!reservation_object_trylock(&bo->ttm_resv));
|
||||
BUG_ON(!reservation_object_trylock(&bo->base._resv));
|
||||
|
||||
r = reservation_object_copy_fences(&bo->ttm_resv, bo->resv);
|
||||
r = reservation_object_copy_fences(&bo->base._resv, bo->base.resv);
|
||||
if (r)
|
||||
reservation_object_unlock(&bo->ttm_resv);
|
||||
reservation_object_unlock(&bo->base._resv);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -456,14 +457,14 @@ static void ttm_bo_flush_all_fences(struct ttm_buffer_object *bo)
|
||||
struct dma_fence *fence;
|
||||
int i;
|
||||
|
||||
fobj = reservation_object_get_list(&bo->ttm_resv);
|
||||
fence = reservation_object_get_excl(&bo->ttm_resv);
|
||||
fobj = reservation_object_get_list(&bo->base._resv);
|
||||
fence = reservation_object_get_excl(&bo->base._resv);
|
||||
if (fence && !fence->ops->signaled)
|
||||
dma_fence_enable_sw_signaling(fence);
|
||||
|
||||
for (i = 0; fobj && i < fobj->shared_count; ++i) {
|
||||
fence = rcu_dereference_protected(fobj->shared[i],
|
||||
reservation_object_held(bo->resv));
|
||||
reservation_object_held(bo->base.resv));
|
||||
|
||||
if (!fence->ops->signaled)
|
||||
dma_fence_enable_sw_signaling(fence);
|
||||
@@ -481,23 +482,23 @@ static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo)
|
||||
/* Last resort, if we fail to allocate memory for the
|
||||
* fences block for the BO to become idle
|
||||
*/
|
||||
reservation_object_wait_timeout_rcu(bo->resv, true, false,
|
||||
reservation_object_wait_timeout_rcu(bo->base.resv, true, false,
|
||||
30 * HZ);
|
||||
spin_lock(&glob->lru_lock);
|
||||
goto error;
|
||||
}
|
||||
|
||||
spin_lock(&glob->lru_lock);
|
||||
ret = reservation_object_trylock(bo->resv) ? 0 : -EBUSY;
|
||||
ret = reservation_object_trylock(bo->base.resv) ? 0 : -EBUSY;
|
||||
if (!ret) {
|
||||
if (reservation_object_test_signaled_rcu(&bo->ttm_resv, true)) {
|
||||
if (reservation_object_test_signaled_rcu(&bo->base._resv, true)) {
|
||||
ttm_bo_del_from_lru(bo);
|
||||
spin_unlock(&glob->lru_lock);
|
||||
if (bo->resv != &bo->ttm_resv)
|
||||
reservation_object_unlock(&bo->ttm_resv);
|
||||
if (bo->base.resv != &bo->base._resv)
|
||||
reservation_object_unlock(&bo->base._resv);
|
||||
|
||||
ttm_bo_cleanup_memtype_use(bo);
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -513,10 +514,10 @@ static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo)
|
||||
ttm_bo_add_to_lru(bo);
|
||||
}
|
||||
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
}
|
||||
if (bo->resv != &bo->ttm_resv)
|
||||
reservation_object_unlock(&bo->ttm_resv);
|
||||
if (bo->base.resv != &bo->base._resv)
|
||||
reservation_object_unlock(&bo->base._resv);
|
||||
|
||||
error:
|
||||
kref_get(&bo->list_kref);
|
||||
@@ -549,9 +550,9 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
|
||||
int ret;
|
||||
|
||||
if (unlikely(list_empty(&bo->ddestroy)))
|
||||
resv = bo->resv;
|
||||
resv = bo->base.resv;
|
||||
else
|
||||
resv = &bo->ttm_resv;
|
||||
resv = &bo->base._resv;
|
||||
|
||||
if (reservation_object_test_signaled_rcu(resv, true))
|
||||
ret = 0;
|
||||
@@ -562,7 +563,7 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
|
||||
long lret;
|
||||
|
||||
if (unlock_resv)
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
spin_unlock(&glob->lru_lock);
|
||||
|
||||
lret = reservation_object_wait_timeout_rcu(resv, true,
|
||||
@@ -575,7 +576,7 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
|
||||
return -EBUSY;
|
||||
|
||||
spin_lock(&glob->lru_lock);
|
||||
if (unlock_resv && !reservation_object_trylock(bo->resv)) {
|
||||
if (unlock_resv && !reservation_object_trylock(bo->base.resv)) {
|
||||
/*
|
||||
* We raced, and lost, someone else holds the reservation now,
|
||||
* and is probably busy in ttm_bo_cleanup_memtype_use.
|
||||
@@ -592,7 +593,7 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
|
||||
|
||||
if (ret || unlikely(list_empty(&bo->ddestroy))) {
|
||||
if (unlock_resv)
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
spin_unlock(&glob->lru_lock);
|
||||
return ret;
|
||||
}
|
||||
@@ -605,7 +606,7 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
|
||||
ttm_bo_cleanup_memtype_use(bo);
|
||||
|
||||
if (unlock_resv)
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -631,14 +632,14 @@ static bool ttm_bo_delayed_delete(struct ttm_bo_device *bdev, bool remove_all)
|
||||
kref_get(&bo->list_kref);
|
||||
list_move_tail(&bo->ddestroy, &removed);
|
||||
|
||||
if (remove_all || bo->resv != &bo->ttm_resv) {
|
||||
if (remove_all || bo->base.resv != &bo->base._resv) {
|
||||
spin_unlock(&glob->lru_lock);
|
||||
reservation_object_lock(bo->resv, NULL);
|
||||
reservation_object_lock(bo->base.resv, NULL);
|
||||
|
||||
spin_lock(&glob->lru_lock);
|
||||
ttm_bo_cleanup_refs(bo, false, !remove_all, true);
|
||||
|
||||
} else if (reservation_object_trylock(bo->resv)) {
|
||||
} else if (reservation_object_trylock(bo->base.resv)) {
|
||||
ttm_bo_cleanup_refs(bo, false, !remove_all, true);
|
||||
} else {
|
||||
spin_unlock(&glob->lru_lock);
|
||||
@@ -671,7 +672,7 @@ static void ttm_bo_release(struct kref *kref)
|
||||
struct ttm_bo_device *bdev = bo->bdev;
|
||||
struct ttm_mem_type_manager *man = &bdev->man[bo->mem.mem_type];
|
||||
|
||||
drm_vma_offset_remove(&bdev->vma_manager, &bo->vma_node);
|
||||
drm_vma_offset_remove(&bdev->vma_manager, &bo->base.vma_node);
|
||||
ttm_mem_io_lock(man, false);
|
||||
ttm_mem_io_free_vm(bo);
|
||||
ttm_mem_io_unlock(man);
|
||||
@@ -707,7 +708,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo,
|
||||
struct ttm_placement placement;
|
||||
int ret = 0;
|
||||
|
||||
reservation_object_assert_held(bo->resv);
|
||||
reservation_object_assert_held(bo->base.resv);
|
||||
|
||||
placement.num_placement = 0;
|
||||
placement.num_busy_placement = 0;
|
||||
@@ -777,8 +778,8 @@ static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo,
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if (bo->resv == ctx->resv) {
|
||||
reservation_object_assert_held(bo->resv);
|
||||
if (bo->base.resv == ctx->resv) {
|
||||
reservation_object_assert_held(bo->base.resv);
|
||||
if (ctx->flags & TTM_OPT_FLAG_ALLOW_RES_EVICT
|
||||
|| !list_empty(&bo->ddestroy))
|
||||
ret = true;
|
||||
@@ -786,7 +787,7 @@ static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo,
|
||||
if (busy)
|
||||
*busy = false;
|
||||
} else {
|
||||
ret = reservation_object_trylock(bo->resv);
|
||||
ret = reservation_object_trylock(bo->base.resv);
|
||||
*locked = ret;
|
||||
if (busy)
|
||||
*busy = !ret;
|
||||
@@ -814,10 +815,10 @@ static int ttm_mem_evict_wait_busy(struct ttm_buffer_object *busy_bo,
|
||||
return -EBUSY;
|
||||
|
||||
if (ctx->interruptible)
|
||||
r = reservation_object_lock_interruptible(busy_bo->resv,
|
||||
r = reservation_object_lock_interruptible(busy_bo->base.resv,
|
||||
ticket);
|
||||
else
|
||||
r = reservation_object_lock(busy_bo->resv, ticket);
|
||||
r = reservation_object_lock(busy_bo->base.resv, ticket);
|
||||
|
||||
/*
|
||||
* TODO: It would be better to keep the BO locked until allocation is at
|
||||
@@ -825,7 +826,7 @@ static int ttm_mem_evict_wait_busy(struct ttm_buffer_object *busy_bo,
|
||||
* of TTM.
|
||||
*/
|
||||
if (!r)
|
||||
reservation_object_unlock(busy_bo->resv);
|
||||
reservation_object_unlock(busy_bo->base.resv);
|
||||
|
||||
return r == -EDEADLK ? -EBUSY : r;
|
||||
}
|
||||
@@ -850,8 +851,8 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
|
||||
|
||||
if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked,
|
||||
&busy)) {
|
||||
if (busy && !busy_bo &&
|
||||
bo->resv->lock.ctx != ticket)
|
||||
if (busy && !busy_bo && ticket !=
|
||||
reservation_object_locking_ctx(bo->base.resv))
|
||||
busy_bo = bo;
|
||||
continue;
|
||||
}
|
||||
@@ -859,7 +860,7 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
|
||||
if (place && !bdev->driver->eviction_valuable(bo,
|
||||
place)) {
|
||||
if (locked)
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
@@ -931,9 +932,9 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
|
||||
spin_unlock(&man->move_lock);
|
||||
|
||||
if (fence) {
|
||||
reservation_object_add_shared_fence(bo->resv, fence);
|
||||
reservation_object_add_shared_fence(bo->base.resv, fence);
|
||||
|
||||
ret = reservation_object_reserve_shared(bo->resv, 1);
|
||||
ret = reservation_object_reserve_shared(bo->base.resv, 1);
|
||||
if (unlikely(ret)) {
|
||||
dma_fence_put(fence);
|
||||
return ret;
|
||||
@@ -957,8 +958,10 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
|
||||
{
|
||||
struct ttm_bo_device *bdev = bo->bdev;
|
||||
struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
|
||||
struct ww_acquire_ctx *ticket;
|
||||
int ret;
|
||||
|
||||
ticket = reservation_object_locking_ctx(bo->base.resv);
|
||||
do {
|
||||
ret = (*man->func->get_node)(man, bo, place, mem);
|
||||
if (unlikely(ret != 0))
|
||||
@@ -966,7 +969,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
|
||||
if (mem->mm_node)
|
||||
break;
|
||||
ret = ttm_mem_evict_first(bdev, mem->mem_type, place, ctx,
|
||||
bo->resv->lock.ctx);
|
||||
ticket);
|
||||
if (unlikely(ret != 0))
|
||||
return ret;
|
||||
} while (1);
|
||||
@@ -1088,7 +1091,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
|
||||
bool type_found = false;
|
||||
int i, ret;
|
||||
|
||||
ret = reservation_object_reserve_shared(bo->resv, 1);
|
||||
ret = reservation_object_reserve_shared(bo->base.resv, 1);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
@@ -1169,7 +1172,7 @@ static int ttm_bo_move_buffer(struct ttm_buffer_object *bo,
|
||||
int ret = 0;
|
||||
struct ttm_mem_reg mem;
|
||||
|
||||
reservation_object_assert_held(bo->resv);
|
||||
reservation_object_assert_held(bo->base.resv);
|
||||
|
||||
mem.num_pages = bo->num_pages;
|
||||
mem.size = mem.num_pages << PAGE_SHIFT;
|
||||
@@ -1239,7 +1242,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
|
||||
int ret;
|
||||
uint32_t new_flags;
|
||||
|
||||
reservation_object_assert_held(bo->resv);
|
||||
reservation_object_assert_held(bo->base.resv);
|
||||
/*
|
||||
* Check whether we need to move buffer.
|
||||
*/
|
||||
@@ -1329,14 +1332,20 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
|
||||
bo->acc_size = acc_size;
|
||||
bo->sg = sg;
|
||||
if (resv) {
|
||||
bo->resv = resv;
|
||||
reservation_object_assert_held(bo->resv);
|
||||
bo->base.resv = resv;
|
||||
reservation_object_assert_held(bo->base.resv);
|
||||
} else {
|
||||
bo->resv = &bo->ttm_resv;
|
||||
bo->base.resv = &bo->base._resv;
|
||||
}
|
||||
if (!ttm_bo_uses_embedded_gem_object(bo)) {
|
||||
/*
|
||||
* bo.gem is not initialized, so we have to setup the
|
||||
* struct elements we want use regardless.
|
||||
*/
|
||||
reservation_object_init(&bo->base._resv);
|
||||
drm_vma_node_reset(&bo->base.vma_node);
|
||||
}
|
||||
reservation_object_init(&bo->ttm_resv);
|
||||
atomic_inc(&bo->bdev->glob->bo_count);
|
||||
drm_vma_node_reset(&bo->vma_node);
|
||||
|
||||
/*
|
||||
* For ttm_bo_type_device buffers, allocate
|
||||
@@ -1344,14 +1353,14 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
|
||||
*/
|
||||
if (bo->type == ttm_bo_type_device ||
|
||||
bo->type == ttm_bo_type_sg)
|
||||
ret = drm_vma_offset_add(&bdev->vma_manager, &bo->vma_node,
|
||||
ret = drm_vma_offset_add(&bdev->vma_manager, &bo->base.vma_node,
|
||||
bo->mem.num_pages);
|
||||
|
||||
/* passed reservation objects should already be locked,
|
||||
* since otherwise lockdep will be angered in radeon.
|
||||
*/
|
||||
if (!resv) {
|
||||
locked = reservation_object_trylock(bo->resv);
|
||||
locked = reservation_object_trylock(bo->base.resv);
|
||||
WARN_ON(!locked);
|
||||
}
|
||||
|
||||
@@ -1772,7 +1781,7 @@ void ttm_bo_unmap_virtual_locked(struct ttm_buffer_object *bo)
|
||||
{
|
||||
struct ttm_bo_device *bdev = bo->bdev;
|
||||
|
||||
drm_vma_node_unmap(&bo->vma_node, bdev->dev_mapping);
|
||||
drm_vma_node_unmap(&bo->base.vma_node, bdev->dev_mapping);
|
||||
ttm_mem_io_free_vm(bo);
|
||||
}
|
||||
|
||||
@@ -1795,13 +1804,13 @@ int ttm_bo_wait(struct ttm_buffer_object *bo,
|
||||
long timeout = 15 * HZ;
|
||||
|
||||
if (no_wait) {
|
||||
if (reservation_object_test_signaled_rcu(bo->resv, true))
|
||||
if (reservation_object_test_signaled_rcu(bo->base.resv, true))
|
||||
return 0;
|
||||
else
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
timeout = reservation_object_wait_timeout_rcu(bo->resv, true,
|
||||
timeout = reservation_object_wait_timeout_rcu(bo->base.resv, true,
|
||||
interruptible, timeout);
|
||||
if (timeout < 0)
|
||||
return timeout;
|
||||
@@ -1809,7 +1818,7 @@ int ttm_bo_wait(struct ttm_buffer_object *bo,
|
||||
if (timeout == 0)
|
||||
return -EBUSY;
|
||||
|
||||
reservation_object_add_excl_fence(bo->resv, NULL);
|
||||
reservation_object_add_excl_fence(bo->base.resv, NULL);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(ttm_bo_wait);
|
||||
@@ -1925,7 +1934,7 @@ out:
|
||||
* already swapped buffer.
|
||||
*/
|
||||
if (locked)
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
kref_put(&bo->list_kref, ttm_bo_release_list);
|
||||
return ret;
|
||||
}
|
||||
@@ -1963,14 +1972,14 @@ int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo)
|
||||
ret = mutex_lock_interruptible(&bo->wu_mutex);
|
||||
if (unlikely(ret != 0))
|
||||
return -ERESTARTSYS;
|
||||
if (!ww_mutex_is_locked(&bo->resv->lock))
|
||||
if (!reservation_object_is_locked(bo->base.resv))
|
||||
goto out_unlock;
|
||||
ret = reservation_object_lock_interruptible(bo->resv, NULL);
|
||||
ret = reservation_object_lock_interruptible(bo->base.resv, NULL);
|
||||
if (ret == -EINTR)
|
||||
ret = -ERESTARTSYS;
|
||||
if (unlikely(ret != 0))
|
||||
goto out_unlock;
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(&bo->wu_mutex);
|
||||
|
@@ -510,16 +510,16 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
|
||||
INIT_LIST_HEAD(&fbo->base.io_reserve_lru);
|
||||
mutex_init(&fbo->base.wu_mutex);
|
||||
fbo->base.moving = NULL;
|
||||
drm_vma_node_reset(&fbo->base.vma_node);
|
||||
drm_vma_node_reset(&fbo->base.base.vma_node);
|
||||
atomic_set(&fbo->base.cpu_writers, 0);
|
||||
|
||||
kref_init(&fbo->base.list_kref);
|
||||
kref_init(&fbo->base.kref);
|
||||
fbo->base.destroy = &ttm_transfered_destroy;
|
||||
fbo->base.acc_size = 0;
|
||||
fbo->base.resv = &fbo->base.ttm_resv;
|
||||
reservation_object_init(fbo->base.resv);
|
||||
ret = reservation_object_trylock(fbo->base.resv);
|
||||
fbo->base.base.resv = &fbo->base.base._resv;
|
||||
reservation_object_init(fbo->base.base.resv);
|
||||
ret = reservation_object_trylock(fbo->base.base.resv);
|
||||
WARN_ON(!ret);
|
||||
|
||||
*new_obj = &fbo->base;
|
||||
@@ -689,7 +689,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
|
||||
int ret;
|
||||
struct ttm_buffer_object *ghost_obj;
|
||||
|
||||
reservation_object_add_excl_fence(bo->resv, fence);
|
||||
reservation_object_add_excl_fence(bo->base.resv, fence);
|
||||
if (evict) {
|
||||
ret = ttm_bo_wait(bo, false, false);
|
||||
if (ret)
|
||||
@@ -716,7 +716,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
reservation_object_add_excl_fence(ghost_obj->resv, fence);
|
||||
reservation_object_add_excl_fence(ghost_obj->base.resv, fence);
|
||||
|
||||
/**
|
||||
* If we're not moving to fixed memory, the TTM object
|
||||
@@ -752,7 +752,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
|
||||
|
||||
int ret;
|
||||
|
||||
reservation_object_add_excl_fence(bo->resv, fence);
|
||||
reservation_object_add_excl_fence(bo->base.resv, fence);
|
||||
|
||||
if (!evict) {
|
||||
struct ttm_buffer_object *ghost_obj;
|
||||
@@ -772,7 +772,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
reservation_object_add_excl_fence(ghost_obj->resv, fence);
|
||||
reservation_object_add_excl_fence(ghost_obj->base.resv, fence);
|
||||
|
||||
/**
|
||||
* If we're not moving to fixed memory, the TTM object
|
||||
@@ -841,7 +841,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = reservation_object_copy_fences(ghost->resv, bo->resv);
|
||||
ret = reservation_object_copy_fences(ghost->base.resv, bo->base.resv);
|
||||
/* Last resort, wait for the BO to be idle when we are OOM */
|
||||
if (ret)
|
||||
ttm_bo_wait(bo, false, false);
|
||||
|
@@ -71,7 +71,7 @@ static vm_fault_t ttm_bo_vm_fault_idle(struct ttm_buffer_object *bo,
|
||||
ttm_bo_get(bo);
|
||||
up_read(&vmf->vma->vm_mm->mmap_sem);
|
||||
(void) dma_fence_wait(bo->moving, true);
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
ttm_bo_put(bo);
|
||||
goto out_unlock;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
|
||||
* for reserve, and if it fails, retry the fault after waiting
|
||||
* for the buffer to become unreserved.
|
||||
*/
|
||||
if (unlikely(!reservation_object_trylock(bo->resv))) {
|
||||
if (unlikely(!reservation_object_trylock(bo->base.resv))) {
|
||||
if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
|
||||
if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
|
||||
ttm_bo_get(bo);
|
||||
@@ -211,9 +211,9 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
|
||||
}
|
||||
|
||||
page_offset = ((address - vma->vm_start) >> PAGE_SHIFT) +
|
||||
vma->vm_pgoff - drm_vma_node_start(&bo->vma_node);
|
||||
vma->vm_pgoff - drm_vma_node_start(&bo->base.vma_node);
|
||||
page_last = vma_pages(vma) + vma->vm_pgoff -
|
||||
drm_vma_node_start(&bo->vma_node);
|
||||
drm_vma_node_start(&bo->base.vma_node);
|
||||
|
||||
if (unlikely(page_offset >= bo->num_pages)) {
|
||||
ret = VM_FAULT_SIGBUS;
|
||||
@@ -267,7 +267,7 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
|
||||
} else if (unlikely(!page)) {
|
||||
break;
|
||||
}
|
||||
page->index = drm_vma_node_start(&bo->vma_node) +
|
||||
page->index = drm_vma_node_start(&bo->base.vma_node) +
|
||||
page_offset;
|
||||
pfn = page_to_pfn(page);
|
||||
}
|
||||
@@ -296,7 +296,7 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
|
||||
out_io_unlock:
|
||||
ttm_mem_io_unlock(man);
|
||||
out_unlock:
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -413,7 +413,8 @@ static struct ttm_buffer_object *ttm_bo_vm_lookup(struct ttm_bo_device *bdev,
|
||||
|
||||
node = drm_vma_offset_lookup_locked(&bdev->vma_manager, offset, pages);
|
||||
if (likely(node)) {
|
||||
bo = container_of(node, struct ttm_buffer_object, vma_node);
|
||||
bo = container_of(node, struct ttm_buffer_object,
|
||||
base.vma_node);
|
||||
bo = ttm_bo_get_unless_zero(bo);
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ static void ttm_eu_backoff_reservation_reverse(struct list_head *list,
|
||||
list_for_each_entry_continue_reverse(entry, list, head) {
|
||||
struct ttm_buffer_object *bo = entry->bo;
|
||||
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
|
||||
|
||||
if (list_empty(&bo->lru))
|
||||
ttm_bo_add_to_lru(bo);
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
}
|
||||
spin_unlock(&glob->lru_lock);
|
||||
|
||||
@@ -114,7 +114,7 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
|
||||
|
||||
ret = __ttm_bo_reserve(bo, intr, (ticket == NULL), ticket);
|
||||
if (!ret && unlikely(atomic_read(&bo->cpu_writers) > 0)) {
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
|
||||
ret = -EBUSY;
|
||||
|
||||
@@ -130,7 +130,7 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
|
||||
if (!entry->num_shared)
|
||||
continue;
|
||||
|
||||
ret = reservation_object_reserve_shared(bo->resv,
|
||||
ret = reservation_object_reserve_shared(bo->base.resv,
|
||||
entry->num_shared);
|
||||
if (!ret)
|
||||
continue;
|
||||
@@ -144,16 +144,16 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
|
||||
|
||||
if (ret == -EDEADLK) {
|
||||
if (intr) {
|
||||
ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
|
||||
ticket);
|
||||
ret = reservation_object_lock_slow_interruptible(bo->base.resv,
|
||||
ticket);
|
||||
} else {
|
||||
ww_mutex_lock_slow(&bo->resv->lock, ticket);
|
||||
reservation_object_lock_slow(bo->base.resv, ticket);
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ret && entry->num_shared)
|
||||
ret = reservation_object_reserve_shared(bo->resv,
|
||||
ret = reservation_object_reserve_shared(bo->base.resv,
|
||||
entry->num_shared);
|
||||
|
||||
if (unlikely(ret != 0)) {
|
||||
@@ -201,14 +201,14 @@ void ttm_eu_fence_buffer_objects(struct ww_acquire_ctx *ticket,
|
||||
list_for_each_entry(entry, list, head) {
|
||||
bo = entry->bo;
|
||||
if (entry->num_shared)
|
||||
reservation_object_add_shared_fence(bo->resv, fence);
|
||||
reservation_object_add_shared_fence(bo->base.resv, fence);
|
||||
else
|
||||
reservation_object_add_excl_fence(bo->resv, fence);
|
||||
reservation_object_add_excl_fence(bo->base.resv, fence);
|
||||
if (list_empty(&bo->lru))
|
||||
ttm_bo_add_to_lru(bo);
|
||||
else
|
||||
ttm_bo_move_to_lru_tail(bo, NULL);
|
||||
reservation_object_unlock(bo->resv);
|
||||
reservation_object_unlock(bo->base.resv);
|
||||
}
|
||||
spin_unlock(&glob->lru_lock);
|
||||
if (ticket)
|
||||
|
@@ -48,7 +48,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)
|
||||
struct ttm_bo_device *bdev = bo->bdev;
|
||||
uint32_t page_flags = 0;
|
||||
|
||||
reservation_object_assert_held(bo->resv);
|
||||
reservation_object_assert_held(bo->base.resv);
|
||||
|
||||
if (bdev->need_dma32)
|
||||
page_flags |= TTM_PAGE_FLAG_DMA32;
|
||||
|
Criar uma nova questão referindo esta
Bloquear um utilizador