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: 10448353 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 060F2600CA for ; Tue, 5 Jun 2018 13:54:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA02E294C8 for ; Tue, 5 Jun 2018 13:54:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDFAC294ED; Tue, 5 Jun 2018 13:54:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8ACF8294C8 for ; Tue, 5 Jun 2018 13:54:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E0A46EDC6; Tue, 5 Jun 2018 13:54:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) by gabe.freedesktop.org (Postfix) with ESMTPS id 74B176EDC6 for ; Tue, 5 Jun 2018 13:54:25 +0000 (UTC) Received: by mail-wm0-x229.google.com with SMTP id o13-v6so5108681wmf.4 for ; Tue, 05 Jun 2018 06:54:25 -0700 (PDT) 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=cuy8Cb/7YwQAnx3VYwToyb31JiWeL9KWGL8rq3v6zGOUMuw/fwbJk2kIv9oYvWF1wH 5PmdRNQxnBGCrWwDVgh1W2ZmYSQ/9xJW2Cp7blYq2rV/1FTQFGV7W91yBuy1T/bc/IQA TmSmpK8IODZQYJ0fMBe1EZy2lN+xsu3V+Mq492h1qF/6dIf50/eXQq7PDK4VEVwGK14c v4LRmJPJFIsGWLizp5C2RJRzZ6sj8BtVqi3pJpJONRfK5op64wMFLkTuOoguEwruBmxI ++VqNW8V1YXkCL8UZ2LMCbcGjMzgWHkjkljGS+NCT6T1NZ9asV0ivDOoxRjTHjmE7Bvi gPow== X-Gm-Message-State: APt69E3WFowx5ZcSpA/iscFFo87PozWha+X3Y5OP5SX+P5qSTMtp6geG SGRky2a/32KgHiQ5fcXlwbs2Pg== X-Google-Smtp-Source: ADUXVKLT6EU+sesEqEbvFTkyNtPVtUgUkFy8GQz2+tUjhq7ygjBdQ/w+TSwkYBq/jPzxK7jWXVEkdg== 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 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> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Philippe Cornu --- drivers/gpu/drm/drm_atomic.c | 15 +++++++++++++++ include/drm/drm_encoder.h | 12 ++++++++++++ 2 files changed, 27 insertions(+) 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); }; /**