From patchwork Tue May 13 18:26:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 30127 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 452B920369 for ; Tue, 13 May 2014 18:27:28 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id jt11sf1266894pbb.2 for ; Tue, 13 May 2014 11:27: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=2ov7oTe1yj62IO8J9jUmLzosX614I2DZ/Nl7INLvh6k=; b=RgyL50ZHpWsyyMOhgrfGBSKStIWLZ/Nm/J0u2cYlsaMidkcO0lp+/LFzh8sILt7Zl7 MkXpq2T2BCVGmyCakAbl4Gd1ZX4hr1Vg0AGZ3fjU6C7zh6UyIf7slBZaFPFVHcXnea4V WXA5UXezlFbrXbXW5Ds/ZWZs5CdCcs0hLA5Ko5zUbklk2OYgf/Cwva5Eca8iXePDZT4w 1Twd5vBuj+UqktEYlLYOu/wnZHhab/LmuLdtoIk4zWOMOysGf0VC9nV8fdnMv8lwgoMG UGMz6CUyDnI1wZGIn78F7UgGEC1vMSMHVL80RhSdRsN3h+gvIDfvrKzSPZjhLzWRb70M VMcg== X-Gm-Message-State: ALoCoQnN36HGcCBLEaOm8RHOOmDUoO55536qnNB4Pxi0VjDL788DKuj0ni6XObasb2ODYrb7ep3q X-Received: by 10.66.188.238 with SMTP id gd14mr17589592pac.18.1400005647609; Tue, 13 May 2014 11:27:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.112 with SMTP id n103ls2053291qga.86.gmail; Tue, 13 May 2014 11:27:27 -0700 (PDT) X-Received: by 10.220.95.2 with SMTP id b2mr1744734vcn.61.1400005647491; Tue, 13 May 2014 11:27:27 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id gu9si2782624vdc.34.2014.05.13.11.27.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 11:27:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 as permitted sender) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id jw12so963962veb.34 for ; Tue, 13 May 2014 11:27:27 -0700 (PDT) X-Received: by 10.220.5.129 with SMTP id 1mr1598322vcv.71.1400005647397; Tue, 13 May 2014 11:27:27 -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 ib8csp172977vcb; Tue, 13 May 2014 11:27:26 -0700 (PDT) X-Received: by 10.66.140.6 with SMTP id rc6mr65588850pab.87.1400005646512; Tue, 13 May 2014 11:27:26 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id ud10si8406312pbc.73.2014.05.13.11.27.25 for ; Tue, 13 May 2014 11:27:26 -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 2C76A7A00D; Tue, 13 May 2014 11:27:25 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com [74.125.82.52]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DE6F7A00A for ; Tue, 13 May 2014 11:27:23 -0700 (PDT) Received: by mail-wg0-f52.google.com with SMTP id l18so780112wgh.11 for ; Tue, 13 May 2014 11:27:22 -0700 (PDT) X-Received: by 10.194.220.42 with SMTP id pt10mr3978584wjc.60.1400005642366; Tue, 13 May 2014 11:27:22 -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.20 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 11:27:21 -0700 (PDT) From: Benjamin Gaignard To: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH v2 16/19] drm: sti: add debug to mixer Date: Tue, 13 May 2014 20:26:25 +0200 Message-Id: <1400005588-3974-17-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.128.175 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 mixer driver more verbose Signed-off-by: Benjamin Gaignard Signed-off-by: Vincent Abriou Signed-off-by: Fabien Dessenne --- drivers/gpu/drm/sti/sti_mixer.c | 164 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/sti/sti_mixer.h | 2 + 2 files changed, 166 insertions(+) diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c index ab8daf6..fce72e4 100644 --- a/drivers/gpu/drm/sti/sti_mixer.c +++ b/drivers/gpu/drm/sti/sti_mixer.c @@ -6,7 +6,9 @@ * License terms: GNU General Public License (GPL), version 2 */ +#include "sti_drm_drv.h" #include "sti_mixer.h" +#include "sti_compositor.h" #include "sti_vtg_utils.h" /* Identity: G=Y , B=Cb , R=Cr */ @@ -139,6 +141,8 @@ int sti_mixer_set_layer_depth(struct sti_mixer *mixer, struct sti_layer *layer) mask = GAM_DEPTH_MASK_ID << (3 * depth); layer_id = layer_id << (3 * depth); + DRM_DEBUG_DRIVER("%s %s depth=%d\n", sti_mixer_to_str(mixer), + sti_layer_to_str(layer), depth); dev_dbg(mixer->dev, "GAM_MIXER_MAIN_CRB val 0x%x mask 0x%x\n", layer_id, mask); sti_mixer_reg_writemask(mixer, GAM_MIXER_MAIN_CRB, layer_id, mask); @@ -197,6 +201,9 @@ int sti_mixer_set_layer_status(struct sti_mixer *mixer, { u32 mask, val; + DRM_DEBUG_DRIVER("%s %s %s\n", status ? "enable" : "disable", + sti_mixer_to_str(mixer), sti_layer_to_str(layer)); + mask = sti_mixer_get_layer_mask(layer); if (!mask) { DRM_ERROR("Can not find layer mask\n"); @@ -239,3 +246,160 @@ struct sti_mixer *sti_mixer_create(struct device *dev, int id, return mixer; } + +static void sti_mixer_dbg_ctl(struct seq_file *m, int val) +{ + int count = 0; + + seq_puts(m, "\tEnabled: "); + if (val & 1) { + seq_puts(m, "BKG "); + count++; + } + val = val >> 1; + + if (val & 1) { + seq_puts(m, "VID0 "); + count++; + } + val = val >> 1; + if (val & 1) { + seq_puts(m, "VID1 "); + count++; + } + val = val >> 1; + if (val & 1) { + seq_puts(m, "GDP0 "); + count++; + } + val = val >> 1; + if (val & 1) { + seq_puts(m, "GDP1 "); + count++; + } + val = val >> 1; + if (val & 1) { + seq_puts(m, "GDP2 "); + count++; + } + val = val >> 1; + if (val & 1) { + seq_puts(m, "GDP3 "); + count++; + } + if (!count) + seq_puts(m, "Nothing"); +} + +static void sti_mixer_dbg_crb(struct seq_file *m, int val) +{ + int i; + + seq_puts(m, "\tDepth: "); + for (i = 0; i < GAM_MIXER_NB_DEPTH_LEVEL; i++) { + switch (val & GAM_DEPTH_MASK_ID) { + case GAM_DEPTH_VID0_ID: + seq_puts(m, "VID0"); + break; + case GAM_DEPTH_VID1_ID: + seq_puts(m, "VID1"); + break; + case GAM_DEPTH_GDP0_ID: + seq_puts(m, "GDP0"); + break; + case GAM_DEPTH_GDP1_ID: + seq_puts(m, "GDP1"); + break; + case GAM_DEPTH_GDP2_ID: + seq_puts(m, "GDP2"); + break; + case GAM_DEPTH_GDP3_ID: + seq_puts(m, "GDP3"); + break; + default: + seq_puts(m, "---"); + } + if (i < GAM_MIXER_NB_DEPTH_LEVEL - 1) + seq_puts(m, " < "); + val = val >> 3; + } +} + +static void sti_mixer_dbg_mxn(struct seq_file *m, void *addr) +{ + int i; + + for (i = 1; i < 8; i++) + seq_printf(m, "-0x%08X", (int)readl(addr + i * 4)); +} + +#define MIXER_DBG_DUMP(reg) seq_printf(m, "\n " #reg "\t 0x%08X", \ + sti_mixer_reg_read(mixer, reg)) + +int sti_mixer_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; + int i, ret; + + ret = mutex_lock_interruptible(&dev->struct_mutex); + if (ret) + return ret; + + if (compo == NULL) { + seq_puts(m, "No compositor available\n"); + goto out; + } + + for (i = 0; i < compo->nb_mixers; i++) { + struct drm_crtc *crtc; + struct drm_framebuffer *fb; + struct sti_mixer *mixer = compo->mixer[i]; + + seq_printf(m, "\n%s", sti_mixer_to_str(mixer)); + MIXER_DBG_DUMP(GAM_MIXER_MAIN_CTL); + sti_mixer_dbg_ctl(m, + sti_mixer_reg_read(mixer, + GAM_MIXER_MAIN_CTL)); + MIXER_DBG_DUMP(GAM_MIXER_MAIN_BKC); + MIXER_DBG_DUMP(GAM_MIXER_MAIN_BCO); + MIXER_DBG_DUMP(GAM_MIXER_MAIN_BCS); + MIXER_DBG_DUMP(GAM_MIXER_MAIN_AVO); + MIXER_DBG_DUMP(GAM_MIXER_MAIN_AVS); + MIXER_DBG_DUMP(GAM_MIXER_MAIN_CRB); + sti_mixer_dbg_crb(m, + sti_mixer_reg_read(mixer, + GAM_MIXER_MAIN_CRB)); + MIXER_DBG_DUMP(GAM_MIXER_MAIN_ACT); + MIXER_DBG_DUMP(GAM_MIXER_MAIN_MBP); + MIXER_DBG_DUMP(GAM_MIXER_MAIN_MX0); + sti_mixer_dbg_mxn(m, mixer->regs + GAM_MIXER_MAIN_MX0); + seq_puts(m, "\n"); + + crtc = &mixer->drm_crtc; + if (!crtc) { + seq_puts(m, " Not connected to any DRM CRTC\n"); + continue; + } + seq_printf(m, " Connected to DRM CRTC #%d which is:\n", + crtc->base.id); + seq_puts(m, crtc->enabled ? "\tEnabled\n" : "\tDisabled\n"); + seq_printf(m, "\tMode: %s %dHz\n", + crtc->mode.name, crtc->mode.vrefresh); + seq_printf(m, "\tat %d,%d\n", crtc->x, crtc->y); + + fb = crtc->fb; + if (!fb) { + seq_puts(m, "\tNot connected to any DRM FB\n"); + continue; + } + seq_printf(m, "\tConnected to DRM FB #%d, %dx%d, %.4s\n", + fb->base.id, + fb->width, fb->height, (char *)&fb->pixel_format); + } +out: + mutex_unlock(&dev->struct_mutex); + return 0; +} diff --git a/drivers/gpu/drm/sti/sti_mixer.h b/drivers/gpu/drm/sti/sti_mixer.h index a05e21f..abdd1ad 100644 --- a/drivers/gpu/drm/sti/sti_mixer.h +++ b/drivers/gpu/drm/sti/sti_mixer.h @@ -43,6 +43,8 @@ int sti_mixer_active_video_area(struct sti_mixer *mixer, void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable); +int sti_mixer_dbg_show(struct seq_file *m, void *arg); + /* depth in Cross-bar control = z order */ #define GAM_MIXER_NB_DEPTH_LEVEL 7