diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c old mode 100644 new mode 100755 index 6efdba4..9f72512 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -42,7 +42,7 @@ * drm_debug: Enable debug output. * Bitmask of DRM_UT_x. See include/drm/drmP.h for details. */ -unsigned int drm_debug = 0; +unsigned int drm_debug = 0xe; EXPORT_SYMBOL(drm_debug); MODULE_AUTHOR("Gareth Hughes, Leif Delgass, José Fonseca, Jon Smirl"); diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c old mode 100644 new mode 100755 index 3ffbd69..7f07034 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c @@ -331,11 +331,38 @@ static int intel_dp_mst_get_modes(struct drm_connector *connector) return intel_dp_mst_get_ddc_modes(connector); } +static int +intel_dp_link_required(int pixel_clock, int bpp) +{ + return (pixel_clock * bpp + 9) / 10; +} + +static int +intel_dp_max_data_rate(int max_link_clock, int max_lanes) +{ + return (max_link_clock * max_lanes * 8) / 10; +} static enum drm_mode_status intel_dp_mst_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { int max_dotclk = to_i915(connector->dev)->max_dotclk_freq; + struct intel_connector *intel_connector = to_intel_connector(connector); + struct intel_dp *intel_dp = intel_connector->mst_port; + int target_clock = mode->clock; + int max_rate, mode_rate, max_lanes, max_link_clock; + + max_link_clock = intel_dp_max_link_rate(intel_dp); + max_lanes = drm_dp_max_lane_count(intel_dp->dpcd); + + max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); + mode_rate = intel_dp_link_required(target_clock, 18); + + DRM_DEBUG_KMS("%s %d %d mode_rate %d max_rate %d \n",mode->name, mode->vrefresh, mode->clock,mode_rate, max_rate); + DRM_DEBUG_KMS("target_clock %d max_dotclk %d\n",target_clock, max_dotclk); + + if (mode_rate > max_rate || target_clock > max_dotclk) + return MODE_CLOCK_HIGH; /* TODO - validate mode against available PBN for link */ if (mode->clock < 10000) @@ -344,9 +371,6 @@ static int intel_dp_mst_get_modes(struct drm_connector *connector) if (mode->flags & DRM_MODE_FLAG_DBLCLK) return MODE_H_ILLEGAL; - if (mode->clock > max_dotclk) - return MODE_CLOCK_HIGH; - return MODE_OK; }