From patchwork Tue May 20 13:56: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: 30464 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f71.google.com (mail-qg0-f71.google.com [209.85.192.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 52DD820C03 for ; Tue, 20 May 2014 13:57:27 +0000 (UTC) Received: by mail-qg0-f71.google.com with SMTP id a108sf1031195qge.6 for ; Tue, 20 May 2014 06:57:27 -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=Kv1qq9seSbGjh3DYzRXYadgyEaLYODuMkSyHxhE3HLA=; b=DRbQytDC8DiXkPp7rKTgOgZTfsZ25WRXz7TJ3Ijw1DxGUAbFEggamw4+plS7hwrIqT hRIgWOT90eg/7bLqtZHWygXDvTql4p/G/8jRBB5jueg4vCJk2AH7BrYfHWWw4hsmsShZ 88IjEd/xFX6TaIMyAyWRbIWH/SFxtKFk1r8leljpCpAIkTBqsQeMo/TvAu3GQpmdGSOQ P8LXjD4/l8pfwqYwsiKUEBXSPDO29AcvdhQdlIOCFpPX7CDeNkWsNaZoXJPcdkps2wSz ZElwUwfp9APf+Cq9O22I8IDuCpb4wqcDF4jppHdp1oxqYXiFakQoy9uRlvGoZ/yTUAU9 4b7g== X-Gm-Message-State: ALoCoQl7kOcL+lex10QuUoc7vJpN8iEDE7gWpV/emQ+EE2SAJZvWkZNZScrZ8sM9Hqdo7h34kyIz X-Received: by 10.52.2.129 with SMTP id 1mr16532240vdu.4.1400594247140; Tue, 20 May 2014 06:57:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.147 with SMTP id 19ls279286qgp.68.gmail; Tue, 20 May 2014 06:57:27 -0700 (PDT) X-Received: by 10.220.163.3 with SMTP id y3mr3856203vcx.7.1400594246965; Tue, 20 May 2014 06:57:26 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id fh10si697739vcb.48.2014.05.20.06.57.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 May 2014 06:57:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id ij19so646982vcb.0 for ; Tue, 20 May 2014 06:57:26 -0700 (PDT) X-Received: by 10.52.2.229 with SMTP id 5mr3302361vdx.24.1400594246880; Tue, 20 May 2014 06:57:26 -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 ib8csp32781vcb; Tue, 20 May 2014 06:57:26 -0700 (PDT) X-Received: by 10.66.179.111 with SMTP id df15mr51479193pac.52.1400594245422; Tue, 20 May 2014 06:57:25 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id he6si24779269pac.20.2014.05.20.06.57.24 for ; Tue, 20 May 2014 06:57:25 -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 E91E16E8EA; Tue, 20 May 2014 06:57:23 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f44.google.com (mail-ee0-f44.google.com [74.125.83.44]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A6B26E8E5 for ; Tue, 20 May 2014 06:57:19 -0700 (PDT) Received: by mail-ee0-f44.google.com with SMTP id c41so615999eek.17 for ; Tue, 20 May 2014 06:57:18 -0700 (PDT) X-Received: by 10.14.194.133 with SMTP id m5mr4505452een.38.1400594238494; Tue, 20 May 2014 06:57:18 -0700 (PDT) Received: from lmenx321.lme.st.com ([80.10.159.130]) by mx.google.com with ESMTPSA id x45sm4061136eee.37.2014.05.20.06.57.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 May 2014 06:57:17 -0700 (PDT) From: Benjamin Gaignard To: dri-devel@lists.freedesktop.org, airlied@linux.ie, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 13/16] drm: sti: add debug to VID Date: Tue, 20 May 2014 15:56:23 +0200 Message-Id: <1400594186-8956-14-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1400594186-8956-1-git-send-email-benjamin.gaignard@linaro.org> References: <1400594186-8956-1-git-send-email-benjamin.gaignard@linaro.org> Cc: lee.jones@linaro.org, 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.169 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 --- 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