From patchwork Mon Apr 13 14:52:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 6210051 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 17859BF4A7 for ; Mon, 13 Apr 2015 14:52:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2ACB72021F for ; Mon, 13 Apr 2015 14:52:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 60ED120357 for ; Mon, 13 Apr 2015 14:52:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 23FD56E54C; Mon, 13 Apr 2015 07:52:32 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pegasos-out.vodafone.de (pegasos-out.vodafone.de [80.84.1.38]) by gabe.freedesktop.org (Postfix) with ESMTP id 862966E54C for ; Mon, 13 Apr 2015 07:52:30 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by pegasos-out.vodafone.de (Rohrpostix1 Daemon) with ESMTP id 2E49626088D; Mon, 13 Apr 2015 16:52:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at vodafone.de X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Authentication-Results: rohrpostix1.prod.vfnet.de (amavisd-new); dkim=pass header.i=@vodafone.de Received: from pegasos-out.vodafone.de ([127.0.0.1]) by localhost (rohrpostix1.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pVVBHfBtjR-p; Mon, 13 Apr 2015 16:52:26 +0200 (CEST) Received: from smtp-01.vodafone.de (xsmail-dmz5.prod.vfnet.de [10.215.254.36]) by pegasos-out.vodafone.de (Rohrpostix1 Daemon) with ESMTP id 9C93426084D; Mon, 13 Apr 2015 16:52:26 +0200 (CEST) X-DKIM: OpenDKIM Filter v2.6.8 pegasos-out.vodafone.de 9C93426084D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafone.de; s=mail; t=1428936746; bh=FeYMcogATe/02V2UL36ykEI9VFHTN4aqx83rVwNOmoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Mnc4mKKzQ+W1NrJ8+aiqhvjYoqh71/y4kTSs95ZiCaLKK3+GHJNSSfrW3I/Z5SLkC p03VUIpnNK3rSNdmw70ST+61hvCwHOplmdcBjAdXvXLus+4GDqY8gSPHS+6ClqWhjo /nJgzu1vF1Pd2H/sLYmx5JQ1thBBYRiOKjciW9jg= X-Virus-Scanned: amavisd-new at vodafone.de Received: from smtp-01.vodafone.de ([127.0.0.1]) by localhost (xsmail-dmz5.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Tr3T8CvqGZ1E; Mon, 13 Apr 2015 16:52:25 +0200 (CEST) From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/3] drm/radeon: wait for BO move to finish on kmap Date: Mon, 13 Apr 2015 16:52:15 +0200 Message-Id: <1428936737-19103-2-git-send-email-deathsimple@vodafone.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428936737-19103-1-git-send-email-deathsimple@vodafone.de> References: <1428936737-19103-1-git-send-email-deathsimple@vodafone.de> MIME-Version: 1.0 Cc: Serguei.Sagalovitch@amd.com 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christian König After resume buffer need to move back into VRAM. We already had this problem with UVD, but solve it more general to be on the safe side. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon.h | 2 ++ drivers/gpu/drm/radeon/radeon_object.c | 11 +++++++++++ drivers/gpu/drm/radeon/radeon_ttm.c | 3 +++ drivers/gpu/drm/radeon/radeon_uvd.c | 10 ---------- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 33d5a4f..6e6b49a 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -506,6 +506,8 @@ struct radeon_bo { struct radeon_mn *mn; struct interval_tree_node mn_it; + + struct radeon_fence *last_move; }; #define gem_to_radeon_bo(gobj) container_of((gobj), struct radeon_bo, gem_base) diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 318165d..14a0f87 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -263,6 +263,17 @@ int radeon_bo_kmap(struct radeon_bo *bo, void **ptr) bool is_iomem; int r; + if (bo->last_move) { + r = radeon_fence_wait(bo->last_move, false); + if (r) { + radeon_bo_kunmap(bo); + DRM_ERROR("Failed waiting BO move (%d)!\n", r); + return r; + } + + radeon_fence_unref(&bo->last_move); + } + if (bo->kptr) { if (ptr) { *ptr = bo->kptr; diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index b292aca..1fa4f2d 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -253,6 +253,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem, struct ttm_mem_reg *old_mem) { + struct radeon_bo *rbo = container_of(bo, struct radeon_bo, tbo); struct radeon_device *rdev; uint64_t old_start, new_start; struct radeon_fence *fence; @@ -300,6 +301,8 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, r = ttm_bo_move_accel_cleanup(bo, &fence->base, evict, no_wait_gpu, new_mem); + radeon_fence_unref(&rbo->last_move); + rbo->last_move = radeon_fence_ref(fence); radeon_fence_unref(&fence); return r; } diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index c10b2ae..60f96a3 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c @@ -401,7 +401,6 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, { int32_t *msg, msg_type, handle; unsigned img_size = 0; - struct fence *f; void *ptr; int i, r; @@ -411,15 +410,6 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, return -EINVAL; } - f = reservation_object_get_excl(bo->tbo.resv); - if (f) { - r = radeon_fence_wait((struct radeon_fence *)f, false); - if (r) { - DRM_ERROR("Failed waiting for UVD message (%d)!\n", r); - return r; - } - } - r = radeon_bo_kmap(bo, &ptr); if (r) { DRM_ERROR("Failed mapping the UVD message (%d)!\n", r);