Commit 3c021931 authored by Claudio Suarez's avatar Claudio Suarez Committed by Alex Deucher

drm/amdgpu: replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi

Once EDID is parsed, the monitor HDMI support information is available
through drm_display_info.is_hdmi. The amdgpu driver still calls
drm_detect_hdmi_monitor() to retrieve the same information, which
is less efficient. Change to drm_display_info.is_hdmi

This is a TODO task in Documentation/gpu/todo.rst
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarClaudio Suarez <cssk@net-c.es>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0b7778f4
...@@ -108,7 +108,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector) ...@@ -108,7 +108,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector)
case DRM_MODE_CONNECTOR_DVII: case DRM_MODE_CONNECTOR_DVII:
case DRM_MODE_CONNECTOR_HDMIB: case DRM_MODE_CONNECTOR_HDMIB:
if (amdgpu_connector->use_digital) { if (amdgpu_connector->use_digital) {
if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector))) { if (connector->display_info.is_hdmi) {
if (connector->display_info.bpc) if (connector->display_info.bpc)
bpc = connector->display_info.bpc; bpc = connector->display_info.bpc;
} }
...@@ -116,7 +116,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector) ...@@ -116,7 +116,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector)
break; break;
case DRM_MODE_CONNECTOR_DVID: case DRM_MODE_CONNECTOR_DVID:
case DRM_MODE_CONNECTOR_HDMIA: case DRM_MODE_CONNECTOR_HDMIA:
if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector))) { if (connector->display_info.is_hdmi) {
if (connector->display_info.bpc) if (connector->display_info.bpc)
bpc = connector->display_info.bpc; bpc = connector->display_info.bpc;
} }
...@@ -125,7 +125,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector) ...@@ -125,7 +125,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector)
dig_connector = amdgpu_connector->con_priv; dig_connector = amdgpu_connector->con_priv;
if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
(dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) || (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) ||
drm_detect_hdmi_monitor(amdgpu_connector_edid(connector))) { connector->display_info.is_hdmi) {
if (connector->display_info.bpc) if (connector->display_info.bpc)
bpc = connector->display_info.bpc; bpc = connector->display_info.bpc;
} }
...@@ -149,7 +149,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector) ...@@ -149,7 +149,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector)
break; break;
} }
if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector))) { if (connector->display_info.is_hdmi) {
/* /*
* Pre DCE-8 hw can't handle > 12 bpc, and more than 12 bpc doesn't make * Pre DCE-8 hw can't handle > 12 bpc, and more than 12 bpc doesn't make
* much sense without support for > 12 bpc framebuffers. RGB 4:4:4 at * much sense without support for > 12 bpc framebuffers. RGB 4:4:4 at
...@@ -1180,7 +1180,7 @@ static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector ...@@ -1180,7 +1180,7 @@ static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector
(amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) || (amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
(amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) { (amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) {
return MODE_OK; return MODE_OK;
} else if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector))) { } else if (connector->display_info.is_hdmi) {
/* HDMI 1.3+ supports max clock of 340 Mhz */ /* HDMI 1.3+ supports max clock of 340 Mhz */
if (mode->clock > 340000) if (mode->clock > 340000)
return MODE_CLOCK_HIGH; return MODE_CLOCK_HIGH;
...@@ -1472,7 +1472,7 @@ static enum drm_mode_status amdgpu_connector_dp_mode_valid(struct drm_connector ...@@ -1472,7 +1472,7 @@ static enum drm_mode_status amdgpu_connector_dp_mode_valid(struct drm_connector
(amdgpu_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) { (amdgpu_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) {
return amdgpu_atombios_dp_mode_valid_helper(connector, mode); return amdgpu_atombios_dp_mode_valid_helper(connector, mode);
} else { } else {
if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector))) { if (connector->display_info.is_hdmi) {
/* HDMI 1.3+ supports max clock of 340 Mhz */ /* HDMI 1.3+ supports max clock of 340 Mhz */
if (mode->clock > 340000) if (mode->clock > 340000)
return MODE_CLOCK_HIGH; return MODE_CLOCK_HIGH;
......
...@@ -1364,7 +1364,7 @@ bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc, ...@@ -1364,7 +1364,7 @@ bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
if ((!(mode->flags & DRM_MODE_FLAG_INTERLACE)) && if ((!(mode->flags & DRM_MODE_FLAG_INTERLACE)) &&
((amdgpu_encoder->underscan_type == UNDERSCAN_ON) || ((amdgpu_encoder->underscan_type == UNDERSCAN_ON) ||
((amdgpu_encoder->underscan_type == UNDERSCAN_AUTO) && ((amdgpu_encoder->underscan_type == UNDERSCAN_AUTO) &&
drm_detect_hdmi_monitor(amdgpu_connector_edid(connector)) && connector->display_info.is_hdmi &&
amdgpu_display_is_hdtv_mode(mode)))) { amdgpu_display_is_hdtv_mode(mode)))) {
if (amdgpu_encoder->underscan_hborder != 0) if (amdgpu_encoder->underscan_hborder != 0)
amdgpu_crtc->h_border = amdgpu_encoder->underscan_hborder; amdgpu_crtc->h_border = amdgpu_encoder->underscan_hborder;
......
...@@ -222,7 +222,7 @@ bool amdgpu_dig_monitor_is_duallink(struct drm_encoder *encoder, ...@@ -222,7 +222,7 @@ bool amdgpu_dig_monitor_is_duallink(struct drm_encoder *encoder,
case DRM_MODE_CONNECTOR_HDMIB: case DRM_MODE_CONNECTOR_HDMIB:
if (amdgpu_connector->use_digital) { if (amdgpu_connector->use_digital) {
/* HDMI 1.3 supports up to 340 Mhz over single link */ /* HDMI 1.3 supports up to 340 Mhz over single link */
if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector))) { if (connector->display_info.is_hdmi) {
if (pixel_clock > 340000) if (pixel_clock > 340000)
return true; return true;
else else
...@@ -244,7 +244,7 @@ bool amdgpu_dig_monitor_is_duallink(struct drm_encoder *encoder, ...@@ -244,7 +244,7 @@ bool amdgpu_dig_monitor_is_duallink(struct drm_encoder *encoder,
return false; return false;
else { else {
/* HDMI 1.3 supports up to 340 Mhz over single link */ /* HDMI 1.3 supports up to 340 Mhz over single link */
if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector))) { if (connector->display_info.is_hdmi) {
if (pixel_clock > 340000) if (pixel_clock > 340000)
return true; return true;
else else
......
...@@ -469,7 +469,7 @@ int amdgpu_atombios_encoder_get_encoder_mode(struct drm_encoder *encoder) ...@@ -469,7 +469,7 @@ int amdgpu_atombios_encoder_get_encoder_mode(struct drm_encoder *encoder)
if (amdgpu_connector->use_digital && if (amdgpu_connector->use_digital &&
(amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE)) (amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE))
return ATOM_ENCODER_MODE_HDMI; return ATOM_ENCODER_MODE_HDMI;
else if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector)) && else if (connector->display_info.is_hdmi &&
(amdgpu_connector->audio == AMDGPU_AUDIO_AUTO)) (amdgpu_connector->audio == AMDGPU_AUDIO_AUTO))
return ATOM_ENCODER_MODE_HDMI; return ATOM_ENCODER_MODE_HDMI;
else if (amdgpu_connector->use_digital) else if (amdgpu_connector->use_digital)
...@@ -488,7 +488,7 @@ int amdgpu_atombios_encoder_get_encoder_mode(struct drm_encoder *encoder) ...@@ -488,7 +488,7 @@ int amdgpu_atombios_encoder_get_encoder_mode(struct drm_encoder *encoder)
if (amdgpu_audio != 0) { if (amdgpu_audio != 0) {
if (amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE) if (amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE)
return ATOM_ENCODER_MODE_HDMI; return ATOM_ENCODER_MODE_HDMI;
else if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector)) && else if (connector->display_info.is_hdmi &&
(amdgpu_connector->audio == AMDGPU_AUDIO_AUTO)) (amdgpu_connector->audio == AMDGPU_AUDIO_AUTO))
return ATOM_ENCODER_MODE_HDMI; return ATOM_ENCODER_MODE_HDMI;
else else
...@@ -506,7 +506,7 @@ int amdgpu_atombios_encoder_get_encoder_mode(struct drm_encoder *encoder) ...@@ -506,7 +506,7 @@ int amdgpu_atombios_encoder_get_encoder_mode(struct drm_encoder *encoder)
} else if (amdgpu_audio != 0) { } else if (amdgpu_audio != 0) {
if (amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE) if (amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE)
return ATOM_ENCODER_MODE_HDMI; return ATOM_ENCODER_MODE_HDMI;
else if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector)) && else if (connector->display_info.is_hdmi &&
(amdgpu_connector->audio == AMDGPU_AUDIO_AUTO)) (amdgpu_connector->audio == AMDGPU_AUDIO_AUTO))
return ATOM_ENCODER_MODE_HDMI; return ATOM_ENCODER_MODE_HDMI;
else else
......
...@@ -83,10 +83,12 @@ static int amdgpu_dm_patch_edid_caps(struct dc_edid_caps *edid_caps) ...@@ -83,10 +83,12 @@ static int amdgpu_dm_patch_edid_caps(struct dc_edid_caps *edid_caps)
* void * void
* */ * */
enum dc_edid_status dm_helpers_parse_edid_caps( enum dc_edid_status dm_helpers_parse_edid_caps(
struct dc_context *ctx, struct dc_link *link,
const struct dc_edid *edid, const struct dc_edid *edid,
struct dc_edid_caps *edid_caps) struct dc_edid_caps *edid_caps)
{ {
struct amdgpu_dm_connector *aconnector = link->priv;
struct drm_connector *connector = &aconnector->base;
struct edid *edid_buf = (struct edid *) edid->raw_edid; struct edid *edid_buf = (struct edid *) edid->raw_edid;
struct cea_sad *sads; struct cea_sad *sads;
int sad_count = -1; int sad_count = -1;
...@@ -114,8 +116,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( ...@@ -114,8 +116,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
edid_caps->display_name, edid_caps->display_name,
AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS); AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS);
edid_caps->edid_hdmi = drm_detect_hdmi_monitor( edid_caps->edid_hdmi = connector->display_info.is_hdmi;
(struct edid *) edid->raw_edid);
sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads); sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads);
if (sad_count <= 0) if (sad_count <= 0)
...@@ -647,14 +648,8 @@ enum dc_edid_status dm_helpers_read_local_edid( ...@@ -647,14 +648,8 @@ enum dc_edid_status dm_helpers_read_local_edid(
/* We don't need the original edid anymore */ /* We don't need the original edid anymore */
kfree(edid); kfree(edid);
/* connector->display_info will be parsed from EDID and saved /* connector->display_info is parsed from EDID and saved
* into drm_connector->display_info from edid by call stack * into drm_connector->display_info
* below:
* drm_parse_ycbcr420_deep_color_info
* drm_parse_hdmi_forum_vsdb
* drm_parse_cea_ext
* drm_add_display_info
* drm_connector_update_edid_property
* *
* drm_connector->display_info will be used by amdgpu_dm funcs, * drm_connector->display_info will be used by amdgpu_dm funcs,
* like fill_stream_properties_from_drm_display_mode * like fill_stream_properties_from_drm_display_mode
...@@ -662,7 +657,7 @@ enum dc_edid_status dm_helpers_read_local_edid( ...@@ -662,7 +657,7 @@ enum dc_edid_status dm_helpers_read_local_edid(
amdgpu_dm_update_connector_after_detect(aconnector); amdgpu_dm_update_connector_after_detect(aconnector);
edid_status = dm_helpers_parse_edid_caps( edid_status = dm_helpers_parse_edid_caps(
ctx, link,
&sink->dc_edid, &sink->dc_edid,
&sink->edid_caps); &sink->edid_caps);
......
...@@ -3448,7 +3448,7 @@ struct dc_sink *dc_link_add_remote_sink( ...@@ -3448,7 +3448,7 @@ struct dc_sink *dc_link_add_remote_sink(
goto fail_add_sink; goto fail_add_sink;
edid_status = dm_helpers_parse_edid_caps( edid_status = dm_helpers_parse_edid_caps(
link->ctx, link,
&dc_sink->dc_edid, &dc_sink->dc_edid,
&dc_sink->edid_caps); &dc_sink->edid_caps);
......
...@@ -59,7 +59,7 @@ void dm_helpers_free_gpu_mem( ...@@ -59,7 +59,7 @@ void dm_helpers_free_gpu_mem(
void *pvMem); void *pvMem);
enum dc_edid_status dm_helpers_parse_edid_caps( enum dc_edid_status dm_helpers_parse_edid_caps(
struct dc_context *ctx, struct dc_link *link,
const struct dc_edid *edid, const struct dc_edid *edid,
struct dc_edid_caps *edid_caps); struct dc_edid_caps *edid_caps);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment