From patchwork Mon Apr 3 05:56:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher James Halse Rogers X-Patchwork-Id: 9658797 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 298FE60353 for ; Mon, 3 Apr 2017 05:56:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10D4328448 for ; Mon, 3 Apr 2017 05:56:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05F072844B; Mon, 3 Apr 2017 05:56:39 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 A947528448 for ; Mon, 3 Apr 2017 05:56:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E8196E298; Mon, 3 Apr 2017 05:56:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.cooperteam.net (mail.cooperteam.net [150.101.105.211]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3246E6E294; Mon, 3 Apr 2017 05:56:35 +0000 (UTC) Received: from localhost.localdomain (unknown [192.168.1.1]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: chris) by mail.cooperteam.net (Postfix) with ESMTPSA id 50B6AA0206B; Mon, 3 Apr 2017 15:56:33 +1000 (AEST) From: raof@ubuntu.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/6 v2] drm/nouveau: Pin bos from imported dma-bufs to GTT. (v2) Date: Mon, 3 Apr 2017 15:56:28 +1000 Message-Id: <20170403055628.9573-1-raof@ubuntu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170329002720.11445-3-raof@ubuntu.com> References: <20170329002720.11445-3-raof@ubuntu.com> Cc: nouveau@lists.freedesktop.org, Christopher James Halse Rogers 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-Virus-Scanned: ClamAV using ClamSMTP From: Christopher James Halse Rogers Attempting to migrate the bo will break the sharing of the buffer. v2: Error-check the nouveau_bo_pin call; it can fail. Signed-off-by: Christopher James Halse Rogers --- drivers/gpu/drm/nouveau/nouveau_prime.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c index 1fefc93af1d7..ad5eaf70c8e2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_prime.c +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c @@ -76,6 +76,12 @@ struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev, return ERR_PTR(ret); nvbo->valid_domains = NOUVEAU_GEM_DOMAIN_GART; + /* pin imported buffer to GTT */ + ret = nouveau_bo_pin(nvbo, TTM_PL_FLAG_TT, false); + if (ret) { + nouveau_bo_ref(NULL, &nvbo); + return ERR_PTR(ret); + } /* Initialize the embedded gem-object. We return a single gem-reference * to the caller, instead of a normal nouveau_bo ttm reference. */