dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: Add timestamp of last modification to GETCONNECTOR ioctl
Date: Fri, 21 Oct 2016 20:17:41 +0300	[thread overview]
Message-ID: <20161021171740.GY4329@intel.com> (raw)
In-Reply-To: <20161021134212.28311-1-chris@chris-wilson.co.uk>

On Fri, Oct 21, 2016 at 02:42:12PM +0100, Chris Wilson wrote:
> After hotplug notification, userspace has to reprobe all connectors to
> detect any changes. This can be expensive (some outputs may require time
> consuming load detection, some outputs may simply be slow to respond)
> and not all outputs need to be checked everytime. The kernel is usually
> in a very good position to know which outputs need to be reprobed (since
> it has just responded to the hardware notification) and can convey this
> information to userspace by tracking the timestamp of the last connector
> change onto the GETCONNECTOR query.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> Adding an epoch/timestamp field would look something like this. There are
> probably a few more places where the hardware indicates a real change
> (more than just status).
> 
> That update_timestamp() should probably be
> 	atomic64_set(&timestamp, ktime_get_ns());
> ---
>  drivers/gpu/drm/drm_connector.c             |  4 +++-
>  drivers/gpu/drm/drm_crtc.c                  |  4 +++-
>  drivers/gpu/drm/drm_probe_helper.c          |  6 +++++-
>  drivers/gpu/drm/gma500/mdfld_dsi_dpi.c      |  1 +
>  drivers/gpu/drm/gma500/mdfld_dsi_output.c   |  1 +
>  drivers/gpu/drm/i915/intel_dp.c             |  4 ++++
>  drivers/gpu/drm/i915/intel_dp_mst.c         |  2 ++
>  drivers/gpu/drm/i915/intel_hotplug.c        |  5 ++++-
>  drivers/gpu/drm/i915/intel_lvds.c           |  1 +
>  drivers/gpu/drm/nouveau/nouveau_connector.c |  1 +
>  drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c         |  1 +
>  drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c        |  1 +
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c        |  1 +
>  include/drm/drm_connector.h                 |  8 ++++++++
>  include/uapi/drm/drm.h                      |  2 +-
>  include/uapi/drm/drm_mode.h                 | 26 ++++++++++++++++++++++++++
>  16 files changed, 63 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 2db7fb510b6c..cd3d85e94b91 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -227,6 +227,7 @@ int drm_connector_init(struct drm_device *dev,
>  	INIT_LIST_HEAD(&connector->modes);
>  	connector->edid_blob_ptr = NULL;
>  	connector->status = connector_status_unknown;
> +	drm_connector_update_timestamp(connector);
>  
>  	drm_connector_get_cmdline_mode(connector);
>  
> @@ -1010,7 +1011,7 @@ static bool drm_mode_expose_to_userspace(const struct drm_display_mode *mode,
>  int drm_mode_getconnector(struct drm_device *dev, void *data,
>  			  struct drm_file *file_priv)
>  {
> -	struct drm_mode_get_connector *out_resp = data;
> +	struct drm_mode_get_connector_v2 *out_resp = data;
>  	struct drm_connector *connector;
>  	struct drm_encoder *encoder;
>  	struct drm_display_mode *mode;
> @@ -1058,6 +1059,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
>  	out_resp->mm_height = connector->display_info.height_mm;
>  	out_resp->subpixel = connector->display_info.subpixel_order;
>  	out_resp->connection = connector->status;
> +	out_resp->timestamp = ktime_to_ns(connector->timestamp);

Is there benefit to making it a timestamp as opposed to just an
incrementing counter?

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      parent reply	other threads:[~2016-10-21 17:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21  8:25 [PATCH] drm: Pass along the hotplug connector to the uevent Chris Wilson
2016-10-21  9:14 ` [PATCH v2] " Chris Wilson
2016-10-21  9:27   ` Jani Nikula
2016-10-21  9:46   ` Ville Syrjälä
2016-10-21 10:05     ` Chris Wilson
2016-10-21 12:45   ` [Intel-gfx] " Daniel Vetter
2016-10-21 13:17     ` Chris Wilson
2016-10-21 13:42       ` [PATCH] drm: Add timestamp of last modification to GETCONNECTOR ioctl Chris Wilson
2016-10-21 16:55         ` Daniel Vetter
2016-10-21 17:17         ` 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=20161021171740.GY4329@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    /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