From patchwork Thu Jul 25 13:26:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11058813 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 383B6138D for ; Thu, 25 Jul 2019 13:27:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29F7C289DC for ; Thu, 25 Jul 2019 13:27:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E501289E1; Thu, 25 Jul 2019 13:27:57 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 B852A289DC for ; Thu, 25 Jul 2019 13:27:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2FB826E75E; Thu, 25 Jul 2019 13:27:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id BF77D6E75E for ; Thu, 25 Jul 2019 13:27:49 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id k8so50219049eds.7 for ; Thu, 25 Jul 2019 06:27:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ttP1+mV0DK/ZdRn/CTFLYCCtPthLQvjtevQ8+/YIW9o=; b=hmxyk1Chpikda2C+qTYngk0vOLlq1XH8g4lZAf78Lii62LvrqIS0JD73sc1SOcc8nG dqFN5HMiSnwfzCIydo96pV7y/lI2rR9J9zWNQKl+YLhHyWP0JacS3KzAb9kSGTw450OQ OrmpnQDfOf/GVblbJSd1VYDe7RMiQk4RW4GUgBshVTkYdLt6xmnf5YoDuKrygEICxzFR 2n+e6y+/1rwZWZJeW4Bk3jt+tiKaC5P0KzlCTGjp+125tYDATLjMmlrUSLa+hGTvhf6A tnvQ6o4GHYxY606Qv7aMwqMiT3lTytCunPxJkc1qH+/hOTklgpbc0cD7ViSUyGDFuhBV Iorg== X-Gm-Message-State: APjAAAXEeEEdQ+RM7VSUxkrMdB35Yn+QvTMsMPj5PrwNolcf5GkdiACX 9lAo9uWS0Dosqrl+6+oXgOM/uRNlV+0= X-Google-Smtp-Source: APXvYqzMmI70/VpIFW6DCm9lnDpY3BIDfEMBlPPvAHyOCKr4KpoBIV3iqogvW+0Mpq1Hjh8Q/cBhhw== X-Received: by 2002:a50:d7d0:: with SMTP id m16mr75378504edj.162.1564061268099; Thu, 25 Jul 2019 06:27:48 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id l1sm13091167edr.17.2019.07.25.06.27.46 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 25 Jul 2019 06:27:47 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 2/4] drm/nouveau: Fill out gem_object->resv Date: Thu, 25 Jul 2019 15:26:53 +0200 Message-Id: <20190725132655.11951-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190725132655.11951-1-daniel.vetter@ffwll.ch> References: <20190725132655.11951-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ttP1+mV0DK/ZdRn/CTFLYCCtPthLQvjtevQ8+/YIW9o=; b=NEE4A7PErQEgsK6kaFHzUyK2BoHRcgiVy9yyeB14qf2TTwR+bGesLVk1MbiYpvTEh4 WxUP0A4fkB4JDilF14TiZnvcoBSKHLqOD9b7BR/btY0Kju11kQj0qRyqI2vVNVh+1hda YDNfMfebOXJ6p5ihh1lahMkwkmTXHb5D7MCaU= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , kraxel@redhat.com, nouveau@lists.freedesktop.org, Daniel Vetter , Emil Velikov , Ben Skeggs Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP That way we can ditch our gem_prime_res_obj implementation. Since ttm absolutely needs the right reservation object all the boilerplate is already there and we just have to wire it up correctly. Note that gem/prime doesn't care when we do this, as long as we do it before the bo is registered and someone can call the handle2fd ioctl on it. Aside: ttm_buffer_object.ttm_resv could probably be ditched in favour of always passing a non-NULL resv to ttm_bo_init(). At least for gem drivers that would avoid having two of these, on in ttm_buffer_object and the other in drm_gem_object, one just there for confusion. Acked-by: Gerd Hoffmann Cc: Gerd Hoffmann Reviewed-by: Emil Velikov Signed-off-by: Daniel Vetter Cc: Ben Skeggs Cc: nouveau@lists.freedesktop.org Reviewed-by: Ben Skeggs --- drivers/gpu/drm/nouveau/nouveau_bo.c | 2 ++ drivers/gpu/drm/nouveau/nouveau_drm.c | 1 - drivers/gpu/drm/nouveau/nouveau_gem.h | 1 - drivers/gpu/drm/nouveau/nouveau_prime.c | 7 ------- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 34a998012bf6..6f1217b3e6b9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -299,6 +299,8 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align, type, &nvbo->placement, align >> PAGE_SHIFT, false, acc_size, sg, robj, nouveau_bo_del_ttm); + nvbo->gem.resv = nvbo->bo.resv; + if (ret) { /* ttm will call nouveau_bo_del_ttm if it fails.. */ return ret; diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 068ff3ad6ed0..7e045580a3a4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -1131,7 +1131,6 @@ driver_stub = { .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_pin = nouveau_gem_prime_pin, - .gem_prime_res_obj = nouveau_gem_prime_res_obj, .gem_prime_unpin = nouveau_gem_prime_unpin, .gem_prime_get_sg_table = nouveau_gem_prime_get_sg_table, .gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table, diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.h b/drivers/gpu/drm/nouveau/nouveau_gem.h index 03371204a47c..d67e2f9ec59c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.h +++ b/drivers/gpu/drm/nouveau/nouveau_gem.h @@ -33,7 +33,6 @@ extern int nouveau_gem_ioctl_info(struct drm_device *, void *, struct drm_file *); extern int nouveau_gem_prime_pin(struct drm_gem_object *); -struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *); extern void nouveau_gem_prime_unpin(struct drm_gem_object *); extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *); extern struct drm_gem_object *nouveau_gem_prime_import_sg_table( diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c index 1fefc93af1d7..ec50017692d4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_prime.c +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c @@ -107,10 +107,3 @@ void nouveau_gem_prime_unpin(struct drm_gem_object *obj) nouveau_bo_unpin(nvbo); } - -struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *obj) -{ - struct nouveau_bo *nvbo = nouveau_gem_object(obj); - - return nvbo->bo.resv; -}