From patchwork Mon Jun 20 15:53:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9187893 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1077A6075E for ; Mon, 20 Jun 2016 15:53:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F20AC223B3 for ; Mon, 20 Jun 2016 15:53:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6AE02766D; Mon, 20 Jun 2016 15:53:41 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E207223B3 for ; Mon, 20 Jun 2016 15:53:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A0F526E45C; Mon, 20 Jun 2016 15:53:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw0-f194.google.com (mail-yw0-f194.google.com [209.85.161.194]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8C8306E459 for ; Mon, 20 Jun 2016 15:53:30 +0000 (UTC) Received: by mail-yw0-f194.google.com with SMTP id i12so2037163ywa.0 for ; Mon, 20 Jun 2016 08:53:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=W9uXJ/ccQqIapQe3YhYQwE4aEXYhVG4i3bycfshPBsQ=; b=LykGDsaJ6ysJ6TfiKs9Zbn9iS7xIHbf/t0PxyBJiSorEISszKB/obq0Iy3EdPdom2i 7IbuyScP8J+AdcopRS5qetyjU5iQVj0oBffh9fh2uILIux007KsdBx7icLnD/MQHFRI2 wXe/Rq6SkEQWF4V1k4nHpvCI5UA1rxcKlimHEe3kFLD1sdFPjKGuBww3Ag00rOoSnm+t pgFx4AmyuPTUyL+P8KR/cbvbdrP01oal8IiQ3gg/P6MkwHE//laZqse6bG/3K5DeXPHx vImZaJUAb/+0TxCRe7xkBB+rJtltNrlJ/YrN2JAVJdTzQRp75QpUo/yYycEYM65yqx6E b6Qw== X-Gm-Message-State: ALyK8tKVhPRwOlRgHZOVAazGQzxys0hiyOnZ7b3CviXYvlYtGC/Yt7+VzZNQLvyrDRfHNQ== X-Received: by 10.129.136.129 with SMTP id y123mr9106704ywf.77.1466438009356; Mon, 20 Jun 2016 08:53:29 -0700 (PDT) Received: from jade.localdomain ([189.61.225.79]) by smtp.gmail.com with ESMTPSA id d205sm29098234ywe.49.2016.06.20.08.53.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 08:53:28 -0700 (PDT) From: Gustavo Padovan To: Greg Kroah-Hartman Subject: [PATCH 2/7] staging/android: display sync_pt name on debugfs Date: Mon, 20 Jun 2016 12:53:08 -0300 Message-Id: <1466437993-21573-3-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466437993-21573-1-git-send-email-gustavo@padovan.org> References: <1466437993-21573-1-git-send-email-gustavo@padovan.org> Cc: devel@driverdev.osuosl.org, Daniel Stone , Daniel Vetter , Riley Andrews , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Gustavo Padovan , John Harrison X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan When creating a sync_pt the name received wasn't used anywhere. Now we add it to the sync info debug output to make it easier to indetify the userspace name of that sync pt. Signed-off-by: Gustavo Padovan --- drivers/staging/android/sw_sync.c | 16 ++++------------ drivers/staging/android/sync_debug.c | 5 +++-- drivers/staging/android/sync_debug.h | 9 +++++++++ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index b4ae092..ea27512 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -37,15 +37,6 @@ struct sw_sync_create_fence_data { struct sw_sync_create_fence_data) #define SW_SYNC_IOC_INC _IOW(SW_SYNC_IOC_MAGIC, 1, __u32) -static const struct fence_ops timeline_fence_ops; - -static inline struct sync_pt *fence_to_sync_pt(struct fence *fence) -{ - if (fence->ops != &timeline_fence_ops) - return NULL; - return container_of(fence, struct sync_pt, base); -} - struct sync_timeline *sync_timeline_create(const char *name) { struct sync_timeline *obj; @@ -108,7 +99,7 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc) } static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size, - unsigned int value) + unsigned int value, char *name) { unsigned long flags; struct sync_pt *pt; @@ -120,6 +111,7 @@ static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size, if (!pt) return NULL; + strlcpy(pt->name, name, sizeof(pt->name)); spin_lock_irqsave(&obj->child_list_lock, flags); sync_timeline_get(obj); fence_init(&pt->base, &timeline_fence_ops, &obj->child_list_lock, @@ -191,7 +183,7 @@ static void timeline_fence_timeline_value_str(struct fence *fence, snprintf(str, size, "%d", parent->value); } -static const struct fence_ops timeline_fence_ops = { +const struct fence_ops timeline_fence_ops = { .get_driver_name = timeline_fence_get_driver_name, .get_timeline_name = timeline_fence_get_timeline_name, .enable_signaling = timeline_fence_enable_signaling, @@ -252,7 +244,7 @@ static long sw_sync_ioctl_create_fence(struct sync_timeline *obj, goto err; } - pt = sync_pt_create(obj, sizeof(*pt), data.value); + pt = sync_pt_create(obj, sizeof(*pt), data.value, data.name); if (!pt) { err = -ENOMEM; goto err; diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c index 4c5a855..b732ea3 100644 --- a/drivers/staging/android/sync_debug.c +++ b/drivers/staging/android/sync_debug.c @@ -75,13 +75,14 @@ static void sync_print_fence(struct seq_file *s, struct fence *fence, bool show) { int status = 1; struct sync_timeline *parent = fence_parent(fence); + struct sync_pt *pt = fence_to_sync_pt(fence); if (fence_is_signaled_locked(fence)) status = fence->status; - seq_printf(s, " %s%sfence %s", + seq_printf(s, " %s%sfence %s %s", show ? parent->name : "", - show ? "_" : "", + show ? "_" : "", pt->name, sync_status_str(status)); if (status <= 0) { diff --git a/drivers/staging/android/sync_debug.h b/drivers/staging/android/sync_debug.h index c44f447..c14587c 100644 --- a/drivers/staging/android/sync_debug.h +++ b/drivers/staging/android/sync_debug.h @@ -43,10 +43,19 @@ static inline struct sync_timeline *fence_parent(struct fence *fence) struct sync_pt { struct fence base; + char name[32]; struct list_head child_list; struct list_head active_list; }; +extern const struct fence_ops timeline_fence_ops; +static inline struct sync_pt *fence_to_sync_pt(struct fence *fence) +{ + if (fence->ops != &timeline_fence_ops) + return NULL; + return container_of(fence, struct sync_pt, base); +} + #ifdef CONFIG_SW_SYNC extern const struct file_operations sw_sync_debugfs_fops;