From patchwork Tue Dec 14 17:38:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 524675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A7BBC433EF for ; Tue, 14 Dec 2021 17:34:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233805AbhLNReF (ORCPT ); Tue, 14 Dec 2021 12:34:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236478AbhLNReE (ORCPT ); Tue, 14 Dec 2021 12:34:04 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C17CEC061574; Tue, 14 Dec 2021 09:34:03 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id oa5-20020a17090b1bc500b001b0f8a5e6b7so1082163pjb.0; Tue, 14 Dec 2021 09:34:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IUVtrCNnk8frIGlEAr3SuG1vPO7+KGLAqJYvYc4iy+A=; b=QYLlFH9FpeWFS2PwTDPc0EDINf2Id7qpanDiTq5Q+PuxvJI8hRirI+cHVv5MGojHZl AvLXg49z6SmaCDpHdvTISH0ku+8iDj2W2hrEmwldCkOKIx9IFrf7MZJ9mIoYxjVA/if2 y8Vv5uuWgShUommqoK3oR1+j6P1nRema/5bbhydrFoHkFDKMdvHuGQQ4U26hEoBwP09i Nc3hEeEF7rfuY680wOGZXZy1xs+GVlGd1rIOkghSvnK18EDB6eSfkXP45ODiDIbuVIHs M3ebhAZIfocoY/QmhcXzFxqpTw/OUwdKU+4972frpQJ0X9ALfHOgChnJ9gXESwzEN2rF W43Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IUVtrCNnk8frIGlEAr3SuG1vPO7+KGLAqJYvYc4iy+A=; b=SDnhnGoVlHMqSc02T4PHEwhMZsv0PZ/b6Dx/6wS5KAV4cTejDDk6tjkifBMs3TO3IM b6iJJURD9AXfhGQFSy01/9a40+2BoDKOMgC7+jof8PMc1GSrc7uRRESrWQpmj3+/c4rY MgiQr7ZpauuJ7pDy9XKFvsQA/GV2+W/Fx7f3SfwdWG53rfEwOMdwf+SWiiPrS9hUHDYK VdF1hpQ0e5geQiDsxFb7bLwco6vZoccpCap/IG1UWaGCkDmAjbrnkFdt3f625ivRJBfr 4q3eX04R7LSmXYiqEBqa1IJxXHuF8yaCQK539GyT2qewbiQ1z+oNSTgQ96TUteg7m2/M njgg== X-Gm-Message-State: AOAM532aqav9MnVBcN9JeKvI5YnX5sTCj91q/5rxgf6fmWgcqwccp+68 djvHPv8x6H8g0ZEoo/j4kRA= X-Google-Smtp-Source: ABdhPJxAyllQpKMu/4CPDbcm2YjXlO5GMQ+PNFz4glkbUUosre2l6gEZOKb+tkDVGNMfOGN4INeIVQ== X-Received: by 2002:a17:903:230d:b0:141:e3ce:2738 with SMTP id d13-20020a170903230d00b00141e3ce2738mr6835284plh.57.1639503243290; Tue, 14 Dec 2021 09:34:03 -0800 (PST) Received: from localhost (c-73-25-156-94.hsd1.or.comcast.net. [73.25.156.94]) by smtp.gmail.com with ESMTPSA id y18sm384629pfp.190.2021.12.14.09.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 09:34:02 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Stephen Boyd , Doug Anderson , Rob Clark , Rob Clark , Sean Paul , Abhinav Kumar , David Airlie , Daniel Vetter , Dmitry Baryshkov , Alexey Dobriyan , Guo Zhengkui , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Fernando Ramos , Bjorn Andersson , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/3] drm/msm/disp: Tweak display snapshot to match gpu snapshot Date: Tue, 14 Dec 2021 09:38:59 -0800 Message-Id: <20211214173917.1496290-2-robdclark@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211214173917.1496290-1-robdclark@gmail.com> References: <20211214173917.1496290-1-robdclark@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Rob Clark Add UTS_RELEASE and show timestamp the same way for consistency. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/disp/msm_disp_snapshot.h | 4 ++-- drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h index 4c619307612c..31ad68be3391 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h @@ -39,7 +39,7 @@ * @dev: device pointer * @drm_dev: drm device pointer * @atomic_state: atomic state duplicated at the time of the error - * @timestamp: timestamp at which the coredump was captured + * @time: timestamp at which the coredump was captured */ struct msm_disp_state { struct device *dev; @@ -49,7 +49,7 @@ struct msm_disp_state { struct drm_atomic_state *atomic_state; - ktime_t timestamp; + struct timespec64 time; }; /** diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c index 2e1acb1bc390..5d2ff6791058 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c @@ -5,6 +5,8 @@ #define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__ +#include + #include "msm_disp_snapshot.h" static void msm_disp_state_dump_regs(u32 **reg, u32 aligned_len, void __iomem *base_addr) @@ -79,10 +81,11 @@ void msm_disp_state_print(struct msm_disp_state *state, struct drm_printer *p) } drm_printf(p, "---\n"); - + drm_printf(p, "kernel: " UTS_RELEASE "\n"); drm_printf(p, "module: " KBUILD_MODNAME "\n"); drm_printf(p, "dpu devcoredump\n"); - drm_printf(p, "timestamp %lld\n", ktime_to_ns(state->timestamp)); + drm_printf(p, "time: %lld.%09ld\n", + state->time.tv_sec, state->time.tv_nsec); list_for_each_entry_safe(block, tmp, &state->blocks, node) { drm_printf(p, "====================%s================\n", block->name); @@ -100,7 +103,7 @@ static void msm_disp_capture_atomic_state(struct msm_disp_state *disp_state) struct drm_device *ddev; struct drm_modeset_acquire_ctx ctx; - disp_state->timestamp = ktime_get(); + ktime_get_real_ts64(&disp_state->time); ddev = disp_state->drm_dev; From patchwork Tue Dec 14 17:39:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 523732 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5079C433EF for ; Tue, 14 Dec 2021 17:34:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236478AbhLNReN (ORCPT ); Tue, 14 Dec 2021 12:34:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236489AbhLNReM (ORCPT ); Tue, 14 Dec 2021 12:34:12 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ACD2C061574; Tue, 14 Dec 2021 09:34:12 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id oa5-20020a17090b1bc500b001b0f8a5e6b7so1082610pjb.0; Tue, 14 Dec 2021 09:34:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5TKn9BEzW+NQEp96roozEjZVgCiZc4QtW5+v79OS1QU=; b=IX7MQPa9jV3smphAxA9+bp9TECF4Hsp5W/Ab79KnhP7ylXRd78v3wf1zgGgi1p26ue il9d6VnYxzw0+aqW857C4l3Ym+635Poc98wVk4QPZntFsRLvl+GZNiyrwwV/eGlYUVCB CgW6F7tfDpXNo7RlXdRdnF7tIlbikbAy6MiavksxujqOJkrhgUquSo+w7jiW7qZxt0ju 7GRBW1fCRbdRakmYhDonrHKqz8dfMbneZuqPuaJQ9FENfviec17UvnSsevAW4pYqCx0H 9x4tqzcbix4TWBHBxenFFhi3sZs1xM5v+DDspB8tG33RSUNcYIwoPqxy8pHFXhi5VODH OVMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5TKn9BEzW+NQEp96roozEjZVgCiZc4QtW5+v79OS1QU=; b=r/Zah9KD8/t4t0XxoX+Z5kkbjJA5F7Hq6aUAnjKO78wbunz4WuIDYnljeGcaeQVFID anw90aBoH0Xzpg8oQIl8y70BYVWrjgL9ZYiW/whO/wIW/Prm0SKmZHV2llWjPNAAlRCK RliqB8elnamu1SK2SsQVbMdx7xDI1XWjtLVgjqPnXXj2bTLsTQnyRL/LrNeidlo8m3Ks YJGiMGLIjGjJUIK7F9dxqj0oCJqzZQuNE7KT85d1u6a863CwTypHryU1U5lS1f5yUNEN qgG9UG6/f/cVkDH/CeqfR56FQwNxwPh6RfW+Ed8y9IYCiOHYxe47qtQw7mCIqUMZftVI ahjw== X-Gm-Message-State: AOAM530OsiNoR62dvhHdwrE1AEm1SZHQNdpDyGxfa0e/gkLRwIuuxhLO go3IYT9oIjznOCWELugAsNo= X-Google-Smtp-Source: ABdhPJyI1ocy09TalCTGQgEActZJ6yyfVRJ2uUV35cURRdHsIPafebqn+w8KFuzJHwYZZxumdCIerg== X-Received: by 2002:a17:90a:bf8a:: with SMTP id d10mr7061487pjs.67.1639503251776; Tue, 14 Dec 2021 09:34:11 -0800 (PST) Received: from localhost (c-73-25-156-94.hsd1.or.comcast.net. [73.25.156.94]) by smtp.gmail.com with ESMTPSA id fs21sm2531167pjb.1.2021.12.14.09.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 09:34:10 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Stephen Boyd , Doug Anderson , Rob Clark , Rob Clark , Sean Paul , Abhinav Kumar , David Airlie , Daniel Vetter , Dmitry Baryshkov , Masahiro Yamada , Guo Zhengkui , Alexey Dobriyan , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/3] drm/msm/disp: Export helper for capturing snapshot Date: Tue, 14 Dec 2021 09:39:00 -0800 Message-Id: <20211214173917.1496290-3-robdclark@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211214173917.1496290-1-robdclark@gmail.com> References: <20211214173917.1496290-1-robdclark@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Rob Clark We'll re-use this for debugfs. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/disp/msm_disp_snapshot.c | 28 +++++++++++++++----- drivers/gpu/drm/msm/disp/msm_disp_snapshot.h | 10 +++++++ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c index a4a7cb06bc87..580ea01b13ab 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c @@ -28,29 +28,43 @@ static ssize_t __maybe_unused disp_devcoredump_read(char *buffer, loff_t offset, return count - iter.remain; } -static void _msm_disp_snapshot_work(struct kthread_work *work) +struct msm_disp_state * +msm_disp_snapshot_state_sync(struct msm_kms *kms) { - struct msm_kms *kms = container_of(work, struct msm_kms, dump_work); struct drm_device *drm_dev = kms->dev; struct msm_disp_state *disp_state; - struct drm_printer p; + + WARN_ON(!mutex_is_locked(&kms->dump_mutex)); disp_state = kzalloc(sizeof(struct msm_disp_state), GFP_KERNEL); if (!disp_state) - return; + return ERR_PTR(-ENOMEM); disp_state->dev = drm_dev->dev; disp_state->drm_dev = drm_dev; INIT_LIST_HEAD(&disp_state->blocks); - /* Serialize dumping here */ - mutex_lock(&kms->dump_mutex); - msm_disp_snapshot_capture_state(disp_state); + return disp_state; +} + +static void _msm_disp_snapshot_work(struct kthread_work *work) +{ + struct msm_kms *kms = container_of(work, struct msm_kms, dump_work); + struct drm_device *drm_dev = kms->dev; + struct msm_disp_state *disp_state; + struct drm_printer p; + + /* Serialize dumping here */ + mutex_lock(&kms->dump_mutex); + disp_state = msm_disp_snapshot_state_sync(kms); mutex_unlock(&kms->dump_mutex); + if (IS_ERR(disp_state)) + return; + if (MSM_DISP_SNAPSHOT_DUMP_IN_CONSOLE) { p = drm_info_printer(disp_state->drm_dev->dev); msm_disp_state_print(disp_state, &p); diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h index 31ad68be3391..b5f452bd7ada 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h @@ -84,6 +84,16 @@ int msm_disp_snapshot_init(struct drm_device *drm_dev); */ void msm_disp_snapshot_destroy(struct drm_device *drm_dev); +/** + * msm_disp_snapshot_state_sync - synchronously snapshot display state + * @kms: the kms object + * + * Returns state or error + * + * Must be called with &kms->dump_mutex held + */ +struct msm_disp_state *msm_disp_snapshot_state_sync(struct msm_kms *kms); + /** * msm_disp_snapshot_state - trigger to dump the display snapshot * @drm_dev: handle to drm device From patchwork Tue Dec 14 17:39:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 524674 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D907DC433EF for ; Tue, 14 Dec 2021 17:34:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236489AbhLNReP (ORCPT ); Tue, 14 Dec 2021 12:34:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236494AbhLNReO (ORCPT ); Tue, 14 Dec 2021 12:34:14 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A0B1C061574; Tue, 14 Dec 2021 09:34:14 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id x131so18411009pfc.12; Tue, 14 Dec 2021 09:34:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MGWQoMYzhBAB2IQM3xcDS7ekxQKFM3AGil27CIrS8Io=; b=kpOVXTp9O8u083FN0cDMv8QEMx6qzsDj6dhRCQ/hhAFstQHJz+m13Py9LbAYcWOiJ2 Jb10Xbw3L64I2D5Mc6rCmDww4uuiEbqqLKjGomPdT8eU9aWjqThycArxhL8p0FpFGnxj 7TeuJXz2xtmgM92cEOJpuTsZGAd5gaxpDgDAQmUr5iYPW2tPvkuofMtHCmKNl/A4uVYm 0RygnF9/Idj3dNJ/o7DQIYDalTQVLM3R9magmlOc7M4nhp98HCs0+8UXUVS3WxvGfiFm v9SPZSqXk43i/19vMwrF/7iBM8TT3ef746SOVAn3YBnvf/0azyoON3+gSZVlajKZd5CI uxVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MGWQoMYzhBAB2IQM3xcDS7ekxQKFM3AGil27CIrS8Io=; b=XI4qcMOeZJehD98dE96MNi1uzqXvJPccSKWKGeV5o+Zbsnd9dtW1X/72V2+4WJ3OlW 2YIgofLP2ZdISdbKxQosn1yIq4r/f+MyEnNHuYn1lYYzvgagQv17YcTMs5hDUTa6oDTR 0uFUdX7aZKuFTRbqS/7Zj+zZVff5vpGsFEcCXVD6mFci1cQkNOi1CrrrOfnc5fvKF5VP VpjQGr0FdOHL9pbuVPu0NS2n+xdx62X7lkw+xbzBl3qLcyDKvKmxSJ8IJrY4aY11TWHy cKxPAfkuJJobAXz3vTnOP2nApRVdoKxcDA0/JEZak5//bB+TURUECKqIn4C+1Oz2TQtX QaGw== X-Gm-Message-State: AOAM531vtrkh+24jkt77hGn3mi0ODxfenFt17eNCJNUPd8HB2SqVPgR1 ynpJsD2sdxl/rZM4Xyt4AYM= X-Google-Smtp-Source: ABdhPJxM83Psw3lwIth4QeOPBbLdhAmJzqzCXZCXy1ejGpDzB8vLX8oSXAQcnAmfPI6/Pk6VfdW1cQ== X-Received: by 2002:aa7:93ce:0:b0:4a8:19fc:f024 with SMTP id y14-20020aa793ce000000b004a819fcf024mr5328681pff.10.1639503253926; Tue, 14 Dec 2021 09:34:13 -0800 (PST) Received: from localhost (c-73-25-156-94.hsd1.or.comcast.net. [73.25.156.94]) by smtp.gmail.com with ESMTPSA id y65sm310696pgd.79.2021.12.14.09.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 09:34:13 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Stephen Boyd , Doug Anderson , Rob Clark , Rob Clark , Sean Paul , Abhinav Kumar , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/3] drm/msm/debugfs: Add display/kms state snapshot Date: Tue, 14 Dec 2021 09:39:01 -0800 Message-Id: <20211214173917.1496290-4-robdclark@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211214173917.1496290-1-robdclark@gmail.com> References: <20211214173917.1496290-1-robdclark@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Rob Clark Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_debugfs.c | 90 +++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/drivers/gpu/drm/msm/msm_debugfs.c b/drivers/gpu/drm/msm/msm_debugfs.c index 956b1efc3721..088f1160c892 100644 --- a/drivers/gpu/drm/msm/msm_debugfs.c +++ b/drivers/gpu/drm/msm/msm_debugfs.c @@ -15,6 +15,11 @@ #include "msm_gpu.h" #include "msm_kms.h" #include "msm_debugfs.h" +#include "disp/msm_disp_snapshot.h" + +/* + * GPU Snapshot: + */ struct msm_gpu_show_priv { struct msm_gpu_state *state; @@ -109,6 +114,88 @@ static const struct file_operations msm_gpu_fops = { .release = msm_gpu_release, }; +/* + * Display Snapshot: + */ + +struct msm_kms_show_priv { + struct msm_disp_state *state; + struct drm_device *dev; +}; + +static int msm_kms_show(struct seq_file *m, void *arg) +{ + struct drm_printer p = drm_seq_file_printer(m); + struct msm_kms_show_priv *show_priv = m->private; + + msm_disp_state_print(show_priv->state, &p); + + return 0; +} + +static int msm_kms_release(struct inode *inode, struct file *file) +{ + struct seq_file *m = file->private_data; + struct msm_kms_show_priv *show_priv = m->private; + + msm_disp_state_free(show_priv->state); + kfree(show_priv); + + return single_release(inode, file); +} + +static int msm_kms_open(struct inode *inode, struct file *file) +{ + struct drm_device *dev = inode->i_private; + struct msm_drm_private *priv = dev->dev_private; + struct msm_kms_show_priv *show_priv; + int ret; + + if (!priv->kms) + return -ENODEV; + + show_priv = kmalloc(sizeof(*show_priv), GFP_KERNEL); + if (!show_priv) + return -ENOMEM; + + ret = mutex_lock_interruptible(&priv->kms->dump_mutex); + if (ret) + goto free_priv; + + show_priv->state = msm_disp_snapshot_state_sync(priv->kms); + + mutex_unlock(&priv->kms->dump_mutex); + + if (IS_ERR(show_priv->state)) { + ret = PTR_ERR(show_priv->state); + goto free_priv; + } + + show_priv->dev = dev; + + ret = single_open(file, msm_kms_show, show_priv); + if (ret) + goto free_priv; + + return 0; + +free_priv: + kfree(show_priv); + return ret; +} + +static const struct file_operations msm_kms_fops = { + .owner = THIS_MODULE, + .open = msm_kms_open, + .read = seq_read, + .llseek = seq_lseek, + .release = msm_kms_release, +}; + +/* + * Other debugfs: + */ + static unsigned long last_shrink_freed; static int @@ -239,6 +326,9 @@ void msm_debugfs_init(struct drm_minor *minor) debugfs_create_file("gpu", S_IRUSR, minor->debugfs_root, dev, &msm_gpu_fops); + debugfs_create_file("kms", S_IRUSR, minor->debugfs_root, + dev, &msm_kms_fops); + debugfs_create_u32("hangcheck_period_ms", 0600, minor->debugfs_root, &priv->hangcheck_period);