From patchwork Fri Aug 14 18:08:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bas Nieuwenhuizen X-Patchwork-Id: 7018441 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 69D219F344 for ; Fri, 14 Aug 2015 18:10:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 76918207FB for ; Fri, 14 Aug 2015 18:10:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EBEB8205FF for ; Fri, 14 Aug 2015 18:10:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 00CEF6E8A6; Fri, 14 Aug 2015 11:10:03 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3CC566E76F for ; Fri, 14 Aug 2015 11:10:01 -0700 (PDT) Received: by wibhh20 with SMTP id hh20so29182196wib.0 for ; Fri, 14 Aug 2015 11:09:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=OJHBKodO3Tes6L5KuRI3UryCYmzz1Lh3iObogou9zaA=; b=MZMTi8tw0HUFL60gm36/9YeKQ1/x0S7dwmijhG+2nFPGsgVPa5sdJ+zHeo/+wydL+P 4y6Qsbo27VmnWDjJPIU2cRvwbLfjTvXLLqCO0woEhiBscU3QZOMI+5nTZRYYoMWKnNic uexm7dS1FnysnzOGPvNTq7dxi7voCTa2iATt6KGKXTrtLKWXhrH8cn8ENml8dYF5c8qR yMxD9MJ5Cm/ic6giNTt69P9er7Td59jgF2m5z0odbERF3U90Q07K4OmMux61ryCMH94D kgswGbpoi2ua+vxx+ckQOeb2bZYgO/Iumz5+3YWq0GAwF2rhuZphr8vx9ZZnhz8Z+R/Z Nr/w== X-Gm-Message-State: ALoCoQlBEWTyWgO4lM289AIQAEONH2AcfCAUTeVBNc7aGigoKHJptG07ZiyYC78L1XQ2J09NkHMJ X-Received: by 10.195.12.76 with SMTP id eo12mr2356406wjd.51.1439575799562; Fri, 14 Aug 2015 11:09:59 -0700 (PDT) Received: from bas-desktop.localdomain (4dafc19f.ftth.telfortglasvezel.nl. [77.175.193.159]) by smtp.gmail.com with ESMTPSA id e8sm4197520wiz.0.2015.08.14.11.09.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Aug 2015 11:09:58 -0700 (PDT) From: Bas Nieuwenhuizen To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/amdgpu: wait on page directory changes. Date: Fri, 14 Aug 2015 20:08:40 +0200 Message-Id: <1439575721-876-1-git-send-email-bas@basnieuwenhuizen.nl> X-Mailer: git-send-email 2.5.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Pagetables can be moved and therefore the page directory update can be necessary for the current cs even if none of the the bo's are moved. In that scenario there is no fence between the sdma0 and gfx ring, so we add one. Signed-off-by: Bas Nieuwenhuizen --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 6934f52..c2383bb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -981,6 +981,7 @@ struct amdgpu_vm { /* contains the page directory */ struct amdgpu_bo *page_directory; unsigned max_pde_used; + struct fence *page_directory_fence; /* array of page tables, one for each page directory entry */ struct amdgpu_vm_pt *page_tables; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index f428288..01b4a67 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -552,6 +552,10 @@ static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p, if (r) return r; + r = amdgpu_sync_fence(adev, &p->ibs[0].sync, vm->page_directory_fence); + if (r) + return r; + r = amdgpu_vm_clear_freed(adev, vm); if (r) return r; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index b3f5d04..e02e353 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -495,6 +495,9 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev, if (r) goto error_free; amdgpu_bo_fence(pd, fence, true); + + fence_put(vm->page_directory_fence); + vm->page_directory_fence = fence_get(fence); } if (!amdgpu_enable_scheduler || ib->length_dw == 0) { @@ -1287,6 +1290,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) return -ENOMEM; } + vm->page_directory_fence = NULL; + r = amdgpu_bo_create(adev, pd_size, align, true, AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, &vm->page_directory); @@ -1335,6 +1340,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) kfree(vm->page_tables); amdgpu_bo_unref(&vm->page_directory); + fence_put(vm->page_directory_fence); for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { amdgpu_fence_unref(&vm->ids[i].flushed_updates);