Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp580004imu; Fri, 7 Dec 2018 05:50:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/WhZfGCqp4MCuK883NRJLJKfmuX+C/2ty0VtV1W6zzjyiXOho/J8IxDRGPXhFLyqRwOQtLJ X-Received: by 2002:a17:902:6948:: with SMTP id k8mr2206804plt.2.1544190645980; Fri, 07 Dec 2018 05:50:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544190645; cv=none; d=google.com; s=arc-20160816; b=E6GHzFQSb7pALnSXBV8qHhggOpvC5YXly6sPzkYRJzAB77g0T0hl7LiR1U2C7yELZT f6lVq7Zx6tR5o2+StZtBTMYUbbR1ipxJJdHU7zvgIdOoVwX9Ku02BVOPYgTFNvLehjF4 uldhkk9gq3rO3BWS0z7RE05XIZlxYWEZPVpw0YoE6dQ+D36QmxALVESq9dy25fqbbBax AywR0ejbEwaEFvmIJK0el3K1MvfE6PUjNUVFcof8tJzsx7kRoFMAsRYcH7RQYQsiZIOC Oofn0ZU/roatO3fCv/0R6hawpz+EQ3OPqFx7Ak34dmL+YFuMaQLSu8SolXlIU7cBiFxM PEaQ== 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 :message-id:date:subject:cc:to:from; bh=8gj2hEEHjkP5EPSnrzwZer513VQ9gPUmfzNkDAr2DGw=; b=wU3jZ69CqXJkbkD7uHovB0q5pZyiYtsYK1D7lh8ClSfDWyWb1dH8erwbQzUJL0J4pp na800pz37/VVBsd/W0EpGDnf3Ek09mhXIlGNnTK2KNUZJneiNYUm0mA1PblBT5iavQeC y7DtBus9fmXhMMoUwklSP5dVSHFmD6BS7u6tGQIlIV9hObI3R9AlR8g7hhNcPpQarpL4 mr8tsl0WRN/IJNsAelvndpQqzjTtasLYLlqamyTB4tINHNNWPDddXn8LLS8MC7tm/F6J GOal+ms3XMoG4cxI1AGrzNlHBL3FGZmNWEr5eUQ2U22YLl4swels6e2x/mZ6KfvGT13E A/JQ== 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 x9si2931094pll.131.2018.12.07.05.50.30; Fri, 07 Dec 2018 05:50:45 -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 S1726083AbeLGNs0 (ORCPT + 99 others); Fri, 7 Dec 2018 08:48:26 -0500 Received: from mail.bootlin.com ([62.4.15.54]:58286 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725998AbeLGNs0 (ORCPT ); Fri, 7 Dec 2018 08:48:26 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 4549D20CC3; Fri, 7 Dec 2018 14:48:24 +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 localhost.localdomain (aaubervilliers-681-1-79-44.w90-88.abo.wanadoo.fr [90.88.21.44]) by mail.bootlin.com (Postfix) with ESMTPSA id ED84F20745; Fri, 7 Dec 2018 14:48:13 +0100 (CET) From: Paul Kocialkowski To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Eric Anholt , David Airlie , Maxime Ripard , Thomas Petazzoni , Boris Brezillon , Paul Kocialkowski Subject: [PATCH v3] drm/vc4: Add a debugfs entry to disable/enable the load tracker Date: Fri, 7 Dec 2018 14:47:57 +0100 Message-Id: <20181207134757.32437-1-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to test whether the load tracker is working as expected, we need the ability to compare the commit result with the underrun indication. With the load tracker always enabled, commits that are expected to trigger an underrun are always rejected, so userspace cannot get the actual underrun indication from the hardware. Add a debugfs entry to disable/enable the load tracker, so that a DRM commit expected to trigger an underrun can go through with the load tracker disabled. The underrun indication is then available to userspace and can be checked against the commit result with the load tracker enabled. Signed-off-by: Paul Kocialkowski --- This patch is based upon Boris Brezillon's series: drm/vc4: Add a load tracker Changes since v2: * Used the standard debugfs_create_bool instead of reinventing it. Changes since v1: * Moved all the debugfs-related functions and structure to vc4_debugfs.c. drivers/gpu/drm/vc4/vc4_debugfs.c | 9 +++++++++ drivers/gpu/drm/vc4/vc4_drv.c | 2 ++ drivers/gpu/drm/vc4/vc4_drv.h | 2 ++ drivers/gpu/drm/vc4/vc4_kms.c | 6 +++++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c index 7a0003de71ab..7c23f5209f6d 100644 --- a/drivers/gpu/drm/vc4/vc4_debugfs.c +++ b/drivers/gpu/drm/vc4/vc4_debugfs.c @@ -35,6 +35,15 @@ static const struct drm_info_list vc4_debugfs_list[] = { int vc4_debugfs_init(struct drm_minor *minor) { + struct vc4_dev *vc4 = to_vc4_dev(minor->dev); + struct dentry *dentry; + + dentry = debugfs_create_bool("load_tracker", S_IRUGO | S_IWUSR, + minor->debugfs_root, + &vc4->load_tracker_enabled); + if (!dentry) + return -ENOMEM; + return drm_debugfs_create_files(vc4_debugfs_list, VC4_DEBUGFS_ENTRIES, minor->debugfs_root, minor); } diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 7195a0bcceb3..12ac971d24d6 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -290,6 +290,8 @@ static int vc4_drm_bind(struct device *dev) drm_fbdev_generic_setup(drm, 32); + vc4->load_tracker_enabled = true; + return 0; unbind_all: diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index a0fb888604d6..8837d2416aae 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -188,6 +188,8 @@ struct vc4_dev { int power_refcount; + bool load_tracker_enabled; + /* Mutex controlling the power refcount. */ struct mutex power_lock; diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index f3fd34faa812..e80b1ad5c938 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -479,6 +479,7 @@ static const struct drm_private_state_funcs vc4_load_tracker_state_funcs = { static int vc4_atomic_check(struct drm_device *dev, struct drm_atomic_state *state) { + struct vc4_dev *vc4 = to_vc4_dev(dev); int ret; ret = vc4_ctm_atomic_check(dev, state); @@ -489,7 +490,10 @@ vc4_atomic_check(struct drm_device *dev, struct drm_atomic_state *state) if (ret) return ret; - return vc4_load_tracker_atomic_check(state); + if (vc4->load_tracker_enabled) + return vc4_load_tracker_atomic_check(state); + + return 0; } static const struct drm_mode_config_funcs vc4_mode_funcs = { -- 2.19.2