From patchwork Fri Nov 17 10:49:34 2017 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: 10062647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C331D6023A for ; Fri, 17 Nov 2017 10:50:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B996A2A847 for ; Fri, 17 Nov 2017 10:50:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC8642A859; Fri, 17 Nov 2017 10:50:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D6882A847 for ; Fri, 17 Nov 2017 10:50:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CCC816EA0E; Fri, 17 Nov 2017 10:49:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC21B6EA07; Fri, 17 Nov 2017 10:49:48 +0000 (UTC) Received: by mail-wr0-x243.google.com with SMTP id u40so1714433wrf.10; Fri, 17 Nov 2017 02:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=dgTGlPZX9/4tERXHyiGp1voq70aM1uewnrqubhN3TSs=; b=pdDNOEQ+WlcN0no/gnnjalUzARu/dMp4c+xBZHpSHCeEwS3IaDoldpARzDnN+SQ+88 Fjjj8vOYhvhZSF63pKwVvDEsZ5XWHvIVMGI7/iFQ5NFhUGLQARjGaSG96jaQJaV5wkR7 WCVJLnE02R/vCXmojzV2rz+n1AJKhTemg4Za8ABpWiI+ZdGwqf1i7cbmZ8r5RFfzazd+ H8O6zULhGM9fqFDoVKmFCDRJdpgIwne5MAMra9APboKRPH0gN3aJuhpWZkuWjfxPus+W wb8k+bDTdflcqwXqKg1lcLOXgdb5/YMca1uIWgw9K3o3dDHlxCXxSwZqNsGR0n/iqLfC iOmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dgTGlPZX9/4tERXHyiGp1voq70aM1uewnrqubhN3TSs=; b=LEHcFwO1PDVlJtFBX6/qiccqIe61bGZJLjfon50Sj6Y8bagv6rbeBehsULNKhASEOL jsS4Sy7p14iezhrtUfQPlYbua3yY5SepMfFWxGW2Ep+4LIue78PLWAOqIUgkjP/DLGsY R9Fs+Us4cfSKlUBHzjc16CPv6HbMNTzrbm1xDcCJ2OX3L+CdWqW98MJMVxAzvuEBOxt+ L0DvVU7sjT5/4VKM8Tsa3N0V8nPqQvzIYA+t2IcaJiU4orGSRZgrBmwjqJpDGEu4NTzQ NcsSPxYlnZmV+G+mYbHK65Xg350H3qfZKYrdTetwgpmte2xx73IOjT6c1Xns5wyKoOu1 d0iQ== X-Gm-Message-State: AJaThX5k+CEVsEf085Q1Ms5lb3CmrRY1rS7tGUkJSXt8EJcVN3bQ0Onc LH1sGPMANClqypcbchPCsvUC3A== X-Google-Smtp-Source: AGs4zMbluFc726Ei5bKhl9c7OdC9l8022ASQ4O32ao8bp9EMsRreGvD30aL2SPEWiJKSsHypzDVlMA== X-Received: by 10.223.132.6 with SMTP id 6mr3969609wrf.93.1510915786749; Fri, 17 Nov 2017 02:49:46 -0800 (PST) Received: from localhost.localdomain ([2a02:908:1251:7981:4ce1:a38d:11ca:a5]) by smtp.gmail.com with ESMTPSA id 186sm2884009wmm.47.2017.11.17.02.49.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 02:49:46 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 7/8] drm/amdgpu: forward operation context to ttm_bo_mem_space Date: Fri, 17 Nov 2017 11:49:34 +0100 Message-Id: <20171117104935.4150-8-christian.koenig@amd.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117104935.4150-1-christian.koenig@amd.com> References: <20171117104935.4150-1-christian.koenig@amd.com> MIME-Version: 1.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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This way we can finally use some more stats. Signed-off-by: Christian König Reviewed-by: Michel Dänzer --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 7d0efc3be25e..17bf0ce1e04f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -466,12 +466,10 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo, return r; } -static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, - bool evict, bool interruptible, - bool no_wait_gpu, +static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict, + struct ttm_operation_ctx *ctx, struct ttm_mem_reg *new_mem) { - struct ttm_operation_ctx ctx = { interruptible, no_wait_gpu }; struct amdgpu_device *adev; struct ttm_mem_reg *old_mem = &bo->mem; struct ttm_mem_reg tmp_mem; @@ -489,7 +487,7 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, placements.fpfn = 0; placements.lpfn = 0; placements.flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT; - r = ttm_bo_mem_space(bo, &placement, &tmp_mem, &ctx); + r = ttm_bo_mem_space(bo, &placement, &tmp_mem, ctx); if (unlikely(r)) { return r; } @@ -503,22 +501,20 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, if (unlikely(r)) { goto out_cleanup; } - r = amdgpu_move_blit(bo, true, no_wait_gpu, &tmp_mem, old_mem); + r = amdgpu_move_blit(bo, true, ctx->no_wait_gpu, &tmp_mem, old_mem); if (unlikely(r)) { goto out_cleanup; } - r = ttm_bo_move_ttm(bo, interruptible, no_wait_gpu, new_mem); + r = ttm_bo_move_ttm(bo, ctx->interruptible, ctx->no_wait_gpu, new_mem); out_cleanup: ttm_bo_mem_put(bo, &tmp_mem); return r; } -static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, - bool evict, bool interruptible, - bool no_wait_gpu, +static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict, + struct ttm_operation_ctx *ctx, struct ttm_mem_reg *new_mem) { - struct ttm_operation_ctx ctx = { interruptible, no_wait_gpu }; struct amdgpu_device *adev; struct ttm_mem_reg *old_mem = &bo->mem; struct ttm_mem_reg tmp_mem; @@ -536,15 +532,15 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, placements.fpfn = 0; placements.lpfn = 0; placements.flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT; - r = ttm_bo_mem_space(bo, &placement, &tmp_mem, &ctx); + r = ttm_bo_mem_space(bo, &placement, &tmp_mem, ctx); if (unlikely(r)) { return r; } - r = ttm_bo_move_ttm(bo, interruptible, no_wait_gpu, &tmp_mem); + r = ttm_bo_move_ttm(bo, ctx->interruptible, ctx->no_wait_gpu, &tmp_mem); if (unlikely(r)) { goto out_cleanup; } - r = amdgpu_move_blit(bo, true, no_wait_gpu, new_mem, old_mem); + r = amdgpu_move_blit(bo, true, ctx->no_wait_gpu, new_mem, old_mem); if (unlikely(r)) { goto out_cleanup; } @@ -590,12 +586,10 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, if (old_mem->mem_type == TTM_PL_VRAM && new_mem->mem_type == TTM_PL_SYSTEM) { - r = amdgpu_move_vram_ram(bo, evict, ctx->interruptible, - ctx->no_wait_gpu, new_mem); + r = amdgpu_move_vram_ram(bo, evict, ctx, new_mem); } else if (old_mem->mem_type == TTM_PL_SYSTEM && new_mem->mem_type == TTM_PL_VRAM) { - r = amdgpu_move_ram_vram(bo, evict, ctx->interruptible, - ctx->no_wait_gpu, new_mem); + r = amdgpu_move_ram_vram(bo, evict, ctx, new_mem); } else { r = amdgpu_move_blit(bo, evict, ctx->no_wait_gpu, new_mem, old_mem);