aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-09-05 08:30:05 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-09-12 14:24:09 -0400
commitca666a3c298f838346ccea46ff542c605e68deb5 (patch)
tree7ac2c1cecaaf8c52a94439604d942f6001af0cd2 /drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
parentb72cf4fca2bb786e20864b5e8755105aa9626fb4 (diff)
drm/amdgpu: stop using BO status for user pages
Instead use a counter to figure out if we need to set new pages or not. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 283a216ee758..4d3f8fbfa59d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -473,7 +473,8 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
473 return -EPERM; 473 return -EPERM;
474 474
475 /* Check if we have user pages and nobody bound the BO already */ 475 /* Check if we have user pages and nobody bound the BO already */
476 if (lobj->user_pages && bo->tbo.ttm->state != tt_bound) { 476 if (amdgpu_ttm_tt_userptr_needs_pages(bo->tbo.ttm) &&
477 lobj->user_pages) {
477 amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm, 478 amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm,
478 lobj->user_pages); 479 lobj->user_pages);
479 binding_userptr = true; 480 binding_userptr = true;
@@ -534,23 +535,25 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
534 INIT_LIST_HEAD(&need_pages); 535 INIT_LIST_HEAD(&need_pages);
535 for (i = p->bo_list->first_userptr; 536 for (i = p->bo_list->first_userptr;
536 i < p->bo_list->num_entries; ++i) { 537 i < p->bo_list->num_entries; ++i) {
538 struct amdgpu_bo *bo;
537 539
538 e = &p->bo_list->array[i]; 540 e = &p->bo_list->array[i];
541 bo = e->robj;
539 542
540 if (amdgpu_ttm_tt_userptr_invalidated(e->robj->tbo.ttm, 543 if (amdgpu_ttm_tt_userptr_invalidated(bo->tbo.ttm,
541 &e->user_invalidated) && e->user_pages) { 544 &e->user_invalidated) && e->user_pages) {
542 545
543 /* We acquired a page array, but somebody 546 /* We acquired a page array, but somebody
544 * invalidated it. Free it and try again 547 * invalidated it. Free it and try again
545 */ 548 */
546 release_pages(e->user_pages, 549 release_pages(e->user_pages,
547 e->robj->tbo.ttm->num_pages, 550 bo->tbo.ttm->num_pages,
548 false); 551 false);
549 kvfree(e->user_pages); 552 kvfree(e->user_pages);
550 e->user_pages = NULL; 553 e->user_pages = NULL;
551 } 554 }
552 555
553 if (e->robj->tbo.ttm->state != tt_bound && 556 if (amdgpu_ttm_tt_userptr_needs_pages(bo->tbo.ttm) &&
554 !e->user_pages) { 557 !e->user_pages) {
555 list_del(&e->tv.head); 558 list_del(&e->tv.head);
556 list_add(&e->tv.head, &need_pages); 559 list_add(&e->tv.head, &need_pages);