mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: gustavo@padovan.org, maarten.lankhorst@linux.intel.com,
	seanpaul@chromium.org, airlied@linux.ie, vincent.abriou@st.com,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v1 2/7] drm: add hook to print encoder status
Date: Tue, 3 Jul 2018 11:28:38 +0200	[thread overview]
Message-ID: <20180703092838.GM7880@phenom.ffwll.local> (raw)
In-Reply-To: <20180605135407.20214-3-benjamin.gaignard@linaro.org>

On Tue, Jun 05, 2018 at 03:54:02PM +0200, Benjamin Gaignard wrote:
> 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 <benjamin.gaignard@linaro.org>
> ---
>  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 <drm/drmP.h>
>  #include <drm/drm_atomic.h>
> +#include <drm/drm_encoder.h>
>  #include <drm/drm_mode.h>
>  #include <drm/drm_print.h>
>  #include <linux/sync_file.h>
> @@ -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);
> +	}

This doesn't make sense to me at all. There's no encoder state, what
exactly do you want to print here?

Note that if you just want to dump hw state from your atomic state
functions (which might be useful sometimes, who knows) you can also dump
encoders by looking at connector_state->best_encoder.

Of have your own sti_dump_state which also adds this loop here.

Ack on the first patch from me.
-Daniel

> +
>  	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);
>  };
>  
>  /**
> -- 
> 2.15.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  parent reply	other threads:[~2018-07-03  9:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 13:54 [PATCH v1 0/7] Remove debugfs from sti display driver Benjamin Gaignard
2018-06-05 13:54 ` [PATCH v1 1/7] drm: print plane state normalized zpos value Benjamin Gaignard
2018-06-15 14:50   ` Philippe CORNU
2018-07-06  8:24   ` Benjamin Gaignard
2018-06-05 13:54 ` [PATCH v1 2/7] drm: add hook to print encoder status Benjamin Gaignard
2018-06-18 15:58   ` Philippe CORNU
2018-07-03  9:28   ` Daniel Vetter [this message]
2018-06-05 13:54 ` [PATCH v1 3/7] drm: sti: make planes use atomic_print_state instead of debugfs Benjamin Gaignard
2018-06-18 16:05   ` Philippe CORNU
2018-06-05 13:54 ` [PATCH v1 4/7] drm: sti: make connectors " Benjamin Gaignard
2018-06-18 16:07   ` Philippe CORNU
2018-06-05 13:54 ` [PATCH v1 5/7] drm: sti: make crtc " Benjamin Gaignard
2018-06-18 16:10   ` Philippe CORNU
2018-06-05 13:54 ` [PATCH v1 6/7] drm: sti: make encoders " Benjamin Gaignard
2018-06-18 16:11   ` Philippe CORNU
2018-06-05 13:54 ` [PATCH v1 7/7] drm: sti: remove the last call to debugfs Benjamin Gaignard
2018-06-18 16:12   ` Philippe CORNU
2018-06-29 13:25 ` [PATCH v1 0/7] Remove debugfs from sti display driver Benjamin Gaignard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180703092838.GM7880@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=benjamin.gaignard@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=seanpaul@chromium.org \
    --cc=vincent.abriou@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®