From patchwork Tue Jun 5 13:54:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 137745 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp990333lji; Tue, 5 Jun 2018 06:54:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIaoZwTncsDu8FmAhoGwAl/NCvE5ErSPEuKfZcAWCHbbMoG7YExJuO8wDepC+xBndF37xoE X-Received: by 2002:a62:1656:: with SMTP id 83-v6mr25649311pfw.61.1528206877174; Tue, 05 Jun 2018 06:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528206877; cv=none; d=google.com; s=arc-20160816; b=RBFHFiw07IHfClSYqQ0n4uUVfJBm7mUCpbUx9EiVg3pdPIROcDvr8tpuB9qd0IQe2g blecDWIF8krq5eb9fgBgeg80KU+JSdYv6MPaaz/jv+TsaD6O9JeqB5m7+Ed0cNJo3g1m TberJ8HQEHIb7aaF2FYtXhZXQsSONJQHJ6YksvCH52XOjG4+WUYZi86LbhoRO224/IoZ 0t94xeNra7XkJb7VvMr+7SFIoZrbM4EPoUg5cNDgd0kJ68bYDP9ONoPC8eChtcc4Gzgb 8nuFXbsF8osbLqNHPUY+mcEd9wyG8DEGD2IjmHayck3SJO0tG+h9V1fPxUfyeCFONwtf 1lJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=eUQ8RLKsiMMjVHSlKefqkVPnWfwwJ/Gy6Gy/q9hN/4A=; b=LnjEvvxdgtMJVdaSWt0sh3vqLJjzXgKDhUOpDZrCQP0j9nzGfsyU/0z7c17i50rcS/ W+4wpq9/2ldt3S7mAIcYrlk4hF2sdCM5QO5kCubR8Xyia3Log43hvmSj8w0vjILx+ufJ Aedtyodg2AqQrjgry9xT7KWSxUg9m0zO40MwgmCTJ93Yu9apIJCsk7fnj/vWcA653jxc Xll9KRA1GScRaEC4sGQAKDdgxEpiLWUKgQE9bNaYAmjMoG0dc1d3NV5KjjM+OQ30tFMN QvEAZl8n0FbwRgKg87+fsT3dAKuMBdRr2lesI3sMsEiAe2OrFUsucVY2upi9gbOU8pu5 N11g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pzz9PG7v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6-v6si24914145plm.448.2018.06.05.06.54.36; Tue, 05 Jun 2018 06:54:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pzz9PG7v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752138AbeFENye (ORCPT + 30 others); Tue, 5 Jun 2018 09:54:34 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:40782 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751889AbeFENyZ (ORCPT ); Tue, 5 Jun 2018 09:54:25 -0400 Received: by mail-wm0-f49.google.com with SMTP id n5-v6so5272448wmc.5 for ; Tue, 05 Jun 2018 06:54:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eUQ8RLKsiMMjVHSlKefqkVPnWfwwJ/Gy6Gy/q9hN/4A=; b=Pzz9PG7vjbp+gP48S4AKmL7BTQJN7qbq5LHgaDAV8OLs8HnIMzn3MkyZy9VNaxl4Jm P5nBqtfw3nBp+ONRqmbYN0Eik4JOLSVnc74X7Qzu1WxkQB+DcbeNUOEQNELzdGbdPtIb pouhnaD7pvoevUrAj6Nxuput8ery9NGfVkS0o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eUQ8RLKsiMMjVHSlKefqkVPnWfwwJ/Gy6Gy/q9hN/4A=; b=BKOef8CPhteEpV1gskNew3O392mtMkf7qnQ5sxKRSaJV3JEcy7A/0cV6Bd8i8hKe5R 66e69sF5bUSHn0Anh2gdf9wp1Q2SeY/PPv6wLSj/J/ScJMgRt1OAEqO+zKNsZlsMWqkr 0Y0Qjfhc3AdefiLHVPK1PT0KOFDiUTtNY2db1bule8ukc+aZTdak/tKkEXRKnJaOyOkO pWh1OppFJAfmmfzbwj42nfaEMJ7ufxO+TPpbNFzOVWawVMv3YkKdOQcIE1Q7/SVtw4cy WFeSeYlEbJfUqoeJsi1gEfbjw716/7w5ONqqwNFUZRuSRhTUB0z+I6iEOBGHUDFysixC 70xg== X-Gm-Message-State: APt69E1DqvjwQGgi2glmOjBgPRK1TvBnPCL2A2rh6+2263ZEnL2Mm3uP ksQYGeRLpMfw362hxfUkou5HsGtWBLo= X-Received: by 2002:a1c:6954:: with SMTP id e81-v6mr1133980wmc.124.1528206864095; Tue, 05 Jun 2018 06:54:24 -0700 (PDT) Received: from lmecxl0911.lme.st.com (bol62-h02-176-179-166-238.dsl.sta.abo.bbox.fr. [176.179.166.238]) by smtp.gmail.com with ESMTPSA id o53-v6sm76797785wrc.96.2018.06.05.06.54.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Jun 2018 06:54:23 -0700 (PDT) From: Benjamin Gaignard To: gustavo@padovan.org, maarten.lankhorst@linux.intel.com, seanpaul@chromium.org, airlied@linux.ie, vincent.abriou@st.com Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Benjamin Gaignard Subject: [PATCH v1 2/7] drm: add hook to print encoder status Date: Tue, 5 Jun 2018 15:54:02 +0200 Message-Id: <20180605135407.20214-3-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20180605135407.20214-1-benjamin.gaignard@linaro.org> References: <20180605135407.20214-1-benjamin.gaignard@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Even if encoders don't have state it could be useful to get information from them when dumping of the other elements state. Add an optional hook in drm_encoder_funcs structure and call it after crtc print state. Signed-off-by: Benjamin Gaignard --- drivers/gpu/drm/drm_atomic.c | 15 +++++++++++++++ include/drm/drm_encoder.h | 12 ++++++++++++ 2 files changed, 27 insertions(+) -- 2.15.0 diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index cd1d677617c8..6a9f5be01172 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -1799,6 +1800,15 @@ int drm_atomic_nonblocking_commit(struct drm_atomic_state *state) } EXPORT_SYMBOL(drm_atomic_nonblocking_commit); +static void drm_atomic_encoder_print(struct drm_printer *p, + struct drm_encoder *encoder) +{ + drm_printf(p, "encoder[%u]: %s\n", encoder->base.id, encoder->name); + + if (encoder->funcs->atomic_print) + encoder->funcs->atomic_print(p, encoder); +} + static void drm_atomic_print_state(const struct drm_atomic_state *state) { struct drm_printer p = drm_info_printer(state->dev->dev); @@ -1828,6 +1838,7 @@ static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p, struct drm_mode_config *config = &dev->mode_config; struct drm_plane *plane; struct drm_crtc *crtc; + struct drm_encoder *encoder; struct drm_connector *connector; struct drm_connector_list_iter conn_iter; @@ -1850,6 +1861,10 @@ static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p, drm_modeset_unlock(&crtc->mutex); } + drm_for_each_encoder(encoder, dev) { + drm_atomic_encoder_print(p, encoder); + } + drm_connector_list_iter_begin(dev, &conn_iter); if (take_locks) drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h index fb299696c7c4..b847dad817b0 100644 --- a/include/drm/drm_encoder.h +++ b/include/drm/drm_encoder.h @@ -80,6 +80,18 @@ struct drm_encoder_funcs { * before data structures are torndown. */ void (*early_unregister)(struct drm_encoder *encoder); + + /** + * @atomic_print + * + * If driver could implement this optional hook for printing + * additional driver specific information. + * + * Do not call this directly, use drm_atomic_encoder_print() + * instead. + */ + void (*atomic_print)(struct drm_printer *p, + struct drm_encoder *encoder); }; /**