From patchwork Fri Jun 14 20:36:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10996739 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 27907112C for ; Fri, 14 Jun 2019 20:39:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19E1228733 for ; Fri, 14 Jun 2019 20:39:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D9F12876B; Fri, 14 Jun 2019 20:39:21 +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=unavailable 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 B6BE328733 for ; Fri, 14 Jun 2019 20:39:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 921628989C; Fri, 14 Jun 2019 20:37:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 33A3B89838 for ; Fri, 14 Jun 2019 20:37:24 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id k8so5229742eds.7 for ; Fri, 14 Jun 2019 13:37:24 -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=vWZfr7ISqOyco6qNaCIPedeBWFUOnZ0cxqOqxgRLM1c=; b=YQl9dwXmLSi09+qLdZ57cBwufA2oMMNgByOXVHfjaM8C/45h/MS66PSHSHQ3RKZ4mZ X24Lw51ifGEaFr3m1pt7RfwW3VldiSkXb00k9UjDSyEem2SvXiEaoz5iEC2/S7IiXZsI nTguKHWPIZ4F412IGlp4OXXJ154xE8OsxrwTjLYr1AjIfAT2vpnBb2H/e6kPxXYByhDZ nYx6P9+QOQGrGl8yo8H7860S3MRD3XVOUhkmu9jEjWDWtu+AyNc337h38LaabpehQqSg hVPjDcfw8FcNY45jYW/vHqcBv80pD+fTW3YQyrvRbdyvKxhrZZ64xflfzKwO/Fut5MbK 79ug== X-Gm-Message-State: APjAAAXC8u9jkIVGkL2cI00O072vDAzwpA8iIdDncdcYGfL+KuXMwGWq RzBoHblvf5ib7odxFJamUXg3wQ+Z7u0= X-Google-Smtp-Source: APXvYqxXisqjXAGwJYNYQFGPAnSwdHNq8sqM4urZEAZvheKiO7AhJJMJfR+SMYwbKK1SNED/AkO0FA== X-Received: by 2002:a05:6402:78c:: with SMTP id d12mr43020119edy.160.1560544641469; Fri, 14 Jun 2019 13:37:21 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id n15sm1166672edd.49.2019.06.14.13.37.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 13:37:20 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 52/59] drm/nouveau: Fill out gem_object->resv Date: Fri, 14 Jun 2019 22:36:08 +0200 Message-Id: <20190614203615.12639-53-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614203615.12639-1-daniel.vetter@ffwll.ch> References: <20190614203615.12639-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=vWZfr7ISqOyco6qNaCIPedeBWFUOnZ0cxqOqxgRLM1c=; b=Qrb+VSRzlRZ2oXsBsEE1LUi96MXc8Vn65XYVQ8Klpnx8wthebGTwxUhN0oQPU7LiK5 /ncXlylhp5U4662Eje2eGtBiaBiExCA792Vlvi3EmJoyDoeoCS8OLz5j/WXnqteLZICY wedESWhOjg3HKaUCT9THJF4TUAMmeVnDrR2Ss= 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: nouveau@lists.freedesktop.org, Daniel Vetter , Intel Graphics Development , Ben Skeggs , Daniel Vetter 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. Signed-off-by: Daniel Vetter Cc: Ben Skeggs Cc: nouveau@lists.freedesktop.org --- 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 4377b836265f..2c36319c158f 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 fe39998f65cc..9dea015387fd 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; -}