From patchwork Thu Jul 25 13:26:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11058811 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 74EA0912 for ; Thu, 25 Jul 2019 13:27:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64A3A289D4 for ; Thu, 25 Jul 2019 13:27:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58B26289D7; Thu, 25 Jul 2019 13:27:54 +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 BE4332876C for ; Thu, 25 Jul 2019 13:27:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 059DC6E75D; 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-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 42EDA6E75D for ; Thu, 25 Jul 2019 13:27:48 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id x19so44315453eda.12 for ; Thu, 25 Jul 2019 06:27:48 -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=qfTfGwiIDonLTkvvou+0H7gyrR31y8O3wuySLzwsFms=; b=jYOSzgL1MFEfwkWTwhbbYpr+qA9OtP8kHsEneBLIfxzy8Rqq1FaXHTh/GkvLyNDeBy mP/RExlRoiqsaCvdvxHHM2KWIZ+x8tP+9DvbETgpr2wjneysIhubMSTAa/N3DT6sfdIX 6nuvfPm0feEahI5vQmo8ZpkdvEnsja3w64mZzl5ZZGPG/m3VBga3B3W7t2YSZPgQtl9d A9AQvzCL7i2hfKFhR+y9h62EAKT6kEVFFkO4a59yggQIMiM3ML2GL+0mazuEh/bRvIyL uw6k18W9pOhSg8qa4APbTtIOlt9/jA/WHnoy5qH6tPUfT7Tth2/j80irBteeMY7ig/mj wtkA== X-Gm-Message-State: APjAAAVF/8yjIlk+mG4Sg+Vi0n1R+hEgndZW9wH4cbtfwZoSjvC+Ipj1 NF1kiMGUAnOzAHdSwGdrz0OrBQBM+Qs= X-Google-Smtp-Source: APXvYqz1yMF3GYmMpgatihwRQqqc+hVtAp7NLasJ91subo2SKELP+HiJfWH4id5REIs40aZCL/5gqQ== X-Received: by 2002:a50:ad45:: with SMTP id z5mr76074349edc.21.1564061266522; Thu, 25 Jul 2019 06:27:46 -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.45 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 25 Jul 2019 06:27:45 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 1/4] drm/radeon: Fill out gem_object->resv Date: Thu, 25 Jul 2019 15:26:52 +0200 Message-Id: <20190725132655.11951-2-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=qfTfGwiIDonLTkvvou+0H7gyrR31y8O3wuySLzwsFms=; b=EBFvo3wxD2YuZbHsa+neDQBx95fJBXENFHYVjaxpk9UcHs5bj5d+tI8l0yZP6ZE9Iz 9xe//bvEuQ+zmrzAeN2W7PZ0HHrRy8ZJIZtW+wf2F2YyJrFfJPZSCKaPo/MQjrj7H5/i GcKxsHGbApfX+kbZlwugadXD7Jm7xxLDKem/Q= 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 , amd-gfx@lists.freedesktop.org, kraxel@redhat.com, Alex Deucher , Daniel Vetter , =?utf-8?q?Christian_K=C3=B6nig?= , Emil Velikov 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: Alex Deucher Cc: "Christian König" Cc: "David (ChunMing) Zhou" Cc: amd-gfx@lists.freedesktop.org Reviewed-by: Christian König --- drivers/gpu/drm/radeon/radeon_drv.c | 2 -- drivers/gpu/drm/radeon/radeon_object.c | 1 + drivers/gpu/drm/radeon/radeon_prime.c | 7 ------- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 4403e76e1ae0..a4a78dfdef37 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -152,7 +152,6 @@ struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev, struct sg_table *sg); int radeon_gem_prime_pin(struct drm_gem_object *obj); void radeon_gem_prime_unpin(struct drm_gem_object *obj); -struct reservation_object *radeon_gem_prime_res_obj(struct drm_gem_object *); void *radeon_gem_prime_vmap(struct drm_gem_object *obj); void radeon_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); @@ -566,7 +565,6 @@ static struct drm_driver kms_driver = { .gem_prime_export = radeon_gem_prime_export, .gem_prime_pin = radeon_gem_prime_pin, .gem_prime_unpin = radeon_gem_prime_unpin, - .gem_prime_res_obj = radeon_gem_prime_res_obj, .gem_prime_get_sg_table = radeon_gem_prime_get_sg_table, .gem_prime_import_sg_table = radeon_gem_prime_import_sg_table, .gem_prime_vmap = radeon_gem_prime_vmap, diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 21f73fc86f38..7a2bad843f8a 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -262,6 +262,7 @@ int radeon_bo_create(struct radeon_device *rdev, r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, &bo->placement, page_align, !kernel, acc_size, sg, resv, &radeon_ttm_bo_destroy); + bo->gem_base.resv = bo->tbo.resv; up_read(&rdev->pm.mclk_lock); if (unlikely(r != 0)) { return r; diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c index deaffce50a2e..8ce3e8045d42 100644 --- a/drivers/gpu/drm/radeon/radeon_prime.c +++ b/drivers/gpu/drm/radeon/radeon_prime.c @@ -117,13 +117,6 @@ void radeon_gem_prime_unpin(struct drm_gem_object *obj) } -struct reservation_object *radeon_gem_prime_res_obj(struct drm_gem_object *obj) -{ - struct radeon_bo *bo = gem_to_radeon_bo(obj); - - return bo->tbo.resv; -} - struct dma_buf *radeon_gem_prime_export(struct drm_gem_object *gobj, int flags) { 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; -} From patchwork Thu Jul 25 13:26:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11058815 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 7F9BD138D for ; Thu, 25 Jul 2019 13:28:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F18A2883F for ; Thu, 25 Jul 2019 13:28:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 632F5289E0; Thu, 25 Jul 2019 13:28:00 +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 C8ADE289EA for ; Thu, 25 Jul 2019 13:27:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DD34E6E75F; Thu, 25 Jul 2019 13:27:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by gabe.freedesktop.org (Postfix) with ESMTPS id 41E7F6E75D for ; Thu, 25 Jul 2019 13:27:51 +0000 (UTC) Received: by mail-ed1-x531.google.com with SMTP id r12so15439321edo.5 for ; Thu, 25 Jul 2019 06:27:51 -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=0zboelfQ3erNNY15bkwZrNnSA/TZK/41T/SkUWNjA0Q=; b=EeExFM0vnuPppZah7Mi7rG07nM4yq9+TOA9hygFOz5FCKeTlPciAG3a8y7DH7TmaSn x1TfertvrZN2Tv6oZ/SbeV5pyBQXYPUJOd9lGqt6UPBmkjX7E+YIFRk0LgGbo6ulCd66 u/QIDi1zYxqcr8fHZIuIljPIyNTBaRhPT7cEnG5uJwC3/a0OumPO+AaN891RpFbDTfSC vn8nS8AplFtNGSv5IySZJSy4LaqPPmgFXHr7ANdPuXiJy4nkSsqeMElI4XhnJ57nCOJX dCJMV9KUngc18x4KsqEGi3wT0iyaDirffdjk/k7cUlhLTNfxNcPDQ8oaPptFscWj1iZK MTjA== X-Gm-Message-State: APjAAAXzE8Ikndc/qZk57iQXS3SEM1BmJb92PgO+YR/KDHO7PUuWzVC6 HcJ01gWuS/o7ZFxnty/JYUJgonXyvz8= X-Google-Smtp-Source: APXvYqy94izB6n6D1MWGokYUlybu07HNq9Hk/3h+WPXDClN9avaSsVCzNT3X9K74GEBy+41YI8u6Rw== X-Received: by 2002:a17:906:e0cd:: with SMTP id gl13mr67331825ejb.52.1564061269475; Thu, 25 Jul 2019 06:27:49 -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.48 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 25 Jul 2019 06:27:48 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 3/4] drm/amdgpu: Fill out gem_object->resv Date: Thu, 25 Jul 2019 15:26:54 +0200 Message-Id: <20190725132655.11951-4-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=0zboelfQ3erNNY15bkwZrNnSA/TZK/41T/SkUWNjA0Q=; b=V0WMg6M9DoxNKbxeSvWa7NDGQgrav3+HyaDC4olfxikPHkEXzxmt2SkQL53HhEGaCF fcxhqg9OHzzTtm9bVXiBPpUidc0ZYmli+eVjbyHdGOM9whkYQtmdyXTpNjLCuCcuZcd1 Sxuz2/yeNxvsi7ZKxkQIQ6T6lRsW0N+lDmuY8= 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: Thomas Zimmermann , Amber Lin , Daniel Vetter , Felix Kuehling , =?utf-8?q?Michel_D=C3=A4nzer?= , Samuel Li , Sonny Jiang , Junwei Zhang , Huang Rui , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , kraxel@redhat.com, Alex Deucher , Daniel Vetter , Evan Quan , =?utf-8?q?Christian_K=C3=B6nig?= , Emil Velikov 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: Alex Deucher Cc: "Christian König" Cc: Daniel Vetter Cc: "Michel Dänzer" Cc: Chris Wilson Cc: Huang Rui Cc: Felix Kuehling Cc: Andrey Grodzovsky Cc: Evan Quan Cc: Sonny Jiang Cc: Amber Lin Cc: "Michał Mirosław" Cc: Junwei Zhang Cc: Thomas Zimmermann Cc: Samuel Li Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 17 +---------------- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++ 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c index 4809d4a5d72a..02cd845e77b3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c @@ -267,20 +267,6 @@ static void amdgpu_dma_buf_map_detach(struct dma_buf *dma_buf, drm_gem_map_detach(dma_buf, attach); } -/** - * amdgpu_gem_prime_res_obj - &drm_driver.gem_prime_res_obj implementation - * @obj: GEM BO - * - * Returns: - * The BO's reservation object. - */ -struct reservation_object *amdgpu_gem_prime_res_obj(struct drm_gem_object *obj) -{ - struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); - - return bo->tbo.resv; -} - /** * amdgpu_dma_buf_begin_cpu_access - &dma_buf_ops.begin_cpu_access implementation * @dma_buf: Shared DMA buffer @@ -339,8 +325,7 @@ const struct dma_buf_ops amdgpu_dmabuf_ops = { * @gobj: GEM BO * @flags: Flags such as DRM_CLOEXEC and DRM_RDWR. * - * The main work is done by the &drm_gem_prime_export helper, which in turn - * uses &amdgpu_gem_prime_res_obj. + * The main work is done by the &drm_gem_prime_export helper. * * Returns: * Shared DMA buffer representing the GEM BO from the given device. diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h index 7f73a4f94204..5012e6ab58f1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h @@ -34,7 +34,6 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_gem_object *gobj, int flags); struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, struct dma_buf *dma_buf); -struct reservation_object *amdgpu_gem_prime_res_obj(struct drm_gem_object *); void *amdgpu_gem_prime_vmap(struct drm_gem_object *obj); void amdgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); int amdgpu_gem_prime_mmap(struct drm_gem_object *obj, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index f67b5baed441..98df55534a6d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1397,7 +1397,6 @@ static struct drm_driver kms_driver = { .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_export = amdgpu_gem_prime_export, .gem_prime_import = amdgpu_gem_prime_import, - .gem_prime_res_obj = amdgpu_gem_prime_res_obj, .gem_prime_get_sg_table = amdgpu_gem_prime_get_sg_table, .gem_prime_import_sg_table = amdgpu_gem_prime_import_sg_table, .gem_prime_vmap = amdgpu_gem_prime_vmap, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index bea6f298dfdc..19ec775b7aa8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -509,6 +509,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, if (unlikely(r != 0)) return r; + bo->gem_base.resv = bo->tbo.resv; + if (!amdgpu_gmc_vram_full_visible(&adev->gmc) && bo->tbo.mem.mem_type == TTM_PL_VRAM && bo->tbo.mem.start < adev->gmc.visible_vram_size >> PAGE_SHIFT) From patchwork Thu Jul 25 13:26:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11058817 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 4EF9C912 for ; Thu, 25 Jul 2019 13:28:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4027F289D7 for ; Thu, 25 Jul 2019 13:28:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34873289E0; Thu, 25 Jul 2019 13:28:02 +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 C5723289D7 for ; Thu, 25 Jul 2019 13:28:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 552306E762; Thu, 25 Jul 2019 13:27:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 536676E75F for ; Thu, 25 Jul 2019 13:27:52 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id e3so50245570edr.10 for ; Thu, 25 Jul 2019 06:27:52 -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=MBKx6cyaWgWK2WLms53NILAn5q7ckrpw79tN0L1qShw=; b=CCWYR8Xm1lCC2Kl3lMaIVzEFTbrExd2Qinyt/VLhgoEXGvdUqEOuITksO6G48LWzuZ nfTePMH/y0Wkom3OgAa7IwJ73RXoJHKL3wa4o/kA+z7dcIW3En+HaUFn4I6YjSLR9UZ/ hb4cEoraRcbNSv9g9gtYwz6LVv7rCm/SQ2YEJ3DcaqCUan+WX5WHFrasZ8Ic2jBxxNPZ dzC621UlQBkoz81HzdcBI7w6o6ct1PzLgMh8fkI665ZZkXvbxEyep3F7XeRHyHnyFn4e Y6NsHPMK0MRtv/Qy2hKjTUR9YPt4Zndb0K7EaQBYd0h33gTCr+JFmz+fU+XBJlq5faPZ V68w== X-Gm-Message-State: APjAAAXEJBE45DhEwoUc5XuT6TCU8Zh/W54Z6CYfieDugqu5hIkaigmq mbYdh/QT2oDTK2tTDI3iZqHCVNlEkXc= X-Google-Smtp-Source: APXvYqzH1zDuSvmSxcC8X+BJdKSHF9nndVPqQn4YrsCETSU36KAispexEvCHQGm2KV6NB2kdjSxSMw== X-Received: by 2002:a50:8bfa:: with SMTP id n55mr78749586edn.9.1564061270648; Thu, 25 Jul 2019 06:27:50 -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.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 25 Jul 2019 06:27:50 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 4/4] drm/prime: Ditch gem_prime_res_obj hook Date: Thu, 25 Jul 2019 15:26:55 +0200 Message-Id: <20190725132655.11951-5-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=MBKx6cyaWgWK2WLms53NILAn5q7ckrpw79tN0L1qShw=; b=U0t2hIay5HP/cAHAyrZpr6gxpjZOs/3Gm0w+HMqxxEIEIepZvwyGmn/Nx6+PcGhd64 o4zKA0npVMsHJzGKzi003eSF1vUrEpEcw9g3EqkVS1bz855XBn33wWDIgW2oqQ5zloWz FSTBirn2b9sbce8/kIowu+oy/xzLuuNlFG2vs= 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: David Airlie , Daniel Vetter , Maxime Ripard , kraxel@redhat.com, Daniel Vetter , Sean Paul , Emil Velikov Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Everyone is just using gem_object->resv now. Acked-by: Gerd Hoffmann Cc: Gerd Hoffmann Reviewed-by: Emil Velikov Signed-off-by: Daniel Vetter Cc: David Airlie Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul --- Documentation/gpu/todo.rst | 9 --------- drivers/gpu/drm/drm_prime.c | 3 --- include/drm/drm_drv.h | 12 ------------ 3 files changed, 24 deletions(-) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index 688b4adbbf62..8e9e9760dbf5 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -196,15 +196,6 @@ Might be good to also have some igt testcases for this. Contact: Daniel Vetter, Noralf Tronnes -Remove the ->gem_prime_res_obj callback --------------------------------------------- - -The ->gem_prime_res_obj callback can be removed from drivers by using the -reservation_object in the drm_gem_object. It may also be possible to use the -generic drm_gem_reservation_object_wait helper for waiting for a bo. - -Contact: Daniel Vetter - idr_init_base() --------------- diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index eca484106cc2..0a2316e0e812 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -836,9 +836,6 @@ struct dma_buf *drm_gem_prime_export(struct drm_gem_object *obj, .resv = obj->resv, }; - if (dev->driver->gem_prime_res_obj) - exp_info.resv = dev->driver->gem_prime_res_obj(obj); - return drm_gem_dmabuf_export(dev, &exp_info); } EXPORT_SYMBOL(drm_gem_prime_export); diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 9927f4f894ef..380e134c5415 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -618,18 +618,6 @@ struct drm_driver { */ struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj); - /** - * @gem_prime_res_obj: - * - * Optional hook to look up the &reservation_object for an buffer when - * exporting it. - * - * FIXME: This hook is deprecated. Users of this hook should be replaced - * by setting &drm_gem_object.resv instead. - */ - struct reservation_object * (*gem_prime_res_obj)( - struct drm_gem_object *obj); - /** * @gem_prime_import_sg_table: *