Skip to content

Commit 70181ad

Browse files
Timur Kristófalexdeucher
authored andcommitted
drm/amd/display: Add common modes to analog displays without EDID
When the EDID of an analog display is not available, we can't know the possible modes supported by the display. However, we still need to offer the user to select from a variety of common modes. It will be up to the user to select the best one, though. This is how it works on other operating systems as well as the legacy display code path in amdgpu. Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent ac1bb49 commit 70181ad

1 file changed

Lines changed: 28 additions & 18 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8412,7 +8412,7 @@ static void amdgpu_dm_get_native_mode(struct drm_connector *connector)
84128412

84138413
static struct drm_display_mode *
84148414
amdgpu_dm_create_common_mode(struct drm_encoder *encoder,
8415-
char *name,
8415+
const char *name,
84168416
int hdisplay, int vdisplay)
84178417
{
84188418
struct drm_device *dev = encoder->dev;
@@ -8434,6 +8434,24 @@ amdgpu_dm_create_common_mode(struct drm_encoder *encoder,
84348434

84358435
}
84368436

8437+
static const struct amdgpu_dm_mode_size {
8438+
char name[DRM_DISPLAY_MODE_LEN];
8439+
int w;
8440+
int h;
8441+
} common_modes[] = {
8442+
{ "640x480", 640, 480},
8443+
{ "800x600", 800, 600},
8444+
{ "1024x768", 1024, 768},
8445+
{ "1280x720", 1280, 720},
8446+
{ "1280x800", 1280, 800},
8447+
{"1280x1024", 1280, 1024},
8448+
{ "1440x900", 1440, 900},
8449+
{"1680x1050", 1680, 1050},
8450+
{"1600x1200", 1600, 1200},
8451+
{"1920x1080", 1920, 1080},
8452+
{"1920x1200", 1920, 1200}
8453+
};
8454+
84378455
static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder,
84388456
struct drm_connector *connector)
84398457
{
@@ -8444,23 +8462,6 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder,
84448462
to_amdgpu_dm_connector(connector);
84458463
int i;
84468464
int n;
8447-
struct mode_size {
8448-
char name[DRM_DISPLAY_MODE_LEN];
8449-
int w;
8450-
int h;
8451-
} common_modes[] = {
8452-
{ "640x480", 640, 480},
8453-
{ "800x600", 800, 600},
8454-
{ "1024x768", 1024, 768},
8455-
{ "1280x720", 1280, 720},
8456-
{ "1280x800", 1280, 800},
8457-
{"1280x1024", 1280, 1024},
8458-
{ "1440x900", 1440, 900},
8459-
{"1680x1050", 1680, 1050},
8460-
{"1600x1200", 1600, 1200},
8461-
{"1920x1080", 1920, 1080},
8462-
{"1920x1200", 1920, 1200}
8463-
};
84648465

84658466
if ((connector->connector_type != DRM_MODE_CONNECTOR_eDP) &&
84668467
(connector->connector_type != DRM_MODE_CONNECTOR_LVDS))
@@ -8684,6 +8685,15 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector)
86848685
if (dc->link_srv->dp_get_encoding_format(verified_link_cap) == DP_128b_132b_ENCODING)
86858686
amdgpu_dm_connector->num_modes +=
86868687
drm_add_modes_noedid(connector, 1920, 1080);
8688+
8689+
if (amdgpu_dm_connector->dc_sink->edid_caps.analog) {
8690+
/* Analog monitor connected by DAC load detection.
8691+
* Add common modes. It will be up to the user to select one that works.
8692+
*/
8693+
for (int i = 0; i < ARRAY_SIZE(common_modes); i++)
8694+
amdgpu_dm_connector->num_modes += drm_add_modes_noedid(
8695+
connector, common_modes[i].w, common_modes[i].h);
8696+
}
86878697
} else {
86888698
amdgpu_dm_connector_ddc_get_modes(connector, drm_edid);
86898699
if (encoder)

0 commit comments

Comments
 (0)