Subversion Repositories Kolibri OS

Rev

Rev 6935 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6935 Rev 6937
Line 706... Line 706...
706
		 mode->hdisplay, mode->vdisplay,
706
		 mode->hdisplay, mode->vdisplay,
707
		 interlaced ? "i" : "");
707
		 interlaced ? "i" : "");
708
}
708
}
709
EXPORT_SYMBOL(drm_mode_set_name);
709
EXPORT_SYMBOL(drm_mode_set_name);
Line -... Line 710...
-
 
710
 
710
 
711
/**
711
/** drm_mode_hsync - get the hsync of a mode
712
 * drm_mode_hsync - get the hsync of a mode
712
 * @mode: mode
713
 * @mode: mode
713
 *
714
 *
714
 * Returns:
715
 * Returns:
715
 * @modes's hsync rate in kHz, rounded to the nearest integer. Calculates the
716
 * @modes's hsync rate in kHz, rounded to the nearest integer. Calculates the
Line 915... Line 916...
915
		if (KHZ2PICOS(mode1->clock) != KHZ2PICOS(mode2->clock))
916
		if (KHZ2PICOS(mode1->clock) != KHZ2PICOS(mode2->clock))
916
			return false;
917
			return false;
917
	} else if (mode1->clock != mode2->clock)
918
	} else if (mode1->clock != mode2->clock)
918
		return false;
919
		return false;
Line -... Line 920...
-
 
920
 
-
 
921
	return drm_mode_equal_no_clocks(mode1, mode2);
-
 
922
}
-
 
923
EXPORT_SYMBOL(drm_mode_equal);
-
 
924
 
-
 
925
/**
-
 
926
 * drm_mode_equal_no_clocks - test modes for equality
-
 
927
 * @mode1: first mode
-
 
928
 * @mode2: second mode
-
 
929
 *
-
 
930
 * Check to see if @mode1 and @mode2 are equivalent, but
-
 
931
 * don't check the pixel clocks.
-
 
932
 *
-
 
933
 * Returns:
-
 
934
 * True if the modes are equal, false otherwise.
-
 
935
 */
-
 
936
bool drm_mode_equal_no_clocks(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2)
919
 
937
{
920
	if ((mode1->flags & DRM_MODE_FLAG_3D_MASK) !=
938
	if ((mode1->flags & DRM_MODE_FLAG_3D_MASK) !=
921
	    (mode2->flags & DRM_MODE_FLAG_3D_MASK))
939
	    (mode2->flags & DRM_MODE_FLAG_3D_MASK))
Line 922... Line 940...
922
		return false;
940
		return false;
923
 
941
 
924
	return drm_mode_equal_no_clocks_no_stereo(mode1, mode2);
942
	return drm_mode_equal_no_clocks_no_stereo(mode1, mode2);
Line 925... Line 943...
925
}
943
}
926
EXPORT_SYMBOL(drm_mode_equal);
944
EXPORT_SYMBOL(drm_mode_equal_no_clocks);
927
 
945
 
928
/**
946
/**
Line 1054... Line 1072...
1054
	MODE_STATUS(ONE_WIDTH),
1072
	MODE_STATUS(ONE_WIDTH),
1055
	MODE_STATUS(ONE_HEIGHT),
1073
	MODE_STATUS(ONE_HEIGHT),
1056
	MODE_STATUS(ONE_SIZE),
1074
	MODE_STATUS(ONE_SIZE),
1057
	MODE_STATUS(NO_REDUCED),
1075
	MODE_STATUS(NO_REDUCED),
1058
	MODE_STATUS(NO_STEREO),
1076
	MODE_STATUS(NO_STEREO),
1059
	MODE_STATUS(UNVERIFIED),
1077
	MODE_STATUS(STALE),
1060
	MODE_STATUS(BAD),
1078
	MODE_STATUS(BAD),
1061
	MODE_STATUS(ERROR),
1079
	MODE_STATUS(ERROR),
1062
};
1080
};
Line 1063... Line 1081...
1063
 
1081
 
Line 1152... Line 1170...
1152
EXPORT_SYMBOL(drm_mode_sort);
1170
EXPORT_SYMBOL(drm_mode_sort);
Line 1153... Line 1171...
1153
 
1171
 
1154
/**
1172
/**
1155
 * drm_mode_connector_list_update - update the mode list for the connector
1173
 * drm_mode_connector_list_update - update the mode list for the connector
1156
 * @connector: the connector to update
-
 
1157
 * @merge_type_bits: whether to merge or overwrite type bits
1174
 * @connector: the connector to update
1158
 *
1175
 *
1159
 * This moves the modes from the @connector probed_modes list
1176
 * This moves the modes from the @connector probed_modes list
1160
 * to the actual mode list. It compares the probed mode against the current
1177
 * to the actual mode list. It compares the probed mode against the current
1161
 * list and only adds different/new modes.
1178
 * list and only adds different/new modes.
1162
 *
1179
 *
1163
 * This is just a helper functions doesn't validate any modes itself and also
1180
 * This is just a helper functions doesn't validate any modes itself and also
1164
 * doesn't prune any invalid modes. Callers need to do that themselves.
1181
 * doesn't prune any invalid modes. Callers need to do that themselves.
1165
 */
1182
 */
1166
void drm_mode_connector_list_update(struct drm_connector *connector,
-
 
1167
				    bool merge_type_bits)
1183
void drm_mode_connector_list_update(struct drm_connector *connector)
1168
{
-
 
1169
	struct drm_display_mode *mode;
1184
{
1170
	struct drm_display_mode *pmode, *pt;
-
 
Line 1171... Line 1185...
1171
	int found_it;
1185
	struct drm_display_mode *pmode, *pt;
Line 1172... Line 1186...
1172
 
1186
 
1173
	WARN_ON(!mutex_is_locked(&connector->dev->mode_config.mutex));
1187
	WARN_ON(!mutex_is_locked(&connector->dev->mode_config.mutex));
1174
 
1188
 
-
 
1189
	list_for_each_entry_safe(pmode, pt, &connector->probed_modes, head) {
1175
	list_for_each_entry_safe(pmode, pt, &connector->probed_modes,
1190
		struct drm_display_mode *mode;
1176
				 head) {
1191
		bool found_it = false;
1177
		found_it = 0;
1192
 
-
 
1193
		/* go through current modes checking for the new probed mode */
-
 
1194
		list_for_each_entry(mode, &connector->modes, head) {
1178
		/* go through current modes checking for the new probed mode */
1195
			if (!drm_mode_equal(pmode, mode))
-
 
1196
				continue;
-
 
1197
 
-
 
1198
			found_it = true;
-
 
1199
 
-
 
1200
			/*
1179
		list_for_each_entry(mode, &connector->modes, head) {
1201
			 * If the old matching mode is stale (ie. left over
-
 
1202
			 * from a previous probe) just replace it outright.
-
 
1203
			 * Otherwise just merge the type bits between all
-
 
1204
			 * equal probed modes.
-
 
1205
			 *
-
 
1206
			 * If two probed modes are considered equal, pick the
-
 
1207
			 * actual timings from the one that's marked as
-
 
1208
			 * preferred (in case the match isn't 100%). If
1180
			if (drm_mode_equal(pmode, mode)) {
1209
			 * multiple or zero preferred modes are present, favor
-
 
1210
			 * the mode added to the probed_modes list first.
-
 
1211
			 */
-
 
1212
			if (mode->status == MODE_STALE) {
1181
				found_it = 1;
1213
				drm_mode_copy(mode, pmode);
1182
				/* if equal delete the probed mode */
1214
			} else if ((mode->type & DRM_MODE_TYPE_PREFERRED) == 0 &&
-
 
1215
				   (pmode->type & DRM_MODE_TYPE_PREFERRED) != 0) {
1183
				mode->status = pmode->status;
1216
				pmode->type |= mode->type;
1184
				/* Merge type bits together */
1217
				drm_mode_copy(mode, pmode);
1185
				if (merge_type_bits)
-
 
-
 
1218
			} else {
1186
					mode->type |= pmode->type;
1219
					mode->type |= pmode->type;
1187
				else
1220
			}
1188
					mode->type = pmode->type;
1221
 
1189
				list_del(&pmode->head);
1222
				list_del(&pmode->head);
1190
				drm_mode_destroy(connector->dev, pmode);
-
 
Line 1191... Line 1223...
1191
				break;
1223
				drm_mode_destroy(connector->dev, pmode);
1192
			}
1224
				break;
1193
		}
1225
			}
1194
 
1226
 
Line 1399... Line 1431...
1399
				    cmd->margins);
1431
				    cmd->margins);
1400
	if (!mode)
1432
	if (!mode)
1401
		return NULL;
1433
		return NULL;
Line 1402... Line 1434...
1402
 
1434
 
1403
	mode->type |= DRM_MODE_TYPE_USERDEF;
-
 
1404
	/* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
-
 
1405
	if (cmd->xres == 1366 && mode->hdisplay == 1368) {
-
 
1406
		mode->hdisplay = 1366;
-
 
1407
		mode->hsync_start--;
-
 
1408
		mode->hsync_end--;
-
 
1409
		drm_mode_set_name(mode);
-
 
1410
	}
1435
	mode->type |= DRM_MODE_TYPE_USERDEF;
1411
	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
1436
	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
1412
	return mode;
1437
	return mode;
1413
}
1438
}
Line 1492... Line 1517...
1492
 
1517
 
1493
	out->status = drm_mode_validate_basic(out);
1518
	out->status = drm_mode_validate_basic(out);
1494
	if (out->status != MODE_OK)
1519
	if (out->status != MODE_OK)
Line 1495... Line -...
1495
		goto out;
-
 
1496
 
-
 
1497
	drm_mode_set_crtcinfo(out, CRTC_INTERLACE_HALVE_V);
1520
		goto out;
Line 1498... Line 1521...
1498
 
1521
 
1499
	ret = 0;
1522
	ret = 0;
1500
 
1523
 
1501
out:
1524
out: