From patchwork Sat Feb 2 15:41:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 157347 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1833026jaa; Sat, 2 Feb 2019 07:42:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Ymj936Pr2I3Tee8tlDdDnnR5htAANnHAHzqo2LxdHJj38OjM5IiaTmvDSePXUygrUPUR6 X-Received: by 2002:a62:868b:: with SMTP id x133mr46321940pfd.252.1549122128932; Sat, 02 Feb 2019 07:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549122128; cv=none; d=google.com; s=arc-20160816; b=uGfICCwuFvGrH9H6GMR45NPKnJibGRHcJCZA4OaDikVnS++CR7nx4T0ES5kb7eiM/E FCXrsufwvmuKI6gIvRb+piGhJ8Qc0UdYhg14zCw2Hu38Gc8ub/zqQVKs8RKgMko3RWAo WGUIkIyzzSnqPVABBfYiBNMCdgj1WCkW/6/LgYg/SLarl0a7/BHUbDdjLXuf7ei5YbK4 ANiC2nItLE32+3siTA7le7hLF5ZAJowFPT3A2dJ6uHwDuaIliuXWUYngU5Lp9lOynziM UsSYIp5p4+AnzPBZuTdqVmiO4wyKdUrcX438DasULBuPXF+jVwS/VAwxKk3J4ltJsK1K lKmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=EcY7KbO6hKDIjnSJCdxYMZiUUicK8qjO+OaoCAH/Xwc=; b=j8QA1yLzWV4ahRRguJiOWtDgUkZsICB1MhU76gAXiXDSEi4Y2wXdERf3LJwJ9wusNf OFQBQSayoF4cSDfeneGZD78qN+N0ZgMpt4EllNni5PevxTCHst9413Uff764kMg4IjBE F6O7kdn3UK5rYjL6+l8UTpzKZ00E0Lwn5TX7xqcjnVrYeqKTsuDfmBSVCRydn82x6HG+ MtSPaA0Yi2UIQF70qBabIeEBL4klZzDRQVXyaWbQ9bnFe9oZURmI478mlC2xTzVIKApF 4ZfICCCX56KPBckzQjOLSVyB/nHAP2Sy5pVG+e7YcZgjtL7Dr3G3lMgwZyRTw4q6e79J GvzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si8238222pli.50.2019.02.02.07.42.08; Sat, 02 Feb 2019 07:42:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727790AbfBBPmI (ORCPT + 15 others); Sat, 2 Feb 2019 10:42:08 -0500 Received: from mail-oi1-f193.google.com ([209.85.167.193]:36225 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727698AbfBBPmI (ORCPT ); Sat, 2 Feb 2019 10:42:08 -0500 Received: by mail-oi1-f193.google.com with SMTP id x23so8329535oix.3 for ; Sat, 02 Feb 2019 07:42:07 -0800 (PST) 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=EcY7KbO6hKDIjnSJCdxYMZiUUicK8qjO+OaoCAH/Xwc=; b=htV6mz/ZhiPCGOMtkNX+NvULlceS1fP7gMy+2nW1sLY2bL0TV2WpXvq+RisKemA9wC /hgpKzr+JYKgZz+mrdCnVEvcfkEHzc0fEeSSaDJPPEvZ3hzavGEmKBN/knomCvhZbjqP BHCSdYAzh8dBcmu+mN3Pu6bu+Zm3smmDBeqnBwoFQb+f3FlE+BUHxcH9M5ixRIeDeD7I EEpDdbBquByNiZmtWnzSXJFSDbcNERJ6hx9x2vsynryVtRBOvllhw72eZ/XF4Eht+5TF 39D6HPG6WHr2/e47y81JMu0GIeWSlW4CDAGj6kXF4VfV3hMnPArcTHV1H8GTHjx+IVIn K9Vg== X-Gm-Message-State: AJcUukfzqCQHEHbsGbGxSEPe2PyEn6n2ZYB0UtMrMCQgmavWPtyrK6Tw lcvwtnkuLqeBqCErZkpscA== X-Received: by 2002:aca:e7c9:: with SMTP id e192mr22347780oih.155.1549122125724; Sat, 02 Feb 2019 07:42:05 -0800 (PST) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id 187sm5215559oic.12.2019.02.02.07.42.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Feb 2019 07:42:04 -0800 (PST) From: Rob Herring To: dri-devel@lists.freedesktop.org Cc: Christian Gmeiner , Daniel Vetter , David Airlie , Eric Anholt , etnaviv@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Lucas Stach , Maarten Lankhorst , Maxime Ripard , Rob Clark , Russell King , Sean Paul Subject: [PATCH v2 5/5] drm: vc4: Switch to use drm_gem_object reservation_object Date: Sat, 2 Feb 2019 09:41:58 -0600 Message-Id: <20190202154158.10443-6-robh@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190202154158.10443-1-robh@kernel.org> References: <20190202154158.10443-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Now that the base struct drm_gem_object has a reservation_object, use it and remove the private BO one. Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Reviewed-by: Eric Anholt Signed-off-by: Rob Herring --- drivers/gpu/drm/vc4/vc4_bo.c | 15 +-------------- drivers/gpu/drm/vc4/vc4_drv.c | 1 - drivers/gpu/drm/vc4/vc4_drv.h | 6 ------ drivers/gpu/drm/vc4/vc4_gem.c | 18 +++++++++--------- drivers/gpu/drm/vc4/vc4_plane.c | 2 +- 5 files changed, 11 insertions(+), 31 deletions(-) -- 2.19.1 diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c index 8dcce7182bb7..92e3f98d8478 100644 --- a/drivers/gpu/drm/vc4/vc4_bo.c +++ b/drivers/gpu/drm/vc4/vc4_bo.c @@ -201,8 +201,6 @@ static void vc4_bo_destroy(struct vc4_bo *bo) bo->validated_shader = NULL; } - reservation_object_fini(&bo->_resv); - drm_gem_cma_free_object(obj); } @@ -427,8 +425,6 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size) vc4->bo_labels[VC4_BO_TYPE_KERNEL].num_allocated++; vc4->bo_labels[VC4_BO_TYPE_KERNEL].size_allocated += size; mutex_unlock(&vc4->bo_lock); - bo->resv = &bo->_resv; - reservation_object_init(bo->resv); return &bo->base.base; } @@ -684,13 +680,6 @@ static void vc4_bo_cache_time_timer(struct timer_list *t) schedule_work(&vc4->bo_cache.time_work); } -struct reservation_object *vc4_prime_res_obj(struct drm_gem_object *obj) -{ - struct vc4_bo *bo = to_vc4_bo(obj); - - return bo->resv; -} - struct dma_buf * vc4_prime_export(struct drm_device *dev, struct drm_gem_object *obj, int flags) { @@ -822,14 +811,12 @@ vc4_prime_import_sg_table(struct drm_device *dev, struct sg_table *sgt) { struct drm_gem_object *obj; - struct vc4_bo *bo; obj = drm_gem_cma_prime_import_sg_table(dev, attach, sgt); if (IS_ERR(obj)) return obj; - bo = to_vc4_bo(obj); - bo->resv = attach->dmabuf->resv; + obj->resv = attach->dmabuf->resv; return obj; } diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index f6f5cd80c04d..d17df8c0291b 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -201,7 +201,6 @@ static struct drm_driver vc4_drm_driver = { .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import = drm_gem_prime_import, .gem_prime_export = vc4_prime_export, - .gem_prime_res_obj = vc4_prime_res_obj, .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = vc4_prime_import_sg_table, .gem_prime_vmap = vc4_prime_vmap, diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 4f87b03f837d..03e9615b7229 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -7,7 +7,6 @@ */ #include -#include #include #include #include @@ -239,10 +238,6 @@ struct vc4_bo { */ struct vc4_validated_shader_info *validated_shader; - /* normally (resv == &_resv) except for imported bo's */ - struct reservation_object *resv; - struct reservation_object _resv; - /* One of enum vc4_kernel_bo_type, or VC4_BO_TYPE_COUNT + i * for user-allocated labels. */ @@ -684,7 +679,6 @@ int vc4_label_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); vm_fault_t vc4_fault(struct vm_fault *vmf); int vc4_mmap(struct file *filp, struct vm_area_struct *vma); -struct reservation_object *vc4_prime_res_obj(struct drm_gem_object *obj); int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev, struct dma_buf_attachment *attach, diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index aea2b8dfec17..5ee5bf7fedf7 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c @@ -536,7 +536,7 @@ vc4_update_bo_seqnos(struct vc4_exec_info *exec, uint64_t seqno) bo = to_vc4_bo(&exec->bo[i]->base); bo->seqno = seqno; - reservation_object_add_shared_fence(bo->resv, exec->fence); + reservation_object_add_shared_fence(bo->base.base.resv, exec->fence); } list_for_each_entry(bo, &exec->unref_list, unref_head) { @@ -547,7 +547,7 @@ vc4_update_bo_seqnos(struct vc4_exec_info *exec, uint64_t seqno) bo = to_vc4_bo(&exec->rcl_write_bo[i]->base); bo->write_seqno = seqno; - reservation_object_add_excl_fence(bo->resv, exec->fence); + reservation_object_add_excl_fence(bo->base.base.resv, exec->fence); } } @@ -559,7 +559,7 @@ vc4_unlock_bo_reservations(struct drm_device *dev, int i; for (i = 0; i < exec->bo_count; i++) { - struct vc4_bo *bo = to_vc4_bo(&exec->bo[i]->base); + struct drm_gem_object *bo = &exec->bo[i]->base; ww_mutex_unlock(&bo->resv->lock); } @@ -581,13 +581,13 @@ vc4_lock_bo_reservations(struct drm_device *dev, { int contended_lock = -1; int i, ret; - struct vc4_bo *bo; + struct drm_gem_object *bo; ww_acquire_init(acquire_ctx, &reservation_ww_class); retry: if (contended_lock != -1) { - bo = to_vc4_bo(&exec->bo[contended_lock]->base); + bo = &exec->bo[contended_lock]->base; ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, acquire_ctx); if (ret) { @@ -600,19 +600,19 @@ vc4_lock_bo_reservations(struct drm_device *dev, if (i == contended_lock) continue; - bo = to_vc4_bo(&exec->bo[i]->base); + bo = &exec->bo[i]->base; ret = ww_mutex_lock_interruptible(&bo->resv->lock, acquire_ctx); if (ret) { int j; for (j = 0; j < i; j++) { - bo = to_vc4_bo(&exec->bo[j]->base); + bo = &exec->bo[j]->base; ww_mutex_unlock(&bo->resv->lock); } if (contended_lock != -1 && contended_lock >= i) { - bo = to_vc4_bo(&exec->bo[contended_lock]->base); + bo = &exec->bo[contended_lock]->base; ww_mutex_unlock(&bo->resv->lock); } @@ -633,7 +633,7 @@ vc4_lock_bo_reservations(struct drm_device *dev, * before we commit the CL to the hardware. */ for (i = 0; i < exec->bo_count; i++) { - bo = to_vc4_bo(&exec->bo[i]->base); + bo = &exec->bo[i]->base; ret = reservation_object_reserve_shared(bo->resv, 1); if (ret) { diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c index 75db62cbe468..b8baceebb73b 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -994,7 +994,7 @@ static int vc4_prepare_fb(struct drm_plane *plane, bo = to_vc4_bo(&drm_fb_cma_get_gem_obj(state->fb, 0)->base); - fence = reservation_object_get_excl_rcu(bo->resv); + fence = reservation_object_get_excl_rcu(bo->base.base.resv); drm_atomic_set_fence_for_plane(state, fence); if (plane->state->fb == state->fb)