Received: by 10.213.65.68 with SMTP id h4csp987489imn; Sat, 7 Apr 2018 14:38:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx48LyDmoKqt6iMXzGSZdhrxXl0F+5qDPpOld+B2zs3tIVAi6xJK43u2vg3s7xOUUBGIT0UiQ X-Received: by 10.101.101.206 with SMTP id y14mr6079573pgv.220.1523137132709; Sat, 07 Apr 2018 14:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523137132; cv=none; d=google.com; s=arc-20160816; b=M/v61XfbQ89u9rUHhYgLg2vNdtuKAYWqEeNqiNHT5NnNS6TdMq54uMVEmnjiG4Bo2O FWr1SVl3bOmWPAgJhfUaTBo3XeI7LRZXj14I8J0yo1NOgwKWc7+Td8IQm+xjVhqwBFsH YSQH4CUz8HPUBYyvu3RwV9Q1jteYTIlNC0JkhcOTLGNJN9F/qc+V18wCWAmGVWhBtEdw OWEDhy63sTA0/npF8HWuqDjMO9YeXMeBxKeXDV2iaU8dD+p2VtBcDKAXWS51oCxL9ful kwocpLA9PD8xAcM/HpBnxZUk7/ZkKRZ4edFLfoAjA0ThJBhbMpLigMyswhjgg7Mu6B+e yBTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=3DPQ23k0sv6GkfSkFQiGNkAs01cj0fAZ5u6y5VcaKpE=; b=gXHS+CiJCuojIHZwTB1/GalhpRNAVbvKI3Nn5CWYzGqdV+1xpEnrhdQwhbbmarfPqm kivniIBtrIv5bMOKr2fOB4Wp2Qs3wTNu3/0W8tTta8VLPGbEGQ6OPIdjECJbnf+U2Cma I8eSSFJKxR+Oq001itQQ83MqVp5Uw8NBIfZgJxQGjzEcfKMOC6qEmbxdSVCGTuEJHIvK BEHhEOg7pfDijnp19sNOKkhqdXhYcaxFLG6W8rctfZwp69smAWe228g9AToONzy6bNbQ KulCVqvSPvyV04yTr/4RgZ4QrFKJ1aFpASjUX9/fEolg5O8S5/QeHoswn6S1jJSS9HKn V/KA== 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 q9si8792375pgp.145.2018.04.07.14.38.15; Sat, 07 Apr 2018 14:38:52 -0700 (PDT) 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 S1752188AbeDGVfe (ORCPT + 99 others); Sat, 7 Apr 2018 17:35:34 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:49803 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751735AbeDGVfd (ORCPT ); Sat, 7 Apr 2018 17:35:33 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w37LTiVN022021; Sat, 7 Apr 2018 23:35:25 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2h6k45kgvw-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 07 Apr 2018 23:35:25 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 285A531; Sat, 7 Apr 2018 21:35:24 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 09C345209; Sat, 7 Apr 2018 21:35:24 +0000 (GMT) Received: from SAFEX1HUBCAS24.st.com (10.75.90.95) by Safex1hubcas22.st.com (10.75.90.92) with Microsoft SMTP Server (TLS) id 14.3.361.1; Sat, 7 Apr 2018 23:35:23 +0200 Received: from localhost (10.129.5.9) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Sat, 7 Apr 2018 23:35:23 +0200 From: Philippe Cornu To: Yannick Fertre , Philippe Cornu , Benjamin Gaignard , Vincent Abriou , David Airlie , , CC: Fabien Dessenne , Mickael Reulier , Alexandre Torgue Subject: [PATCH] drm/stm: ltdc: add user update info in plane print state Date: Sat, 7 Apr 2018 23:35:03 +0200 Message-ID: <20180407213503.30932-1-philippe.cornu@st.com> X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.129.5.9] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-07_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds the user update information in frames-per-second into the drm debugfs plane state. Signed-off-by: Philippe Cornu --- drivers/gpu/drm/stm/ltdc.c | 22 ++++++++++++++++++++++ drivers/gpu/drm/stm/ltdc.h | 8 ++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 2b745cfc9000..061d2b6e5157 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -729,6 +729,8 @@ static void ltdc_plane_atomic_update(struct drm_plane *plane, reg_update_bits(ldev->regs, LTDC_L1CR + lofs, LXCR_LEN | LXCR_CLUTEN, val); + ldev->plane_fpsi[plane->index].counter++; + mutex_lock(&ldev->err_lock); if (ldev->error_status & ISR_FUIF) { DRM_DEBUG_DRIVER("Fifo underrun\n"); @@ -754,6 +756,25 @@ static void ltdc_plane_atomic_disable(struct drm_plane *plane, oldstate->crtc->base.id, plane->base.id); } +static void ltdc_plane_atomic_print_state(struct drm_printer *p, + const struct drm_plane_state *state) +{ + struct drm_plane *plane = state->plane; + struct ltdc_device *ldev = plane_to_ltdc(plane); + struct fps_info *fpsi = &ldev->plane_fpsi[plane->index]; + int ms_since_last; + ktime_t now; + + now = ktime_get(); + ms_since_last = ktime_to_ms(ktime_sub(now, fpsi->last_timestamp)); + + drm_printf(p, "\tuser_updates=%dfps\n", + DIV_ROUND_CLOSEST(fpsi->counter * 1000, ms_since_last)); + + fpsi->last_timestamp = now; + fpsi->counter = 0; +} + static const struct drm_plane_funcs ltdc_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, @@ -761,6 +782,7 @@ static const struct drm_plane_funcs ltdc_plane_funcs = { .reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, + .atomic_print_state = ltdc_plane_atomic_print_state, }; static const struct drm_plane_helper_funcs ltdc_plane_helper_funcs = { diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h index 61a80d00bc3b..1e16d6afb0d2 100644 --- a/drivers/gpu/drm/stm/ltdc.h +++ b/drivers/gpu/drm/stm/ltdc.h @@ -20,6 +20,13 @@ struct ltdc_caps { bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */ }; +#define LTDC_MAX_LAYER 4 + +struct fps_info { + unsigned int counter; + ktime_t last_timestamp; +}; + struct ltdc_device { void __iomem *regs; struct clk *pixel_clk; /* lcd pixel clock */ @@ -27,6 +34,7 @@ struct ltdc_device { struct ltdc_caps caps; u32 error_status; u32 irq_status; + struct fps_info plane_fpsi[LTDC_MAX_LAYER]; }; int ltdc_load(struct drm_device *ddev); -- 2.15.1