From patchwork Wed Nov 7 22:35:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 10673171 X-Patchwork-Delegate: agross@codeaurora.org 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 BEA1F15E9 for ; Wed, 7 Nov 2018 22:36:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B04AD2C653 for ; Wed, 7 Nov 2018 22:36:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4B902C691; Wed, 7 Nov 2018 22:36:10 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B1D12C79E for ; Wed, 7 Nov 2018 22:36:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728050AbeKHIIh (ORCPT ); Thu, 8 Nov 2018 03:08:37 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:47352 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727440AbeKHIIh (ORCPT ); Thu, 8 Nov 2018 03:08:37 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E2C8760ADB; Wed, 7 Nov 2018 22:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541630169; bh=x+6NlUumphIam+ZPh8+cxkI88kx9ywhSvCmodRHflmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EGwEMVXtxvMgUzCWtGLw7ZRwoI7H4VrrYyyGfp8TLdeyFJRyZXxWe+wE5A3wGcC0q OA8rzGEdbC3PCL60p31Q12xyYSs+kuAO785jkhogZ6w/l0Q4YYm9utumxlSPWTaHTt /Gtj67DD6d8GUNVF+IZTzX21FlikCvOHmC6/CkNY= Received: from jcrouse-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 066CC6081A; Wed, 7 Nov 2018 22:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541630165; bh=x+6NlUumphIam+ZPh8+cxkI88kx9ywhSvCmodRHflmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FLoXSRbTKfFX7bFf4qE6C9bBKU7/8V7SxtUqVDOs/ppQaEnWAb+uQJTdIZOPJc+zF pWqcQw9p0ykPh0BVYlhcEA1mGuw5ueuwwF376Aufof2UYdlCObGbGjXg+E3gSdnpsc hgw9/eqpERsxqITPg0sU+X82utWeDdjjr1SAtmUo= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 066CC6081A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org From: Jordan Crouse To: freedreno@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, seanpaul@chromium.org, dri-devel@lists.freedesktop.org, bzwang@chromium.org, sam@ravnborg.org Subject: [PATCH 8/9] drm/msm: Add a name field to struct drm_msm_gem_new Date: Wed, 7 Nov 2018 15:35:53 -0700 Message-Id: <20181107223554.27308-9-jcrouse@codeaurora.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181107223554.27308-1-jcrouse@codeaurora.org> References: <20181107223554.27308-1-jcrouse@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a name field to struct drm_msm_gem_new to allow userspace to specify a name/description for gem buffers to improve debugging and tracking. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/msm/msm_drv.c | 5 +++-- drivers/gpu/drm/msm/msm_drv.h | 2 +- drivers/gpu/drm/msm/msm_gem.c | 16 ++++++++++++++-- include/uapi/drm/msm_drm.h | 1 + 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index f2ebfb9ba0e4..8fb86edd30fa 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -35,9 +35,10 @@ * - 1.3.0 - adds GMEM_BASE + NR_RINGS params, SUBMITQUEUE_NEW + * SUBMITQUEUE_CLOSE ioctls, and MSM_INFO_IOVA flag for * MSM_GEM_INFO ioctl. + * - 1.4.0 - Add char name[32] to MSM_GEM_BO_NEW for tracking purposes */ #define MSM_VERSION_MAJOR 1 -#define MSM_VERSION_MINOR 3 +#define MSM_VERSION_MINOR 4 #define MSM_VERSION_PATCHLEVEL 0 static const struct drm_mode_config_funcs mode_config_funcs = { @@ -791,7 +792,7 @@ static int msm_ioctl_gem_new(struct drm_device *dev, void *data, } return msm_gem_new_handle(dev, file, args->size, - args->flags, &args->handle); + args->flags, &args->handle, args->name); } static inline ktime_t to_ktime(struct drm_msm_timespec timeout) diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index df920b13a8a4..71a03ce21da5 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -309,7 +309,7 @@ int msm_gem_cpu_prep(struct drm_gem_object *obj, uint32_t op, ktime_t *timeout); int msm_gem_cpu_fini(struct drm_gem_object *obj); void msm_gem_free_object(struct drm_gem_object *obj); int msm_gem_new_handle(struct drm_device *dev, struct drm_file *file, - uint32_t size, uint32_t flags, uint32_t *handle); + uint32_t size, uint32_t flags, uint32_t *handle, char *name); struct drm_gem_object *msm_gem_new(struct drm_device *dev, uint32_t size, uint32_t flags); struct drm_gem_object *msm_gem_new_locked(struct drm_device *dev, diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 35c9d4048b37..3d53e8765a7f 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -890,16 +890,28 @@ void msm_gem_free_object(struct drm_gem_object *obj) /* convenience method to construct a GEM buffer object, and userspace handle */ int msm_gem_new_handle(struct drm_device *dev, struct drm_file *file, - uint32_t size, uint32_t flags, uint32_t *handle) + uint32_t size, uint32_t flags, uint32_t *handle, + char *name) { struct drm_gem_object *obj; - int ret; + struct msm_gem_object *msm_obj; + int ret, i; obj = msm_gem_new(dev, size, flags); if (IS_ERR(obj)) return PTR_ERR(obj); + msm_obj = to_msm_bo(obj); + + /* Copy the buffer name stopping at the first non printable character */ + for(i = 0; i < sizeof(msm_obj->name) - 1; i++) { + if (!isprint(name[i])) + break; + + msm_obj->name[i] = name[i]; + } + ret = drm_gem_handle_create(file, obj, handle); /* drop reference from allocate - handle holds it now */ diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h index c06d0a5bdd80..0d89e9875faf 100644 --- a/include/uapi/drm/msm_drm.h +++ b/include/uapi/drm/msm_drm.h @@ -103,6 +103,7 @@ struct drm_msm_gem_new { __u64 size; /* in */ __u32 flags; /* in, mask of MSM_BO_x */ __u32 handle; /* out */ + char name[32]; /* in, name of the bo for tracking */ }; #define MSM_INFO_IOVA 0x01