Subversion Repositories Kolibri OS

Rev

Rev 6937 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6937 Rev 7144
Line 834... Line 834...
834
	intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
834
	intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
835
	intel_hdmi_set_spd_infoframe(encoder);
835
	intel_hdmi_set_spd_infoframe(encoder);
836
	intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
836
	intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
837
}
837
}
Line -... Line 838...
-
 
838
 
-
 
839
void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable)
-
 
840
{
-
 
841
	struct drm_i915_private *dev_priv = to_i915(intel_hdmi_to_dev(hdmi));
-
 
842
	struct i2c_adapter *adapter =
-
 
843
		intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus);
-
 
844
 
-
 
845
	if (hdmi->dp_dual_mode.type < DRM_DP_DUAL_MODE_TYPE2_DVI)
-
 
846
		return;
-
 
847
 
-
 
848
	DRM_DEBUG_KMS("%s DP dual mode adaptor TMDS output\n",
-
 
849
		      enable ? "Enabling" : "Disabling");
-
 
850
 
-
 
851
	drm_dp_dual_mode_set_tmds_output(hdmi->dp_dual_mode.type,
-
 
852
					 adapter, enable);
-
 
853
}
838
 
854
 
839
static void intel_hdmi_prepare(struct intel_encoder *encoder)
855
static void intel_hdmi_prepare(struct intel_encoder *encoder)
840
{
856
{
841
	struct drm_device *dev = encoder->base.dev;
857
	struct drm_device *dev = encoder->base.dev;
842
	struct drm_i915_private *dev_priv = dev->dev_private;
858
	struct drm_i915_private *dev_priv = dev->dev_private;
843
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
859
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
844
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
860
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
845
	const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
861
	const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
Line -... Line 862...
-
 
862
	u32 hdmi_val;
-
 
863
 
846
	u32 hdmi_val;
864
	intel_dp_dual_mode_set_tmds_output(intel_hdmi, true);
847
 
865
 
848
	hdmi_val = SDVO_ENCODING_HDMI;
866
	hdmi_val = SDVO_ENCODING_HDMI;
849
	if (!HAS_PCH_SPLIT(dev) && crtc->config->limited_color_range)
867
	if (!HAS_PCH_SPLIT(dev) && crtc->config->limited_color_range)
850
		hdmi_val |= HDMI_COLOR_RANGE_16_235;
868
		hdmi_val |= HDMI_COLOR_RANGE_16_235;
Line 1141... Line 1159...
1141
		intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, true);
1159
		intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, true);
1142
		intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, true);
1160
		intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, true);
1143
	}
1161
	}
Line 1144... Line 1162...
1144
 
1162
 
-
 
1163
	intel_hdmi->set_infoframes(&encoder->base, false, NULL);
-
 
1164
 
1145
	intel_hdmi->set_infoframes(&encoder->base, false, NULL);
1165
	intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
Line 1146... Line 1166...
1146
}
1166
}
1147
 
1167
 
1148
static void g4x_disable_hdmi(struct intel_encoder *encoder)
1168
static void g4x_disable_hdmi(struct intel_encoder *encoder)
Line 1166... Line 1186...
1166
static void pch_post_disable_hdmi(struct intel_encoder *encoder)
1186
static void pch_post_disable_hdmi(struct intel_encoder *encoder)
1167
{
1187
{
1168
	intel_disable_hdmi(encoder);
1188
	intel_disable_hdmi(encoder);
1169
}
1189
}
Line 1170... Line 1190...
1170
 
1190
 
1171
static int hdmi_port_clock_limit(struct intel_hdmi *hdmi, bool respect_dvi_limit)
1191
static int intel_hdmi_source_max_tmds_clock(struct drm_i915_private *dev_priv)
1172
{
1192
{
1173
	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
-
 
1174
 
-
 
1175
	if ((respect_dvi_limit && !hdmi->has_hdmi_sink) || IS_G4X(dev))
1193
	if (IS_G4X(dev_priv))
1176
		return 165000;
1194
		return 165000;
1177
	else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8)
1195
	else if (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8)
1178
		return 300000;
1196
		return 300000;
1179
	else
1197
	else
1180
		return 225000;
1198
		return 225000;
Line -... Line 1199...
-
 
1199
}
-
 
1200
 
-
 
1201
static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
-
 
1202
				 bool respect_downstream_limits)
-
 
1203
{
-
 
1204
	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
-
 
1205
	int max_tmds_clock = intel_hdmi_source_max_tmds_clock(to_i915(dev));
-
 
1206
 
-
 
1207
	if (respect_downstream_limits) {
-
 
1208
		if (hdmi->dp_dual_mode.max_tmds_clock)
-
 
1209
			max_tmds_clock = min(max_tmds_clock,
-
 
1210
					     hdmi->dp_dual_mode.max_tmds_clock);
-
 
1211
		if (!hdmi->has_hdmi_sink)
-
 
1212
			max_tmds_clock = min(max_tmds_clock, 165000);
-
 
1213
	}
-
 
1214
 
-
 
1215
	return max_tmds_clock;
1181
}
1216
}
1182
 
1217
 
1183
static enum drm_mode_status
1218
static enum drm_mode_status
1184
hdmi_port_clock_valid(struct intel_hdmi *hdmi,
1219
hdmi_port_clock_valid(struct intel_hdmi *hdmi,
1185
		      int clock, bool respect_dvi_limit)
1220
		      int clock, bool respect_downstream_limits)
Line 1186... Line 1221...
1186
{
1221
{
1187
	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
1222
	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
1188
 
1223
 
1189
	if (clock < 25000)
1224
	if (clock < 25000)
Line 1190... Line 1225...
1190
		return MODE_CLOCK_LOW;
1225
		return MODE_CLOCK_LOW;
1191
	if (clock > hdmi_port_clock_limit(hdmi, respect_dvi_limit))
1226
	if (clock > hdmi_port_clock_limit(hdmi, respect_downstream_limits))
1192
		return MODE_CLOCK_HIGH;
1227
		return MODE_CLOCK_HIGH;
Line 1208... Line 1243...
1208
{
1243
{
1209
	struct intel_hdmi *hdmi = intel_attached_hdmi(connector);
1244
	struct intel_hdmi *hdmi = intel_attached_hdmi(connector);
1210
	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
1245
	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
1211
	enum drm_mode_status status;
1246
	enum drm_mode_status status;
1212
	int clock;
1247
	int clock;
-
 
1248
	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
Line 1213... Line 1249...
1213
 
1249
 
1214
	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
1250
	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
Line 1215... Line 1251...
1215
		return MODE_NO_DBLESCAN;
1251
		return MODE_NO_DBLESCAN;
-
 
1252
 
-
 
1253
	clock = mode->clock;
-
 
1254
 
-
 
1255
	if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
-
 
1256
		clock *= 2;
-
 
1257
 
-
 
1258
	if (clock > max_dotclk)
1216
 
1259
		return MODE_CLOCK_HIGH;
1217
	clock = mode->clock;
1260
 
Line 1218... Line 1261...
1218
	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
1261
	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
1219
		clock *= 2;
1262
		clock *= 2;
Line 1302... Line 1345...
1302
	 * through, clamp it down. Note that g4x/vlv don't support 12bpc hdmi
1345
	 * through, clamp it down. Note that g4x/vlv don't support 12bpc hdmi
1303
	 * outputs. We also need to check that the higher clock still fits
1346
	 * outputs. We also need to check that the higher clock still fits
1304
	 * within limits.
1347
	 * within limits.
1305
	 */
1348
	 */
1306
	if (pipe_config->pipe_bpp > 8*3 && pipe_config->has_hdmi_sink &&
1349
	if (pipe_config->pipe_bpp > 8*3 && pipe_config->has_hdmi_sink &&
1307
	    hdmi_port_clock_valid(intel_hdmi, clock_12bpc, false) == MODE_OK &&
1350
	    hdmi_port_clock_valid(intel_hdmi, clock_12bpc, true) == MODE_OK &&
1308
	    hdmi_12bpc_possible(pipe_config)) {
1351
	    hdmi_12bpc_possible(pipe_config)) {
1309
		DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n");
1352
		DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n");
1310
		desired_bpp = 12*3;
1353
		desired_bpp = 12*3;
Line 1311... Line 1354...
1311
 
1354
 
Line 1342... Line 1385...
1342
 
1385
 
1343
	intel_hdmi->has_hdmi_sink = false;
1386
	intel_hdmi->has_hdmi_sink = false;
1344
	intel_hdmi->has_audio = false;
1387
	intel_hdmi->has_audio = false;
Line -... Line 1388...
-
 
1388
	intel_hdmi->rgb_quant_range_selectable = false;
-
 
1389
 
-
 
1390
	intel_hdmi->dp_dual_mode.type = DRM_DP_DUAL_MODE_NONE;
1345
	intel_hdmi->rgb_quant_range_selectable = false;
1391
	intel_hdmi->dp_dual_mode.max_tmds_clock = 0;
1346
 
1392
 
1347
	kfree(to_intel_connector(connector)->detect_edid);
1393
	kfree(to_intel_connector(connector)->detect_edid);
Line -... Line 1394...
-
 
1394
	to_intel_connector(connector)->detect_edid = NULL;
-
 
1395
}
-
 
1396
 
-
 
1397
static void
-
 
1398
intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector)
-
 
1399
{
-
 
1400
	struct drm_i915_private *dev_priv = to_i915(connector->dev);
-
 
1401
	struct intel_hdmi *hdmi = intel_attached_hdmi(connector);
-
 
1402
	struct i2c_adapter *adapter =
-
 
1403
		intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus);
-
 
1404
	enum drm_dp_dual_mode_type type = drm_dp_dual_mode_detect(adapter);
-
 
1405
 
-
 
1406
	if (type == DRM_DP_DUAL_MODE_NONE ||
-
 
1407
	    type == DRM_DP_DUAL_MODE_UNKNOWN)
-
 
1408
		return;
-
 
1409
 
-
 
1410
	hdmi->dp_dual_mode.type = type;
-
 
1411
	hdmi->dp_dual_mode.max_tmds_clock =
-
 
1412
		drm_dp_dual_mode_max_tmds_clock(type, adapter);
-
 
1413
 
-
 
1414
	DRM_DEBUG_KMS("DP dual mode adaptor (%s) detected (max TMDS clock: %d kHz)\n",
-
 
1415
		      drm_dp_get_dual_mode_type_name(type),
1348
	to_intel_connector(connector)->detect_edid = NULL;
1416
		      hdmi->dp_dual_mode.max_tmds_clock);
1349
}
1417
}
1350
 
1418
 
1351
static bool
1419
static bool
1352
intel_hdmi_set_edid(struct drm_connector *connector, bool force)
1420
intel_hdmi_set_edid(struct drm_connector *connector, bool force)
Line 1361... Line 1429...
1361
 
1429
 
1362
		edid = drm_get_edid(connector,
1430
		edid = drm_get_edid(connector,
1363
				    intel_gmbus_get_adapter(dev_priv,
1431
				    intel_gmbus_get_adapter(dev_priv,
Line -... Line 1432...
-
 
1432
				    intel_hdmi->ddc_bus));
-
 
1433
 
1364
				    intel_hdmi->ddc_bus));
1434
		intel_hdmi_dp_dual_mode_detect(connector);
1365
 
1435
 
Line 1366... Line 1436...
1366
	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
1436
		intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
1367
	}
1437
	}
Line 2047... Line 2117...
2047
	struct drm_device *dev = intel_encoder->base.dev;
2117
	struct drm_device *dev = intel_encoder->base.dev;
2048
	struct drm_i915_private *dev_priv = dev->dev_private;
2118
	struct drm_i915_private *dev_priv = dev->dev_private;
2049
	enum port port = intel_dig_port->port;
2119
	enum port port = intel_dig_port->port;
2050
	uint8_t alternate_ddc_pin;
2120
	uint8_t alternate_ddc_pin;
Line -... Line 2121...
-
 
2121
 
-
 
2122
	if (WARN(intel_dig_port->max_lanes < 4,
-
 
2123
		 "Not enough lanes (%d) for HDMI on port %c\n",
-
 
2124
		 intel_dig_port->max_lanes, port_name(port)))
-
 
2125
		return;
2051
 
2126
 
2052
	drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
2127
	drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
2053
			   DRM_MODE_CONNECTOR_HDMIA);
2128
			   DRM_MODE_CONNECTOR_HDMIA);
Line 2054... Line 2129...
2054
	drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
2129
	drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
Line 2230... Line 2305...
2230
		intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
2305
		intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
Line 2231... Line 2306...
2231
 
2306
 
2232
	intel_dig_port->port = port;
2307
	intel_dig_port->port = port;
2233
	intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
2308
	intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
-
 
2309
	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
Line 2234... Line 2310...
2234
	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
2310
	intel_dig_port->max_lanes = 4;
2235
 
2311