Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5177282imu; Tue, 13 Nov 2018 02:23:48 -0800 (PST) X-Google-Smtp-Source: AJdET5fCgB3IFnGC+VtDNIS4NQeHBJ40tZ3dEV1UcB7LKnoe9uFO8h5QwaV8x3p7ansC/lggGUE/ X-Received: by 2002:a62:1f9d:: with SMTP id l29mr2562639pfj.14.1542104628217; Tue, 13 Nov 2018 02:23:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542104628; cv=none; d=google.com; s=arc-20160816; b=NIxatUWe2zVcYQjhPfHi4TKypRaAz9Mp02LyHySBp3VFvtjq+pw56A8GoGUjHImvd6 o4Uh9iXZxdaSI1A/6rDR/Hp1Zppbmlnwypv0gPFEIy6j+Lu5DDsBPtu7Pdp80+EKQ/vI PMIydztAfaXKlsoCTp3FTN6hdkgdx4pMOp8I7J53S0M6Kd5pbeV2Z9q6tWeGlAiCi6vY d3c7tsMbrY1Qyq0cE/OTNu8ykuDBb2e0Us6KTcgLY3Vh1l6Ns01E0jVhDpJGdWjUx01f yLfi/RqyvUvmSqdktI/c6bD/lBnXIp7+y8Rk0TKj+8fOKFNJyHscQRYybK1vkK/5VCXi k/qQ== 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:subject:cc:to:from:date; bh=Tyj7+BTx2qmVWA8DWzQ0SQKdWbYcFTKbgnhnwa36ku8=; b=yprkaZd8SIyvymii4nFO1IrMa+e1XGFmKgOCRfkXaLrMFaFN0O6+sH2uwoeD5UGxxY hVKn9EOO/4Na2ycqPUUXtVXB6WBqnO6BdjMRltA3MwubCXXAn6jki9Ovj0amFSRH5E0l ZHSPTQSC7uizjaYplX9UqOoY3kuj+WHStk8uwY1/HlpyHi6yMN8O12QOPYa1sa18r3s/ gFiJSGXEWHG+23t1r3p8vaImrJ2bRVI3RTi+HbOe8Jzp9CeGRbQLjvMMDtaVnBJIKjNk UnKxwv7gFy9vf5GMS7OTFymiFusfjMNrixnNcxQ92++M819XEFibScp0Ill1EfHfUgCR ddpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j14si8314082pgg.44.2018.11.13.02.23.32; Tue, 13 Nov 2018 02:23:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732250AbeKMUUR (ORCPT + 99 others); Tue, 13 Nov 2018 15:20:17 -0500 Received: from mail.bootlin.com ([62.4.15.54]:44066 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732030AbeKMUUR (ORCPT ); Tue, 13 Nov 2018 15:20:17 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 2E5C020726; Tue, 13 Nov 2018 11:22:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from bbrezillon (aaubervilliers-681-1-30-49.w90-88.abo.wanadoo.fr [90.88.15.49]) by mail.bootlin.com (Postfix) with ESMTPSA id E1F7A20714; Tue, 13 Nov 2018 11:22:48 +0100 (CET) Date: Tue, 13 Nov 2018 11:22:49 +0100 From: Boris Brezillon To: Eric Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Daniel Vetter Subject: Re: [PATCH 3/4] drm/v3d: Clean up the reservation object setup. Message-ID: <20181113112249.532ed593@bbrezillon> In-Reply-To: <20181108161654.19888-4-eric@anholt.net> References: <20181108161654.19888-1-eric@anholt.net> <20181108161654.19888-4-eric@anholt.net> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 8 Nov 2018 08:16:53 -0800 Eric Anholt wrote: > The extra to_v3d_bo() calls came from copying this from the vc4 > driver, which stored the cma gem object in the structs. > > Signed-off-by: Eric Anholt Reviewed-by: Boris Brezillon > --- > drivers/gpu/drm/v3d/v3d_gem.c | 32 +++++++++++--------------------- > 1 file changed, 11 insertions(+), 21 deletions(-) > > diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c > index b88c96911453..d0dfdcbbd42c 100644 > --- a/drivers/gpu/drm/v3d/v3d_gem.c > +++ b/drivers/gpu/drm/v3d/v3d_gem.c > @@ -214,10 +214,8 @@ v3d_attach_object_fences(struct v3d_exec_info *exec) > int i; > > for (i = 0; i < exec->bo_count; i++) { > - bo = to_v3d_bo(&exec->bo[i]->base); > - > /* XXX: Use shared fences for read-only objects. */ > - reservation_object_add_excl_fence(bo->resv, out_fence); > + reservation_object_add_excl_fence(exec->bo[i]->resv, out_fence); > } > } > > @@ -228,11 +226,8 @@ v3d_unlock_bo_reservations(struct drm_device *dev, > { > int i; > > - for (i = 0; i < exec->bo_count; i++) { > - struct v3d_bo *bo = to_v3d_bo(&exec->bo[i]->base); > - > - ww_mutex_unlock(&bo->resv->lock); > - } > + for (i = 0; i < exec->bo_count; i++) > + ww_mutex_unlock(&exec->bo[i]->resv->lock); > > ww_acquire_fini(acquire_ctx); > } > @@ -251,13 +246,13 @@ v3d_lock_bo_reservations(struct drm_device *dev, > { > int contended_lock = -1; > int i, ret; > - struct v3d_bo *bo; > > ww_acquire_init(acquire_ctx, &reservation_ww_class); > > retry: > if (contended_lock != -1) { > - bo = to_v3d_bo(&exec->bo[contended_lock]->base); > + struct v3d_bo *bo = exec->bo[contended_lock]; > + > ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, > acquire_ctx); > if (ret) { > @@ -270,19 +265,16 @@ v3d_lock_bo_reservations(struct drm_device *dev, > if (i == contended_lock) > continue; > > - bo = to_v3d_bo(&exec->bo[i]->base); > - > - ret = ww_mutex_lock_interruptible(&bo->resv->lock, acquire_ctx); > + ret = ww_mutex_lock_interruptible(&exec->bo[i]->resv->lock, > + acquire_ctx); > if (ret) { > int j; > > - for (j = 0; j < i; j++) { > - bo = to_v3d_bo(&exec->bo[j]->base); > - ww_mutex_unlock(&bo->resv->lock); > - } > + for (j = 0; j < i; j++) > + ww_mutex_unlock(&exec->bo[j]->resv->lock); > > if (contended_lock != -1 && contended_lock >= i) { > - bo = to_v3d_bo(&exec->bo[contended_lock]->base); > + struct v3d_bo *bo = exec->bo[contended_lock]; > > ww_mutex_unlock(&bo->resv->lock); > } > @@ -303,9 +295,7 @@ v3d_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_v3d_bo(&exec->bo[i]->base); > - > - ret = reservation_object_reserve_shared(bo->resv, 1); > + ret = reservation_object_reserve_shared(exec->bo[i]->resv, 1); > if (ret) { > v3d_unlock_bo_reservations(dev, exec, acquire_ctx); > return ret;