[Intel-gfx] [RFC][PATCH 02/11] drm/i915: Fill display_info.{width, height}_mm from .get_modes()
Ville Syrjala
ville.syrjala at linux.intel.com
Tue Feb 27 12:56:51 UTC 2018
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
display_info.width_mm and display_info.height_mm are dynamic metadata
that either gets parsed from the EDID or filled by the driver by some
other means. Either way we should update it in the same place, ie.
the .fill_modes()/.get_modes() hooks.
Cc: Keith Packard <keithp at keithp.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/i915/intel_dp.c | 15 +++++++--------
drivers/gpu/drm/i915/intel_dsi.c | 13 +++++++------
drivers/gpu/drm/i915/intel_lvds.c | 9 ++++++---
3 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 801a21b16004..edfcad276506 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4966,6 +4966,7 @@ intel_dp_force(struct drm_connector *connector)
static int intel_dp_get_modes(struct drm_connector *connector)
{
struct intel_connector *intel_connector = to_intel_connector(connector);
+ const struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
struct edid *edid;
edid = intel_connector->detect_edid;
@@ -4976,12 +4977,13 @@ static int intel_dp_get_modes(struct drm_connector *connector)
}
/* if eDP has no EDID, fall back to fixed mode */
- if (intel_dp_is_edp(intel_attached_dp(connector)) &&
- intel_connector->panel.fixed_mode) {
+ if (intel_dp_is_edp(intel_attached_dp(connector)) && fixed_mode) {
struct drm_display_mode *mode;
- mode = drm_mode_duplicate(connector->dev,
- intel_connector->panel.fixed_mode);
+ connector->display_info.width_mm = fixed_mode->width_mm;
+ connector->display_info.height_mm = fixed_mode->height_mm;
+
+ mode = drm_mode_duplicate(connector->dev, fixed_mode);
if (mode) {
drm_mode_probed_add(connector, mode);
return 1;
@@ -6251,11 +6253,8 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
if (!fixed_mode && dev_priv->vbt.lfp_lvds_vbt_mode) {
fixed_mode = drm_mode_duplicate(dev,
dev_priv->vbt.lfp_lvds_vbt_mode);
- if (fixed_mode) {
+ if (fixed_mode)
fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
- connector->display_info.width_mm = fixed_mode->width_mm;
- connector->display_info.height_mm = fixed_mode->height_mm;
- }
}
mutex_unlock(&dev->mode_config.mutex);
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 51a1d6868b1e..c8cf3d5c7783 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1599,17 +1599,21 @@ static void intel_dsi_unprepare(struct intel_encoder *encoder)
static int intel_dsi_get_modes(struct drm_connector *connector)
{
struct intel_connector *intel_connector = to_intel_connector(connector);
+ const struct drm_display_mode *fixed_mode =
+ intel_connector->panel.fixed_mode;
struct drm_display_mode *mode;
DRM_DEBUG_KMS("\n");
- if (!intel_connector->panel.fixed_mode) {
+ if (!fixed_mode) {
DRM_DEBUG_KMS("no fixed mode\n");
return 0;
}
- mode = drm_mode_duplicate(connector->dev,
- intel_connector->panel.fixed_mode);
+ connector->display_info.width_mm = fixed_mode->width_mm;
+ connector->display_info.height_mm = fixed_mode->height_mm;
+
+ mode = drm_mode_duplicate(connector->dev, fixed_mode);
if (!mode) {
DRM_DEBUG_KMS("drm_mode_duplicate failed\n");
return 0;
@@ -1843,9 +1847,6 @@ void intel_dsi_init(struct drm_i915_private *dev_priv)
goto err;
}
- connector->display_info.width_mm = fixed_mode->width_mm;
- connector->display_info.height_mm = fixed_mode->height_mm;
-
intel_panel_init(&intel_connector->panel, fixed_mode, NULL, NULL);
intel_panel_setup_backlight(connector, INVALID_PIPE);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index d35d2d50f595..cdae4934b885 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -477,6 +477,8 @@ intel_lvds_detect(struct drm_connector *connector, bool force)
static int intel_lvds_get_modes(struct drm_connector *connector)
{
struct intel_lvds_connector *lvds_connector = to_lvds_connector(connector);
+ const struct drm_display_mode *fixed_mode =
+ lvds_connector->base.panel.fixed_mode;
struct drm_device *dev = connector->dev;
struct drm_display_mode *mode;
@@ -484,7 +486,10 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
return drm_add_edid_modes(connector, lvds_connector->base.edid);
- mode = drm_mode_duplicate(dev, lvds_connector->base.panel.fixed_mode);
+ connector->display_info.width_mm = fixed_mode->width_mm;
+ connector->display_info.height_mm = fixed_mode->height_mm;
+
+ mode = drm_mode_duplicate(dev, fixed_mode);
if (mode == NULL)
return 0;
@@ -1114,8 +1119,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
if (fixed_mode) {
fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
- connector->display_info.width_mm = fixed_mode->width_mm;
- connector->display_info.height_mm = fixed_mode->height_mm;
goto out;
}
}
--
2.13.6
More information about the Intel-gfx
mailing list