Re: [Intel-gfx] [PATCH 4/6] drm/i915: Idleness detection for DRRS

2014-04-01 Thread Jani Nikula
On Fri, 28 Mar 2014, Vandana Kannan vandana.kan...@intel.com wrote:
 Adding support to detect display idleness by tracking page flip from
 user space. Switch to low refresh rate is triggered after 2 seconds of
 idleness. The delay is configurable. If there is a page flip or call to
 update the plane, then high refresh rate is applied.
 The feature is not used in dual-display mode.

 v2: Chris Wilson's review comments incorporated.
 Modify idleness detection implementation to make it similar to the
 implementation of intel_update_fbc/intel_disable_fbc

 v3: Internal review comments incorporated
 Add NULL pointer check in intel_disable_drrs.
 Add drrs calls in i9xx_crtc_enable/disable and valleyview_crtc_enable.

 v4: Jani's review comments incorporated.
 Change in sequence in intel_update_drrs. Comment modified to remove details
 of update param. Modified DRRS idleness interval to a module parameter.

 v5: Chris's review comments incorporated.
 Initialize connector in idleness detection init. Modifications made to
 use only intel_connector in i915_drrs and derive intel_dp when required.
 Added a function drrs_fini to cleanup DRRS work.

 v6: Internal review comments. Removed check for primary enabled, which is
 a redundant check, in the case of clone mode. Added a flag to track
 dual-display configuration. Remove print statement for cancel DRR work
 and print DRRS not supported only once.

 v7: As per internal review comments, removing calls to update/disable drrs
 from sprite update path. For sprite, all drrs related updates would be
 taken care of with calls to crtc page flip itself. This will have to be
 revisited later if flip infrastructure changes for sprite.

 v8: Incorporated Jani's review comments. Added space after the periods in the
 module param description. Changes around drrs-fini to remove seamless DRRS
 check.

 Signed-off-by: Vandana Kannan vandana.kan...@intel.com
 Signed-off-by: Pradeep Bhat pradeep.b...@intel.com
 Cc: Jani Nikula jani.nik...@linux.intel.com
 ---
  drivers/gpu/drm/i915/i915_drv.h  |7 ++
  drivers/gpu/drm/i915/i915_params.c   |8 ++
  drivers/gpu/drm/i915/intel_display.c |   16 
  drivers/gpu/drm/i915/intel_dp.c  |   22 +-
  drivers/gpu/drm/i915/intel_drv.h |5 +-
  drivers/gpu/drm/i915/intel_pm.c  |  138 
 ++
  6 files changed, 193 insertions(+), 3 deletions(-)

 diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
 index 1c9d5cf..c4e9b37 100644
 --- a/drivers/gpu/drm/i915/i915_drv.h
 +++ b/drivers/gpu/drm/i915/i915_drv.h
 @@ -796,6 +796,12 @@ struct i915_fbc {
  
  struct i915_drrs {
   struct intel_connector *connector;
 + bool is_clone;
 + struct intel_drrs_work {
 + struct delayed_work work;
 + struct drm_crtc *crtc;
 + int interval;
 + } *drrs_work;
  };
  
  struct i915_psr {
 @@ -2092,6 +2098,7 @@ struct i915_params {
   int enable_ips;
   int invert_brightness;
   int enable_cmd_parser;
 + int drrs_interval;
   /* leave bools at the end to not create holes */
   bool enable_hangcheck;
   bool fastboot;
 diff --git a/drivers/gpu/drm/i915/i915_params.c 
 b/drivers/gpu/drm/i915/i915_params.c
 index d1d7980..05ca0a0 100644
 --- a/drivers/gpu/drm/i915/i915_params.c
 +++ b/drivers/gpu/drm/i915/i915_params.c
 @@ -47,6 +47,7 @@ struct i915_params i915 __read_mostly = {
   .invert_brightness = 0,
   .disable_display = 0,
   .enable_cmd_parser = 0,
 + .drrs_interval = 2000,
  };
  
  module_param_named(modeset, i915.modeset, int, 0400);
 @@ -152,3 +153,10 @@ MODULE_PARM_DESC(disable_display, Disable display 
 (default: false));
  module_param_named(enable_cmd_parser, i915.enable_cmd_parser, int, 0600);
  MODULE_PARM_DESC(enable_cmd_parser,
Enable command parsing (1=enabled, 0=disabled [default]));
 +
 +module_param_named(drrs_interval, i915.drrs_interval, int, 0600);
 +MODULE_PARM_DESC(drrs_interval,
 + DRRS idleness detection interval  (default: 2000 ms). 
 + If this field is set to 0, then seamless DRRS feature 
 + based on idleness detection is disabled. 
 + The interval is to be set in milliseconds.);
 diff --git a/drivers/gpu/drm/i915/intel_display.c 
 b/drivers/gpu/drm/i915/intel_display.c
 index 7e4ea8d..c309561 100644
 --- a/drivers/gpu/drm/i915/intel_display.c
 +++ b/drivers/gpu/drm/i915/intel_display.c
 @@ -2542,6 +2542,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
  
   mutex_lock(dev-struct_mutex);
   intel_update_fbc(dev);
 + intel_update_drrs(dev);
   intel_edp_psr_update(dev);
   mutex_unlock(dev-struct_mutex);
  
 @@ -3708,6 +3709,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
  
   mutex_lock(dev-struct_mutex);
   intel_update_fbc(dev);
 + intel_update_drrs(dev);
   mutex_unlock(dev-struct_mutex);
  
   for_each_encoder_on_crtc(dev, crtc, encoder)
 @@ -3751,6 +3753,7 @@ 

Re: [Intel-gfx] [PATCH 4/6] drm/i915: Idleness detection for DRRS

2014-03-27 Thread Vandana Kannan
On Mar-26-2014 6:35 PM, Jani Nikula wrote:
 On Fri, 07 Mar 2014, Vandana Kannan vandana.kan...@intel.com wrote:
 Adding support to detect display idleness by tracking page flip from
 user space. Switch to low refresh rate is triggered after 2 seconds of
 idleness. The delay is configurable. If there is a page flip or call to
 update the plane, then high refresh rate is applied.
 The feature is not used in dual-display mode.

 v2: Chris Wilson's review comments incorporated.
 Modify idleness detection implementation to make it similar to the
 implementation of intel_update_fbc/intel_disable_fbc

 v3: Internal review comments incorporated
 Add NULL pointer check in intel_disable_drrs.
 Add drrs calls in i9xx_crtc_enable/disable and valleyview_crtc_enable.

 v4: Jani's review comments incorporated.
 Change in sequence in intel_update_drrs. Comment modified to remove details
 of update param. Modified DRRS idleness interval to a module parameter.

 v5: Chris's review comments incorporated.
 Initialize connector in idleness detection init. Modifications made to
 use only intel_connector in i915_drrs and derive intel_dp when required.
 Added a function drrs_fini to cleanup DRRS work.

 v6: Internal review comments. Removed check for primary enabled, which is
 a redundant check, in the case of clone mode. Added a flag to track
 dual-display configuration. Remove print statement for cancel DRR work
 and print DRRS not supported only once.

 v7: As per internal review comments, removing calls to update/disable drrs
 from sprite update path. For sprite, all drrs related updates would be
 taken care of with calls to crtc page flip itself. This will have to be
 revisited later if flip infrastructure changes for sprite.

 Signed-off-by: Vandana Kannan vandana.kan...@intel.com
 Signed-off-by: Pradeep Bhat pradeep.b...@intel.com
 ---
  drivers/gpu/drm/i915/i915_drv.h  |7 ++
  drivers/gpu/drm/i915/i915_params.c   |8 ++
  drivers/gpu/drm/i915/intel_display.c |   16 
  drivers/gpu/drm/i915/intel_dp.c  |   26 ++-
  drivers/gpu/drm/i915/intel_drv.h |5 +-
  drivers/gpu/drm/i915/intel_pm.c  |  138 
 ++
  6 files changed, 197 insertions(+), 3 deletions(-)

 diff --git a/drivers/gpu/drm/i915/i915_drv.h 
 b/drivers/gpu/drm/i915/i915_drv.h
 index 43d3dfe..87865e9 100644
 --- a/drivers/gpu/drm/i915/i915_drv.h
 +++ b/drivers/gpu/drm/i915/i915_drv.h
 @@ -776,6 +776,12 @@ struct i915_fbc {
  
  struct i915_drrs {
  struct intel_connector *connector;
 +bool is_clone;
 +struct intel_drrs_work {
 +struct delayed_work work;
 +struct drm_crtc *crtc;
 +int interval;
 +} *drrs_work;
  };
  
  struct i915_psr {
 @@ -1975,6 +1981,7 @@ struct i915_params {
  bool prefault_disable;
  bool reset;
  int invert_brightness;
 +int drrs_interval;
  };
  extern struct i915_params i915 __read_mostly;
  
 diff --git a/drivers/gpu/drm/i915/i915_params.c 
 b/drivers/gpu/drm/i915/i915_params.c
 index c743057..69f8b83 100644
 --- a/drivers/gpu/drm/i915/i915_params.c
 +++ b/drivers/gpu/drm/i915/i915_params.c
 @@ -47,6 +47,7 @@ struct i915_params i915 __read_mostly = {
  .prefault_disable = 0,
  .reset = true,
  .invert_brightness = 0,
 +.drrs_interval = 2000,
  };
  
  module_param_named(modeset, i915.modeset, int, 0400);
 @@ -153,3 +154,10 @@ MODULE_PARM_DESC(invert_brightness,
  report PCI device ID, subsystem vendor and subsystem device ID 
  to dri-de...@lists.freedesktop.org, if your machine needs it. 
  It will then be included in an upcoming module version.);
 +
 +module_param_named(drrs_interval, i915.drrs_interval, int, 0600);
 +MODULE_PARM_DESC(drrs_interval,
 +DRRS idleness detection interval  (default: 2000 ms).
 +If this field is set to 0, then seamless DRRS feature 
 +based on idleness detection is disabled.
 +The interval is to be set in milliseconds.);
 
 When the strings are concatenated there won't be a space after the
 periods.
 
Ok.. Will make appropriate changes..
 diff --git a/drivers/gpu/drm/i915/intel_display.c 
 b/drivers/gpu/drm/i915/intel_display.c
 index 4d4a0d9..86cd603 100644
 --- a/drivers/gpu/drm/i915/intel_display.c
 +++ b/drivers/gpu/drm/i915/intel_display.c
 @@ -2410,6 +2410,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int 
 y,
  }
  
  intel_update_fbc(dev);
 +intel_update_drrs(dev);
  intel_edp_psr_update(dev);
  mutex_unlock(dev-struct_mutex);
  
 @@ -3598,6 +3599,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
  
  mutex_lock(dev-struct_mutex);
  intel_update_fbc(dev);
 +intel_update_drrs(dev);
  mutex_unlock(dev-struct_mutex);
  
  for_each_encoder_on_crtc(dev, crtc, encoder)
 @@ -3639,6 +3641,7 @@ static void haswell_crtc_enable_planes(struct drm_crtc 
 *crtc)
  
  mutex_lock(dev-struct_mutex);
  intel_update_fbc(dev);
 +intel_update_drrs(dev);
  

Re: [Intel-gfx] [PATCH 4/6] drm/i915: Idleness detection for DRRS

2014-03-26 Thread Jani Nikula
On Fri, 07 Mar 2014, Vandana Kannan vandana.kan...@intel.com wrote:
 Adding support to detect display idleness by tracking page flip from
 user space. Switch to low refresh rate is triggered after 2 seconds of
 idleness. The delay is configurable. If there is a page flip or call to
 update the plane, then high refresh rate is applied.
 The feature is not used in dual-display mode.

 v2: Chris Wilson's review comments incorporated.
 Modify idleness detection implementation to make it similar to the
 implementation of intel_update_fbc/intel_disable_fbc

 v3: Internal review comments incorporated
 Add NULL pointer check in intel_disable_drrs.
 Add drrs calls in i9xx_crtc_enable/disable and valleyview_crtc_enable.

 v4: Jani's review comments incorporated.
 Change in sequence in intel_update_drrs. Comment modified to remove details
 of update param. Modified DRRS idleness interval to a module parameter.

 v5: Chris's review comments incorporated.
 Initialize connector in idleness detection init. Modifications made to
 use only intel_connector in i915_drrs and derive intel_dp when required.
 Added a function drrs_fini to cleanup DRRS work.

 v6: Internal review comments. Removed check for primary enabled, which is
 a redundant check, in the case of clone mode. Added a flag to track
 dual-display configuration. Remove print statement for cancel DRR work
 and print DRRS not supported only once.

 v7: As per internal review comments, removing calls to update/disable drrs
 from sprite update path. For sprite, all drrs related updates would be
 taken care of with calls to crtc page flip itself. This will have to be
 revisited later if flip infrastructure changes for sprite.

 Signed-off-by: Vandana Kannan vandana.kan...@intel.com
 Signed-off-by: Pradeep Bhat pradeep.b...@intel.com
 ---
  drivers/gpu/drm/i915/i915_drv.h  |7 ++
  drivers/gpu/drm/i915/i915_params.c   |8 ++
  drivers/gpu/drm/i915/intel_display.c |   16 
  drivers/gpu/drm/i915/intel_dp.c  |   26 ++-
  drivers/gpu/drm/i915/intel_drv.h |5 +-
  drivers/gpu/drm/i915/intel_pm.c  |  138 
 ++
  6 files changed, 197 insertions(+), 3 deletions(-)

 diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
 index 43d3dfe..87865e9 100644
 --- a/drivers/gpu/drm/i915/i915_drv.h
 +++ b/drivers/gpu/drm/i915/i915_drv.h
 @@ -776,6 +776,12 @@ struct i915_fbc {
  
  struct i915_drrs {
   struct intel_connector *connector;
 + bool is_clone;
 + struct intel_drrs_work {
 + struct delayed_work work;
 + struct drm_crtc *crtc;
 + int interval;
 + } *drrs_work;
  };
  
  struct i915_psr {
 @@ -1975,6 +1981,7 @@ struct i915_params {
   bool prefault_disable;
   bool reset;
   int invert_brightness;
 + int drrs_interval;
  };
  extern struct i915_params i915 __read_mostly;
  
 diff --git a/drivers/gpu/drm/i915/i915_params.c 
 b/drivers/gpu/drm/i915/i915_params.c
 index c743057..69f8b83 100644
 --- a/drivers/gpu/drm/i915/i915_params.c
 +++ b/drivers/gpu/drm/i915/i915_params.c
 @@ -47,6 +47,7 @@ struct i915_params i915 __read_mostly = {
   .prefault_disable = 0,
   .reset = true,
   .invert_brightness = 0,
 + .drrs_interval = 2000,
  };
  
  module_param_named(modeset, i915.modeset, int, 0400);
 @@ -153,3 +154,10 @@ MODULE_PARM_DESC(invert_brightness,
   report PCI device ID, subsystem vendor and subsystem device ID 
   to dri-de...@lists.freedesktop.org, if your machine needs it. 
   It will then be included in an upcoming module version.);
 +
 +module_param_named(drrs_interval, i915.drrs_interval, int, 0600);
 +MODULE_PARM_DESC(drrs_interval,
 + DRRS idleness detection interval  (default: 2000 ms).
 + If this field is set to 0, then seamless DRRS feature 
 + based on idleness detection is disabled.
 + The interval is to be set in milliseconds.);

When the strings are concatenated there won't be a space after the
periods.

 diff --git a/drivers/gpu/drm/i915/intel_display.c 
 b/drivers/gpu/drm/i915/intel_display.c
 index 4d4a0d9..86cd603 100644
 --- a/drivers/gpu/drm/i915/intel_display.c
 +++ b/drivers/gpu/drm/i915/intel_display.c
 @@ -2410,6 +2410,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
   }
  
   intel_update_fbc(dev);
 + intel_update_drrs(dev);
   intel_edp_psr_update(dev);
   mutex_unlock(dev-struct_mutex);
  
 @@ -3598,6 +3599,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
  
   mutex_lock(dev-struct_mutex);
   intel_update_fbc(dev);
 + intel_update_drrs(dev);
   mutex_unlock(dev-struct_mutex);
  
   for_each_encoder_on_crtc(dev, crtc, encoder)
 @@ -3639,6 +3641,7 @@ static void haswell_crtc_enable_planes(struct drm_crtc 
 *crtc)
  
   mutex_lock(dev-struct_mutex);
   intel_update_fbc(dev);
 + intel_update_drrs(dev);
   mutex_unlock(dev-struct_mutex);
  }
  
 @@ -3845,6 +3848,7 @@ static