All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	"Ben Skeggs" <bskeggs@redhat.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH] drm: Move ->get_scanout_position() to struct drm_crtc_funcs
Date: Tue, 16 Dec 2014 20:25:32 +0200	[thread overview]
Message-ID: <20141216182532.GK10649@intel.com> (raw)
In-Reply-To: <1418749214-17433-1-git-send-email-thierry.reding@gmail.com>

On Tue, Dec 16, 2014 at 06:00:14PM +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> None of the drivers use this in legacy mode, so it can be converted to
> use struct drm_crtc * directly. While at it, also make the sole user of
> the callback, drm_calc_vbltimestamp_from_scanoutpos(), pass through the
> CRTC directly.
> 
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> Note: This is compile-tested only. It is a straightforward conversion so
> I wouldn't expect any fallout, but it'd certainly be best if this can be
> tested on all three drivers.
> 
>  drivers/gpu/drm/drm_irq.c                 | 34 +++++++++-------------
>  drivers/gpu/drm/i915/i915_irq.c           | 15 +++++-----
>  drivers/gpu/drm/i915/intel_display.c      |  1 +
>  drivers/gpu/drm/i915/intel_drv.h          |  3 ++
>  drivers/gpu/drm/nouveau/dispnv04/crtc.c   |  1 +
>  drivers/gpu/drm/nouveau/nouveau_display.c | 25 ++++------------
>  drivers/gpu/drm/nouveau/nouveau_display.h |  4 +--
>  drivers/gpu/drm/nouveau/nouveau_drm.c     |  1 -
>  drivers/gpu/drm/nouveau/nv50_display.c    |  1 +
>  drivers/gpu/drm/radeon/radeon_display.c   | 39 ++++++++++++-------------
>  drivers/gpu/drm/radeon/radeon_drv.c       |  1 -
>  drivers/gpu/drm/radeon/radeon_kms.c       |  2 +-
>  drivers/gpu/drm/radeon/radeon_mode.h      |  2 +-
>  drivers/gpu/drm/radeon/radeon_pm.c        |  4 ++-
>  include/drm/drmP.h                        | 47 -------------------------------
>  include/drm/drm_crtc.h                    | 45 +++++++++++++++++++++++++++++
>  16 files changed, 104 insertions(+), 121 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 37b536c57cd2..18f1ccad7ee0 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -161,14 +161,14 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
>   * DRM_VBLANKTIME_INVBL - Timestamp taken while scanout was in vblank interval.
>   *
>   */
> -int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
> -					  unsigned int pipe,
> +int drm_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
>  					  int *max_error,
>  					  struct timeval *vblank_time,
>  					  unsigned flags,
>  					  const struct drm_crtc *refcrtc,
>  					  const struct drm_display_mode *mode)
>  {
> +	const struct drm_crtc_funcs *funcs = crtc->funcs;
>  	struct timeval tv_etime;
>  	ktime_t stime, etime;
>  	int vbl_status;
> @@ -176,16 +176,9 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  	int framedur_ns, linedur_ns, pixeldur_ns, delta_ns, duration_ns;
>  	bool invbl;
>  
> -	if (pipe >= dev->num_crtcs) {
> -		DRM_ERROR("Invalid crtc %u\n", pipe);
> -		return -EINVAL;
> -	}
> -
>  	/* Scanout position query not supported? Should not happen. */
> -	if (!dev->driver->get_scanout_position) {
> -		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
> -		return -EIO;
> -	}
> +	if (WARN_ON(funcs->get_scanout_position == NULL))
> +		return -ENOSYS;
>  
>  	/* Durations of frames, lines, pixels in nanoseconds. */
>  	framedur_ns = refcrtc->framedur_ns;
> @@ -196,7 +189,8 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  	 * Happens during initial modesetting of a crtc.
>  	 */
>  	if (framedur_ns == 0) {
> -		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
> +		DRM_DEBUG("crtc %x: Noop due to uninitialized mode.\n",
> +			  crtc->base.id);

I don't think we want the obj ID in hex.

And I must say I hate looking at obj IDs. You basically need to build
some kind of obj ID to hw crtc cross reference every time you try to
read a log. So keeping to drm_crtc_index() would better IMO. Or maybe
even add crtc->name so each driver could provide its own name for the
thing, but that would be a slightly bigger task.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2014-12-16 18:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 17:00 [PATCH] drm: Move ->get_scanout_position() to struct drm_crtc_funcs Thierry Reding
2014-12-16 18:25 ` Ville Syrjälä [this message]

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=20141216182532.GK10649@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=alexander.deucher@amd.com \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=thierry.reding@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.