diff options
| author | Dave Airlie <airlied@redhat.com> | 2017-06-28 03:07:15 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2017-06-28 03:07:15 -0400 |
| commit | 9ff1beb1d19ffe2b26bf9cd2d33e6073d4f4b5fe (patch) | |
| tree | 0d154cdf42dfeeb1afa11ee05395f5c16e5fa0f0 | |
| parent | 5193c08c7e82248cb6b1e5d672d261c4da6bb47b (diff) | |
| parent | 611cdf3695a307fdca3ff3779a1e6cca935e2d31 (diff) | |
Merge tag 'drm-intel-fixes-2017-06-27' of git://anongit.freedesktop.org/git/drm-intel into drm-fixes
Just a few minor fixes. Important one is the execbuf async fix (aka
ANDROID_native_sync). There was another patch for a display coherency
corner case on APL, but we've random-walked in that space too much,
and the cherry-pick looked really invasive.
* tag 'drm-intel-fixes-2017-06-27' of git://anongit.freedesktop.org/git/drm-intel:
drm/i915: Disable EXEC_OBJECT_ASYNC when doing relocations
drm/i915: Hold struct_mutex for per-file stats in debugfs/i915_gem_object
drm/i915: Retire the VMA's fence tracker before unbinding
| -rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 6 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_gem_execbuffer.c | 17 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_vma.c | 5 |
3 files changed, 24 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index d689e511744e..4bd1467c17b1 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
| @@ -292,6 +292,8 @@ static int per_file_stats(int id, void *ptr, void *data) | |||
| 292 | struct file_stats *stats = data; | 292 | struct file_stats *stats = data; |
| 293 | struct i915_vma *vma; | 293 | struct i915_vma *vma; |
| 294 | 294 | ||
| 295 | lockdep_assert_held(&obj->base.dev->struct_mutex); | ||
| 296 | |||
| 295 | stats->count++; | 297 | stats->count++; |
| 296 | stats->total += obj->base.size; | 298 | stats->total += obj->base.size; |
| 297 | if (!obj->bind_count) | 299 | if (!obj->bind_count) |
| @@ -476,6 +478,8 @@ static int i915_gem_object_info(struct seq_file *m, void *data) | |||
| 476 | struct drm_i915_gem_request *request; | 478 | struct drm_i915_gem_request *request; |
| 477 | struct task_struct *task; | 479 | struct task_struct *task; |
| 478 | 480 | ||
| 481 | mutex_lock(&dev->struct_mutex); | ||
| 482 | |||
| 479 | memset(&stats, 0, sizeof(stats)); | 483 | memset(&stats, 0, sizeof(stats)); |
| 480 | stats.file_priv = file->driver_priv; | 484 | stats.file_priv = file->driver_priv; |
| 481 | spin_lock(&file->table_lock); | 485 | spin_lock(&file->table_lock); |
| @@ -487,7 +491,6 @@ static int i915_gem_object_info(struct seq_file *m, void *data) | |||
| 487 | * still alive (e.g. get_pid(current) => fork() => exit()). | 491 | * still alive (e.g. get_pid(current) => fork() => exit()). |
| 488 | * Therefore, we need to protect this ->comm access using RCU. | 492 | * Therefore, we need to protect this ->comm access using RCU. |
| 489 | */ | 493 | */ |
| 490 | mutex_lock(&dev->struct_mutex); | ||
| 491 | request = list_first_entry_or_null(&file_priv->mm.request_list, | 494 | request = list_first_entry_or_null(&file_priv->mm.request_list, |
| 492 | struct drm_i915_gem_request, | 495 | struct drm_i915_gem_request, |
| 493 | client_link); | 496 | client_link); |
| @@ -497,6 +500,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data) | |||
| 497 | PIDTYPE_PID); | 500 | PIDTYPE_PID); |
| 498 | print_file_stats(m, task ? task->comm : "<unknown>", stats); | 501 | print_file_stats(m, task ? task->comm : "<unknown>", stats); |
| 499 | rcu_read_unlock(); | 502 | rcu_read_unlock(); |
| 503 | |||
| 500 | mutex_unlock(&dev->struct_mutex); | 504 | mutex_unlock(&dev->struct_mutex); |
| 501 | } | 505 | } |
| 502 | mutex_unlock(&dev->filelist_mutex); | 506 | mutex_unlock(&dev->filelist_mutex); |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index a3e59c8ef27b..9ad13eeed904 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
| @@ -546,11 +546,12 @@ repeat: | |||
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | static int | 548 | static int |
| 549 | i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, | 549 | i915_gem_execbuffer_relocate_entry(struct i915_vma *vma, |
| 550 | struct eb_vmas *eb, | 550 | struct eb_vmas *eb, |
| 551 | struct drm_i915_gem_relocation_entry *reloc, | 551 | struct drm_i915_gem_relocation_entry *reloc, |
| 552 | struct reloc_cache *cache) | 552 | struct reloc_cache *cache) |
| 553 | { | 553 | { |
| 554 | struct drm_i915_gem_object *obj = vma->obj; | ||
| 554 | struct drm_i915_private *dev_priv = to_i915(obj->base.dev); | 555 | struct drm_i915_private *dev_priv = to_i915(obj->base.dev); |
| 555 | struct drm_gem_object *target_obj; | 556 | struct drm_gem_object *target_obj; |
| 556 | struct drm_i915_gem_object *target_i915_obj; | 557 | struct drm_i915_gem_object *target_i915_obj; |
| @@ -628,6 +629,16 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, | |||
| 628 | return -EINVAL; | 629 | return -EINVAL; |
| 629 | } | 630 | } |
| 630 | 631 | ||
| 632 | /* | ||
| 633 | * If we write into the object, we need to force the synchronisation | ||
| 634 | * barrier, either with an asynchronous clflush or if we executed the | ||
| 635 | * patching using the GPU (though that should be serialised by the | ||
| 636 | * timeline). To be completely sure, and since we are required to | ||
| 637 | * do relocations we are already stalling, disable the user's opt | ||
| 638 | * of our synchronisation. | ||
| 639 | */ | ||
| 640 | vma->exec_entry->flags &= ~EXEC_OBJECT_ASYNC; | ||
| 641 | |||
| 631 | ret = relocate_entry(obj, reloc, cache, target_offset); | 642 | ret = relocate_entry(obj, reloc, cache, target_offset); |
| 632 | if (ret) | 643 | if (ret) |
| 633 | return ret; | 644 | return ret; |
| @@ -678,7 +689,7 @@ i915_gem_execbuffer_relocate_vma(struct i915_vma *vma, | |||
| 678 | do { | 689 | do { |
| 679 | u64 offset = r->presumed_offset; | 690 | u64 offset = r->presumed_offset; |
| 680 | 691 | ||
| 681 | ret = i915_gem_execbuffer_relocate_entry(vma->obj, eb, r, &cache); | 692 | ret = i915_gem_execbuffer_relocate_entry(vma, eb, r, &cache); |
| 682 | if (ret) | 693 | if (ret) |
| 683 | goto out; | 694 | goto out; |
| 684 | 695 | ||
| @@ -726,7 +737,7 @@ i915_gem_execbuffer_relocate_vma_slow(struct i915_vma *vma, | |||
| 726 | 737 | ||
| 727 | reloc_cache_init(&cache, eb->i915); | 738 | reloc_cache_init(&cache, eb->i915); |
| 728 | for (i = 0; i < entry->relocation_count; i++) { | 739 | for (i = 0; i < entry->relocation_count; i++) { |
| 729 | ret = i915_gem_execbuffer_relocate_entry(vma->obj, eb, &relocs[i], &cache); | 740 | ret = i915_gem_execbuffer_relocate_entry(vma, eb, &relocs[i], &cache); |
| 730 | if (ret) | 741 | if (ret) |
| 731 | break; | 742 | break; |
| 732 | } | 743 | } |
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c index 1aba47024656..f066e2d785f5 100644 --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c | |||
| @@ -650,6 +650,11 @@ int i915_vma_unbind(struct i915_vma *vma) | |||
| 650 | break; | 650 | break; |
| 651 | } | 651 | } |
| 652 | 652 | ||
| 653 | if (!ret) { | ||
| 654 | ret = i915_gem_active_retire(&vma->last_fence, | ||
| 655 | &vma->vm->i915->drm.struct_mutex); | ||
| 656 | } | ||
| 657 | |||
| 653 | __i915_vma_unpin(vma); | 658 | __i915_vma_unpin(vma); |
| 654 | if (ret) | 659 | if (ret) |
| 655 | return ret; | 660 | return ret; |
