Skip to content

Commit cd51a57

Browse files
emersionalexdeucher
authored andcommitted
amd/display: enable panel orientation quirks
This patch allows panel orientation quirks from DRM core to be used. They attach a DRM connector property "panel orientation" which indicates in which direction the panel has been mounted. Some machines have the internal screen mounted with a rotation. Since the panel orientation quirks need the native mode from the EDID, check for it in amdgpu_dm_connector_ddc_get_modes. Signed-off-by: Simon Ser <contact@emersion.fr> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: Harry Wentland <hwentlan@amd.com> Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent b287e49 commit cd51a57

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7528,6 +7528,32 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder,
75287528
}
75297529
}
75307530

7531+
static void amdgpu_set_panel_orientation(struct drm_connector *connector)
7532+
{
7533+
struct drm_encoder *encoder;
7534+
struct amdgpu_encoder *amdgpu_encoder;
7535+
const struct drm_display_mode *native_mode;
7536+
7537+
if (connector->connector_type != DRM_MODE_CONNECTOR_eDP &&
7538+
connector->connector_type != DRM_MODE_CONNECTOR_LVDS)
7539+
return;
7540+
7541+
encoder = amdgpu_dm_connector_to_encoder(connector);
7542+
if (!encoder)
7543+
return;
7544+
7545+
amdgpu_encoder = to_amdgpu_encoder(encoder);
7546+
7547+
native_mode = &amdgpu_encoder->native_mode;
7548+
if (native_mode->hdisplay == 0 || native_mode->vdisplay == 0)
7549+
return;
7550+
7551+
drm_connector_set_panel_orientation_with_quirk(connector,
7552+
DRM_MODE_PANEL_ORIENTATION_UNKNOWN,
7553+
native_mode->hdisplay,
7554+
native_mode->vdisplay);
7555+
}
7556+
75317557
static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector,
75327558
struct edid *edid)
75337559
{
@@ -7556,6 +7582,8 @@ static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector,
75567582
* restored here.
75577583
*/
75587584
amdgpu_dm_update_freesync_caps(connector, edid);
7585+
7586+
amdgpu_set_panel_orientation(connector);
75597587
} else {
75607588
amdgpu_dm_connector->num_modes = 0;
75617589
}

0 commit comments

Comments
 (0)