Re: [PATCH] drm: Add timestamp of last modification to GETCONNECTOR ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux