Skip to content

Commit

Permalink
XXX: WIP: drm: Universal display rotation on Nexus 7
Browse files Browse the repository at this point in the history
This removes a need to have bleeding edge userspace that knows how to
work with the rotated planes. Only Opentegra driver supports planes rotation
today, everything else is upside-down without the universal rotation support.

The plan is to teach DRM core about the CRTC rotation capabilities and then
this hack won't be needed, for now it's not obvious how to implement that.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
  • Loading branch information
digetx committed Jan 16, 2022
1 parent 91985d9 commit afcc800
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/drm_connector.c
Expand Up @@ -2362,6 +2362,10 @@ int drm_connector_set_panel_orientation(
struct drm_display_info *info = &connector->display_info;
struct drm_property *prop;

/* Temporal hack for Nexus 7 */
if (of_machine_is_compatible("asus,grouper"))
return 0;

/* Already set? */
if (info->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
return 0;
Expand Down
8 changes: 8 additions & 0 deletions drivers/gpu/drm/grate/dc.c
Expand Up @@ -763,6 +763,14 @@ static void tegra_plane_atomic_update(struct drm_plane *plane,
window.format = tegra_plane_state->format;
window.swap = tegra_plane_state->swap;

if (of_machine_is_compatible("asus,grouper")) {
struct drm_display_mode *mode = &plane->state->crtc->state->adjusted_mode;
window.dst.x = mode->hdisplay - window.dst.w - window.dst.x;
window.dst.y = mode->vdisplay - window.dst.h - window.dst.y;
window.reflect_x = !window.reflect_x;
window.reflect_y = !window.reflect_y;
}

for (i = 0; i < fb->format->num_planes; i++) {
window.base[i] = tegra_plane_state->iova[i] + fb->offsets[i];

Expand Down
8 changes: 8 additions & 0 deletions drivers/gpu/drm/tegra/dc.c
Expand Up @@ -753,6 +753,14 @@ static void tegra_plane_atomic_update(struct drm_plane *plane,
window.format = tegra_plane_state->format;
window.swap = tegra_plane_state->swap;

if (of_machine_is_compatible("asus,grouper")) {
struct drm_display_mode *mode = &plane->state->crtc->state->adjusted_mode;
window.dst.x = mode->hdisplay - window.dst.w - window.dst.x;
window.dst.y = mode->vdisplay - window.dst.h - window.dst.y;
window.reflect_x = !window.reflect_x;
window.reflect_y = !window.reflect_y;
}

for (i = 0; i < fb->format->num_planes; i++) {
window.base[i] = tegra_plane_state->iova[i] + fb->offsets[i];

Expand Down

0 comments on commit afcc800

Please sign in to comment.