Skip to content

Commit d77de78

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 <[email protected]> Cc: Alex Deucher <[email protected]> Cc: Harry Wentland <[email protected]> Cc: Nicholas Kazlauskas <[email protected]> Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 31ea434 commit d77de78

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
@@ -7826,6 +7826,32 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder,
78267826
}
78277827
}
78287828

7829+
static void amdgpu_set_panel_orientation(struct drm_connector *connector)
7830+
{
7831+
struct drm_encoder *encoder;
7832+
struct amdgpu_encoder *amdgpu_encoder;
7833+
const struct drm_display_mode *native_mode;
7834+
7835+
if (connector->connector_type != DRM_MODE_CONNECTOR_eDP &&
7836+
connector->connector_type != DRM_MODE_CONNECTOR_LVDS)
7837+
return;
7838+
7839+
encoder = amdgpu_dm_connector_to_encoder(connector);
7840+
if (!encoder)
7841+
return;
7842+
7843+
amdgpu_encoder = to_amdgpu_encoder(encoder);
7844+
7845+
native_mode = &amdgpu_encoder->native_mode;
7846+
if (native_mode->hdisplay == 0 || native_mode->vdisplay == 0)
7847+
return;
7848+
7849+
drm_connector_set_panel_orientation_with_quirk(connector,
7850+
DRM_MODE_PANEL_ORIENTATION_UNKNOWN,
7851+
native_mode->hdisplay,
7852+
native_mode->vdisplay);
7853+
}
7854+
78297855
static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector,
78307856
struct edid *edid)
78317857
{
@@ -7854,6 +7880,8 @@ static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector,
78547880
* restored here.
78557881
*/
78567882
amdgpu_dm_update_freesync_caps(connector, edid);
7883+
7884+
amdgpu_set_panel_orientation(connector);
78577885
} else {
78587886
amdgpu_dm_connector->num_modes = 0;
78597887
}

0 commit comments

Comments
 (0)