aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm/ttm_execbuf_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_execbuf_util.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_execbuf_util.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
index 3832fe10b4df..36d111a88232 100644
--- a/drivers/gpu/drm/ttm/ttm_execbuf_util.c
+++ b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
@@ -221,8 +221,18 @@ void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj)
221 221
222 list_for_each_entry(entry, list, head) { 222 list_for_each_entry(entry, list, head) {
223 bo = entry->bo; 223 bo = entry->bo;
224 entry->old_sync_obj_read = NULL;
225 entry->old_sync_obj_write = NULL;
224 entry->old_sync_obj = bo->sync_obj; 226 entry->old_sync_obj = bo->sync_obj;
225 bo->sync_obj = driver->sync_obj_ref(sync_obj); 227 bo->sync_obj = driver->sync_obj_ref(sync_obj);
228 if (entry->usage & TTM_USAGE_READ) {
229 entry->old_sync_obj_read = bo->sync_obj_read;
230 bo->sync_obj_read = driver->sync_obj_ref(sync_obj);
231 }
232 if (entry->usage & TTM_USAGE_WRITE) {
233 entry->old_sync_obj_write = bo->sync_obj_write;
234 bo->sync_obj_write = driver->sync_obj_ref(sync_obj);
235 }
226 bo->sync_obj_arg = entry->new_sync_obj_arg; 236 bo->sync_obj_arg = entry->new_sync_obj_arg;
227 ttm_bo_unreserve_locked(bo); 237 ttm_bo_unreserve_locked(bo);
228 entry->reserved = false; 238 entry->reserved = false;
@@ -231,8 +241,15 @@ void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj)
231 spin_unlock(&bdev->fence_lock); 241 spin_unlock(&bdev->fence_lock);
232 242
233 list_for_each_entry(entry, list, head) { 243 list_for_each_entry(entry, list, head) {
234 if (entry->old_sync_obj) 244 if (entry->old_sync_obj) {
235 driver->sync_obj_unref(&entry->old_sync_obj); 245 driver->sync_obj_unref(&entry->old_sync_obj);
246 }
247 if (entry->old_sync_obj_read) {
248 driver->sync_obj_unref(&entry->old_sync_obj_read);
249 }
250 if (entry->old_sync_obj_write) {
251 driver->sync_obj_unref(&entry->old_sync_obj_write);
252 }
236 } 253 }
237} 254}
238EXPORT_SYMBOL(ttm_eu_fence_buffer_objects); 255EXPORT_SYMBOL(ttm_eu_fence_buffer_objects);