From patchwork Tue Apr 8 12:19: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: 27970 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 555B12066E for ; Tue, 8 Apr 2014 12:20:56 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id wp18sf3689329obc.8 for ; Tue, 08 Apr 2014 05:20:55 -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=5iONaFKK4F4H2QOLh8EtoidmoutdE5z1IfOB/QyydZs=; b=NjjzuQxAGk8L+8bo3sqSdLw9tVe20/PutUU0flgNckVFMwCJzQ4ON1MvG54/zq2cnO c5LG45NH1LuJMWmOFrD53Ee+snau7XPKLaMnFMkaqJgxsMERw/xOv9U+cJzdb0kkwkfQ wIYBmsT2vqtMLE+XVijQQHYWowfkUlw2C29fU0TuwTvexYr/VzYGiqzlNW+KMj7IxlcX XKWEfKt1fLZdj/heR8olQoHlWKu5d3SbK8bw5WZbQhrsGuvi/Dr8Jaq9rX1BXaulmBm2 aRU5UQVReoxlBPLrrbF4zKA9bFpkCGTcaScayBvtcVeZzJveRsbS7lbfq6aloZPvb+39 VwPQ== X-Gm-Message-State: ALoCoQnzLJ3vQHkZP53gIul5+1eem+F3ASx8/VvTp/qGRJ98lAcdoont1YL/GItHXYqmWLwtnq51 X-Received: by 10.43.88.73 with SMTP id az9mr1412137icc.5.1396959655929; Tue, 08 Apr 2014 05:20:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.230 with SMTP id m93ls179360qge.87.gmail; Tue, 08 Apr 2014 05:20:55 -0700 (PDT) X-Received: by 10.221.34.7 with SMTP id sq7mr2985228vcb.5.1396959655789; Tue, 08 Apr 2014 05:20:55 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id sc7si356190vdc.121.2014.04.08.05.20.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Apr 2014 05:20:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id lc6so651734vcb.7 for ; Tue, 08 Apr 2014 05:20:55 -0700 (PDT) X-Received: by 10.52.119.197 with SMTP id kw5mr2494079vdb.5.1396959655618; Tue, 08 Apr 2014 05:20:55 -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.12.8 with SMTP id v8csp240732vcv; Tue, 8 Apr 2014 05:20:55 -0700 (PDT) X-Received: by 10.67.14.231 with SMTP id fj7mr4043864pad.115.1396959654749; Tue, 08 Apr 2014 05:20:54 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id oq10si1000604pbb.60.2014.04.08.05.20.53 for ; Tue, 08 Apr 2014 05:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5548A6E9F8; Tue, 8 Apr 2014 05:20:52 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-we0-f170.google.com (mail-we0-f170.google.com [74.125.82.170]) by gabe.freedesktop.org (Postfix) with ESMTP id F3A276E9F8 for ; Tue, 8 Apr 2014 05:20:48 -0700 (PDT) Received: by mail-we0-f170.google.com with SMTP id w61so864287wes.15 for ; Tue, 08 Apr 2014 05:20:48 -0700 (PDT) X-Received: by 10.180.89.102 with SMTP id bn6mr31565161wib.28.1396959648242; Tue, 08 Apr 2014 05:20:48 -0700 (PDT) Received: from lmenx321.lme.st.com (LPuteaux-656-01-48-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id v6sm2683904wif.0.2014.04.08.05.20.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Apr 2014 05:20:47 -0700 (PDT) From: Benjamin Gaignard To: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH v1 16/19] drm: sti: add debug to mixer Date: Tue, 8 Apr 2014 14:19:23 +0200 Message-Id: <1396959566-2960-17-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1396959566-2960-1-git-send-email-benjamin.gaignard@linaro.org> References: <1396959566-2960-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=neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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