From patchwork Thu Aug 1 11:37:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lowry Li (Arm Technology China)" X-Patchwork-Id: 11070537 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 050531395 for ; Thu, 1 Aug 2019 11:37:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8D5828564 for ; Thu, 1 Aug 2019 11:37:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD0A62856B; Thu, 1 Aug 2019 11:37:39 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 38B9228564 for ; Thu, 1 Aug 2019 11:37:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB1106E4D6; Thu, 1 Aug 2019 11:37:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70044.outbound.protection.outlook.com [40.107.7.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id F19D76E4D6 for ; Thu, 1 Aug 2019 11:37:34 +0000 (UTC) Received: from DB6PR0801CA0043.eurprd08.prod.outlook.com (2603:10a6:4:2b::11) by VI1PR0802MB2607.eurprd08.prod.outlook.com (2603:10a6:800:b9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.14; Thu, 1 Aug 2019 11:37:30 +0000 Received: from DB5EUR03FT064.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::201) by DB6PR0801CA0043.outlook.office365.com (2603:10a6:4:2b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2136.12 via Frontend Transport; Thu, 1 Aug 2019 11:37:30 +0000 Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT064.mail.protection.outlook.com (10.152.21.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2052.18 via Frontend Transport; Thu, 1 Aug 2019 11:37:28 +0000 Received: ("Tessian outbound 71602e13cd49:v26"); Thu, 01 Aug 2019 11:37:24 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 91774eda1974e065 X-CR-MTA-TID: 64aa7808 Received: from 6ae7899e46a2.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.5.52]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 90B8A925-0D84-40E3-B445-75FCBB61EF7B.1; Thu, 01 Aug 2019 11:37:18 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02lp2052.outbound.protection.outlook.com [104.47.5.52]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6ae7899e46a2.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Thu, 01 Aug 2019 11:37:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ICS8VHzsCL7roMXesHcMsxFYaDnnUCMrLYkXTlmAEMIA4TUDcKGf9ierVLfyoTxIkNG8x4NHRfGbsfhK9ew5iVA+opSg4w+iJEMvZJkDPkeliSdqLfkFBARdt2/NjTtIuRSixaoe6h2rHIup4sG3/5xVge+IFXaHd0B6ek+LqeKxSkgj3HHHDTrtTTme5BF8sDlkwFYI7cD6noDNAzvTMkyJVRXyiWVRqabYX7hZgrGp7EQsNMn8EtG1ryiQB+Isdzlr8lEHLSGoP5742Y4aPBZQqOmEKcE1TizJdm5bBnxJg/5n0SZ7DmkBEwvAOHISk7fPL4gMNucHzJRQ/qA1tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2B3kRhxDKN309WlgD0F4Z17E9I1IFbdDJKdWWR1UfrI=; b=XbkPgVW+xe5ebIRYv7WZh5YtzKLTjgi4bJmP9Oi69t6MjchlKPo+CkQayKvPUjlm0oolaCi981MSTnTgLtWgmK73pZ3+hZliyd32tFH0n56lZ9mTWPd1yRGNQtB7OuvXjAEpHgL179dGqVN8DYW2G+m0FCgln3OX//LcQBUIUYR1/rIb3+LKuxyYIOoEak2yWtHwBGn9HcWGpIHDFhLUVTyl7aM1Z/UTx2t864FDhmBGH5rHLIPQYz7+0BJy72scSOMKErulIe5PFjQT8kHmxP2r7QZlK4OgoSCtAz7mVrC+6W/TZCimv+1/42yTiT/EDEzPR5QNdLIpmBVScKvIMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=arm.com;dmarc=pass action=none header.from=arm.com;dkim=pass header.d=arm.com;arc=none Received: from AM7PR08MB5477.eurprd08.prod.outlook.com (10.141.174.204) by AM7PR08MB5528.eurprd08.prod.outlook.com (10.141.175.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.13; Thu, 1 Aug 2019 11:37:16 +0000 Received: from AM7PR08MB5477.eurprd08.prod.outlook.com ([fe80::a8b8:cc18:ded9:6fdb]) by AM7PR08MB5477.eurprd08.prod.outlook.com ([fe80::a8b8:cc18:ded9:6fdb%3]) with mapi id 15.20.2136.010; Thu, 1 Aug 2019 11:37:16 +0000 From: "Lowry Li (Arm Technology China)" To: Liviu Dudau , "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , Brian Starkey Subject: [PATCH] drm/komeda: Adds error event print functionality Thread-Topic: [PATCH] drm/komeda: Adds error event print functionality Thread-Index: AQHVSF13B+//d/diR06VTAGnMwmj+A== Date: Thu, 1 Aug 2019 11:37:15 +0000 Message-ID: <1564659415-14548-1-git-send-email-lowry.li@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK2PR02CA0158.apcprd02.prod.outlook.com (2603:1096:201:1f::18) To AM7PR08MB5477.eurprd08.prod.outlook.com (2603:10a6:20b:10f::12) Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.9.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: f893acb2-25d0-4563-0485-08d71674a221 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:AM7PR08MB5528; X-MS-TrafficTypeDiagnostic: AM7PR08MB5528:|VI1PR0802MB2607: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:6430;OLM:6430; x-forefront-prvs: 01165471DB X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(136003)(366004)(39860400002)(396003)(199004)(189003)(6506007)(386003)(66066001)(52116002)(102836004)(14454004)(26005)(186003)(50226002)(81156014)(55236004)(2501003)(99286004)(6436002)(54906003)(316002)(81166006)(8936002)(8676002)(53936002)(6486002)(3846002)(6116002)(6636002)(110136005)(6512007)(478600001)(66476007)(66946007)(66556008)(64756008)(66446008)(86362001)(25786009)(4326008)(2906002)(2201001)(305945005)(7736002)(71190400001)(71200400001)(5660300002)(68736007)(14444005)(36756003)(2616005)(476003)(486006)(256004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM7PR08MB5528; H:AM7PR08MB5477.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: D7Nkfxd+7gYRkfR0toDWqukx6MQirT1+MnZ2dlheVYnNAiFqTWqAGKuCnnP7cMkIv0hgEHNLKJ5uk2gZunPs4lcXpPlta3bUOqpLhlwFN73CUNiKgSKUTRwDHGRcyolsIS9NtiYkUlmGB//4Ty04UvGVP0h01ufDbBdWiopRLngmuDC4nawVYV3J2eUq8ACL5TiLOM7uc1oMt00ws8K6KCbYd+ygCfh5WN6thxKDTKF4HDuv8MISuF31KxCmxloAn4q+YkVc4IZUbWdl/19p7Bzm56z0DAHRnoVrEM332hbvVF0h5D65vsMRqAmhDB93jh0yLahLyLoRspaG2yTF7i9t5nm9mozbHtDgQFACftoVwewvfatSJKgc/JQ+W6yF8PI2kk3apkF7MyIuKsVXTH34ksvowKcju/3QxNj60FQ= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5528 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT064.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(376002)(396003)(39860400002)(346002)(136003)(2980300002)(189003)(199004)(26826003)(99286004)(3846002)(6116002)(2201001)(6486002)(22756006)(478600001)(356004)(14454004)(50466002)(25786009)(54906003)(50226002)(4326008)(63350400001)(63370400001)(6636002)(336012)(486006)(6512007)(110136005)(316002)(6506007)(386003)(102836004)(2616005)(2906002)(47776003)(476003)(186003)(14444005)(2501003)(5660300002)(305945005)(81156014)(66066001)(26005)(7736002)(23756003)(70206006)(8936002)(8746002)(8676002)(126002)(81166006)(76130400001)(36756003)(70586007)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0802MB2607; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: bd442fc2-e183-49d7-18f4-08d716749a54 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(710020)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:VI1PR0802MB2607; NoDisclaimer: True X-Forefront-PRVS: 01165471DB X-Microsoft-Antispam-Message-Info: tRlnFDYZQA/IIiV8lFHcw9LYv8mO9AeP+yxHcx99bHrZBpwC3kM2JJQDB2BMXVFzqjK6mE8z2rH0onaUszXFEp/FpQl0EjVTWwyFClYgcYc5JWjWFrg5KxVUlTePO9KHnUU4+iBa30kwOc2t/QG+FNd7JHQqKnXlPRJUbiUTHnt28wT1bOuxxb8OF8EuEUEYhBpUE8ISeJspl7U2HhX2BFneL6tefGkkVSdwwajMO8wkgsO1VFElwN3zKxly/01OIQ/8eyEckPscrF518g1YefLfMthbNYHktOlTePpP/CpjbKIPbOUZLeK52G18PsJscRZ/FvMWY//YyWhMLW4oL8hnMYp2md7i9zeml722qsC52jPhB2MqpNT+gB/zNAdFrScKDEUG+eb0uO7QkIE0Bxm+B0yxleUlb2nf27+Emvo= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2019 11:37:28.7584 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f893acb2-25d0-4563-0485-08d71674a221 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2607 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2B3kRhxDKN309WlgD0F4Z17E9I1IFbdDJKdWWR1UfrI=; b=Jeyt/5sYkSf0oPa0TD/SHq8fC1B4tx/XSern2gwgdmvU9G1XmWQ8QE5KiqU22P0jpbPMTFA1yCiA+t5l6bWj7qrR+CmMLeML4zZ78FKLz/DfkZuV2NejGUkQpI82W8NV+1WC13jXunJ3tM/OOTHEBDphZc4nX9up1t0NyVf9zJk= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2B3kRhxDKN309WlgD0F4Z17E9I1IFbdDJKdWWR1UfrI=; b=Jeyt/5sYkSf0oPa0TD/SHq8fC1B4tx/XSern2gwgdmvU9G1XmWQ8QE5KiqU22P0jpbPMTFA1yCiA+t5l6bWj7qrR+CmMLeML4zZ78FKLz/DfkZuV2NejGUkQpI82W8NV+1WC13jXunJ3tM/OOTHEBDphZc4nX9up1t0NyVf9zJk= X-Mailman-Original-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.freedesktop.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.freedesktop.org; dmarc=temperror action=none header.from=arm.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ayan Halder , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , nd Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Lowry Li (Arm Technology China)" Adds to print the event message when error happens and the same event will not be printed until next vsync. Changes since v1: 1. Handling the event print by CONFIG_KOMEDA_ERROR_PRINT; 2. Changing the max string size to 256. Signed-off-by: Lowry Li (Arm Technology China) Reviewed-by: Liviu Dudau --- drivers/gpu/drm/arm/display/Kconfig | 6 + drivers/gpu/drm/arm/display/komeda/Makefile | 2 + drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 15 +++ drivers/gpu/drm/arm/display/komeda/komeda_event.c | 141 ++++++++++++++++++++++ drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 4 + 5 files changed, 168 insertions(+) create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_event.c diff --git a/drivers/gpu/drm/arm/display/Kconfig b/drivers/gpu/drm/arm/display/Kconfig index cec0639..e87ff86 100644 --- a/drivers/gpu/drm/arm/display/Kconfig +++ b/drivers/gpu/drm/arm/display/Kconfig @@ -12,3 +12,9 @@ config DRM_KOMEDA Processor driver. It supports the D71 variants of the hardware. If compiled as a module it will be called komeda. + +config DRM_KOMEDA_ERROR_PRINT + bool "Enable komeda error print" + depends on DRM_KOMEDA + help + Choose this option to enable error printing. diff --git a/drivers/gpu/drm/arm/display/komeda/Makefile b/drivers/gpu/drm/arm/display/komeda/Makefile index 5c3900c..f095a1c 100644 --- a/drivers/gpu/drm/arm/display/komeda/Makefile +++ b/drivers/gpu/drm/arm/display/komeda/Makefile @@ -22,4 +22,6 @@ komeda-y += \ d71/d71_dev.o \ d71/d71_component.o +komeda-$(CONFIG_DRM_KOMEDA_ERROR_PRINT) += komeda_event.o + obj-$(CONFIG_DRM_KOMEDA) += komeda.o diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h index d1c86b6..e28e7e6 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h @@ -40,6 +40,17 @@ #define KOMEDA_ERR_TTNG BIT_ULL(30) #define KOMEDA_ERR_TTF BIT_ULL(31) +#define KOMEDA_ERR_EVENTS \ + (KOMEDA_EVENT_URUN | KOMEDA_EVENT_IBSY | KOMEDA_EVENT_OVR |\ + KOMEDA_ERR_TETO | KOMEDA_ERR_TEMR | KOMEDA_ERR_TITR |\ + KOMEDA_ERR_CPE | KOMEDA_ERR_CFGE | KOMEDA_ERR_AXIE |\ + KOMEDA_ERR_ACE0 | KOMEDA_ERR_ACE1 | KOMEDA_ERR_ACE2 |\ + KOMEDA_ERR_ACE3 | KOMEDA_ERR_DRIFTTO | KOMEDA_ERR_FRAMETO |\ + KOMEDA_ERR_ZME | KOMEDA_ERR_MERR | KOMEDA_ERR_TCF |\ + KOMEDA_ERR_TTNG | KOMEDA_ERR_TTF) + +#define KOMEDA_WARN_EVENTS KOMEDA_ERR_CSCE + /* malidp device id */ enum { MALI_D71 = 0, @@ -207,4 +218,8 @@ struct komeda_dev { struct komeda_dev *dev_to_mdev(struct device *dev); +#ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT +void komeda_print_events(struct komeda_events *evts); +#endif + #endif /*_KOMEDA_DEV_H_*/ diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c new file mode 100644 index 0000000..57b60cd --- /dev/null +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c @@ -0,0 +1,141 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * (C) COPYRIGHT 2019 ARM Limited. All rights reserved. + * Author: James.Qian.Wang + * + */ +#include + +#include "komeda_dev.h" + +struct komeda_str { + char *str; + u32 sz; + u32 len; +}; + +/* return 0 on success, < 0 on no space. + */ +static int komeda_sprintf(struct komeda_str *str, const char *fmt, ...) +{ + va_list args; + int num, free_sz; + int err; + + free_sz = str->sz - str->len; + if (free_sz <= 0) + return -ENOSPC; + + va_start(args, fmt); + + num = vsnprintf(str->str + str->len, free_sz, fmt, args); + + va_end(args); + + if (num <= free_sz) { + str->len += num; + err = 0; + } else { + str->len = str->sz; + err = -ENOSPC; + } + + return err; +} + +static void evt_sprintf(struct komeda_str *str, u64 evt, const char *msg) +{ + if (evt) + komeda_sprintf(str, msg); +} + +static void evt_str(struct komeda_str *str, u64 events) +{ + if (events == 0ULL) { + evt_sprintf(str, 1, "None"); + return; + } + + evt_sprintf(str, events & KOMEDA_EVENT_VSYNC, "VSYNC|"); + evt_sprintf(str, events & KOMEDA_EVENT_FLIP, "FLIP|"); + evt_sprintf(str, events & KOMEDA_EVENT_EOW, "EOW|"); + evt_sprintf(str, events & KOMEDA_EVENT_MODE, "OP-MODE|"); + + evt_sprintf(str, events & KOMEDA_EVENT_URUN, "UNDERRUN|"); + evt_sprintf(str, events & KOMEDA_EVENT_OVR, "OVERRUN|"); + + /* GLB error */ + evt_sprintf(str, events & KOMEDA_ERR_MERR, "MERR|"); + evt_sprintf(str, events & KOMEDA_ERR_FRAMETO, "FRAMETO|"); + + /* DOU error */ + evt_sprintf(str, events & KOMEDA_ERR_DRIFTTO, "DRIFTTO|"); + evt_sprintf(str, events & KOMEDA_ERR_FRAMETO, "FRAMETO|"); + evt_sprintf(str, events & KOMEDA_ERR_TETO, "TETO|"); + evt_sprintf(str, events & KOMEDA_ERR_CSCE, "CSCE|"); + + /* LPU errors or events */ + evt_sprintf(str, events & KOMEDA_EVENT_IBSY, "IBSY|"); + evt_sprintf(str, events & KOMEDA_ERR_AXIE, "AXIE|"); + evt_sprintf(str, events & KOMEDA_ERR_ACE0, "ACE0|"); + evt_sprintf(str, events & KOMEDA_ERR_ACE1, "ACE1|"); + evt_sprintf(str, events & KOMEDA_ERR_ACE2, "ACE2|"); + evt_sprintf(str, events & KOMEDA_ERR_ACE3, "ACE3|"); + + /* LPU TBU errors*/ + evt_sprintf(str, events & KOMEDA_ERR_TCF, "TCF|"); + evt_sprintf(str, events & KOMEDA_ERR_TTNG, "TTNG|"); + evt_sprintf(str, events & KOMEDA_ERR_TITR, "TITR|"); + evt_sprintf(str, events & KOMEDA_ERR_TEMR, "TEMR|"); + evt_sprintf(str, events & KOMEDA_ERR_TTF, "TTF|"); + + /* CU errors*/ + evt_sprintf(str, events & KOMEDA_ERR_CPE, "COPROC|"); + evt_sprintf(str, events & KOMEDA_ERR_ZME, "ZME|"); + evt_sprintf(str, events & KOMEDA_ERR_CFGE, "CFGE|"); + evt_sprintf(str, events & KOMEDA_ERR_TEMR, "TEMR|"); + + if (str->len > 0 && (str->str[str->len - 1] == '|')) { + str->str[str->len - 1] = 0; + str->len--; + } +} + +static bool is_new_frame(struct komeda_events *a) +{ + return (a->pipes[0] | a->pipes[1]) & + (KOMEDA_EVENT_FLIP | KOMEDA_EVENT_EOW); +} + +void komeda_print_events(struct komeda_events *evts) +{ + u64 print_evts = KOMEDA_ERR_EVENTS; + static bool en_print = true; + + /* reduce the same msg print, only print the first evt for one frame */ + if (evts->global || is_new_frame(evts)) + en_print = true; + if (!en_print) + return; + + if ((evts->global | evts->pipes[0] | evts->pipes[1]) & print_evts) { + #define STR_SZ 256 + char msg[STR_SZ]; + struct komeda_str str; + + str.str = msg; + str.sz = STR_SZ; + str.len = 0; + + komeda_sprintf(&str, "gcu: "); + evt_str(&str, evts->global); + komeda_sprintf(&str, ", pipes[0]: "); + evt_str(&str, evts->pipes[0]); + komeda_sprintf(&str, ", pipes[1]: "); + evt_str(&str, evts->pipes[1]); + + DRM_ERROR("err detect: %s\n", msg); + + en_print = false; + } +} diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index 419a8b0..0fafc36 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -47,6 +47,10 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data) memset(&evts, 0, sizeof(evts)); status = mdev->funcs->irq_handler(mdev, &evts); +#ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT + komeda_print_events(&evts); +#endif + /* Notify the crtc to handle the events */ for (i = 0; i < kms->n_crtcs; i++) komeda_crtc_handle_event(&kms->crtcs[i], &evts);