Re: [Intel-gfx] [PATCH v8 4/4] drm/dp: Track MST link bandwidth

2017-05-01 Thread Maarten Lankhorst
Op 29-04-17 om 01:14 schreef Dhinakaran Pandiyan:
> From: "Pandiyan, Dhinakaran" 
>
> Use the added helpers to track MST link bandwidth for atomic modesets.
> Link bw is acquired in the ->atomic_check() phase when CRTCs are being
> enabled with drm_atomic_find_vcpi_slots(). Similarly, link bw is released
> during ->atomic_check() with the connector helper callback ->atomic_check()
> when CRTCs are disabled.
>
> v6: active_changed does not alter vcpi allocations (Maarten)
> v5: Implement connector->atomic_check() in place of atomic_release()
> v4: Return an int from intel_dp_mst_atomic_release() (Maarten)
> v3:
>  Handled the case where ->atomic_release() is called more than once
>  during an atomic_check() for the same state.
> v2:
>  Squashed atomic_release() implementation and caller (Daniel)
>  Fixed logic for connector-crtc switching case (Daniel)
>  Fixed logic for suspend-resume case.
>
> Cc: Daniel Vetter 
> Cc: Maarten Lankhorst 
> Cc: Archit Taneja 
> Cc: Chris Wilson 
> Cc: Harry Wentland 
> Signed-off-by: Dhinakaran Pandiyan 
Missing changes since v7. ;)
Otherwise this looks good, if testbot is happy too then for the whole series:

Reviewed-by: Maarten Lankhorst 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 2/4] drm/i915: Change get_existing_crtc_state to old state

2017-05-01 Thread Maarten Lankhorst
get_existing_crtc_state is currently unused, but the next commit
needs to access the old intel state. Rename this and use this
as convenience wrapper.

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/i915/intel_drv.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 054b454a8d07..f69b56d8f7d7 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1915,12 +1915,12 @@ intel_atomic_get_crtc_state(struct drm_atomic_state 
*state,
 }
 
 static inline struct intel_crtc_state *
-intel_atomic_get_existing_crtc_state(struct drm_atomic_state *state,
-struct intel_crtc *crtc)
+intel_atomic_get_old_crtc_state(struct drm_atomic_state *state,
+   struct intel_crtc *crtc)
 {
struct drm_crtc_state *crtc_state;
 
-   crtc_state = drm_atomic_get_existing_crtc_state(state, &crtc->base);
+   crtc_state = drm_atomic_get_old_crtc_state(state, &crtc->base);
 
if (crtc_state)
return to_intel_crtc_state(crtc_state);
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 4/4] drm/i915: Calculate vlv/chv intermediate watermarks correctly, v2.

2017-05-01 Thread Maarten Lankhorst
The watermarks it should calculate against are the old optimal watermarks.
The currently active crtc watermarks are pure fiction, and are invalid in
case of a nonblocking modeset, page flip enabling/disabling planes or any
other reason.

When the crtc is disabled or during a modeset the intermediate watermarks
don't need to be programmed separately, and could be directly assigned
to the optimal watermarks.

Also rename crtc_state to new_crtc_state, to distinguish it from the old state.

Changes since v1:
- Use intel_atomic_get_old_crtc_state. (ville)

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/i915/intel_pm.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 0f344b1fff45..a09396ee1f3d 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -1458,16 +1458,24 @@ static void vlv_atomic_update_fifo(struct 
intel_atomic_state *state,
 
 static int vlv_compute_intermediate_wm(struct drm_device *dev,
   struct intel_crtc *crtc,
-  struct intel_crtc_state *crtc_state)
+  struct intel_crtc_state *new_crtc_state)
 {
-   struct vlv_wm_state *intermediate = &crtc_state->wm.vlv.intermediate;
-   const struct vlv_wm_state *optimal = &crtc_state->wm.vlv.optimal;
-   const struct vlv_wm_state *active = &crtc->wm.active.vlv;
+   struct vlv_wm_state *intermediate = 
&new_crtc_state->wm.vlv.intermediate;
+   const struct vlv_wm_state *optimal = &new_crtc_state->wm.vlv.optimal;
+   const struct intel_crtc_state *old_crtc_state =
+   intel_atomic_get_old_crtc_state(new_crtc_state->base.state, 
crtc);
+   const struct vlv_wm_state *active = &old_crtc_state->wm.vlv.optimal;
int level;
 
+   if (!new_crtc_state->base.active || 
drm_atomic_crtc_needs_modeset(&new_crtc_state->base)) {
+   *intermediate = *optimal;
+
+   return 0;
+   }
+
intermediate->num_levels = min(optimal->num_levels, active->num_levels);
intermediate->cxsr = optimal->cxsr && active->cxsr &&
-   !crtc_state->disable_cxsr;
+   !new_crtc_state->disable_cxsr;
 
for (level = 0; level < intermediate->num_levels; level++) {
enum plane_id plane_id;
@@ -1491,7 +1499,7 @@ static int vlv_compute_intermediate_wm(struct drm_device 
*dev,
 * omit the post-vblank programming; only update if it's different.
 */
if (memcmp(intermediate, optimal, sizeof(*intermediate)) != 0)
-   crtc_state->wm.need_postvbl_update = true;
+   new_crtc_state->wm.need_postvbl_update = true;
 
return 0;
 }
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 3/4] drm/i915: Calculate ironlake intermediate watermarks correctly, v2.

2017-05-01 Thread Maarten Lankhorst
The watermarks it should calculate against are the old optimal watermarks.
The currently active crtc watermarks are pure fiction, and are invalid in
case of a nonblocking modeset, page flip enabling/disabling planes or any
other reason.

When the crtc is disabled or during a modeset the intermediate watermarks
don't need to be programmed separately, and could be directly assigned
to the optimal watermarks.

Changes since v1:
- Use intel_atomic_get_old_crtc_state. (ville)

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/i915/intel_pm.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 246e0723e6e9..0f344b1fff45 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2638,7 +2638,9 @@ static int ilk_compute_intermediate_wm(struct drm_device 
*dev,
   struct intel_crtc_state *newstate)
 {
struct intel_pipe_wm *a = &newstate->wm.ilk.intermediate;
-   struct intel_pipe_wm *b = &intel_crtc->wm.active.ilk;
+   const struct intel_crtc_state *oldstate =
+   intel_atomic_get_old_crtc_state(newstate->base.state, 
intel_crtc);
+   const struct intel_pipe_wm *b = &oldstate->wm.ilk.optimal;
int level, max_level = ilk_wm_max_level(to_i915(dev));
 
/*
@@ -2647,6 +2649,9 @@ static int ilk_compute_intermediate_wm(struct drm_device 
*dev,
 * and after the vblank.
 */
*a = newstate->wm.ilk.optimal;
+   if (!newstate->base.active || 
drm_atomic_crtc_needs_modeset(&newstate->base))
+   return 0;
+
a->pipe_enabled |= b->pipe_enabled;
a->sprites_enabled |= b->sprites_enabled;
a->sprites_scaled |= b->sprites_scaled;
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 1/4] drm/i915: Change use get_new_plane_state instead of existing plane state

2017-05-01 Thread Maarten Lankhorst
The get_existing macros are deprecated and should be replaced by
get_old/new_state for clarity.

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/i915/intel_atomic.c | 4 ++--
 drivers/gpu/drm/i915/intel_drv.h| 4 ++--
 drivers/gpu/drm/i915/intel_pm.c | 6 ++
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_atomic.c 
b/drivers/gpu/drm/i915/intel_atomic.c
index d791b3ef89b5..87b1dd464eee 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -301,8 +301,8 @@ int intel_atomic_setup_scalers(struct drm_i915_private 
*dev_priv,
continue;
}
 
-   plane_state = 
intel_atomic_get_existing_plane_state(drm_state,
-   
intel_plane);
+   plane_state = 
intel_atomic_get_new_plane_state(drm_state,
+  
intel_plane);
scaler_id = &plane_state->scaler_id;
}
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 110d9088be35..054b454a8d07 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1929,12 +1929,12 @@ intel_atomic_get_existing_crtc_state(struct 
drm_atomic_state *state,
 }
 
 static inline struct intel_plane_state *
-intel_atomic_get_existing_plane_state(struct drm_atomic_state *state,
+intel_atomic_get_new_plane_state(struct drm_atomic_state *state,
  struct intel_plane *plane)
 {
struct drm_plane_state *plane_state;
 
-   plane_state = drm_atomic_get_existing_plane_state(state, &plane->base);
+   plane_state = drm_atomic_get_new_plane_state(state, &plane->base);
 
return to_intel_plane_state(plane_state);
 }
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index cacb65fa2dd5..246e0723e6e9 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2561,8 +2561,7 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state 
*cstate)
for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
struct intel_plane_state *ps;
 
-   ps = intel_atomic_get_existing_plane_state(state,
-  intel_plane);
+   ps = intel_atomic_get_new_plane_state(state, intel_plane);
if (!ps)
continue;
 
@@ -3924,8 +3923,7 @@ skl_compute_wm_level(const struct drm_i915_private 
*dev_priv,
 
if (state)
intel_pstate =
-   intel_atomic_get_existing_plane_state(state,
- intel_plane);
+   intel_atomic_get_new_plane_state(state, intel_plane);
 
/*
 * Note: If we start supporting multiple pending atomic commits against
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 0/4] drm/i915: Calculate intermediate watermarks correctly.

2017-05-01 Thread Maarten Lankhorst
Calculate intermediate watermarks with the correct previous optimal watermark 
values.
This is the same as v1, but with helper macro to get the old state.

Maarten Lankhorst (4):
  drm/i915: Change use get_new_plane_state instead of existing plane
state
  drm/i915: Change get_existing_crtc_state to old state
  drm/i915: Calculate ironlake intermediate watermarks correctly, v2.
  drm/i915: Calculate vlv/chv intermediate watermarks correctly, v2.

 drivers/gpu/drm/i915/intel_atomic.c |  4 ++--
 drivers/gpu/drm/i915/intel_drv.h| 10 +-
 drivers/gpu/drm/i915/intel_pm.c | 33 ++---
 3 files changed, 29 insertions(+), 18 deletions(-)

-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v6 02/12] drm/atomic: Add support for custom scaling mode properties, v2

2017-05-01 Thread Maarten Lankhorst
Some connectors may not allow all scaling mode properties, this function will 
allow
creating the scaling mode property with only the supported subset. It also 
wires up
this state for atomic.

This will make it possible to convert i915 connectors to atomic.

Changes since v1:
 - Add DRM_MODE_PROP_ENUM flag to drm_property_create
 - Use the correct index in drm_property_add_enum.
 - Add DocBook for function (Sean Paul).
 - Warn if less than 2 valid scaling modes are passed.
 - Remove level of indent. (Sean Paul)

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/drm_atomic.c|  4 +++
 drivers/gpu/drm/drm_connector.c | 58 +
 include/drm/drm_connector.h | 10 +++
 3 files changed, 72 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 77bb36e956db..c7f91dcebbe9 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1125,6 +1125,8 @@ int drm_atomic_connector_set_property(struct 
drm_connector *connector,
state->link_status = val;
} else if (property == config->aspect_ratio_property) {
state->picture_aspect_ratio = val;
+   } else if (property == connector->scaling_mode_property) {
+   state->scaling_mode = val;
} else if (connector->funcs->atomic_set_property) {
return connector->funcs->atomic_set_property(connector,
state, property, val);
@@ -1203,6 +1205,8 @@ drm_atomic_connector_get_property(struct drm_connector 
*connector,
*val = state->link_status;
} else if (property == config->aspect_ratio_property) {
*val = state->picture_aspect_ratio;
+   } else if (property == connector->scaling_mode_property) {
+   *val = state->scaling_mode;
} else if (connector->funcs->atomic_get_property) {
return connector->funcs->atomic_get_property(connector,
state, property, val);
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 9f847615ac74..b3912f2e48c6 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -961,6 +961,64 @@ int drm_mode_create_scaling_mode_property(struct 
drm_device *dev)
 EXPORT_SYMBOL(drm_mode_create_scaling_mode_property);
 
 /**
+ * drm_mode_connector_attach_scaling_mode_property - attach atomic scaling 
mode property
+ * @connector: connector to attach scaling mode property on.
+ * @scaling_mode_mask: or'ed mask of BIT(DRM_MODE_SCALE_\*).
+ *
+ * This is used to add support for scaling mode to atomic drivers.
+ * The scaling mode will be set to &struct 
drm_connector_state->picture_aspect_ratio
+ * and can be used from &struct drm_connector_helper_funcs->atomic_check for 
validation.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_connector_attach_scaling_mode_property(struct drm_connector 
*connector,
+   u32 scaling_mode_mask)
+{
+   struct drm_device *dev = connector->dev;
+   struct drm_property *scaling_mode_property;
+   int i, j = 0;
+   const unsigned valid_scaling_mode_mask =
+   (1U << ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1;
+
+   if (WARN_ON(hweight32(scaling_mode_mask) < 2 ||
+   scaling_mode_mask & ~valid_scaling_mode_mask))
+   return -EINVAL;
+
+   scaling_mode_property =
+   drm_property_create(dev, DRM_MODE_PROP_ENUM, "scaling mode",
+   hweight32(scaling_mode_mask));
+
+   if (!scaling_mode_property)
+   return -ENOMEM;
+
+   for (i = 0; i < ARRAY_SIZE(drm_scaling_mode_enum_list); i++) {
+   int ret;
+
+   if (!(BIT(i) & scaling_mode_mask))
+   continue;
+
+   ret = drm_property_add_enum(scaling_mode_property, j++,
+   drm_scaling_mode_enum_list[i].type,
+   drm_scaling_mode_enum_list[i].name);
+
+   if (ret) {
+   drm_property_destroy(dev, scaling_mode_property);
+
+   return ret;
+   }
+   }
+
+   drm_object_attach_property(&connector->base,
+  scaling_mode_property, 0);
+
+   connector->scaling_mode_property = scaling_mode_property;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_mode_connector_attach_scaling_mode_property);
+
+/**
  * drm_mode_create_aspect_ratio_property - create aspect ratio property
  * @dev: DRM device
  *
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 1ecf5f2619c0..e71b8959c15f 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -336,6 +336,12 @@ struct drm_connector_state {
 * values for &enum hdmi_picture_aspect
 */
  

[Intel-gfx] [PATCH v6 00/12] drm/i915: Convert connector properties to atomic.

2017-05-01 Thread Maarten Lankhorst
This is required to allow setting i915 connector properties using the atomic 
ioctl.
This version shouldn't cause unbisectable changes in between.

CHanges since last version:
- Split out picture_aspect_ratio and atomic scaling mode property to separate
  commits.
- Make sure it bisects correctly, no breaking commits while drivers are not
  converted yet.

Maarten Lankhorst (12):
  drm/atomic: Handle picture_aspect_ratio in atomic core
  drm/atomic: Add support for custom scaling mode properties, v2
  drm/i915: Use atomic scaling_mode instead of panel.fitting_mode
  drm/i915: Use per-connector scaling mode property
  drm/i915: Add plumbing for digital connector state, v3.
  drm/i915: Convert DSI connector properties to atomic.
  drm/i915: Convert LVDS connector properties to atomic.
  drm/i915: Make intel_dp->has_audio reflect hw state only
  drm/i915: Convert intel_dp properties to atomic, v2.
  drm/i915: Convert intel_hdmi connector properties to atomic
  drm/i915: Handle force_audio correctly in intel_sdvo
  drm/i915: Convert intel_sdvo connector properties to atomic.

 drivers/gpu/drm/drm_atomic.c |   8 +
 drivers/gpu/drm/drm_connector.c  |  58 
 drivers/gpu/drm/i915/intel_atomic.c  | 135 +++--
 drivers/gpu/drm/i915/intel_display.c |  51 +---
 drivers/gpu/drm/i915/intel_dp.c  | 155 ++
 drivers/gpu/drm/i915/intel_drv.h |  35 ++-
 drivers/gpu/drm/i915/intel_dsi.c |  71 ++---
 drivers/gpu/drm/i915/intel_hdmi.c| 165 +++---
 drivers/gpu/drm/i915/intel_lvds.c|  57 +---
 drivers/gpu/drm/i915/intel_sdvo.c| 562 ++-
 include/drm/drm_connector.h  |  20 ++
 11 files changed, 607 insertions(+), 710 deletions(-)

-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v6 05/12] drm/i915: Add plumbing for digital connector state, v3.

2017-05-01 Thread Maarten Lankhorst
Some atomic properties are common between the various kinds of
connectors, for example a lot of them use panel fitting mode.
It makes sense to put a lot of it in a common place, so each
connector can use it while they're being converted.

Implement the properties required for the connectors:
- scaling mode property
- force audio property
- broadcast rgb
- aspect ratio

While at it, make clear that intel_digital_connector_atomic_get_property
is a hack that has to be removed when all connector properties
are converted to atomic.

Changes since v1:
- Scaling mode and aspect ratio are partly handled in core now.
Changes since v2:
- Split out the scaling mode / aspect ratio changes to a preparation
  patch.
- Use mode_changed for panel fitter, changes to this property
  are checked by fastset.
- Allowed_scaling_modes is removed, handled through core now.

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/i915/intel_atomic.c  | 131 +--
 drivers/gpu/drm/i915/intel_display.c |  14 +++-
 drivers/gpu/drm/i915/intel_drv.h |  23 ++
 3 files changed, 159 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_atomic.c 
b/drivers/gpu/drm/i915/intel_atomic.c
index 50fb1f76cc5f..182909f266f5 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -36,7 +36,7 @@
 #include "intel_drv.h"
 
 /**
- * intel_connector_atomic_get_property - fetch connector property value
+ * intel_connector_atomic_get_property - fetch legacy connector property value
  * @connector: connector to fetch property for
  * @state: state containing the property value
  * @property: property to look up
@@ -45,12 +45,14 @@
  * The DRM core does not store shadow copies of properties for
  * atomic-capable drivers.  This entrypoint is used to fetch
  * the current value of a driver-specific connector property.
+ *
+ * This is a intermediary solution until all connectors are
+ * converted to support full atomic properties.
  */
-int
-intel_connector_atomic_get_property(struct drm_connector *connector,
-   const struct drm_connector_state *state,
-   struct drm_property *property,
-   uint64_t *val)
+int intel_connector_atomic_get_property(struct drm_connector *connector,
+   const struct drm_connector_state *state,
+   struct drm_property *property,
+   uint64_t *val)
 {
int i;
 
@@ -73,7 +75,122 @@ intel_connector_atomic_get_property(struct drm_connector 
*connector,
return -EINVAL;
 }
 
-/*
+/**
+ * intel_digital_connector_atomic_get_property - hook for 
connector->atomic_get_property.
+ * @connector: Connector to get the property for.
+ * @state: Connector state to retrieve the property from.
+ * @property: Property to retrieve.
+ * @val: Return value for the property.
+ *
+ * Returns the atomic property value for a digital connector.
+ */
+int intel_digital_connector_atomic_get_property(struct drm_connector 
*connector,
+   const struct 
drm_connector_state *state,
+   struct drm_property *property,
+   uint64_t *val)
+{
+   struct drm_device *dev = connector->dev;
+   struct drm_i915_private *dev_priv = to_i915(dev);
+   struct intel_digital_connector_state *intel_conn_state =
+   to_intel_digital_connector_state(state);
+
+   if (property == dev_priv->force_audio_property)
+   *val = intel_conn_state->force_audio;
+   else if (property == dev_priv->broadcast_rgb_property)
+   *val = intel_conn_state->broadcast_rgb;
+   else {
+   DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
+/**
+ * intel_digital_connector_atomic_set_property - hook for 
connector->atomic_set_property.
+ * @connector: Connector to set the property for.
+ * @state: Connector state to set the property on.
+ * @property: Property to set.
+ * @val: New value for the property.
+ *
+ * Sets the atomic property value for a digital connector.
+ */
+int intel_digital_connector_atomic_set_property(struct drm_connector 
*connector,
+   struct drm_connector_state 
*state,
+   struct drm_property *property,
+   uint64_t val)
+{
+   struct drm_device *dev = connector->dev;
+   struct drm_i915_private *dev_priv = to_i915(dev);
+   struct intel_digital_connector_state *intel_conn_state =
+   to_intel_digital_connector_state(state);
+
+   if (property == dev_priv->force_audio_property) {
+   intel_conn_state->force_audio = val;
+ 

[Intel-gfx] [PATCH v6 03/12] drm/i915: Use atomic scaling_mode instead of panel.fitting_mode

2017-05-01 Thread Maarten Lankhorst
The first step in converting connector properties to atomic is
wiring up the atomic state. We're still not completely supoprting
the scaling mode in the atomic case, but this is the first step
towards it.

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/i915/intel_dp.c   | 13 +
 drivers/gpu/drm/i915/intel_drv.h  |  1 -
 drivers/gpu/drm/i915/intel_dsi.c  | 11 +--
 drivers/gpu/drm/i915/intel_lvds.c | 11 +--
 4 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 08834f74d396..ea4366b264f1 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1686,10 +1686,10 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 
if (HAS_GMCH_DISPLAY(dev_priv))
intel_gmch_panel_fitting(intel_crtc, pipe_config,
-
intel_connector->panel.fitting_mode);
+conn_state->scaling_mode);
else
intel_pch_panel_fitting(intel_crtc, pipe_config,
-   
intel_connector->panel.fitting_mode);
+   conn_state->scaling_mode);
}
 
if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
@@ -4828,7 +4828,6 @@ intel_dp_set_property(struct drm_connector *connector,
  uint64_t val)
 {
struct drm_i915_private *dev_priv = to_i915(connector->dev);
-   struct intel_connector *intel_connector = to_intel_connector(connector);
struct intel_encoder *intel_encoder = intel_attached_encoder(connector);
struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base);
int ret;
@@ -4897,11 +4896,11 @@ intel_dp_set_property(struct drm_connector *connector,
return -EINVAL;
}
 
-   if (intel_connector->panel.fitting_mode == val) {
+   if (connector->state->scaling_mode == val) {
/* the eDP scaling property is not changed */
return 0;
}
-   intel_connector->panel.fitting_mode = val;
+   connector->state->scaling_mode = val;
 
goto done;
}
@@ -5179,8 +5178,6 @@ bool intel_dp_is_edp(struct drm_i915_private *dev_priv, 
enum port port)
 static void
 intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector 
*connector)
 {
-   struct intel_connector *intel_connector = to_intel_connector(connector);
-
intel_attach_force_audio_property(connector);
intel_attach_broadcast_rgb_property(connector);
intel_dp->color_range_auto = true;
@@ -5191,7 +5188,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct 
drm_connector *connect
&connector->base,
connector->dev->mode_config.scaling_mode_property,
DRM_MODE_SCALE_ASPECT);
-   intel_connector->panel.fitting_mode = DRM_MODE_SCALE_ASPECT;
+   connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
}
 }
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index d38fed78500b..2b243444cf8b 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -266,7 +266,6 @@ struct intel_encoder {
 struct intel_panel {
struct drm_display_mode *fixed_mode;
struct drm_display_mode *downclock_mode;
-   int fitting_mode;
 
/* backlight */
struct {
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index fc0ef492252a..ec141eb59e6d 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -320,10 +320,10 @@ static bool intel_dsi_compute_config(struct intel_encoder 
*encoder,
 
if (HAS_GMCH_DISPLAY(dev_priv))
intel_gmch_panel_fitting(crtc, pipe_config,
-
intel_connector->panel.fitting_mode);
+conn_state->scaling_mode);
else
intel_pch_panel_fitting(crtc, pipe_config,
-   
intel_connector->panel.fitting_mode);
+   conn_state->scaling_mode);
}
 
/* DSI uses short packets for sync events, so clear mode flags for DSI 
*/
@@ -1592,7 +1592,6 @@ static int intel_dsi_set_property(struct drm_connector 
*connector,
  uint64_t val)
 {
struct drm_device *dev = connector->dev;
-   struct intel_connector *intel_connector = to_intel_connector(connector);
struct drm_crtc *crtc;
int ret;
 
@@ -1611,10 +1610,10 @@ static int intel_dsi_set_property(struct drm_connector 
*connector,
 

[Intel-gfx] [PATCH v6 01/12] drm/atomic: Handle picture_aspect_ratio in atomic core

2017-05-01 Thread Maarten Lankhorst
This is only used in i915, which had used its own non-taomic way to
deal with the picture aspect ratio. Move selected aspect_ratio to
atomic state and use the atomic state in the affected i915 connectors.

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/drm_atomic.c  |  4 
 drivers/gpu/drm/i915/intel_drv.h  |  1 -
 drivers/gpu/drm/i915/intel_hdmi.c | 18 +++---
 drivers/gpu/drm/i915/intel_sdvo.c | 23 +++
 include/drm/drm_connector.h   | 10 ++
 5 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 30229ab719c0..77bb36e956db 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1123,6 +1123,8 @@ int drm_atomic_connector_set_property(struct 
drm_connector *connector,
 */
if (state->link_status != DRM_LINK_STATUS_GOOD)
state->link_status = val;
+   } else if (property == config->aspect_ratio_property) {
+   state->picture_aspect_ratio = val;
} else if (connector->funcs->atomic_set_property) {
return connector->funcs->atomic_set_property(connector,
state, property, val);
@@ -1199,6 +1201,8 @@ drm_atomic_connector_get_property(struct drm_connector 
*connector,
*val = state->tv.hue;
} else if (property == config->link_status_property) {
*val = state->link_status;
+   } else if (property == config->aspect_ratio_property) {
+   *val = state->picture_aspect_ratio;
} else if (connector->funcs->atomic_get_property) {
return connector->funcs->atomic_get_property(connector,
state, property, val);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 54f3ff840812..d38fed78500b 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -877,7 +877,6 @@ struct intel_hdmi {
bool has_audio;
enum hdmi_force_audio force_audio;
bool rgb_quant_range_selectable;
-   enum hdmi_picture_aspect aspect_ratio;
struct intel_connector *attached_connector;
void (*write_infoframe)(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state,
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
b/drivers/gpu/drm/i915/intel_hdmi.c
index 52f0b2d5fad2..58d690393b29 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1408,7 +1408,7 @@ bool intel_hdmi_compute_config(struct intel_encoder 
*encoder,
}
 
/* Set user selected PAR to incoming mode's member */
-   adjusted_mode->picture_aspect_ratio = intel_hdmi->aspect_ratio;
+   adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
 
pipe_config->lane_count = 4;
 
@@ -1654,19 +1654,7 @@ intel_hdmi_set_property(struct drm_connector *connector,
}
 
if (property == connector->dev->mode_config.aspect_ratio_property) {
-   switch (val) {
-   case DRM_MODE_PICTURE_ASPECT_NONE:
-   intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
-   break;
-   case DRM_MODE_PICTURE_ASPECT_4_3:
-   intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_4_3;
-   break;
-   case DRM_MODE_PICTURE_ASPECT_16_9:
-   intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_16_9;
-   break;
-   default:
-   return -EINVAL;
-   }
+   connector->state->picture_aspect_ratio = val;
goto done;
}
 
@@ -1828,7 +1816,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, 
struct drm_connector *c
intel_attach_broadcast_rgb_property(connector);
intel_hdmi->color_range_auto = true;
intel_attach_aspect_ratio_property(connector);
-   intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
+   connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
 /*
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c 
b/drivers/gpu/drm/i915/intel_sdvo.c
index 816a6f5a3fd9..ef6fa87b2f8a 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -107,11 +107,6 @@ struct intel_sdvo {
bool color_range_auto;
 
/**
-* HDMI user specified aspect ratio
-*/
-   enum hdmi_picture_aspect aspect_ratio;
-
-   /**
 * This is set if we're going to treat the device as TV-out.
 *
 * While we have these nice friendly flags for output types that ought
@@ -1186,7 +1181,7 @@ static bool intel_sdvo_compute_config(struct 
intel_encoder *encoder,
 
/* Set user selected PAR to incoming mode's member */
if (intel_sdvo->is_hdmi)
-   adjusted_mode->pic

[Intel-gfx] [PATCH v6 08/12] drm/i915: Make intel_dp->has_audio reflect hw state only

2017-05-01 Thread Maarten Lankhorst
Always detect if audio is available during edid detection.
With less magic switching it's easier to convert the dp connector
properties to atomic.

Signed-off-by: Maarten Lankhorst 
Reviewed-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_dp.c | 38 --
 1 file changed, 16 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 8eb381ebbea6..0966b9319332 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1671,7 +1671,12 @@ intel_dp_compute_config(struct intel_encoder *encoder,
pipe_config->has_pch_encoder = true;
 
pipe_config->has_drrs = false;
-   pipe_config->has_audio = intel_dp->has_audio && port != PORT_A;
+   if (port == PORT_A)
+   pipe_config->has_audio = false;
+   else if (intel_dp->force_audio == HDMI_AUDIO_AUTO)
+   pipe_config->has_audio = intel_dp->has_audio;
+   else
+   pipe_config->has_audio = intel_dp->force_audio == HDMI_AUDIO_ON;
 
if (is_edp(intel_dp) && intel_connector->panel.fixed_mode) {
intel_fixed_panel_mode(intel_connector->panel.fixed_mode,
@@ -4598,10 +4603,7 @@ intel_dp_set_edid(struct intel_dp *intel_dp)
edid = intel_dp_get_edid(intel_dp);
intel_connector->detect_edid = edid;
 
-   if (intel_dp->force_audio != HDMI_AUDIO_AUTO)
-   intel_dp->has_audio = intel_dp->force_audio == HDMI_AUDIO_ON;
-   else
-   intel_dp->has_audio = drm_detect_monitor_audio(edid);
+   intel_dp->has_audio = drm_detect_monitor_audio(edid);
 }
 
 static void
@@ -4809,19 +4811,6 @@ static int intel_dp_get_modes(struct drm_connector 
*connector)
return 0;
 }
 
-static bool
-intel_dp_detect_audio(struct drm_connector *connector)
-{
-   bool has_audio = false;
-   struct edid *edid;
-
-   edid = to_intel_connector(connector)->detect_edid;
-   if (edid)
-   has_audio = drm_detect_monitor_audio(edid);
-
-   return has_audio;
-}
-
 static int
 intel_dp_set_property(struct drm_connector *connector,
  struct drm_property *property,
@@ -4838,22 +4827,27 @@ intel_dp_set_property(struct drm_connector *connector,
 
if (property == dev_priv->force_audio_property) {
int i = val;
-   bool has_audio;
+   bool has_audio, old_has_audio;
+   int old_force_audio = intel_dp->force_audio;
 
if (i == intel_dp->force_audio)
return 0;
 
+   if (old_force_audio == HDMI_AUDIO_AUTO)
+   old_has_audio = intel_dp->has_audio;
+   else
+   old_has_audio = old_force_audio;
+
intel_dp->force_audio = i;
 
if (i == HDMI_AUDIO_AUTO)
-   has_audio = intel_dp_detect_audio(connector);
+   has_audio = intel_dp->has_audio;
else
has_audio = (i == HDMI_AUDIO_ON);
 
-   if (has_audio == intel_dp->has_audio)
+   if (has_audio == old_has_audio)
return 0;
 
-   intel_dp->has_audio = has_audio;
goto done;
}
 
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v6 06/12] drm/i915: Convert DSI connector properties to atomic.

2017-05-01 Thread Maarten Lankhorst
Signed-off-by: Maarten Lankhorst 
Reviewed-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_dsi.c | 38 +-
 1 file changed, 5 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 8617d996abe5..40f50e9f7a0d 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1587,36 +1587,6 @@ static int intel_dsi_get_modes(struct drm_connector 
*connector)
return 1;
 }
 
-static int intel_dsi_set_property(struct drm_connector *connector,
- struct drm_property *property,
- uint64_t val)
-{
-   struct drm_crtc *crtc;
-   int ret;
-
-   ret = drm_object_property_set_value(&connector->base, property, val);
-   if (ret)
-   return ret;
-
-   if (property == connector->scaling_mode_property) {
-   if (connector->state->scaling_mode == val)
-   return 0;
-
-   connector->state->scaling_mode = val;
-   }
-
-   crtc = connector->state->crtc;
-   if (crtc && crtc->state->enable) {
-   /*
-* If the CRTC is enabled, the display will be changed
-* according to the new panel fitting mode.
-*/
-   intel_crtc_restore_mode(crtc);
-   }
-
-   return 0;
-}
-
 static void intel_dsi_connector_destroy(struct drm_connector *connector)
 {
struct intel_connector *intel_connector = to_intel_connector(connector);
@@ -1645,6 +1615,7 @@ static const struct drm_encoder_funcs intel_dsi_funcs = {
 static const struct drm_connector_helper_funcs 
intel_dsi_connector_helper_funcs = {
.get_modes = intel_dsi_get_modes,
.mode_valid = intel_dsi_mode_valid,
+   .atomic_check = intel_digital_connector_atomic_check,
 };
 
 static const struct drm_connector_funcs intel_dsi_connector_funcs = {
@@ -1653,10 +1624,11 @@ static const struct drm_connector_funcs 
intel_dsi_connector_funcs = {
.early_unregister = intel_connector_unregister,
.destroy = intel_dsi_connector_destroy,
.fill_modes = drm_helper_probe_single_connector_modes,
-   .set_property = intel_dsi_set_property,
-   .atomic_get_property = intel_connector_atomic_get_property,
+   .set_property = drm_atomic_helper_connector_set_property,
+   .atomic_get_property = intel_digital_connector_atomic_get_property,
+   .atomic_set_property = intel_digital_connector_atomic_set_property,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_duplicate_state = intel_digital_connector_duplicate_state,
 };
 
 static void intel_dsi_add_properties(struct intel_connector *connector)
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v6 09/12] drm/i915: Convert intel_dp properties to atomic, v2.

2017-05-01 Thread Maarten Lankhorst
intel_dp supports 3 properties, scaling mode, broadcast rgb and
force_audio. intel_digital_connector handles the plumbing,
so we only have to hook this up in compute_config and init.

Changes since v1:
- Remove limited_color_range too, unused. (danvet)

Signed-off-by: Maarten Lankhorst 
Reviewed-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_dp.c  | 105 ---
 drivers/gpu/drm/i915/intel_drv.h |   3 --
 2 files changed, 11 insertions(+), 97 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 0966b9319332..d2a9eaaf1af6 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1648,6 +1648,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
enum port port = dp_to_dig_port(intel_dp)->port;
struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc);
struct intel_connector *intel_connector = intel_dp->attached_connector;
+   struct intel_digital_connector_state *intel_conn_state =
+   to_intel_digital_connector_state(conn_state);
int lane_count, clock;
int min_lane_count = 1;
int max_lane_count = intel_dp_max_lane_count(intel_dp);
@@ -1673,10 +1675,10 @@ intel_dp_compute_config(struct intel_encoder *encoder,
pipe_config->has_drrs = false;
if (port == PORT_A)
pipe_config->has_audio = false;
-   else if (intel_dp->force_audio == HDMI_AUDIO_AUTO)
+   else if (intel_conn_state->force_audio == HDMI_AUDIO_AUTO)
pipe_config->has_audio = intel_dp->has_audio;
else
-   pipe_config->has_audio = intel_dp->force_audio == HDMI_AUDIO_ON;
+   pipe_config->has_audio = intel_conn_state->force_audio == 
HDMI_AUDIO_ON;
 
if (is_edp(intel_dp) && intel_connector->panel.fixed_mode) {
intel_fixed_panel_mode(intel_connector->panel.fixed_mode,
@@ -1763,7 +1765,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
return false;
 
 found:
-   if (intel_dp->color_range_auto) {
+   if (intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_AUTO) {
/*
 * See:
 * CEA-861-E - 5.1 Default Encoding Parameters
@@ -1775,7 +1777,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
HDMI_QUANTIZATION_RANGE_LIMITED;
} else {
pipe_config->limited_color_range =
-   intel_dp->limited_color_range;
+   intel_conn_state->broadcast_rgb == 
INTEL_BROADCAST_RGB_LIMITED;
}
 
pipe_config->lane_count = lane_count;
@@ -4812,92 +4814,6 @@ static int intel_dp_get_modes(struct drm_connector 
*connector)
 }
 
 static int
-intel_dp_set_property(struct drm_connector *connector,
- struct drm_property *property,
- uint64_t val)
-{
-   struct drm_i915_private *dev_priv = to_i915(connector->dev);
-   struct intel_encoder *intel_encoder = intel_attached_encoder(connector);
-   struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base);
-   int ret;
-
-   ret = drm_object_property_set_value(&connector->base, property, val);
-   if (ret)
-   return ret;
-
-   if (property == dev_priv->force_audio_property) {
-   int i = val;
-   bool has_audio, old_has_audio;
-   int old_force_audio = intel_dp->force_audio;
-
-   if (i == intel_dp->force_audio)
-   return 0;
-
-   if (old_force_audio == HDMI_AUDIO_AUTO)
-   old_has_audio = intel_dp->has_audio;
-   else
-   old_has_audio = old_force_audio;
-
-   intel_dp->force_audio = i;
-
-   if (i == HDMI_AUDIO_AUTO)
-   has_audio = intel_dp->has_audio;
-   else
-   has_audio = (i == HDMI_AUDIO_ON);
-
-   if (has_audio == old_has_audio)
-   return 0;
-
-   goto done;
-   }
-
-   if (property == dev_priv->broadcast_rgb_property) {
-   bool old_auto = intel_dp->color_range_auto;
-   bool old_range = intel_dp->limited_color_range;
-
-   switch (val) {
-   case INTEL_BROADCAST_RGB_AUTO:
-   intel_dp->color_range_auto = true;
-   break;
-   case INTEL_BROADCAST_RGB_FULL:
-   intel_dp->color_range_auto = false;
-   intel_dp->limited_color_range = false;
-   break;
-   case INTEL_BROADCAST_RGB_LIMITED:
-   intel_dp->color_range_auto = false;
-   intel_dp->limited_color_range = true;
-   break;
-   default:
-   return -EINVAL;
-   }
-
-   if (old_

[Intel-gfx] [PATCH v6 11/12] drm/i915: Handle force_audio correctly in intel_sdvo

2017-05-01 Thread Maarten Lankhorst
Do the same as other connectors, attempt to detect hdmi audio in
the detect() callback, and only use the force_audio property as
override. Compute has_audio in pipe_config, and use that value
instead of the probed value directly.

Signed-off-by: Maarten Lankhorst 
Reviewed-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_sdvo.c | 51 ++-
 1 file changed, 18 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c 
b/drivers/gpu/drm/i915/intel_sdvo.c
index ef6fa87b2f8a..4be8be162058 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1122,6 +1122,8 @@ static bool intel_sdvo_compute_config(struct 
intel_encoder *encoder,
  struct drm_connector_state *conn_state)
 {
struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
+   struct intel_sdvo_connector *intel_sdvo_connector =
+   to_intel_sdvo_connector(conn_state->connector);
struct drm_display_mode *adjusted_mode = 
&pipe_config->base.adjusted_mode;
struct drm_display_mode *mode = &pipe_config->base.mode;
 
@@ -1160,7 +1162,12 @@ static bool intel_sdvo_compute_config(struct 
intel_encoder *encoder,
pipe_config->pixel_multiplier =
intel_sdvo_get_pixel_multiplier(adjusted_mode);
 
-   pipe_config->has_hdmi_sink = intel_sdvo->has_hdmi_monitor;
+   if (intel_sdvo_connector->force_audio != HDMI_AUDIO_OFF_DVI)
+   pipe_config->has_hdmi_sink = intel_sdvo->has_hdmi_monitor;
+
+   if (intel_sdvo_connector->force_audio == HDMI_AUDIO_ON ||
+   (intel_sdvo_connector->force_audio == HDMI_AUDIO_AUTO && 
intel_sdvo->has_hdmi_audio))
+   pipe_config->has_audio = true;
 
if (intel_sdvo->color_range_auto) {
/* See CEA-861-E - 5.1 Default Encoding Parameters */
@@ -1285,7 +1292,7 @@ static void intel_sdvo_pre_enable(struct intel_encoder 
*intel_encoder,
else
sdvox |= SDVO_PIPE_SEL(crtc->pipe);
 
-   if (intel_sdvo->has_hdmi_audio)
+   if (crtc_state->has_audio)
sdvox |= SDVO_AUDIO_ENABLE;
 
if (INTEL_GEN(dev_priv) >= 4) {
@@ -1694,12 +1701,6 @@ intel_sdvo_tmds_sink_detect(struct drm_connector 
*connector)
kfree(edid);
}
 
-   if (status == connector_status_connected) {
-   struct intel_sdvo_connector *intel_sdvo_connector = 
to_intel_sdvo_connector(connector);
-   if (intel_sdvo_connector->force_audio != HDMI_AUDIO_AUTO)
-   intel_sdvo->has_hdmi_audio = 
(intel_sdvo_connector->force_audio == HDMI_AUDIO_ON);
-   }
-
return status;
 }
 
@@ -1978,23 +1979,6 @@ static void intel_sdvo_destroy(struct drm_connector 
*connector)
kfree(intel_sdvo_connector);
 }
 
-static bool intel_sdvo_detect_hdmi_audio(struct drm_connector *connector)
-{
-   struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
-   struct edid *edid;
-   bool has_audio = false;
-
-   if (!intel_sdvo->is_hdmi)
-   return false;
-
-   edid = intel_sdvo_get_edid(connector);
-   if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL)
-   has_audio = drm_detect_monitor_audio(edid);
-   kfree(edid);
-
-   return has_audio;
-}
-
 static int
 intel_sdvo_set_property(struct drm_connector *connector,
struct drm_property *property,
@@ -2013,22 +1997,23 @@ intel_sdvo_set_property(struct drm_connector *connector,
 
if (property == dev_priv->force_audio_property) {
int i = val;
-   bool has_audio;
-
-   if (i == intel_sdvo_connector->force_audio)
-   return 0;
+   bool has_audio, old_audio;
 
-   intel_sdvo_connector->force_audio = i;
+   if (intel_sdvo_connector->force_audio == HDMI_AUDIO_AUTO)
+   old_audio = intel_sdvo->has_hdmi_audio;
+   else
+   old_audio = intel_sdvo_connector->force_audio == 
HDMI_AUDIO_ON;
 
if (i == HDMI_AUDIO_AUTO)
-   has_audio = intel_sdvo_detect_hdmi_audio(connector);
+   has_audio = intel_sdvo->has_hdmi_audio;
else
has_audio = (i == HDMI_AUDIO_ON);
 
-   if (has_audio == intel_sdvo->has_hdmi_audio)
+   intel_sdvo_connector->force_audio = i;
+
+   if (has_audio == old_audio)
return 0;
 
-   intel_sdvo->has_hdmi_audio = has_audio;
goto done;
}
 
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v6 07/12] drm/i915: Convert LVDS connector properties to atomic.

2017-05-01 Thread Maarten Lankhorst
Signed-off-by: Maarten Lankhorst 
Reviewed-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_lvds.c | 35 +--
 1 file changed, 5 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lvds.c 
b/drivers/gpu/drm/i915/intel_lvds.c
index a3f9216e32eb..1d62629cce33 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -598,49 +598,24 @@ static void intel_lvds_destroy(struct drm_connector 
*connector)
kfree(connector);
 }
 
-static int intel_lvds_set_property(struct drm_connector *connector,
-  struct drm_property *property,
-  uint64_t value)
-{
-
-   if (property == connector->scaling_mode_property) {
-   struct drm_crtc *crtc;
-
-   if (connector->state->scaling_mode == value) {
-   /* the LVDS scaling property is not changed */
-   return 0;
-   }
-   connector->state->scaling_mode = value;
-
-   crtc = intel_attached_encoder(connector)->base.crtc;
-   if (crtc && crtc->state->enable) {
-   /*
-* If the CRTC is enabled, the display will be changed
-* according to the new panel fitting mode.
-*/
-   intel_crtc_restore_mode(crtc);
-   }
-   }
-
-   return 0;
-}
-
 static const struct drm_connector_helper_funcs 
intel_lvds_connector_helper_funcs = {
.get_modes = intel_lvds_get_modes,
.mode_valid = intel_lvds_mode_valid,
+   .atomic_check = intel_digital_connector_atomic_check,
 };
 
 static const struct drm_connector_funcs intel_lvds_connector_funcs = {
.dpms = drm_atomic_helper_connector_dpms,
.detect = intel_lvds_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
-   .set_property = intel_lvds_set_property,
-   .atomic_get_property = intel_connector_atomic_get_property,
+   .set_property = drm_atomic_helper_connector_set_property,
+   .atomic_get_property = intel_digital_connector_atomic_get_property,
+   .atomic_set_property = intel_digital_connector_atomic_set_property,
.late_register = intel_connector_register,
.early_unregister = intel_connector_unregister,
.destroy = intel_lvds_destroy,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_duplicate_state = intel_digital_connector_duplicate_state,
 };
 
 static const struct drm_encoder_funcs intel_lvds_enc_funcs = {
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v6 04/12] drm/i915: Use per-connector scaling mode property

2017-05-01 Thread Maarten Lankhorst
None of the intel connectors can use all types of scaling modes,
so only try the ones that are possible. This is another preparation
for connectors towards conversion to atomic.

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/i915/intel_dp.c   | 29 -
 drivers/gpu/drm/i915/intel_dsi.c  | 28 +++-
 drivers/gpu/drm/i915/intel_lvds.c | 17 ++---
 3 files changed, 29 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index ea4366b264f1..8eb381ebbea6 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4884,18 +4884,7 @@ intel_dp_set_property(struct drm_connector *connector,
goto done;
}
 
-   if (is_edp(intel_dp) &&
-   property == connector->dev->mode_config.scaling_mode_property) {
-   if (val == DRM_MODE_SCALE_NONE) {
-   DRM_DEBUG_KMS("no scaling not supported\n");
-   return -EINVAL;
-   }
-   if (HAS_GMCH_DISPLAY(dev_priv) &&
-   val == DRM_MODE_SCALE_CENTER) {
-   DRM_DEBUG_KMS("centering not supported\n");
-   return -EINVAL;
-   }
-
+   if (property == connector->scaling_mode_property) {
if (connector->state->scaling_mode == val) {
/* the eDP scaling property is not changed */
return 0;
@@ -5178,17 +5167,23 @@ bool intel_dp_is_edp(struct drm_i915_private *dev_priv, 
enum port port)
 static void
 intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector 
*connector)
 {
+   struct drm_i915_private *dev_priv = to_i915(connector->dev);
+
intel_attach_force_audio_property(connector);
intel_attach_broadcast_rgb_property(connector);
intel_dp->color_range_auto = true;
 
if (is_edp(intel_dp)) {
-   drm_mode_create_scaling_mode_property(connector->dev);
-   drm_object_attach_property(
-   &connector->base,
-   connector->dev->mode_config.scaling_mode_property,
-   DRM_MODE_SCALE_ASPECT);
+   u32 allowed_scalers;
+
+   allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT) | 
BIT(DRM_MODE_SCALE_FULLSCREEN);
+   if (!HAS_GMCH_DISPLAY(dev_priv))
+   allowed_scalers |= BIT(DRM_MODE_SCALE_CENTER);
+
+   drm_mode_connector_attach_scaling_mode_property(connector, 
allowed_scalers);
+
connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
+
}
 }
 
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index ec141eb59e6d..8617d996abe5 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1591,7 +1591,6 @@ static int intel_dsi_set_property(struct drm_connector 
*connector,
  struct drm_property *property,
  uint64_t val)
 {
-   struct drm_device *dev = connector->dev;
struct drm_crtc *crtc;
int ret;
 
@@ -1599,17 +1598,7 @@ static int intel_dsi_set_property(struct drm_connector 
*connector,
if (ret)
return ret;
 
-   if (property == dev->mode_config.scaling_mode_property) {
-   if (val == DRM_MODE_SCALE_NONE) {
-   DRM_DEBUG_KMS("no scaling not supported\n");
-   return -EINVAL;
-   }
-   if (HAS_GMCH_DISPLAY(to_i915(dev)) &&
-   val == DRM_MODE_SCALE_CENTER) {
-   DRM_DEBUG_KMS("centering not supported\n");
-   return -EINVAL;
-   }
-
+   if (property == connector->scaling_mode_property) {
if (connector->state->scaling_mode == val)
return 0;
 
@@ -1672,13 +1661,18 @@ static const struct drm_connector_funcs 
intel_dsi_connector_funcs = {
 
 static void intel_dsi_add_properties(struct intel_connector *connector)
 {
-   struct drm_device *dev = connector->base.dev;
+   struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 
if (connector->panel.fixed_mode) {
-   drm_mode_create_scaling_mode_property(dev);
-   drm_object_attach_property(&connector->base.base,
-  
dev->mode_config.scaling_mode_property,
-  DRM_MODE_SCALE_ASPECT);
+   u32 allowed_scalers;
+
+   allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT) | 
BIT(DRM_MODE_SCALE_FULLSCREEN);
+   if (!HAS_GMCH_DISPLAY(dev_priv))
+   allowed_scalers |= BIT(DRM_MODE_SCALE_CENTER);
+
+   
drm_mode_connector_attach_scaling_mode_property(&connector->base,
+  

[Intel-gfx] [PATCH v6 10/12] drm/i915: Convert intel_hdmi connector properties to atomic

2017-05-01 Thread Maarten Lankhorst
intel_hdmi supports 3 properties, force_audio, broadcast rgb and
scaling mode. The last one is only created for eDP, so the is_eDP
in set_property is not required.

panel fitting and broadcast rgb are straightforward and only requires
changing compute_config.

force_audio is also used to force DVI mode, which means changes to
compute_config and mode_valid. mode_valid is called with
connection_mutex held, so it can safely dereference connector->state.

Signed-off-by: Maarten Lankhorst 
Reviewed-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_drv.h  |   3 -
 drivers/gpu/drm/i915/intel_hdmi.c | 149 +-
 2 files changed, 33 insertions(+), 119 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index aacfa8494491..9507364d4770 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -879,11 +879,8 @@ struct intel_hdmi {
enum drm_dp_dual_mode_type type;
int max_tmds_clock;
} dp_dual_mode;
-   bool limited_color_range;
-   bool color_range_auto;
bool has_hdmi_sink;
bool has_audio;
-   enum hdmi_force_audio force_audio;
bool rgb_quant_range_selectable;
struct intel_connector *attached_connector;
void (*write_infoframe)(struct drm_encoder *encoder,
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
b/drivers/gpu/drm/i915/intel_hdmi.c
index 58d690393b29..41267ffb3624 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1218,7 +1218,8 @@ static int intel_hdmi_source_max_tmds_clock(struct 
drm_i915_private *dev_priv)
 }
 
 static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
-bool respect_downstream_limits)
+bool respect_downstream_limits,
+bool force_dvi)
 {
struct drm_device *dev = intel_hdmi_to_dev(hdmi);
int max_tmds_clock = intel_hdmi_source_max_tmds_clock(to_i915(dev));
@@ -1234,7 +1235,7 @@ static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
if (info->max_tmds_clock)
max_tmds_clock = min(max_tmds_clock,
 info->max_tmds_clock);
-   else if (!hdmi->has_hdmi_sink)
+   else if (!hdmi->has_hdmi_sink || force_dvi)
max_tmds_clock = min(max_tmds_clock, 165000);
}
 
@@ -1243,13 +1244,14 @@ static int hdmi_port_clock_limit(struct intel_hdmi 
*hdmi,
 
 static enum drm_mode_status
 hdmi_port_clock_valid(struct intel_hdmi *hdmi,
- int clock, bool respect_downstream_limits)
+ int clock, bool respect_downstream_limits,
+ bool force_dvi)
 {
struct drm_i915_private *dev_priv = to_i915(intel_hdmi_to_dev(hdmi));
 
if (clock < 25000)
return MODE_CLOCK_LOW;
-   if (clock > hdmi_port_clock_limit(hdmi, respect_downstream_limits))
+   if (clock > hdmi_port_clock_limit(hdmi, respect_downstream_limits, 
force_dvi))
return MODE_CLOCK_HIGH;
 
/* BXT DPLL can't generate 223-240 MHz */
@@ -1273,6 +1275,8 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
enum drm_mode_status status;
int clock;
int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
+   bool force_dvi =
+   
READ_ONCE(to_intel_digital_connector_state(connector->state)->force_audio) == 
HDMI_AUDIO_OFF_DVI;
 
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
return MODE_NO_DBLESCAN;
@@ -1289,11 +1293,11 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
clock *= 2;
 
/* check if we can do 8bpc */
-   status = hdmi_port_clock_valid(hdmi, clock, true);
+   status = hdmi_port_clock_valid(hdmi, clock, true, force_dvi);
 
/* if we can't do 8bpc we may still be able to do 12bpc */
-   if (!HAS_GMCH_DISPLAY(dev_priv) && status != MODE_OK)
-   status = hdmi_port_clock_valid(hdmi, clock * 3 / 2, true);
+   if (!HAS_GMCH_DISPLAY(dev_priv) && status != MODE_OK && 
hdmi->has_hdmi_sink && !force_dvi)
+   status = hdmi_port_clock_valid(hdmi, clock * 3 / 2, true, 
force_dvi);
 
return status;
 }
@@ -1343,16 +1347,19 @@ bool intel_hdmi_compute_config(struct intel_encoder 
*encoder,
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
struct drm_display_mode *adjusted_mode = 
&pipe_config->base.adjusted_mode;
struct drm_scdc *scdc = &conn_state->connector->display_info.hdmi.scdc;
+   struct intel_digital_connector_state *intel_conn_state =
+   to_intel_digital_connector_state(conn_state);
int clock_8bpc = pipe_config->base.adjusted_mode.crtc_clock;
int clock_12bpc = clock_8bpc * 3 / 2;
int desired_bpp;
+   bool force_dvi = intel_conn_state->force_audio 

[Intel-gfx] [PATCH v6 12/12] drm/i915: Convert intel_sdvo connector properties to atomic.

2017-05-01 Thread Maarten Lankhorst
SDVO was the last connector that's still using the legacy paths
for properties, and this is with a reason!

This connector implements a lot of properties dynamically,
and some of them shared with the digital connector state,
so sdvo_connector_state subclasses intel_digital_connector_state.

set_property had a lot of validation, but this is handled in the
drm core, so most of the validation can die off. The properties
are written right before enabling the connector, since there is no
good way to update the properties without crtc.

Signed-off-by: Maarten Lankhorst 
Reviewed-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_atomic.c  |  40 ---
 drivers/gpu/drm/i915/intel_display.c |  37 ---
 drivers/gpu/drm/i915/intel_drv.h |   6 -
 drivers/gpu/drm/i915/intel_sdvo.c| 518 +++
 4 files changed, 280 insertions(+), 321 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_atomic.c 
b/drivers/gpu/drm/i915/intel_atomic.c
index 182909f266f5..d791b3ef89b5 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -36,46 +36,6 @@
 #include "intel_drv.h"
 
 /**
- * intel_connector_atomic_get_property - fetch legacy connector property value
- * @connector: connector to fetch property for
- * @state: state containing the property value
- * @property: property to look up
- * @val: pointer to write property value into
- *
- * The DRM core does not store shadow copies of properties for
- * atomic-capable drivers.  This entrypoint is used to fetch
- * the current value of a driver-specific connector property.
- *
- * This is a intermediary solution until all connectors are
- * converted to support full atomic properties.
- */
-int intel_connector_atomic_get_property(struct drm_connector *connector,
-   const struct drm_connector_state *state,
-   struct drm_property *property,
-   uint64_t *val)
-{
-   int i;
-
-   /*
-* TODO: We only have atomic modeset for planes at the moment, so the
-* crtc/connector code isn't quite ready yet.  Until it's ready,
-* continue to look up all property values in the DRM's shadow copy
-* in obj->properties->values[].
-*
-* When the crtc/connector state work matures, this function should
-* be updated to read the values out of the state structure instead.
-*/
-   for (i = 0; i < connector->base.properties->count; i++) {
-   if (connector->base.properties->properties[i] == property) {
-   *val = connector->base.properties->values[i];
-   return 0;
-   }
-   }
-
-   return -EINVAL;
-}
-
-/**
  * intel_digital_connector_atomic_get_property - hook for 
connector->atomic_get_property.
  * @connector: Connector to get the property for.
  * @state: Connector state to retrieve the property from.
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 108122daa807..2eea479f4c3b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13077,43 +13077,6 @@ static int intel_atomic_commit(struct drm_device *dev,
return 0;
 }
 
-void intel_crtc_restore_mode(struct drm_crtc *crtc)
-{
-   struct drm_device *dev = crtc->dev;
-   struct drm_atomic_state *state;
-   struct drm_crtc_state *crtc_state;
-   int ret;
-
-   state = drm_atomic_state_alloc(dev);
-   if (!state) {
-   DRM_DEBUG_KMS("[CRTC:%d:%s] crtc restore failed, out of memory",
- crtc->base.id, crtc->name);
-   return;
-   }
-
-   state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
-
-retry:
-   crtc_state = drm_atomic_get_crtc_state(state, crtc);
-   ret = PTR_ERR_OR_ZERO(crtc_state);
-   if (!ret) {
-   if (!crtc_state->active)
-   goto out;
-
-   crtc_state->mode_changed = true;
-   ret = drm_atomic_commit(state);
-   }
-
-   if (ret == -EDEADLK) {
-   drm_atomic_state_clear(state);
-   drm_modeset_backoff(state->acquire_ctx);
-   goto retry;
-   }
-
-out:
-   drm_atomic_state_put(state);
-}
-
 static const struct drm_crtc_funcs intel_crtc_funcs = {
.gamma_set = drm_atomic_helper_legacy_gamma_set,
.set_config = drm_atomic_helper_set_config,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 9507364d4770..110d9088be35 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1324,7 +1324,6 @@ unsigned int intel_rotation_info_size(const struct 
intel_rotation_info *rot_info
 bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv);
 void intel_mark_busy(struct drm_i915_private *dev_priv);
 void intel_mark_idle(struct drm_i915_private *dev_

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Calculate intermediate watermarks correctly.

2017-05-01 Thread Patchwork
== Series Details ==

Series: drm/i915: Calculate intermediate watermarks correctly.
URL   : https://patchwork.freedesktop.org/series/23769/
State : success

== Summary ==

Series 23769v1 drm/i915: Calculate intermediate watermarks correctly.
https://patchwork.freedesktop.org/api/1.0/series/23769/revisions/1/mbox/

Test gem_exec_suspend:
Subgroup basic-s4-devices:
pass   -> DMESG-WARN (fi-kbl-7560u) fdo#100125

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125

fi-bdw-5557u total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  
time:429s
fi-bdw-gvtdvmtotal:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  
time:436s
fi-bsw-n3050 total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  
time:584s
fi-bxt-j4205 total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  
time:509s
fi-bxt-t5700 total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  
time:563s
fi-byt-j1900 total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  
time:491s
fi-byt-n2820 total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time:483s
fi-hsw-4770  total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time:412s
fi-hsw-4770r total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time:402s
fi-ilk-650   total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  
time:416s
fi-ivb-3520m total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:478s
fi-ivb-3770  total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:475s
fi-kbl-7500u total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:455s
fi-kbl-7560u total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  
time:567s
fi-skl-6260u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time:455s
fi-skl-6700hqtotal:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  
time:570s
fi-skl-6700k total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  
time:463s
fi-skl-6770hqtotal:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time:497s
fi-skl-gvtdvmtotal:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  
time:428s
fi-snb-2520m total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time:525s
fi-snb-2600  total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  
time:399s

1d490e4b6d5324cfbf8dc800cf4a99471252802c drm-tip: 2017y-04m-28d-14h-14m-47s UTC 
integration manifest
aefcd83 drm/i915: Calculate vlv/chv intermediate watermarks correctly, v2.
e039db0 drm/i915: Calculate ironlake intermediate watermarks correctly, v2.
157989e drm/i915: Change get_existing_crtc_state to old state
60a0a96 drm/i915: Change use get_new_plane_state instead of existing plane state

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4586/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Convert connector properties to atomic. (rev7)

2017-05-01 Thread Patchwork
== Series Details ==

Series: drm/i915: Convert connector properties to atomic. (rev7)
URL   : https://patchwork.freedesktop.org/series/22634/
State : failure

== Summary ==

Series 22634v7 drm/i915: Convert connector properties to atomic.
https://patchwork.freedesktop.org/api/1.0/series/22634/revisions/7/mbox/

Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
pass   -> FAIL   (fi-snb-2600) fdo#17
Test kms_cursor_legacy:
Subgroup basic-flip-after-cursor-varying-size:
pass   -> INCOMPLETE (fi-bxt-t5700)

fdo#17 https://bugs.freedesktop.org/show_bug.cgi?id=17

fi-bdw-5557u total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  
time:432s
fi-bdw-gvtdvmtotal:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  
time:426s
fi-bsw-n3050 total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  
time:573s
fi-bxt-j4205 total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  
time:511s
fi-bxt-t5700 total:203  pass:189  dwarn:0   dfail:0   fail:0   skip:13 
fi-byt-j1900 total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  
time:489s
fi-byt-n2820 total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time:479s
fi-hsw-4770  total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time:412s
fi-hsw-4770r total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time:404s
fi-ilk-650   total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  
time:418s
fi-ivb-3520m total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:494s
fi-ivb-3770  total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:462s
fi-kbl-7500u total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:457s
fi-kbl-7560u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time:565s
fi-skl-6260u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time:456s
fi-skl-6700hqtotal:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  
time:572s
fi-skl-6700k total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  
time:464s
fi-skl-6770hqtotal:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time:497s
fi-skl-gvtdvmtotal:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  
time:429s
fi-snb-2520m total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time:531s
fi-snb-2600  total:278  pass:248  dwarn:0   dfail:0   fail:1   skip:29  
time:417s

1d490e4b6d5324cfbf8dc800cf4a99471252802c drm-tip: 2017y-04m-28d-14h-14m-47s UTC 
integration manifest
a19e169 drm/i915: Convert intel_sdvo connector properties to atomic.
cc9a005 drm/i915: Handle force_audio correctly in intel_sdvo
e8d375f drm/i915: Convert intel_hdmi connector properties to atomic
a14800a drm/i915: Convert intel_dp properties to atomic, v2.
d381f3c drm/i915: Make intel_dp->has_audio reflect hw state only
ac661f4 drm/i915: Convert LVDS connector properties to atomic.
b1a4909 drm/i915: Convert DSI connector properties to atomic.
657436d drm/i915: Add plumbing for digital connector state, v3.
99a75d2 drm/i915: Use per-connector scaling mode property
9fc8494 drm/i915: Use atomic scaling_mode instead of panel.fitting_mode
fc9a906 drm/atomic: Add support for custom scaling mode properties, v2
1561141 drm/atomic: Handle picture_aspect_ratio in atomic core

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4587/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: New vfunc prepare_request

2017-05-01 Thread Oscar Mateo



On 04/29/2017 08:31 AM, Chris Wilson wrote:

On Fri, Apr 28, 2017 at 05:26:09PM +, Oscar Mateo wrote:

This will be more useful later to support platforms that need to emit
HW commands at the beginning of every request (more general than emitting
things at the beginning of every batchbuffer, which is already covered by
emit_bb_start).

We already have one... You are presenting this without a good reason and
failing to transform similar code, which indicates to me that this vfunc
isn't that general.


It looks like I've missed that. What function are you talking about?


Cc: Chris Wilson 
Cc: Joonas Lahtinen 
Signed-off-by: Oscar Mateo 
---
  drivers/gpu/drm/i915/intel_lrc.c| 17 -
  drivers/gpu/drm/i915/intel_ringbuffer.h |  1 +
  2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 9488578..a5c055a 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -687,6 +687,15 @@ static bool insert_request(struct i915_priotree *pt, 
struct rb_root *root)
return first;
  }
  
+static int execlists_prepare_request(struct drm_i915_gem_request *request)

+{
+   u32 *cs = intel_ring_begin(request, 0);
+   if (IS_ERR(cs))
+   return PTR_ERR(cs);
+
+   return 0;
+}
+
  static void execlists_submit_request(struct drm_i915_gem_request *request)
  {
struct intel_engine_cs *engine = request->engine;
@@ -879,7 +888,6 @@ static int execlists_request_alloc(struct 
drm_i915_gem_request *request)
  {
struct intel_engine_cs *engine = request->engine;
struct intel_context *ce = &request->ctx->engine[engine->id];
-   u32 *cs;
int ret;
  
  	GEM_BUG_ON(!ce->pin_count);

@@ -904,11 +912,9 @@ static int execlists_request_alloc(struct 
drm_i915_gem_request *request)
goto err;
}
  
-	cs = intel_ring_begin(request, 0);

-   if (IS_ERR(cs)) {
-   ret = PTR_ERR(cs);
+   ret = engine->prepare_request(request);
+   if (ret)
goto err_unreserve;
-   }
  
  	if (!ce->initialised) {

ret = engine->init_context(request);
@@ -1650,6 +1656,7 @@ void intel_logical_ring_cleanup(struct intel_engine_cs 
*engine)
  
  static void execlists_set_default_submission(struct intel_engine_cs *engine)

  {
+   engine->prepare_request = execlists_prepare_request;
engine->submit_request = execlists_submit_request;
engine->schedule = execlists_schedule;
engine->irq_tasklet.func = intel_lrc_irq_handler;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h 
b/drivers/gpu/drm/i915/intel_ringbuffer.h
index d901831..67de978 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -303,6 +303,7 @@ struct intel_engine_cs {
void(*emit_breadcrumb)(struct drm_i915_gem_request *req,
   u32 *cs);
int emit_breadcrumb_sz;
+   int (*prepare_request)(struct drm_i915_gem_request *req);

Why in the emit group?
-Chris



Missing newline.

-- Oscar

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v8 4/4] drm/dp: Track MST link bandwidth

2017-05-01 Thread Pandiyan, Dhinakaran
On Mon, 2017-05-01 at 10:24 +0200, Maarten Lankhorst wrote:
> Op 29-04-17 om 01:14 schreef Dhinakaran Pandiyan:
> > From: "Pandiyan, Dhinakaran" 
> >
> > Use the added helpers to track MST link bandwidth for atomic modesets.
> > Link bw is acquired in the ->atomic_check() phase when CRTCs are being
> > enabled with drm_atomic_find_vcpi_slots(). Similarly, link bw is released
> > during ->atomic_check() with the connector helper callback ->atomic_check()
> > when CRTCs are disabled.
> >
> > v6: active_changed does not alter vcpi allocations (Maarten)
> > v5: Implement connector->atomic_check() in place of atomic_release()
> > v4: Return an int from intel_dp_mst_atomic_release() (Maarten)
> > v3:
> >  Handled the case where ->atomic_release() is called more than once
> >  during an atomic_check() for the same state.
> > v2:
> >  Squashed atomic_release() implementation and caller (Daniel)
> >  Fixed logic for connector-crtc switching case (Daniel)
> >  Fixed logic for suspend-resume case.
> >
> > Cc: Daniel Vetter 
> > Cc: Maarten Lankhorst 
> > Cc: Archit Taneja 
> > Cc: Chris Wilson 
> > Cc: Harry Wentland 
> > Signed-off-by: Dhinakaran Pandiyan 
> Missing changes since v7. ;)
> Otherwise this looks good, if testbot is happy too then for the whole series:
> 
> Reviewed-by: Maarten Lankhorst 


I have updated the version number for the changes only when the specific
patch has changed. But I'll check that again and submit the series for
CI. Thanks a lot for the review!

-DK 


> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v6 01/12] drm/atomic: Handle picture_aspect_ratio in atomic core

2017-05-01 Thread Manasi Navare
On Mon, May 01, 2017 at 03:37:53PM +0200, Maarten Lankhorst wrote:
> This is only used in i915, which had used its own non-taomic way to
> deal with the picture aspect ratio. Move selected aspect_ratio to
> atomic state and use the atomic state in the affected i915 connectors.
>

Please correct the typo, should be non-atomic instead of non-taomic.

Manasi
 
> Signed-off-by: Maarten Lankhorst 
> ---
>  drivers/gpu/drm/drm_atomic.c  |  4 
>  drivers/gpu/drm/i915/intel_drv.h  |  1 -
>  drivers/gpu/drm/i915/intel_hdmi.c | 18 +++---
>  drivers/gpu/drm/i915/intel_sdvo.c | 23 +++
>  include/drm/drm_connector.h   | 10 ++
>  5 files changed, 20 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 30229ab719c0..77bb36e956db 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1123,6 +1123,8 @@ int drm_atomic_connector_set_property(struct 
> drm_connector *connector,
>*/
>   if (state->link_status != DRM_LINK_STATUS_GOOD)
>   state->link_status = val;
> + } else if (property == config->aspect_ratio_property) {
> + state->picture_aspect_ratio = val;
>   } else if (connector->funcs->atomic_set_property) {
>   return connector->funcs->atomic_set_property(connector,
>   state, property, val);
> @@ -1199,6 +1201,8 @@ drm_atomic_connector_get_property(struct drm_connector 
> *connector,
>   *val = state->tv.hue;
>   } else if (property == config->link_status_property) {
>   *val = state->link_status;
> + } else if (property == config->aspect_ratio_property) {
> + *val = state->picture_aspect_ratio;
>   } else if (connector->funcs->atomic_get_property) {
>   return connector->funcs->atomic_get_property(connector,
>   state, property, val);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h 
> b/drivers/gpu/drm/i915/intel_drv.h
> index 54f3ff840812..d38fed78500b 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -877,7 +877,6 @@ struct intel_hdmi {
>   bool has_audio;
>   enum hdmi_force_audio force_audio;
>   bool rgb_quant_range_selectable;
> - enum hdmi_picture_aspect aspect_ratio;
>   struct intel_connector *attached_connector;
>   void (*write_infoframe)(struct drm_encoder *encoder,
>   const struct intel_crtc_state *crtc_state,
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
> b/drivers/gpu/drm/i915/intel_hdmi.c
> index 52f0b2d5fad2..58d690393b29 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1408,7 +1408,7 @@ bool intel_hdmi_compute_config(struct intel_encoder 
> *encoder,
>   }
>  
>   /* Set user selected PAR to incoming mode's member */
> - adjusted_mode->picture_aspect_ratio = intel_hdmi->aspect_ratio;
> + adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
>  
>   pipe_config->lane_count = 4;
>  
> @@ -1654,19 +1654,7 @@ intel_hdmi_set_property(struct drm_connector 
> *connector,
>   }
>  
>   if (property == connector->dev->mode_config.aspect_ratio_property) {
> - switch (val) {
> - case DRM_MODE_PICTURE_ASPECT_NONE:
> - intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
> - break;
> - case DRM_MODE_PICTURE_ASPECT_4_3:
> - intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_4_3;
> - break;
> - case DRM_MODE_PICTURE_ASPECT_16_9:
> - intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_16_9;
> - break;
> - default:
> - return -EINVAL;
> - }
> + connector->state->picture_aspect_ratio = val;
>   goto done;
>   }
>  
> @@ -1828,7 +1816,7 @@ intel_hdmi_add_properties(struct intel_hdmi 
> *intel_hdmi, struct drm_connector *c
>   intel_attach_broadcast_rgb_property(connector);
>   intel_hdmi->color_range_auto = true;
>   intel_attach_aspect_ratio_property(connector);
> - intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
> + connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
>  }
>  
>  /*
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c 
> b/drivers/gpu/drm/i915/intel_sdvo.c
> index 816a6f5a3fd9..ef6fa87b2f8a 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -107,11 +107,6 @@ struct intel_sdvo {
>   bool color_range_auto;
>  
>   /**
> -  * HDMI user specified aspect ratio
> -  */
> - enum hdmi_picture_aspect aspect_ratio;
> -
> - /**
>* This is set if we're going to treat the device as TV-out.
>*
>* While we have these nice friendly f

[Intel-gfx] [RESEND FOR CI PATCH v8 0/4] Adding driver-private objects to atomic state

2017-05-01 Thread Dhinakaran Pandiyan
Resending for CI.

Pandiyan, Dhinakaran (4):
  drm: Add driver-private objects to atomic state
  drm/dp: Introduce MST topology state to track available link bandwidth
  drm/dp: Add DP MST helpers to atomically find and release vcpi slots
  drm/dp: Track MST link bandwidth

 drivers/gpu/drm/drm_atomic.c  |  65 +++
 drivers/gpu/drm/drm_atomic_helper.c   |   5 ++
 drivers/gpu/drm/drm_dp_mst_topology.c | 150 ++
 drivers/gpu/drm/i915/intel_dp_mst.c   |  48 +--
 include/drm/drm_atomic.h  |  95 +
 include/drm/drm_dp_mst_helper.h   |  26 ++
 6 files changed, 383 insertions(+), 6 deletions(-)

-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RESEND FOR CI PATCH v8 4/4] drm/dp: Track MST link bandwidth

2017-05-01 Thread Dhinakaran Pandiyan
From: "Pandiyan, Dhinakaran" 

Use the added helpers to track MST link bandwidth for atomic modesets.
Link bw is acquired in the ->atomic_check() phase when CRTCs are being
enabled with drm_atomic_find_vcpi_slots(). Similarly, link bw is released
during ->atomic_check() with the connector helper callback ->atomic_check()
when CRTCs are disabled.

v6: active_changed does not alter vcpi allocations (Maarten)
v5: Implement connector->atomic_check() in place of atomic_release()
v4: Return an int from intel_dp_mst_atomic_release() (Maarten)
v3:
 Handled the case where ->atomic_release() is called more than once
 during an atomic_check() for the same state.
v2:
 Squashed atomic_release() implementation and caller (Daniel)
 Fixed logic for connector-crtc switching case (Daniel)
 Fixed logic for suspend-resume case.

Cc: Daniel Vetter 
Cc: Maarten Lankhorst 
Cc: Archit Taneja 
Cc: Chris Wilson 
Cc: Harry Wentland 

Acked-by: Harry Wentland 
Reviewed-by: Maarten Lankhorst 
Signed-off-by: Dhinakaran Pandiyan 
---
 drivers/gpu/drm/i915/intel_dp_mst.c | 48 -
 1 file changed, 42 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c 
b/drivers/gpu/drm/i915/intel_dp_mst.c
index 5af22a7..68c788e 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -39,7 +39,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder 
*encoder,
struct intel_dp *intel_dp = &intel_dig_port->dp;
struct intel_connector *connector =
to_intel_connector(conn_state->connector);
-   struct drm_atomic_state *state;
+   struct drm_atomic_state *state = pipe_config->base.state;
int bpp;
int lane_count, slots;
const struct drm_display_mode *adjusted_mode = 
&pipe_config->base.adjusted_mode;
@@ -57,20 +57,24 @@ static bool intel_dp_mst_compute_config(struct 
intel_encoder *encoder,
 * seem to suggest we should do otherwise.
 */
lane_count = intel_dp_max_lane_count(intel_dp);
-
pipe_config->lane_count = lane_count;
 
pipe_config->pipe_bpp = bpp;
-   pipe_config->port_clock = intel_dp_max_link_rate(intel_dp);
 
-   state = pipe_config->base.state;
+   pipe_config->port_clock = intel_dp_max_link_rate(intel_dp);
 
if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, connector->port))
pipe_config->has_audio = true;
-   mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp);
 
+   mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp);
pipe_config->pbn = mst_pbn;
-   slots = drm_dp_find_vcpi_slots(&intel_dp->mst_mgr, mst_pbn);
+
+   slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr,
+ connector->port, mst_pbn);
+   if (slots < 0) {
+   DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots);
+   return false;
+   }
 
intel_link_compute_m_n(bpp, lane_count,
   adjusted_mode->crtc_clock,
@@ -80,7 +84,38 @@ static bool intel_dp_mst_compute_config(struct intel_encoder 
*encoder,
pipe_config->dp_m_n.tu = slots;
 
return true;
+}
 
+static int intel_dp_mst_atomic_check(struct drm_connector *connector,
+   struct drm_connector_state *new_conn_state)
+{
+   struct drm_atomic_state *state = new_conn_state->state;
+   struct drm_connector_state *old_conn_state;
+   struct drm_crtc *old_crtc;
+   struct drm_crtc_state *crtc_state;
+   int slots, ret = 0;
+
+   old_conn_state = drm_atomic_get_old_connector_state(state, connector);
+   old_crtc = old_conn_state->crtc;
+   if (!old_crtc)
+   return ret;
+
+   crtc_state = drm_atomic_get_new_crtc_state(state, old_crtc);
+   slots = to_intel_crtc_state(crtc_state)->dp_m_n.tu;
+   if (drm_atomic_crtc_needs_modeset(crtc_state) && slots > 0) {
+   struct drm_dp_mst_topology_mgr *mgr;
+   struct drm_encoder *old_encoder;
+
+   old_encoder = old_conn_state->best_encoder;
+   mgr = &enc_to_mst(old_encoder)->primary->dp.mst_mgr;
+
+   ret = drm_dp_atomic_release_vcpi_slots(state, mgr, slots);
+   if (ret)
+   DRM_DEBUG_KMS("failed releasing %d vcpi slots:%d\n", 
slots, ret);
+   else
+   to_intel_crtc_state(crtc_state)->dp_m_n.tu = 0;
+   }
+   return ret;
 }
 
 static void intel_mst_disable_dp(struct intel_encoder *encoder,
@@ -378,6 +413,7 @@ static const struct drm_connector_helper_funcs 
intel_dp_mst_connector_helper_fun
.mode_valid = intel_dp_mst_mode_valid,
.atomic_best_encoder = intel_mst_atomic_best_encoder,
.best_encoder = intel_mst_best_encoder,
+   .atomic_check = intel_dp_mst_atomic_check,
 };
 
 static void intel_dp_mst_encoder_destroy(struct drm_encoder *encoder)
-- 
2.7.4

_

[Intel-gfx] [RESEND FOR CI PATCH v8 2/4] drm/dp: Introduce MST topology state to track available link bandwidth

2017-05-01 Thread Dhinakaran Pandiyan
From: "Pandiyan, Dhinakaran" 

Link bandwidth is shared between multiple display streams in DP MST
configurations. The DP MST topology manager structure maintains the
shared link bandwidth for a primary link directly connected to the GPU. For
atomic modesetting drivers, checking if there is sufficient link bandwidth
for a mode needs to be done during the atomic_check phase to avoid failed
modesets. Let's encapsulate the available link bw information in a
private state structure so that bw can be allocated and released atomically
for each of the ports sharing the primary link.

v3: WARN_ON() if connection_mutex is not held (Archit)
v2: Included kernel doc, moved state initialization and switched to
kmemdup() for allocation (Daniel)

Cc: Daniel Vetter 
Cc: Maarten Lankhorst 
Cc: Archit Taneja 
Cc: Chris Wilson 
Cc: Harry Wentland 

Reviewed-by: Maarten Lankhorst 
Reviewed-by: Harry Wentland 
Signed-off-by: Dhinakaran Pandiyan 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 75 +++
 include/drm/drm_dp_mst_helper.h   | 20 ++
 2 files changed, 95 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index d3fc7e4..0ad0baa 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2936,6 +2936,69 @@ static void drm_dp_destroy_connector_work(struct 
work_struct *work)
(*mgr->cbs->hotplug)(mgr);
 }
 
+void *drm_dp_mst_duplicate_state(struct drm_atomic_state *state, void *obj)
+{
+   struct drm_dp_mst_topology_mgr *mgr = obj;
+   struct drm_dp_mst_topology_state *new_mst_state;
+
+   if (WARN_ON(!mgr->state))
+   return NULL;
+
+   new_mst_state = kmemdup(mgr->state, sizeof(*new_mst_state), GFP_KERNEL);
+   if (new_mst_state)
+   new_mst_state->state = state;
+   return new_mst_state;
+}
+
+void drm_dp_mst_swap_state(void *obj, void **obj_state_ptr)
+{
+   struct drm_dp_mst_topology_mgr *mgr = obj;
+   struct drm_dp_mst_topology_state **topology_state_ptr;
+
+   topology_state_ptr = (struct drm_dp_mst_topology_state **)obj_state_ptr;
+
+   mgr->state->state = (*topology_state_ptr)->state;
+   swap(*topology_state_ptr, mgr->state);
+   mgr->state->state = NULL;
+}
+
+void drm_dp_mst_destroy_state(void *obj_state)
+{
+   kfree(obj_state);
+}
+
+static const struct drm_private_state_funcs mst_state_funcs = {
+   .duplicate_state = drm_dp_mst_duplicate_state,
+   .swap_state = drm_dp_mst_swap_state,
+   .destroy_state = drm_dp_mst_destroy_state,
+};
+
+/**
+ * drm_atomic_get_mst_topology_state: get MST topology state
+ *
+ * @state: global atomic state
+ * @mgr: MST topology manager, also the private object in this case
+ *
+ * This function wraps drm_atomic_get_priv_obj_state() passing in the MST 
atomic
+ * state vtable so that the private object state returned is that of a MST
+ * topology object. Also, drm_atomic_get_private_obj_state() expects the caller
+ * to care of the locking, so warn if don't hold the connection_mutex.
+ *
+ * RETURNS:
+ *
+ * The MST topology state or error pointer.
+ */
+struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state(struct 
drm_atomic_state *state,
+   struct 
drm_dp_mst_topology_mgr *mgr)
+{
+   struct drm_device *dev = mgr->dev;
+
+   WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
+   return drm_atomic_get_private_obj_state(state, mgr,
+   &mst_state_funcs);
+}
+EXPORT_SYMBOL(drm_atomic_get_mst_topology_state);
+
 /**
  * drm_dp_mst_topology_mgr_init - initialise a topology manager
  * @mgr: manager struct to initialise
@@ -2980,6 +3043,15 @@ int drm_dp_mst_topology_mgr_init(struct 
drm_dp_mst_topology_mgr *mgr,
if (test_calc_pbn_mode() < 0)
DRM_ERROR("MST PBN self-test failed\n");
 
+   mgr->state = kzalloc(sizeof(*mgr->state), GFP_KERNEL);
+   if (mgr->state == NULL)
+   return -ENOMEM;
+   mgr->state->mgr = mgr;
+
+   /* max. time slots - one slot for MTP header */
+   mgr->state->avail_slots = 63;
+   mgr->funcs = &mst_state_funcs;
+
return 0;
 }
 EXPORT_SYMBOL(drm_dp_mst_topology_mgr_init);
@@ -3000,6 +3072,9 @@ void drm_dp_mst_topology_mgr_destroy(struct 
drm_dp_mst_topology_mgr *mgr)
mutex_unlock(&mgr->payload_lock);
mgr->dev = NULL;
mgr->aux = NULL;
+   kfree(mgr->state);
+   mgr->state = NULL;
+   mgr->funcs = NULL;
 }
 EXPORT_SYMBOL(drm_dp_mst_topology_mgr_destroy);
 
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index 5b02476..0b371df 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -24,6 +24,7 @@
 
 #include 
 #include 
+#include 
 
 struct drm_dp_mst_branch;
 
@@ -403,6 +404,12 @@ struct drm_dp_payload {
 

[Intel-gfx] [RESEND FOR CI PATCH v8 3/4] drm/dp: Add DP MST helpers to atomically find and release vcpi slots

2017-05-01 Thread Dhinakaran Pandiyan
From: "Pandiyan, Dhinakaran" 

drm_dp_atomic_find_vcpi_slots() should be called from ->atomic_check() to
check there are sufficient vcpi slots for a mode and to add that to the
state. This should be followed by a call to drm_dp_mst_allocate_vcpi()
in ->atomic_commit() to initialize a struct vcpi for the port.

drm_dp_atomic_release_vcpi_slots() should be called from
->atomic_check() to release a port's vcpi slot allocation from the
state.

Drivers that do not make use of this atomic helper are expected to call
drm_dp_find_vcpi_slots() instead before calling
drm_dp_mst_allocate_vcpi().

v3: drm_dp_atomic_release_vcpi_slots() now needs to know how many slots
to release as we may not have a valid reference to port.
v2:
Added checks for verifying the port reference is valid
Moved get_mst_topology_state() into the helpers (Daniel)
Changed find_vcpi_slots() to not depend on current allocation

Cc: Daniel Vetter 
Cc: Maarten Lankhorst 
Cc: Archit Taneja 
Cc: Chris Wilson 
Cc: Harry Wentland 

Reviewed-by: Maarten Lankhorst 
Reviewed-by: Harry Wentland 
Signed-off-by: Dhinakaran Pandiyan 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 75 +++
 include/drm/drm_dp_mst_helper.h   |  6 +++
 2 files changed, 81 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 0ad0baa..d1cbb9c 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2498,6 +2498,81 @@ static int drm_dp_init_vcpi(struct 
drm_dp_mst_topology_mgr *mgr,
 }
 
 /**
+ * drm_dp_atomic_find_vcpi_slots() - Find and add vcpi slots to the state
+ * @state: global atomic state
+ * @mgr: MST topology manager for the port
+ * @port: port to find vcpi slots for
+ * @pbn: bandwidth required for the mode in PBN
+ *
+ * RETURNS:
+ * Total slots in the atomic state assigned for this port or error
+ */
+int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,
+ struct drm_dp_mst_topology_mgr *mgr,
+ struct drm_dp_mst_port *port, int pbn)
+{
+   struct drm_dp_mst_topology_state *topology_state;
+   int req_slots;
+
+   topology_state = drm_atomic_get_mst_topology_state(state, mgr);
+   if (topology_state == NULL)
+   return -ENOMEM;
+
+   port = drm_dp_get_validated_port_ref(mgr, port);
+   if (port == NULL)
+   return -EINVAL;
+   req_slots = DIV_ROUND_UP(pbn, mgr->pbn_div);
+   DRM_DEBUG_KMS("vcpi slots req=%d, avail=%d\n",
+   req_slots, topology_state->avail_slots);
+
+   if (req_slots > topology_state->avail_slots) {
+   drm_dp_put_port(port);
+   return -ENOSPC;
+   }
+
+   topology_state->avail_slots -= req_slots;
+   DRM_DEBUG_KMS("vcpi slots avail=%d", topology_state->avail_slots);
+
+   drm_dp_put_port(port);
+   return req_slots;
+}
+EXPORT_SYMBOL(drm_dp_atomic_find_vcpi_slots);
+
+/**
+ * drm_dp_atomic_release_vcpi_slots() - Release allocated vcpi slots
+ * @state: global atomic state
+ * @mgr: MST topology manager for the port
+ * @slots: number of vcpi slots to release
+ *
+ * RETURNS:
+ * 0 if @slots were added back to &drm_dp_mst_topology_state->avail_slots or
+ * negative error code
+ */
+int drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state,
+struct drm_dp_mst_topology_mgr *mgr,
+int slots)
+{
+   struct drm_dp_mst_topology_state *topology_state;
+
+   topology_state = drm_atomic_get_mst_topology_state(state, mgr);
+   if (topology_state == NULL)
+   return -ENOMEM;
+
+   /* We cannot rely on port->vcpi.num_slots to update
+* topology_state->avail_slots as the port may not exist if the parent
+* branch device was unplugged. This should be fixed by tracking
+* per-port slot allocation in drm_dp_mst_topology_state instead of
+* depending on the caller to tell us how many slots to release.
+*/
+   topology_state->avail_slots += slots;
+   DRM_DEBUG_KMS("vcpi slots released=%d, avail=%d\n",
+   slots, topology_state->avail_slots);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_atomic_release_vcpi_slots);
+
+/**
  * drm_dp_mst_allocate_vcpi() - Allocate a virtual channel
  * @mgr: manager for this port
  * @port: port to allocate a virtual channel for.
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index 0b371df..177ab6f 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -615,5 +615,11 @@ void drm_dp_mst_topology_mgr_suspend(struct 
drm_dp_mst_topology_mgr *mgr);
 int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr);
 struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state(struct 
drm_atomic_state *state,
   

[Intel-gfx] [RESEND FOR CI PATCH v8 1/4] drm: Add driver-private objects to atomic state

2017-05-01 Thread Dhinakaran Pandiyan
From: "Pandiyan, Dhinakaran" 

It is necessary to track states for objects other than connector, crtc
and plane for atomic modesets. But adding objects like DP MST link
bandwidth to drm_atomic_state would mean that a non-core object will be
modified by the core helper functions for swapping and clearing
it's state. So, lets add void * objects and helper functions that operate
on void * types to keep these objects and states private to the core.
Drivers can then implement specific functions to swap and clear states.
The other advantage having just void * for these objects in
drm_atomic_state is that objects of different types can be managed in the
same state array.

v7: Use __for_each_private_obj to define for_each_private_obj (Maarten)
v6: More kernel-doc to keep 0-day happy
v5: Remove more NULL checks (Maarten)
v4: Avoid redundant NULL checks when private_objs array is empty (Maarten)
v3: Macro alignment (Chris)
v2: Added docs and new iterator to filter private objects (Daniel)

Cc: Daniel Vetter 
Cc: Maarten Lankhorst 
Cc: Archit Taneja 
Cc: Chris Wilson 
Cc: Harry Wentland 

Acked-by: Harry Wentland 
Reviewed-by: Harry Wentland 
Reviewed-by: Maarten Lankhorst 
Suggested-by: Daniel Vetter 
Signed-off-by: Dhinakaran Pandiyan 
---
 drivers/gpu/drm/drm_atomic.c| 65 +
 drivers/gpu/drm/drm_atomic_helper.c |  5 ++
 include/drm/drm_atomic.h| 95 +
 3 files changed, 165 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 30229ab..8e5f3eb 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -57,6 +57,7 @@ void drm_atomic_state_default_release(struct drm_atomic_state 
*state)
kfree(state->connectors);
kfree(state->crtcs);
kfree(state->planes);
+   kfree(state->private_objs);
 }
 EXPORT_SYMBOL(drm_atomic_state_default_release);
 
@@ -184,6 +185,17 @@ void drm_atomic_state_default_clear(struct 
drm_atomic_state *state)
state->planes[i].ptr = NULL;
state->planes[i].state = NULL;
}
+
+   for (i = 0; i < state->num_private_objs; i++) {
+   void *obj_state = state->private_objs[i].obj_state;
+
+   state->private_objs[i].funcs->destroy_state(obj_state);
+   state->private_objs[i].obj = NULL;
+   state->private_objs[i].obj_state = NULL;
+   state->private_objs[i].funcs = NULL;
+   }
+   state->num_private_objs = 0;
+
 }
 EXPORT_SYMBOL(drm_atomic_state_default_clear);
 
@@ -978,6 +990,59 @@ static void drm_atomic_plane_print_state(struct 
drm_printer *p,
 }
 
 /**
+ * drm_atomic_get_private_obj_state - get private object state
+ * @state: global atomic state
+ * @obj: private object to get the state for
+ * @funcs: pointer to the struct of function pointers that identify the object
+ * type
+ *
+ * This function returns the private object state for the given private object,
+ * allocating the state if needed. It does not grab any locks as the caller is
+ * expected to care of any required locking.
+ *
+ * RETURNS:
+ *
+ * Either the allocated state or the error code encoded into a pointer.
+ */
+void *
+drm_atomic_get_private_obj_state(struct drm_atomic_state *state, void *obj,
+ const struct drm_private_state_funcs *funcs)
+{
+   int index, num_objs, i;
+   size_t size;
+   struct __drm_private_objs_state *arr;
+
+   for (i = 0; i < state->num_private_objs; i++)
+   if (obj == state->private_objs[i].obj &&
+   state->private_objs[i].obj_state)
+   return state->private_objs[i].obj_state;
+
+   num_objs = state->num_private_objs + 1;
+   size = sizeof(*state->private_objs) * num_objs;
+   arr = krealloc(state->private_objs, size, GFP_KERNEL);
+   if (!arr)
+   return ERR_PTR(-ENOMEM);
+
+   state->private_objs = arr;
+   index = state->num_private_objs;
+   memset(&state->private_objs[index], 0, sizeof(*state->private_objs));
+
+   state->private_objs[index].obj_state = funcs->duplicate_state(state, 
obj);
+   if (!state->private_objs[index].obj_state)
+   return ERR_PTR(-ENOMEM);
+
+   state->private_objs[index].obj = obj;
+   state->private_objs[index].funcs = funcs;
+   state->num_private_objs = num_objs;
+
+   DRM_DEBUG_ATOMIC("Added new private object state %p to %p\n",
+state->private_objs[index].obj_state, state);
+
+   return state->private_objs[index].obj_state;
+}
+EXPORT_SYMBOL(drm_atomic_get_private_obj_state);
+
+/**
  * drm_atomic_get_connector_state - get connector state
  * @state: global atomic state object
  * @connector: connector to get state object for
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index cfeda5f..cce05fb 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/

[Intel-gfx] ✓ Fi.CI.BAT: success for Adding driver-private objects to atomic state

2017-05-01 Thread Patchwork
== Series Details ==

Series: Adding driver-private objects to atomic state
URL   : https://patchwork.freedesktop.org/series/23775/
State : success

== Summary ==

Series 23775v1 Adding driver-private objects to atomic state
https://patchwork.freedesktop.org/api/1.0/series/23775/revisions/1/mbox/

Test gvt_basic:
Subgroup invalid-placeholder-test:
skip   -> INCOMPLETE (fi-hsw-4770r) fdo#100256

fdo#100256 https://bugs.freedesktop.org/show_bug.cgi?id=100256

fi-bdw-5557u total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  
time:431s
fi-bdw-gvtdvmtotal:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  
time:434s
fi-bsw-n3050 total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  
time:566s
fi-bxt-j4205 total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  
time:507s
fi-bxt-t5700 total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  
time:544s
fi-byt-j1900 total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  
time:485s
fi-byt-n2820 total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time:486s
fi-hsw-4770  total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time:410s
fi-hsw-4770r total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:15 
fi-ilk-650   total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  
time:414s
fi-ivb-3520m total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:492s
fi-ivb-3770  total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:467s
fi-kbl-7500u total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:456s
fi-kbl-7560u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time:671s
fi-skl-6260u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time:457s
fi-skl-6700hqtotal:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  
time:577s
fi-skl-6700k total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  
time:461s
fi-skl-6770hqtotal:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time:488s
fi-snb-2520m total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time:529s
fi-snb-2600  total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  
time:409s
fi-skl-gvtdvm failed to collect. IGT log at Patchwork_4588/fi-skl-gvtdvm/igt.log

1d490e4b6d5324cfbf8dc800cf4a99471252802c drm-tip: 2017y-04m-28d-14h-14m-47s UTC 
integration manifest
0e053d7 drm/dp: Track MST link bandwidth
e47590e drm/dp: Add DP MST helpers to atomically find and release vcpi slots
57ae56a drm/dp: Introduce MST topology state to track available link bandwidth
969f6f6 drm: Add driver-private objects to atomic state

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4588/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v7 13/20] drm/i915/guc: Rename the function that resets the GuC

2017-05-01 Thread Michel Thierry

On 28/04/17 00:40, Tvrtko Ursulin wrote:

--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -46,9 +46,9 @@ static int __intel_uc_reset_hw(struct
drm_i915_private *dev_priv)
 int ret;
 u32 guc_status;

-ret = intel_guc_reset(dev_priv);
+ret = intel_reset_guc(dev_priv);
 if (ret) {
-DRM_ERROR("GuC reset failed, ret = %d\n", ret);
+DRM_ERROR("Reset GuC failed, ret = %d\n", ret);


As a non-native speaker I might be wrong, but was thinking something
like "Failed to reset GuC", "Resetting GuC failed", "Reset of GuC
failed" would be clearer? I leave it for someone more competent to decide.


"Failed to reset GuC" sounds good to me.
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3 1/2] PCI / PM: Add needs_resume flag to avoid suspend complete optimization

2017-05-01 Thread Rafael J. Wysocki
On Sunday, April 30, 2017 03:57:13 PM Imre Deak wrote:
> On Sat, Apr 29, 2017 at 12:21:57PM +0200, Rafael J. Wysocki wrote:
> > On Friday, April 28, 2017 11:33:02 PM Rafael J. Wysocki wrote:
> > > On Friday, April 28, 2017 05:16:02 PM Imre Deak wrote:
> > > > Some drivers - like i915 - may not support the system suspend direct
> > > > complete optimization due to differences in their runtime and system
> > > > suspend sequence. Add a flag that when set resumes the device before
> > > > calling the driver's system suspend handlers which effectively disables
> > > > the optimization.
> > > > 
> > > > Needed by the next patch fixing suspend/resume on i915.
> > > > 
> > > > Suggested by Rafael.
> > > > 
> > > > Cc: Rafael J. Wysocki 
> > > > Cc: Bjorn Helgaas 
> > > > Cc: linux-...@vger.kernel.org
> > > > Cc: sta...@vger.kernel.org
> > > > Signed-off-by: Imre Deak 
> > > 
> > > Acked-by: Rafael J. Wysocki 
> > > 
> > > The reason why the opt-out flag was not added on day one was because we 
> > > were
> > > not sure whether or not it would be necessary at all.
> > > 
> > > Quite evidently, it is needed.
> > 
> > But that said, it actually can be implemented as a flag in dev_flags too, 
> > say
> > PCI_DEV_FLAGS_NEEDS_RESUME, in analogy with PCI_DEV_FLAGS_NO_D3 that's
> > already there.
> > 
> > The struct size would not need to grow then which I guess would be better?
> 
> Hm, both the bit field and the flag would need to increase if running
> out of bits, so what's the difference? (Atm, the struct size wouldn't
> change either way.)

In the bit field case this depends on what the compiler thinks is better to be
entirely precise, so they are not 100% equivalent.

Plus, since there already are things related to PM in dev_flags, why to depart
from that pattern?

Thanks,
Rafael

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v7 04/20] drm/i915: Skip reset request if there is one already

2017-05-01 Thread Michel Thierry



On 29/04/17 07:21, Chris Wilson wrote:

On Thu, Apr 27, 2017 at 04:12:44PM -0700, Michel Thierry wrote:

From: Mika Kuoppala 

To perform engine reset we first disable engine to capture its state. This
is done by issuing a reset request. Because we are reusing existing
infrastructure, again when we actually reset an engine, reset function
checks engine mask and issues reset request again which is unnecessary. To
avoid this we check if the engine is already prepared, if so we just exit
from that point.


Do we still need this? I am a bit dubious because it implies we have no
idea what we are doing, recursively calling resets.
-Chris



I can drop this one. It isn't really needed (the 'shortcut' it refers is 
because we already set the bit in intel_reset_engine_start).


btw here it's only setting/querying "Ready-ness for Reset", and I've 
heard rumours that the register may not clear itself sometimes (but I 
haven't seen that behaviour myself).


-Michel
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v9 12/15] drm/i915/perf: Add OA unit support for Gen 8+

2017-05-01 Thread Lionel Landwerlin
From: Robert Bragg 

Enables access to OA unit metrics for BDW, CHV, SKL and BXT which all
share (more-or-less) the same OA unit design.

Of particular note in comparison to Haswell: some OA unit HW config
state has become per-context state and as a consequence it is somewhat
more complicated to manage synchronous state changes from the cpu while
there's no guarantee of what context (if any) is currently actively
running on the gpu.

The periodic sampling frequency which can be particularly useful for
system-wide analysis (as opposed to command stream synchronised
MI_REPORT_PERF_COUNT commands) is perhaps the most surprising state to
have become per-context save and restored (while the OABUFFER
destination is still a shared, system-wide resource).

This support for gen8+ takes care to consider a number of timing
challenges involved in synchronously updating per-context state
primarily by programming all config state from the cpu and updating all
current and saved contexts synchronously while the OA unit is still
disabled.

The driver intentionally avoids depending on command streamer
programming to update OA state considering the lack of synchronization
between the automatic loading of OACTXCONTROL state (that includes the
periodic sampling state and enable state) on context restore and the
parsing of any general purpose BB the driver can control. I.e. this
implementation is careful to avoid the possibility of a context restore
temporarily enabling any out-of-date periodic sampling state. In
addition to the risk of transiently-out-of-date state being loaded
automatically; there are also internal HW latencies involved in the
loading of MUX configurations which would be difficult to account for
from the command streamer (and we only want to enable the unit when once
the MUX configuration is complete).

Since the Gen8+ OA unit design no longer supports clock gating the unit
off for a single given context (which effectively stopped any progress
of counters while any other context was running) and instead supports
tagging OA reports with a context ID for filtering on the CPU, it means
we can no longer hide the system-wide progress of counters from a
non-privileged application only interested in metrics for its own
context. Although we could theoretically try and subtract the progress
of other contexts before forwarding reports via read() we aren't in a
position to filter reports captured via MI_REPORT_PERF_COUNT commands.
As a result, for Gen8+, we always require the
dev.i915.perf_stream_paranoid to be unset for any access to OA metrics
if not root.

v5: Drain submitted requests when enabling metric set to ensure no
lite-restore erases the context image we just updated (Lionel)

v6: In addition to drain, switch to kernel context & update all
context in place (Chris)

v7: Add missing mutex_unlock() if switching to kernel context fails
(Matthew)

v8: Simplify OA period/flex-eu-counters programming by using the
batchbuffer instead of modifying ctx-image (Lionel)

v9: Back to updating the context image (due to erroneous testing,
batchbuffer programming the OA unit doesn't actually work)
(Lionel)
Pin context before updating context image (Chris)
Drop MMIO programming now that we switch to a kernel context with
right values in initial context image (Chris)

Signed-off-by: Robert Bragg 
Signed-off-by: Lionel Landwerlin 
Reviewed-by: Matthew Auld  \o/
---
 drivers/gpu/drm/i915/i915_drv.h  |  45 +-
 drivers/gpu/drm/i915/i915_perf.c | 879 +++
 drivers/gpu/drm/i915/i915_reg.h  |  22 +
 drivers/gpu/drm/i915/intel_lrc.c |   2 +
 include/uapi/drm/i915_drm.h  |  19 +-
 5 files changed, 874 insertions(+), 93 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f15751534c29..eaf4ce5e5790 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2063,9 +2063,17 @@ struct i915_oa_ops {
void (*init_oa_buffer)(struct drm_i915_private *dev_priv);

/**
-* @enable_metric_set: Applies any MUX configuration to set up the
-* Boolean and Custom (B/C) counters that are part of the counter
-* reports being sampled. May apply system constraints such as
+* @select_metric_set: The auto generated code that checks whether a
+* requested OA config is applicable to the system and if so sets up
+* the mux, oa and flex eu register config pointers according to the
+* current dev_priv->perf.oa.metrics_set.
+*/
+   int (*select_metric_set)(struct drm_i915_private *dev_priv);
+
+   /**
+* @enable_metric_set: Selects and applies any MUX configuration to set
+* up the Boolean and Custom (B/C) counters that are part of the
+* counter reports being sampled. May apply system constraints such as
 * disabling EU clock gating as required.
 */
int (*enable_metric_set)(struct drm_i

Re: [Intel-gfx] [alsa-devel] [PATCH v2 00/11] drm/i915: LPE audio runtime PM and multipipe (v2)

2017-05-01 Thread Pierre-Louis Bossart



On 04/28/2017 02:37 PM, Ville Syrjälä wrote:

On Fri, Apr 28, 2017 at 12:10:31PM -0500, Pierre-Louis Bossart wrote:


On 04/28/2017 03:41 AM, Takashi Iwai wrote:

On Thu, 27 Apr 2017 18:02:19 +0200,
ville.syrj...@linux.intel.com wrote:

From: Ville Syrjälä 

Okay, here's the second attempt at getting multiple pipes playing back
audio on the VLV/CHV HDMI LPE audio device. The main change from v1 is
that now the PCM devices are associated with ports instead of pipes,
so the audio from one device always gets output on the same display.

I've also tacked on the alsa-lib conf update. No clue whether it's
really correct or not (the config language isn't a close friend
of mine).

BTW I did notice that with LPE audio all the controls say iface=PCM,
whereas on HDA a bunch of them say iface=MIXER. No idea if that's
OK or not, just something I spotted when I was comparing the results
with HDA.

We generally accept both iface types for IEC958 stuff, since
historically many drivers have already mixed them up.  So it's no
problem :)



Entire series available here:
git://github.com/vsyrjala/linux.git lpe_audio_multipipe_2

Cc: Takashi Iwai 
Cc: Pierre-Louis Bossart 

All look good, and feel free to take my reviewed-by tag
Reviewed-by: Takashi Iwai 

As said previously, my only slight concern is the compatibility.
But, in the current situation with PulseAudio, only few people would
use this driver, so it shouldn't be so big impact, I suppose.

BTW, which port is used in general on BYT/CHT?

Oh, also, I suppose you want to carry these over i915 tree?
I don't mind either way, I can take them through sound tree if
preferred, too.

I see frequent oops on startup with this lpe_audio_multipipe_2 branch
with my CHT device not booting or no HDMI audio device created.
Not sure if these issues are due to the new patches or to the rest of
the drm code?

[5.529023] BUG: unable to handle kernel NULL pointer dereference
at   (null)
[5.529143] IP: hdmi_lpe_audio_probe+0x40f/0x650 [snd_hdmi_lpe_audio]
[5.529202] PGD 0

[5.529242] Oops:  [#1] SMP
[5.529274] Modules linked in: snd_soc_sst_atom_hifi2_platform
snd_soc_sst_match snd_soc_core snd_compress lpc_ich snd_seq
snd_seq_device shpchp snd_hdmi_lpe_audio(+) snd_pcm snd_timer dw_dmac
snd soundcore i2c_designware_platform(+) i2c_designware_core
spi_pxa2xx_platform acpi_pad mac_hid nfsd auth_rpcgss nfs_acl lockd
grace sunrpc ip_tables x_tables hid_generic mmc_block i2c_hid usbhid hid
autofs4
[5.529605] CPU: 2 PID: 512 Comm: systemd-udevd Not tainted
4.11.0-rc8-test+ #11
[5.529671] Hardware name: ZOTAC XX/Cherry Trail FFD, BIOS 5.11
09/28/2016
[5.529736] task: 88007485b780 task.stack: c9bfc000
[5.529793] RIP: 0010:hdmi_lpe_audio_probe+0x40f/0x650
[snd_hdmi_lpe_audio]
[5.529855] RSP: 0018:c9bffaf0 EFLAGS: 00010246
[5.529904] RAX:  RBX: 880079209898 RCX:
88007920f078
[5.529967] RDX: 0014 RSI: c9bffb28 RDI:
0002
[5.530031] RBP: c9bffb70 R08: 0001 R09:

[5.530094] R10: 88007441bf00 R11: c9bffb36 R12:
88007920ef20
[5.530159] R13: 88007920ef48 R14: 5688 R15:
0047
[5.530225] FS:  7f627c988640() GS:88007b30()
knlGS:
[5.530299] CS:  0010 DS:  ES:  CR0: 80050033
[5.530352] CR2:  CR3: 78cb8000 CR4:
001006e0
[5.530416] Call Trace:
[5.530452]  platform_drv_probe+0x3b/0xa0
[5.530494]  driver_probe_device+0x2bb/0x460
[5.530538]  __driver_attach+0xdf/0xf0
[5.530576]  ? driver_probe_device+0x460/0x460
[5.530620]  bus_for_each_dev+0x60/0xa0
[5.530658]  driver_attach+0x1e/0x20
[5.530693]  bus_add_driver+0x170/0x270
[5.530731]  driver_register+0x60/0xe0
[5.530769]  ? 0xa01cb000
[5.530803]  __platform_driver_register+0x36/0x40
[5.530851]  hdmi_lpe_audio_driver_init+0x17/0x1000 [snd_hdmi_lpe_audio]
[5.530915]  do_one_initcall+0x43/0x180
[5.530956]  ? __vunmap+0x81/0xd0
[5.530991]  ? kfree+0x14c/0x160
[5.531024]  ? kmem_cache_alloc_trace+0x38/0x150
[5.531070]  do_init_module+0x5f/0x1f8
[5.531108]  load_module+0x271e/0x2bd0
[5.531147]  ? kernel_read_file+0x1a3/0x1c0
[5.531188]  SYSC_finit_module+0xbc/0xf0
[5.531226]  ? SYSC_finit_module+0xbc/0xf0
[5.531267]  SyS_finit_module+0xe/0x10
[5.531305]  do_syscall_64+0x6e/0x180
[5.531345]  entry_SYSCALL64_slow_path+0x25/0x25
[5.531389] RIP: 0033:0x7f627b5fbbf9
[5.531424] RSP: 002b:7ffe053eee68 EFLAGS: 0246 ORIG_RAX:
0139
[5.531493] RAX: ffda RBX: 55d6c745b690 RCX:
7f627b5fbbf9
[5.531558] RDX:  RSI: 7f627c134995 RDI:
0007
[5.531622] RBP: 7f627c134995 R08:  R09:
7ffe053eef80
[5.531687] R10: 0007 R11: 

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Convert connector properties to atomic. (rev7)

2017-05-01 Thread Patchwork
== Series Details ==

Series: drm/i915: Convert connector properties to atomic. (rev7)
URL   : https://patchwork.freedesktop.org/series/22634/
State : success

== Summary ==

Series 22634v7 drm/i915: Convert connector properties to atomic.
https://patchwork.freedesktop.org/api/1.0/series/22634/revisions/7/mbox/

Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
pass   -> FAIL   (fi-snb-2600) fdo#17
Test gem_exec_suspend:
Subgroup basic-s4-devices:
pass   -> DMESG-WARN (fi-kbl-7560u) fdo#100125
Test kms_cursor_legacy:
Subgroup basic-flip-before-cursor-varying-size:
pass   -> INCOMPLETE (fi-bxt-t5700) fdo#100706

fdo#17 https://bugs.freedesktop.org/show_bug.cgi?id=17
fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fdo#100706 https://bugs.freedesktop.org/show_bug.cgi?id=100706

fi-bdw-5557u total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  
time:434s
fi-bdw-gvtdvmtotal:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  
time:432s
fi-bsw-n3050 total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  
time:568s
fi-bxt-j4205 total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  
time:511s
fi-bxt-t5700 total:206  pass:192  dwarn:0   dfail:0   fail:0   skip:13 
fi-byt-j1900 total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  
time:489s
fi-byt-n2820 total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time:488s
fi-hsw-4770  total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time:408s
fi-hsw-4770r total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time:405s
fi-ilk-650   total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  
time:414s
fi-ivb-3520m total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:489s
fi-ivb-3770  total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:473s
fi-kbl-7500u total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time:459s
fi-kbl-7560u total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  
time:567s
fi-skl-6260u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time:448s
fi-skl-6700hqtotal:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  
time:566s
fi-skl-6700k total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  
time:458s
fi-skl-6770hqtotal:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time:491s
fi-skl-gvtdvmtotal:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  
time:431s
fi-snb-2520m total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time:530s
fi-snb-2600  total:278  pass:248  dwarn:0   dfail:0   fail:1   skip:29  
time:399s

1d490e4b6d5324cfbf8dc800cf4a99471252802c drm-tip: 2017y-04m-28d-14h-14m-47s UTC 
integration manifest
1dd5a05 drm/i915: Convert intel_sdvo connector properties to atomic.
ec20237 drm/i915: Handle force_audio correctly in intel_sdvo
49d72274 drm/i915: Convert intel_hdmi connector properties to atomic
0f2b124 drm/i915: Convert intel_dp properties to atomic, v2.
576b049 drm/i915: Make intel_dp->has_audio reflect hw state only
10e25fa drm/i915: Convert LVDS connector properties to atomic.
7ede562 drm/i915: Convert DSI connector properties to atomic.
78eeb6db drm/i915: Add plumbing for digital connector state, v3.
9b94848 drm/i915: Use per-connector scaling mode property
62e8693 drm/i915: Use atomic scaling_mode instead of panel.fitting_mode
af8cf3c drm/atomic: Add support for custom scaling mode properties, v2
b6cd286 drm/atomic: Handle picture_aspect_ratio in atomic core

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4590/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx