From patchwork Tue May 13 18:26:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 30125 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 74C8920369 for ; Tue, 13 May 2014 18:27:25 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id ey11sf3362390pad.0 for ; Tue, 13 May 2014 11:27:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:subject:date :message-id:in-reply-to:references:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=emd54MbqOmEpowhDzQbf/BU2RECW7xsgsFJ8CM1zfjI=; b=AI8duo69vYw1IbCvb/woa4Q624489AHSWoavj81ius9zbx5sBiCSfgAz7C4A//C5/u NWvKP/G14xKS7XsKVHbtH5hK44Y1JmRrM1W8FNLAcqa5Av0vhUHA1eZSUDP0JT7u0RWG XLV00VbYZW+upEBbXWTJaFj8bQI9+UtZIirOGHjVLCv2SGmZxGwYmkQdexzrpLk6YROD gEMZP2dc0/Ht65owXihdEBTrAgck5SItkS9hKxV/LyhGUS/6bfvfXvKPMfqPhIf43Ly7 1O3067TVvHPrVcF767ICNU70yJPmoM0pnqKPgOAiQIYcnZdsi5BdoxUDqNhZ8/Ok/lwG jDJQ== X-Gm-Message-State: ALoCoQmRMZT9BNKcTovARuzaf1ckn7ZEDXa3oUf4qTeZ7tdkRhHRkREtz2hlKF7r+zADUseemjBu X-Received: by 10.66.163.33 with SMTP id yf1mr16034279pab.19.1400005644806; Tue, 13 May 2014 11:27:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.16.173 with SMTP id 42ls373755qgb.62.gmail; Tue, 13 May 2014 11:27:24 -0700 (PDT) X-Received: by 10.58.178.115 with SMTP id cx19mr1176709vec.70.1400005644580; Tue, 13 May 2014 11:27:24 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id ol2si2785469vcb.89.2014.05.13.11.27.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 11:27:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id la4so1022625vcb.27 for ; Tue, 13 May 2014 11:27:24 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr30592633vcb.0.1400005644479; Tue, 13 May 2014 11:27:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp172972vcb; Tue, 13 May 2014 11:27:24 -0700 (PDT) X-Received: by 10.69.26.103 with SMTP id ix7mr7122222pbd.41.1400005642677; Tue, 13 May 2014 11:27:22 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id lc8si14087055pab.180.2014.05.13.11.27.22 for ; Tue, 13 May 2014 11:27:22 -0700 (PDT) Received-SPF: none (google.com: dri-devel-bounces@lists.freedesktop.org does not designate permitted sender hosts) client-ip=131.252.210.177; Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4CBBD6EBB3; Tue, 13 May 2014 11:27:21 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by gabe.freedesktop.org (Postfix) with ESMTP id A21E06EBB1 for ; Tue, 13 May 2014 11:27:19 -0700 (PDT) Received: by mail-wi0-f179.google.com with SMTP id bs8so1126012wib.0 for ; Tue, 13 May 2014 11:27:18 -0700 (PDT) X-Received: by 10.180.7.227 with SMTP id m3mr22348274wia.59.1400005638914; Tue, 13 May 2014 11:27:18 -0700 (PDT) Received: from lmenx321.lme.st.com (lya72-2-88-175-155-153.fbx.proxad.net. [88.175.155.153]) by mx.google.com with ESMTPSA id f7sm23191631wjy.24.2014.05.13.11.27.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 11:27:18 -0700 (PDT) From: Benjamin Gaignard To: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH v2 14/19] drm: sti: add debug to VID Date: Tue, 13 May 2014 20:26:23 +0200 Message-Id: <1400005588-3974-15-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1400005588-3974-1-git-send-email-benjamin.gaignard@linaro.org> References: <1400005588-3974-1-git-send-email-benjamin.gaignard@linaro.org> Cc: Fabien Dessenne , Benjamin Gaignard X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: benjamin.gaignard@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Make VIdeo plug more verbose on what is on going Signed-off-by: Benjamin Gaignard Signed-off-by: Vincent Abriou Signed-off-by: Fabien Dessenne --- drivers/gpu/drm/sti/sti_vid.c | 121 ++++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/sti/sti_vid.h | 1 + 2 files changed, 122 insertions(+) diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c index 710665d..35f60d8 100644 --- a/drivers/gpu/drm/sti/sti_vid.c +++ b/drivers/gpu/drm/sti/sti_vid.c @@ -8,6 +8,8 @@ #include "sti_vid.h" #include "sti_layer.h" +#include "sti_compositor.h" +#include "sti_drm_drv.h" #include "sti_vtg_utils.h" /* Registers */ @@ -49,6 +51,8 @@ static int sti_vid_prepare_layer(void *lay, bool first_prepare) struct sti_layer *layer = (struct sti_layer *)lay; struct sti_vid *vid = layer->vid; + dev_dbg(vid->dev, "%s %s\n", __func__, sti_layer_to_str(layer)); + /* Unmask */ val = readl(vid->regs + VID_CTL); val &= ~VID_CTL_IGNORE; @@ -64,6 +68,8 @@ static int sti_vid_commit_layer(void *lay) struct drm_display_mode *mode = layer->mode; u32 ydo, xdo, yds, xds; + dev_dbg(vid->dev, "%s %s\n", __func__, sti_layer_to_str(layer)); + ydo = sti_vtg_get_line_number(*mode, layer->dst_y); yds = sti_vtg_get_line_number(*mode, layer->dst_y + layer->dst_h - 1); xdo = sti_vtg_get_pixel_number(*mode, layer->dst_x); @@ -81,6 +87,8 @@ static int sti_vid_disable_layer(void *lay) struct sti_layer *layer = (struct sti_layer *)lay; struct sti_vid *vid = layer->vid; + DRM_DEBUG_DRIVER("%s\n", sti_layer_to_str(layer)); + /* Mask */ val = readl(vid->regs + VID_CTL); val |= VID_CTL_IGNORE; @@ -136,3 +144,116 @@ struct sti_vid *sti_vid_create(struct device *dev, void __iomem *baseaddr) return vid; } + +static void sti_vid_dbg_ctl(struct seq_file *m, int val) +{ + val = val >> 30; + seq_puts(m, "\t"); + + if (!(val & 1)) + seq_puts(m, "NOT "); + seq_puts(m, "ignored on main mixer - "); + + if (!(val & 2)) + seq_puts(m, "NOT "); + seq_puts(m, "ignored on aux mixer"); +} + +static void sti_vid_dbg_vpo(struct seq_file *m, int val) +{ + seq_printf(m, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF); +} + +static void sti_vid_dbg_vps(struct seq_file *m, int val) +{ + seq_printf(m, "\txds:%4d\tyds:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF); +} + +static void sti_vid_dbg_mst(struct seq_file *m, int val) +{ + if (val & 1) + seq_puts(m, "\tBUFFER UNDERFLOW!"); +} + +#define DBG_DUMP(reg) \ + seq_printf(m, "\n " #reg "\t 0x%08X", readl(vid->regs + reg)) + +int sti_vid_dbg_show(struct seq_file *m, void *arg) +{ + struct drm_info_node *node = (struct drm_info_node *)m->private; + struct drm_device *dev = node->minor->dev; + struct sti_drm_private *dev_priv = dev->dev_private; + struct sti_compositor *compo = dev_priv->compo; + enum sti_layer_desc vid_id = *(enum sti_layer_desc *)arg; + struct sti_layer *layer; + struct sti_vid *vid; + struct drm_plane *plane; + struct drm_crtc *crtc; + struct drm_framebuffer *fb; + + if (compo == NULL) { + seq_puts(m, "No compo available\n"); + goto out; + } + + layer = sti_layer_find_layer(compo->layer, vid_id); + if (!layer) { + seq_puts(m, "Cannot find video layer\n"); + goto out; + } + vid = layer->vid; + + seq_printf(m, "\n%s (associated with the mixer_id %d)", + sti_layer_to_str(layer), layer->mixer_id); + seq_printf(m, "\t %d frame updates", + layer->fps_info.curr_frame_counter); + + DBG_DUMP(VID_CTL); + sti_vid_dbg_ctl(m, readl(vid->regs + VID_CTL)); + DBG_DUMP(VID_ALP); + DBG_DUMP(VID_CLF); + DBG_DUMP(VID_VPO); + sti_vid_dbg_vpo(m, readl(vid->regs + VID_VPO)); + DBG_DUMP(VID_VPS); + sti_vid_dbg_vps(m, readl(vid->regs + VID_VPS)); + DBG_DUMP(VID_KEY1); + DBG_DUMP(VID_KEY2); + DBG_DUMP(VID_MPR0); + DBG_DUMP(VID_MPR1); + DBG_DUMP(VID_MPR2); + DBG_DUMP(VID_MPR3); + DBG_DUMP(VID_MST); + sti_vid_dbg_mst(m, readl(vid->regs + VID_MST)); + DBG_DUMP(VID_BC); + DBG_DUMP(VID_TINT); + DBG_DUMP(VID_CSAT); + + seq_puts(m, "\n"); + + plane = &layer->plane; + if (!plane->base.id) { + seq_puts(m, " Not connected to any DRM PLANE\n"); + goto out; + } + seq_printf(m, " Connected to DRM PLANE #%d which is:\n", + plane->base.id); + + crtc = plane->crtc; + if (!crtc) { + seq_puts(m, "\tNot connected to any DRM CRTC\n"); + goto out; + } + seq_printf(m, "\tConnected to DRM CRTC #%d\n", crtc->base.id); + + fb = crtc->fb; + if (!fb) { + seq_puts(m, "\tNot connected to any DRM FB\n"); + goto out; + } + seq_printf(m, "\tConnected to DRM FB #%d, %dx%d, %.4s\n", + fb->base.id, + fb->width, fb->height, (char *)&fb->pixel_format); + +out: + return 0; +} diff --git a/drivers/gpu/drm/sti/sti_vid.h b/drivers/gpu/drm/sti/sti_vid.h index dd4fd95..6261ade 100644 --- a/drivers/gpu/drm/sti/sti_vid.h +++ b/drivers/gpu/drm/sti/sti_vid.h @@ -29,5 +29,6 @@ struct sti_vid { }; struct sti_vid *sti_vid_create(struct device *dev, void __iomem *baseaddr); +int sti_vid_dbg_show(struct seq_file *m, void *arg); #endif