Hello!
This series adds 180° display plane rotation support to the NVIDIA Tegra DRM driver which is needed for devices that have display panel physically mounted upside-down, like Nexus 7 tablet device for example [1]. Since DRM panel rotation is a new thing for a userspace, currently only Opentegra Xorg driver handles the rotated display panel [2], but this is good enough for the start.
Note that later on it should be possible to implement a transparent 180° display rotation for Tegra DRM driver which will remove the need to have a bleeding edge userspace that knows how to rotate display planes and I'm slowly working on it. For the starter we can go with the minimal rotation support, so it's not a blocker.
This series is based on the work that was made by Derek Basehore for the Mediatek driver [3], his patch is included into this patchset. I added my tested-by tag to the Derek's patch.
Please review and apply, thanks in advance!
[1] https://patchwork.ozlabs.org/project/linux-tegra/patch/20200607154327.18589-... [2] https://github.com/grate-driver/xf86-video-opentegra/commit/28eb20a3959bbe5b... [3] https://lkml.org/lkml/2020/3/5/1119
Changelog:
v2: - Dropped "drm/panel: Set display info in panel attach" patch, which turned out to be obsolete now.
- Renamed the cover-latter, hopefully this will fix the bouncing emails.
Derek Basehore (1): drm/panel: Add helper for reading DT rotation
Dmitry Osipenko (4): drm/panel: lvds: Set up panel orientation drm/tegra: plane: Rename bottom_up to reflect_y drm/tegra: plane: Support horizontal reflection mode drm/tegra: plane: Support 180° rotation
drivers/gpu/drm/drm_panel.c | 43 ++++++++++++++++++++++++++++++ drivers/gpu/drm/panel/panel-lvds.c | 8 ++++++ drivers/gpu/drm/tegra/dc.c | 43 ++++++++++++++++++++++++------ drivers/gpu/drm/tegra/dc.h | 3 ++- drivers/gpu/drm/tegra/plane.c | 3 ++- drivers/gpu/drm/tegra/plane.h | 3 ++- include/drm/drm_panel.h | 9 +++++++ 7 files changed, 101 insertions(+), 11 deletions(-)
From: Derek Basehore dbasehore@chromium.org
This adds a helper function for reading the rotation (panel orientation) from the device tree.
Signed-off-by: Derek Basehore dbasehore@chromium.org Reviewed-by: Sam Ravnborg sam@ravnborg.org Tested-by: Dmitry Osipenko digetx@gmail.com Signed-off-by: Dmitry Osipenko digetx@gmail.com --- drivers/gpu/drm/drm_panel.c | 43 +++++++++++++++++++++++++++++++++++++ include/drm/drm_panel.h | 9 ++++++++ 2 files changed, 52 insertions(+)
diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 8c7bac85a793..5557c75301f1 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -300,6 +300,49 @@ struct drm_panel *of_drm_find_panel(const struct device_node *np) return ERR_PTR(-EPROBE_DEFER); } EXPORT_SYMBOL(of_drm_find_panel); + +/** + * of_drm_get_panel_orientation - look up the orientation of the panel through + * the "rotation" binding from a device tree node + * @np: device tree node of the panel + * @orientation: orientation enum to be filled in + * + * Looks up the rotation of a panel in the device tree. The orientation of the + * panel is expressed as a property name "rotation" in the device tree. The + * rotation in the device tree is counter clockwise. + * + * Return: 0 when a valid rotation value (0, 90, 180, or 270) is read or the + * rotation property doesn't exist. -EERROR otherwise. + */ +int of_drm_get_panel_orientation(const struct device_node *np, + enum drm_panel_orientation *orientation) +{ + int rotation, ret; + + ret = of_property_read_u32(np, "rotation", &rotation); + if (ret == -EINVAL) { + /* Don't return an error if there's no rotation property. */ + *orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; + return 0; + } + + if (ret < 0) + return ret; + + if (rotation == 0) + *orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; + else if (rotation == 90) + *orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; + else if (rotation == 180) + *orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; + else if (rotation == 270) + *orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; + else + return -EINVAL; + + return 0; +} +EXPORT_SYMBOL(of_drm_get_panel_orientation); #endif
#if IS_REACHABLE(CONFIG_BACKLIGHT_CLASS_DEVICE) diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 6193cb555acc..781c735f0f9b 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -35,6 +35,8 @@ struct drm_device; struct drm_panel; struct display_timing;
+enum drm_panel_orientation; + /** * struct drm_panel_funcs - perform operations on a given panel * @@ -191,11 +193,18 @@ int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector
#if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL) struct drm_panel *of_drm_find_panel(const struct device_node *np); +int of_drm_get_panel_orientation(const struct device_node *np, + enum drm_panel_orientation *orientation); #else static inline struct drm_panel *of_drm_find_panel(const struct device_node *np) { return ERR_PTR(-ENODEV); } +static inline int of_drm_get_panel_orientation(const struct device_node *np, + enum drm_panel_orientation *orientation) +{ + return -ENODEV; +} #endif
#if IS_ENABLED(CONFIG_DRM_PANEL) && (IS_BUILTIN(CONFIG_BACKLIGHT_CLASS_DEVICE) || \
The panel orientation needs to parsed from a device-tree and assigned to the panel's connector in order to make orientation property available to userspace. That's what this patch does for the generic LVDS panel.
Signed-off-by: Dmitry Osipenko digetx@gmail.com --- drivers/gpu/drm/panel/panel-lvds.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index 5ce3f4a2b7a1..333d21cee5f6 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -37,6 +37,8 @@ struct panel_lvds {
struct gpio_desc *enable_gpio; struct gpio_desc *reset_gpio; + + enum drm_panel_orientation orientation; };
static inline struct panel_lvds *to_panel_lvds(struct drm_panel *panel) @@ -99,6 +101,7 @@ static int panel_lvds_get_modes(struct drm_panel *panel, connector->display_info.bus_flags = lvds->data_mirror ? DRM_BUS_FLAG_DATA_LSB_TO_MSB : DRM_BUS_FLAG_DATA_MSB_TO_LSB; + drm_connector_set_panel_orientation(connector, lvds->orientation);
return 1; } @@ -223,6 +226,11 @@ static int panel_lvds_probe(struct platform_device *pdev) drm_panel_init(&lvds->panel, lvds->dev, &panel_lvds_funcs, DRM_MODE_CONNECTOR_LVDS);
+ ret = of_drm_get_panel_orientation(lvds->dev->of_node, + &lvds->orientation); + if (ret) + return ret; + ret = drm_panel_of_backlight(&lvds->panel); if (ret) return ret;
This makes the naming consistent with the DRM core.
Signed-off-by: Dmitry Osipenko digetx@gmail.com --- drivers/gpu/drm/tegra/dc.c | 10 +++++----- drivers/gpu/drm/tegra/dc.h | 2 +- drivers/gpu/drm/tegra/plane.c | 2 +- drivers/gpu/drm/tegra/plane.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 83f31c6e891c..ed282f88e409 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -404,7 +404,7 @@ static void tegra_dc_setup_window(struct tegra_plane *plane, tegra_plane_writel(plane, window->stride[0], DC_WIN_LINE_STRIDE); }
- if (window->bottom_up) + if (window->reflect_y) v_offset += window->src.h - 1;
tegra_plane_writel(plane, h_offset, DC_WINBUF_ADDR_H_OFFSET); @@ -470,7 +470,7 @@ static void tegra_dc_setup_window(struct tegra_plane *plane, value |= COLOR_EXPAND; }
- if (window->bottom_up) + if (window->reflect_y) value |= V_DIRECTION;
if (tegra_plane_use_horizontal_filtering(plane, window)) { @@ -642,9 +642,9 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, rotation = drm_rotation_simplify(state->rotation, rotation);
if (rotation & DRM_MODE_REFLECT_Y) - plane_state->bottom_up = true; + plane_state->reflect_y = true; else - plane_state->bottom_up = false; + plane_state->reflect_y = false;
/* * Tegra doesn't support different strides for U and V planes so we @@ -706,7 +706,7 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, window.dst.w = drm_rect_width(&plane->state->dst); window.dst.h = drm_rect_height(&plane->state->dst); window.bits_per_pixel = fb->format->cpp[0] * 8; - window.bottom_up = tegra_fb_is_bottom_up(fb) || state->bottom_up; + window.reflect_y = tegra_fb_is_bottom_up(fb) || state->reflect_y;
/* copy from state */ window.zpos = plane->state->normalized_zpos; diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index 3d8ddccd758f..98e1b625168e 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h @@ -136,7 +136,7 @@ struct tegra_dc_window { unsigned int stride[2]; unsigned long base[3]; unsigned int zpos; - bool bottom_up; + bool reflect_y;
struct tegra_bo_tiling tiling; u32 format; diff --git a/drivers/gpu/drm/tegra/plane.c b/drivers/gpu/drm/tegra/plane.c index 9ccfb56e9b01..e05ef6013a97 100644 --- a/drivers/gpu/drm/tegra/plane.c +++ b/drivers/gpu/drm/tegra/plane.c @@ -61,7 +61,7 @@ tegra_plane_atomic_duplicate_state(struct drm_plane *plane) copy->tiling = state->tiling; copy->format = state->format; copy->swap = state->swap; - copy->bottom_up = state->bottom_up; + copy->reflect_y = state->reflect_y; copy->opaque = state->opaque;
for (i = 0; i < 2; i++) diff --git a/drivers/gpu/drm/tegra/plane.h b/drivers/gpu/drm/tegra/plane.h index a158a915109a..8047fc916d8c 100644 --- a/drivers/gpu/drm/tegra/plane.h +++ b/drivers/gpu/drm/tegra/plane.h @@ -46,7 +46,7 @@ struct tegra_plane_state { u32 format; u32 swap;
- bool bottom_up; + bool reflect_y;
/* used for legacy blending support only */ struct tegra_plane_legacy_blending_state blending[2];
Support horizontal reflection mode which will allow to support 180° rotation mode when combined with the vertical reflection.
Signed-off-by: Dmitry Osipenko digetx@gmail.com --- drivers/gpu/drm/tegra/dc.c | 24 ++++++++++++++++++++---- drivers/gpu/drm/tegra/dc.h | 1 + drivers/gpu/drm/tegra/plane.c | 1 + drivers/gpu/drm/tegra/plane.h | 1 + 4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index ed282f88e409..f31bca27cde4 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -368,6 +368,12 @@ static void tegra_dc_setup_window(struct tegra_plane *plane, h_size = window->src.w * bpp; v_size = window->src.h;
+ if (window->reflect_x) + h_offset += (window->src.w - 1) * bpp; + + if (window->reflect_y) + v_offset += window->src.h - 1; + value = V_PRESCALED_SIZE(v_size) | H_PRESCALED_SIZE(h_size); tegra_plane_writel(plane, value, DC_WIN_PRESCALED_SIZE);
@@ -404,9 +410,6 @@ static void tegra_dc_setup_window(struct tegra_plane *plane, tegra_plane_writel(plane, window->stride[0], DC_WIN_LINE_STRIDE); }
- if (window->reflect_y) - v_offset += window->src.h - 1; - tegra_plane_writel(plane, h_offset, DC_WINBUF_ADDR_H_OFFSET); tegra_plane_writel(plane, v_offset, DC_WINBUF_ADDR_V_OFFSET);
@@ -470,6 +473,9 @@ static void tegra_dc_setup_window(struct tegra_plane *plane, value |= COLOR_EXPAND; }
+ if (window->reflect_x) + value |= H_DIRECTION; + if (window->reflect_y) value |= V_DIRECTION;
@@ -601,7 +607,9 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, struct drm_plane_state *state) { struct tegra_plane_state *plane_state = to_tegra_plane_state(state); - unsigned int rotation = DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_Y; + unsigned int rotation = DRM_MODE_ROTATE_0 | + DRM_MODE_REFLECT_X | + DRM_MODE_REFLECT_Y; struct tegra_bo_tiling *tiling = &plane_state->tiling; struct tegra_plane *tegra = to_tegra_plane(plane); struct tegra_dc *dc = to_tegra_dc(state->crtc); @@ -641,6 +649,11 @@ static int tegra_plane_atomic_check(struct drm_plane *plane,
rotation = drm_rotation_simplify(state->rotation, rotation);
+ if (rotation & DRM_MODE_REFLECT_X) + plane_state->reflect_x = true; + else + plane_state->reflect_x = false; + if (rotation & DRM_MODE_REFLECT_Y) plane_state->reflect_y = true; else @@ -706,6 +719,7 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, window.dst.w = drm_rect_width(&plane->state->dst); window.dst.h = drm_rect_height(&plane->state->dst); window.bits_per_pixel = fb->format->cpp[0] * 8; + window.reflect_x = state->reflect_x; window.reflect_y = tegra_fb_is_bottom_up(fb) || state->reflect_y;
/* copy from state */ @@ -792,6 +806,7 @@ static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm, err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 | + DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y); if (err < 0) dev_err(dc->dev, "failed to create rotation property: %d\n", @@ -1079,6 +1094,7 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 | + DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y); if (err < 0) dev_err(dc->dev, "failed to create rotation property: %d\n", diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index 98e1b625168e..051d03dcb9b0 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h @@ -136,6 +136,7 @@ struct tegra_dc_window { unsigned int stride[2]; unsigned long base[3]; unsigned int zpos; + bool reflect_x; bool reflect_y;
struct tegra_bo_tiling tiling; diff --git a/drivers/gpu/drm/tegra/plane.c b/drivers/gpu/drm/tegra/plane.c index e05ef6013a97..4cd0461cc508 100644 --- a/drivers/gpu/drm/tegra/plane.c +++ b/drivers/gpu/drm/tegra/plane.c @@ -61,6 +61,7 @@ tegra_plane_atomic_duplicate_state(struct drm_plane *plane) copy->tiling = state->tiling; copy->format = state->format; copy->swap = state->swap; + copy->reflect_x = state->reflect_x; copy->reflect_y = state->reflect_y; copy->opaque = state->opaque;
diff --git a/drivers/gpu/drm/tegra/plane.h b/drivers/gpu/drm/tegra/plane.h index 8047fc916d8c..c691dd79b27b 100644 --- a/drivers/gpu/drm/tegra/plane.h +++ b/drivers/gpu/drm/tegra/plane.h @@ -46,6 +46,7 @@ struct tegra_plane_state { u32 format; u32 swap;
+ bool reflect_x; bool reflect_y;
/* used for legacy blending support only */
Combining horizontal and vertical reflections gives us 180 degrees of rotation.
Signed-off-by: Dmitry Osipenko digetx@gmail.com --- drivers/gpu/drm/tegra/dc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index f31bca27cde4..ddd9b88f8fce 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -608,6 +608,7 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, { struct tegra_plane_state *plane_state = to_tegra_plane_state(state); unsigned int rotation = DRM_MODE_ROTATE_0 | + DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y; struct tegra_bo_tiling *tiling = &plane_state->tiling; @@ -659,6 +660,14 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, else plane_state->reflect_y = false;
+ if (tegra_fb_is_bottom_up(state->fb)) + plane_state->reflect_y = true; + + if (rotation & DRM_MODE_ROTATE_180) { + plane_state->reflect_x = !plane_state->reflect_x; + plane_state->reflect_y = !plane_state->reflect_y; + } + /* * Tegra doesn't support different strides for U and V planes so we * error out if the user tries to display a framebuffer with such a @@ -720,7 +729,7 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, window.dst.h = drm_rect_height(&plane->state->dst); window.bits_per_pixel = fb->format->cpp[0] * 8; window.reflect_x = state->reflect_x; - window.reflect_y = tegra_fb_is_bottom_up(fb) || state->reflect_y; + window.reflect_y = state->reflect_y;
/* copy from state */ window.zpos = plane->state->normalized_zpos; @@ -806,6 +815,7 @@ static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm, err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 | + DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y); if (err < 0) @@ -1094,6 +1104,7 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 | + DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y); if (err < 0)
On Sun, Jun 14, 2020 at 11:01:21PM +0300, Dmitry Osipenko wrote:
Combining horizontal and vertical reflections gives us 180 degrees of rotation.
Signed-off-by: Dmitry Osipenko digetx@gmail.com
drivers/gpu/drm/tegra/dc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index f31bca27cde4..ddd9b88f8fce 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -608,6 +608,7 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, { struct tegra_plane_state *plane_state = to_tegra_plane_state(state); unsigned int rotation = DRM_MODE_ROTATE_0 |
DRM_MODE_ROTATE_180 |
Leave this out ...
DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
struct tegra_bo_tiling *tiling = &plane_state->tiling; @@ -659,6 +660,14 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, else plane_state->reflect_y = false;
- if (tegra_fb_is_bottom_up(state->fb))
plane_state->reflect_y = true;
- if (rotation & DRM_MODE_ROTATE_180) {
plane_state->reflect_x = !plane_state->reflect_x;
plane_state->reflect_y = !plane_state->reflect_y;
- }
... and drm_rotation_simplify() will do this for you.
Though the bottim_up() thing will need a slightly different tweak I guess.
I'd write this as somehting like: rotation = state->rotation; if (bottom_up()) rotation ^= DRM_MODE_REFLECT_Y; rotation = drm_rotation_simplify(rotation, DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
Also note my use of XOR for the bottom_up() handling. I suspect the current code is already broken if you combine bottom_up() and REFLECT_Y since it just uses an OR instead of an XOR. That's assuming my hucnh what bottom_up() is supposed to do is correct.
- /*
- Tegra doesn't support different strides for U and V planes so we
- error out if the user tries to display a framebuffer with such a
@@ -720,7 +729,7 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, window.dst.h = drm_rect_height(&plane->state->dst); window.bits_per_pixel = fb->format->cpp[0] * 8; window.reflect_x = state->reflect_x;
- window.reflect_y = tegra_fb_is_bottom_up(fb) || state->reflect_y;
window.reflect_y = state->reflect_y;
/* copy from state */ window.zpos = plane->state->normalized_zpos;
@@ -806,6 +815,7 @@ static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm, err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 |
if (err < 0)DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y);
@@ -1094,6 +1104,7 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 |
if (err < 0)DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y);
-- 2.26.0
dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
15.06.2020 19:57, Ville Syrjälä пишет:
On Sun, Jun 14, 2020 at 11:01:21PM +0300, Dmitry Osipenko wrote:
Combining horizontal and vertical reflections gives us 180 degrees of rotation.
Signed-off-by: Dmitry Osipenko digetx@gmail.com
drivers/gpu/drm/tegra/dc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index f31bca27cde4..ddd9b88f8fce 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -608,6 +608,7 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, { struct tegra_plane_state *plane_state = to_tegra_plane_state(state); unsigned int rotation = DRM_MODE_ROTATE_0 |
DRM_MODE_ROTATE_180 |
Leave this out ...
DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
struct tegra_bo_tiling *tiling = &plane_state->tiling; @@ -659,6 +660,14 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, else plane_state->reflect_y = false;
- if (tegra_fb_is_bottom_up(state->fb))
plane_state->reflect_y = true;
- if (rotation & DRM_MODE_ROTATE_180) {
plane_state->reflect_x = !plane_state->reflect_x;
plane_state->reflect_y = !plane_state->reflect_y;
- }
... and drm_rotation_simplify() will do this for you.
Hello Ville,
Indeed, thank you for the suggestion!
Though the bottim_up() thing will need a slightly different tweak I guess.
I'd write this as somehting like: rotation = state->rotation; if (bottom_up()) rotation ^= DRM_MODE_REFLECT_Y; rotation = drm_rotation_simplify(rotation, DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
Also note my use of XOR for the bottom_up() handling. I suspect the current code is already broken if you combine bottom_up() and REFLECT_Y since it just uses an OR instead of an XOR. That's assuming my hucnh what bottom_up() is supposed to do is correct.
The bottom_up() is a legacy way of specifying reflect_y flag of the modern DRM's rotation property. It's was used by older userspace before Tegra DRM driver got support for the rotation property and we keep it today in order to maintain backwards compatibility with older userspace. Although, maybe it's about time to retire it since I don't think that such old userspace exists anymore.
The legacy bottom_up() duplicates the modern reflect_y flag, so these are not mutually exclusive. Combining with yours suggestion above, we can write it in this way:
/* * Older userspace used custom BO flag in order to specify * the Y reflection, while modern userspace uses the generic * DRM rotation property in order to achieve the same result. * The legacy BO flag amends the modern rotation property * when both are set. */ if (tegra_fb_is_bottom_up(state->fb)) rotation = drm_rotation_simplify(state->rotation | DRM_MODE_REFLECT_Y, rotation); else rotation = drm_rotation_simplify(state->rotation, rotation);
Thank you very much for taking a look at this patch! I'll prepare v3 in accordance to yours comments.
Hi all,
Perhaps a silly question:
On Mon, 15 Jun 2020 at 08:28, Dmitry Osipenko digetx@gmail.com wrote:
Combining horizontal and vertical reflections gives us 180 degrees of rotation.
Signed-off-by: Dmitry Osipenko digetx@gmail.com
drivers/gpu/drm/tegra/dc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index f31bca27cde4..ddd9b88f8fce 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c
if (rotation & DRM_MODE_ROTATE_180) {
plane_state->reflect_x = !plane_state->reflect_x;
plane_state->reflect_y = !plane_state->reflect_y;
}
As mentioned by Ville the above is already handled by drm_rotation_simplify() ... although it makes me wonder:
err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 |
DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y);
Would it make sense for drm_plane_create_rotation_property() itself, to add DRM_MODE_ROTATE_180, when both reflections are supported?
-Emil
16.06.2020 00:47, Emil Velikov пишет:
Hi all,
Perhaps a silly question:
On Mon, 15 Jun 2020 at 08:28, Dmitry Osipenko digetx@gmail.com wrote:
Combining horizontal and vertical reflections gives us 180 degrees of rotation.
Signed-off-by: Dmitry Osipenko digetx@gmail.com
drivers/gpu/drm/tegra/dc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index f31bca27cde4..ddd9b88f8fce 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c
if (rotation & DRM_MODE_ROTATE_180) {
plane_state->reflect_x = !plane_state->reflect_x;
plane_state->reflect_y = !plane_state->reflect_y;
}
As mentioned by Ville the above is already handled by drm_rotation_simplify() ... although it makes me wonder:
err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 |
DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y);
Would it make sense for drm_plane_create_rotation_property() itself, to add DRM_MODE_ROTATE_180, when both reflections are supported?
Hello Emil,
That's a good point! All DRM_MODE_ROTATE_180 should be removed because Tegra can't do 180° + reflected-x. The DRM core takes care of 180° rotation when both x/y reflections are supported.
16.06.2020 14:25, Dmitry Osipenko пишет:
16.06.2020 00:47, Emil Velikov пишет:
Hi all,
Perhaps a silly question:
On Mon, 15 Jun 2020 at 08:28, Dmitry Osipenko digetx@gmail.com wrote:
Combining horizontal and vertical reflections gives us 180 degrees of rotation.
Signed-off-by: Dmitry Osipenko digetx@gmail.com
drivers/gpu/drm/tegra/dc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index f31bca27cde4..ddd9b88f8fce 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c
if (rotation & DRM_MODE_ROTATE_180) {
plane_state->reflect_x = !plane_state->reflect_x;
plane_state->reflect_y = !plane_state->reflect_y;
}
As mentioned by Ville the above is already handled by drm_rotation_simplify() ... although it makes me wonder:
err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 |
DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y);
Would it make sense for drm_plane_create_rotation_property() itself, to add DRM_MODE_ROTATE_180, when both reflections are supported?
Hello Emil,
That's a good point! All DRM_MODE_ROTATE_180 should be removed because Tegra can't do 180° + reflected-x. The DRM core takes care of 180° rotation when both x/y reflections are supported.
I just found out that I forgot to drop the WIP patches which added transparent rotation support while was checking whether these plane DRM_MODE_ROTATE_180 could be dropped and it's actually need to be set for the planes, otherwise 180 rotation support is filtered out by the atomic check.
Hi Dmitry,
On Mon, 15 Jun 2020 at 08:28, Dmitry Osipenko digetx@gmail.com wrote:
Hello!
This series adds 180° display plane rotation support to the NVIDIA Tegra DRM driver which is needed for devices that have display panel physically mounted upside-down, like Nexus 7 tablet device for example [1]. Since DRM panel rotation is a new thing for a userspace, currently only Opentegra Xorg driver handles the rotated display panel [2], but this is good enough for the start.
Note that later on it should be possible to implement a transparent 180° display rotation for Tegra DRM driver which will remove the need to have a bleeding edge userspace that knows how to rotate display planes and I'm slowly working on it. For the starter we can go with the minimal rotation support, so it's not a blocker.
This series is based on the work that was made by Derek Basehore for the Mediatek driver [3], his patch is included into this patchset. I added my tested-by tag to the Derek's patch.
Please review and apply, thanks in advance!
[1] https://patchwork.ozlabs.org/project/linux-tegra/patch/20200607154327.18589-... [2] https://github.com/grate-driver/xf86-video-opentegra/commit/28eb20a3959bbe5b... [3] https://lkml.org/lkml/2020/3/5/1119
Changelog:
v2: - Dropped "drm/panel: Set display info in panel attach" patch, which turned out to be obsolete now.
- Renamed the cover-latter, hopefully this will fix the bouncing emails.
Derek Basehore (1): drm/panel: Add helper for reading DT rotation
Dmitry Osipenko (4): drm/panel: lvds: Set up panel orientation
IMHO it's perfectly reasonable to report the panel orientation to userspace, which can apply plane rotation as needed.
Although I see that this series, alike Derek's, has a couple of issues: - only a single panel driver is updated - rotation is _not_ listed as supported property, in said panel driver device-tree bindings
My personal inclination is that we should aim for a comprehensive solution: - wire all panel drivers, as currently documented (quick grep list below) - document and wire-up the lvds and boe panels - as proposed by you and Derek respectively
HTH Emil
Documentation/devicetree/bindings/display/himax,hx8357d.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9225.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9341.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9486.yaml:2 Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt:2 Documentation/devicetree/bindings/display/panel/panel-common.yaml:2 Documentation/devicetree/bindings/display/sitronix,st7586.txt:1 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml:2
16.06.2020 01:26, Emil Velikov пишет:
Hi Dmitry,
On Mon, 15 Jun 2020 at 08:28, Dmitry Osipenko digetx@gmail.com wrote:
Hello!
This series adds 180° display plane rotation support to the NVIDIA Tegra DRM driver which is needed for devices that have display panel physically mounted upside-down, like Nexus 7 tablet device for example [1]. Since DRM panel rotation is a new thing for a userspace, currently only Opentegra Xorg driver handles the rotated display panel [2], but this is good enough for the start.
Note that later on it should be possible to implement a transparent 180° display rotation for Tegra DRM driver which will remove the need to have a bleeding edge userspace that knows how to rotate display planes and I'm slowly working on it. For the starter we can go with the minimal rotation support, so it's not a blocker.
This series is based on the work that was made by Derek Basehore for the Mediatek driver [3], his patch is included into this patchset. I added my tested-by tag to the Derek's patch.
Please review and apply, thanks in advance!
[1] https://patchwork.ozlabs.org/project/linux-tegra/patch/20200607154327.18589-... [2] https://github.com/grate-driver/xf86-video-opentegra/commit/28eb20a3959bbe5b... [3] https://lkml.org/lkml/2020/3/5/1119
Changelog:
v2: - Dropped "drm/panel: Set display info in panel attach" patch, which turned out to be obsolete now.
- Renamed the cover-latter, hopefully this will fix the bouncing emails.
Derek Basehore (1): drm/panel: Add helper for reading DT rotation
Dmitry Osipenko (4): drm/panel: lvds: Set up panel orientation
IMHO it's perfectly reasonable to report the panel orientation to userspace, which can apply plane rotation as needed.
Although I see that this series, alike Derek's, has a couple of issues:
- only a single panel driver is updated
- rotation is _not_ listed as supported property, in said panel
driver device-tree bindings
My personal inclination is that we should aim for a comprehensive solution:
- wire all panel drivers, as currently documented (quick grep list below)
- document and wire-up the lvds and boe panels - as proposed by you
and Derek respectively
HTH Emil
Documentation/devicetree/bindings/display/himax,hx8357d.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9225.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9341.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9486.yaml:2 Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt:2 Documentation/devicetree/bindings/display/panel/panel-common.yaml:2 Documentation/devicetree/bindings/display/sitronix,st7586.txt:1 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml:2
Rotation is a common DT panel property that is described in the panel-common.yaml. This property is supported by all panel bindings because these bindings inherent the common properties from the panel-common.yaml.
I don't think that it makes sense to wire up rotation property to all panel drivers at once because those drivers will be untested, at least I don't know anything about those other panels and can't test them. It will be much better to support the rotation on by as-needed basis for each panel driver individually.
On Tue, 16 Jun 2020 at 12:40, Dmitry Osipenko digetx@gmail.com wrote:
16.06.2020 01:26, Emil Velikov пишет:
Hi Dmitry,
On Mon, 15 Jun 2020 at 08:28, Dmitry Osipenko digetx@gmail.com wrote:
Hello!
This series adds 180° display plane rotation support to the NVIDIA Tegra DRM driver which is needed for devices that have display panel physically mounted upside-down, like Nexus 7 tablet device for example [1]. Since DRM panel rotation is a new thing for a userspace, currently only Opentegra Xorg driver handles the rotated display panel [2], but this is good enough for the start.
Note that later on it should be possible to implement a transparent 180° display rotation for Tegra DRM driver which will remove the need to have a bleeding edge userspace that knows how to rotate display planes and I'm slowly working on it. For the starter we can go with the minimal rotation support, so it's not a blocker.
This series is based on the work that was made by Derek Basehore for the Mediatek driver [3], his patch is included into this patchset. I added my tested-by tag to the Derek's patch.
Please review and apply, thanks in advance!
[1] https://patchwork.ozlabs.org/project/linux-tegra/patch/20200607154327.18589-... [2] https://github.com/grate-driver/xf86-video-opentegra/commit/28eb20a3959bbe5b... [3] https://lkml.org/lkml/2020/3/5/1119
Changelog:
v2: - Dropped "drm/panel: Set display info in panel attach" patch, which turned out to be obsolete now.
- Renamed the cover-latter, hopefully this will fix the bouncing emails.
Derek Basehore (1): drm/panel: Add helper for reading DT rotation
Dmitry Osipenko (4): drm/panel: lvds: Set up panel orientation
IMHO it's perfectly reasonable to report the panel orientation to userspace, which can apply plane rotation as needed.
Although I see that this series, alike Derek's, has a couple of issues:
- only a single panel driver is updated
- rotation is _not_ listed as supported property, in said panel
driver device-tree bindings
My personal inclination is that we should aim for a comprehensive solution:
- wire all panel drivers, as currently documented (quick grep list below)
- document and wire-up the lvds and boe panels - as proposed by you
and Derek respectively
HTH Emil
Documentation/devicetree/bindings/display/himax,hx8357d.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9225.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9341.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9486.yaml:2 Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt:2 Documentation/devicetree/bindings/display/panel/panel-common.yaml:2 Documentation/devicetree/bindings/display/sitronix,st7586.txt:1 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml:2
Rotation is a common DT panel property that is described in the panel-common.yaml.
The property was introduced almost exclusively for tiny drm panels. Those ones are a bit different from the rest (in panel/) - MIPI-DBI/SPI w/o (not connected at least) an actual GPU.
To make it a bit better, the rotation is seemingly performed in the tiny driver itself ouch.
This property is supported by all panel bindings because these bindings inherent the common properties from the panel-common.yaml.
Seems like that was an unintentional change with the conversion to YAML. Beforehand only a few selected panels had rotation. Upon closer look - some panels do have follow-up fixes, to remove/limit the implicit inclusion.
Sam seems like you've done most of the YAML conversion. IMHO it would make sense to revisit the patches and inherit common properties only as applicable.
I don't think that it makes sense to wire up rotation property to all panel drivers at once because those drivers will be untested, at least I don't know anything about those other panels and can't test them. It will be much better to support the rotation on by as-needed basis for each panel driver individually.
How about CCing the author and reviewer asking them to test the patch? The only place where the patches might cause an issue is with tiny, although patches would still be appreciated.
-Emil
16.06.2020 18:48, Emil Velikov пишет:
On Tue, 16 Jun 2020 at 12:40, Dmitry Osipenko digetx@gmail.com wrote:
16.06.2020 01:26, Emil Velikov пишет:
Hi Dmitry,
On Mon, 15 Jun 2020 at 08:28, Dmitry Osipenko digetx@gmail.com wrote:
Hello!
This series adds 180° display plane rotation support to the NVIDIA Tegra DRM driver which is needed for devices that have display panel physically mounted upside-down, like Nexus 7 tablet device for example [1]. Since DRM panel rotation is a new thing for a userspace, currently only Opentegra Xorg driver handles the rotated display panel [2], but this is good enough for the start.
Note that later on it should be possible to implement a transparent 180° display rotation for Tegra DRM driver which will remove the need to have a bleeding edge userspace that knows how to rotate display planes and I'm slowly working on it. For the starter we can go with the minimal rotation support, so it's not a blocker.
This series is based on the work that was made by Derek Basehore for the Mediatek driver [3], his patch is included into this patchset. I added my tested-by tag to the Derek's patch.
Please review and apply, thanks in advance!
[1] https://patchwork.ozlabs.org/project/linux-tegra/patch/20200607154327.18589-... [2] https://github.com/grate-driver/xf86-video-opentegra/commit/28eb20a3959bbe5b... [3] https://lkml.org/lkml/2020/3/5/1119
Changelog:
v2: - Dropped "drm/panel: Set display info in panel attach" patch, which turned out to be obsolete now.
- Renamed the cover-latter, hopefully this will fix the bouncing emails.
Derek Basehore (1): drm/panel: Add helper for reading DT rotation
Dmitry Osipenko (4): drm/panel: lvds: Set up panel orientation
IMHO it's perfectly reasonable to report the panel orientation to userspace, which can apply plane rotation as needed.
Although I see that this series, alike Derek's, has a couple of issues:
- only a single panel driver is updated
- rotation is _not_ listed as supported property, in said panel
driver device-tree bindings
My personal inclination is that we should aim for a comprehensive solution:
- wire all panel drivers, as currently documented (quick grep list below)
- document and wire-up the lvds and boe panels - as proposed by you
and Derek respectively
HTH Emil
Documentation/devicetree/bindings/display/himax,hx8357d.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9225.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9341.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9486.yaml:2 Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt:2 Documentation/devicetree/bindings/display/panel/panel-common.yaml:2 Documentation/devicetree/bindings/display/sitronix,st7586.txt:1 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml:2
Rotation is a common DT panel property that is described in the panel-common.yaml.
The property was introduced almost exclusively for tiny drm panels. Those ones are a bit different from the rest (in panel/) - MIPI-DBI/SPI w/o (not connected at least) an actual GPU.
To make it a bit better, the rotation is seemingly performed in the tiny driver itself ouch.
This property is supported by all panel bindings because these bindings inherent the common properties from the panel-common.yaml.
Seems like that was an unintentional change with the conversion to YAML. Beforehand only a few selected panels had rotation. Upon closer look - some panels do have follow-up fixes, to remove/limit the implicit inclusion.
Interesting.. my understanding that the rotation property is supposed to be a generic property which represents physical orientation of a display panel and hence it should be applicable to all panels.
Sam seems like you've done most of the YAML conversion. IMHO it would make sense to revisit the patches and inherit common properties only as applicable.
I don't think that it makes sense to wire up rotation property to all panel drivers at once because those drivers will be untested, at least I don't know anything about those other panels and can't test them. It will be much better to support the rotation on by as-needed basis for each panel driver individually.
How about CCing the author and reviewer asking them to test the patch? The only place where the patches might cause an issue is with tiny, although patches would still be appreciated.
There are quite a lot of panel drivers and I'm a bit doubtful that at least half of devices that use those panels have any real use for the rotation property. I could write the patches.. but in the end it could be a wasted effort if nobody needs it, so I'd prefer not to do it.
On Tue, Jun 16, 2020 at 08:20:57PM +0300, Dmitry Osipenko wrote:
16.06.2020 18:48, Emil Velikov пишет:
On Tue, 16 Jun 2020 at 12:40, Dmitry Osipenko digetx@gmail.com wrote:
16.06.2020 01:26, Emil Velikov пишет:
Hi Dmitry,
On Mon, 15 Jun 2020 at 08:28, Dmitry Osipenko digetx@gmail.com wrote:
Hello!
This series adds 180° display plane rotation support to the NVIDIA Tegra DRM driver which is needed for devices that have display panel physically mounted upside-down, like Nexus 7 tablet device for example [1]. Since DRM panel rotation is a new thing for a userspace, currently only Opentegra Xorg driver handles the rotated display panel [2], but this is good enough for the start.
Note that later on it should be possible to implement a transparent 180° display rotation for Tegra DRM driver which will remove the need to have a bleeding edge userspace that knows how to rotate display planes and I'm slowly working on it. For the starter we can go with the minimal rotation support, so it's not a blocker.
This series is based on the work that was made by Derek Basehore for the Mediatek driver [3], his patch is included into this patchset. I added my tested-by tag to the Derek's patch.
Please review and apply, thanks in advance!
[1] https://patchwork.ozlabs.org/project/linux-tegra/patch/20200607154327.18589-... [2] https://github.com/grate-driver/xf86-video-opentegra/commit/28eb20a3959bbe5b... [3] https://lkml.org/lkml/2020/3/5/1119
Changelog:
v2: - Dropped "drm/panel: Set display info in panel attach" patch, which turned out to be obsolete now.
- Renamed the cover-latter, hopefully this will fix the bouncing emails.
Derek Basehore (1): drm/panel: Add helper for reading DT rotation
Dmitry Osipenko (4): drm/panel: lvds: Set up panel orientation
IMHO it's perfectly reasonable to report the panel orientation to userspace, which can apply plane rotation as needed.
Although I see that this series, alike Derek's, has a couple of issues:
- only a single panel driver is updated
- rotation is _not_ listed as supported property, in said panel
driver device-tree bindings
My personal inclination is that we should aim for a comprehensive solution:
- wire all panel drivers, as currently documented (quick grep list below)
- document and wire-up the lvds and boe panels - as proposed by you
and Derek respectively
HTH Emil
Documentation/devicetree/bindings/display/himax,hx8357d.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9225.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9341.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9486.yaml:2 Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt:2 Documentation/devicetree/bindings/display/panel/panel-common.yaml:2 Documentation/devicetree/bindings/display/sitronix,st7586.txt:1 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml:2
Rotation is a common DT panel property that is described in the panel-common.yaml.
The property was introduced almost exclusively for tiny drm panels. Those ones are a bit different from the rest (in panel/) - MIPI-DBI/SPI w/o (not connected at least) an actual GPU.
To make it a bit better, the rotation is seemingly performed in the tiny driver itself ouch.
This property is supported by all panel bindings because these bindings inherent the common properties from the panel-common.yaml.
Seems like that was an unintentional change with the conversion to YAML. Beforehand only a few selected panels had rotation. Upon closer look - some panels do have follow-up fixes, to remove/limit the implicit inclusion.
Interesting.. my understanding that the rotation property is supposed to be a generic property which represents physical orientation of a display panel and hence it should be applicable to all panels.
Adding a bit more food for thoughts, the DT rotation property for camera sensor modules has recently been documented with lots of details. See https://lore.kernel.org/linux-media/20200509090456.3496481-3-jacopo@jmondi.o..., part of the documentation may be useful for panels.
Sam seems like you've done most of the YAML conversion. IMHO it would make sense to revisit the patches and inherit common properties only as applicable.
I don't think that it makes sense to wire up rotation property to all panel drivers at once because those drivers will be untested, at least I don't know anything about those other panels and can't test them. It will be much better to support the rotation on by as-needed basis for each panel driver individually.
How about CCing the author and reviewer asking them to test the patch? The only place where the patches might cause an issue is with tiny, although patches would still be appreciated.
There are quite a lot of panel drivers and I'm a bit doubtful that at least half of devices that use those panels have any real use for the rotation property. I could write the patches.. but in the end it could be a wasted effort if nobody needs it, so I'd prefer not to do it.
16.06.2020 20:45, Laurent Pinchart пишет:
On Tue, Jun 16, 2020 at 08:20:57PM +0300, Dmitry Osipenko wrote:
16.06.2020 18:48, Emil Velikov пишет:
On Tue, 16 Jun 2020 at 12:40, Dmitry Osipenko digetx@gmail.com wrote:
16.06.2020 01:26, Emil Velikov пишет:
Hi Dmitry,
On Mon, 15 Jun 2020 at 08:28, Dmitry Osipenko digetx@gmail.com wrote:
Hello!
This series adds 180° display plane rotation support to the NVIDIA Tegra DRM driver which is needed for devices that have display panel physically mounted upside-down, like Nexus 7 tablet device for example [1]. Since DRM panel rotation is a new thing for a userspace, currently only Opentegra Xorg driver handles the rotated display panel [2], but this is good enough for the start.
Note that later on it should be possible to implement a transparent 180° display rotation for Tegra DRM driver which will remove the need to have a bleeding edge userspace that knows how to rotate display planes and I'm slowly working on it. For the starter we can go with the minimal rotation support, so it's not a blocker.
This series is based on the work that was made by Derek Basehore for the Mediatek driver [3], his patch is included into this patchset. I added my tested-by tag to the Derek's patch.
Please review and apply, thanks in advance!
[1] https://patchwork.ozlabs.org/project/linux-tegra/patch/20200607154327.18589-... [2] https://github.com/grate-driver/xf86-video-opentegra/commit/28eb20a3959bbe5b... [3] https://lkml.org/lkml/2020/3/5/1119
Changelog:
v2: - Dropped "drm/panel: Set display info in panel attach" patch, which turned out to be obsolete now.
- Renamed the cover-latter, hopefully this will fix the bouncing emails.
Derek Basehore (1): drm/panel: Add helper for reading DT rotation
Dmitry Osipenko (4): drm/panel: lvds: Set up panel orientation
IMHO it's perfectly reasonable to report the panel orientation to userspace, which can apply plane rotation as needed.
Although I see that this series, alike Derek's, has a couple of issues:
- only a single panel driver is updated
- rotation is _not_ listed as supported property, in said panel
driver device-tree bindings
My personal inclination is that we should aim for a comprehensive solution:
- wire all panel drivers, as currently documented (quick grep list below)
- document and wire-up the lvds and boe panels - as proposed by you
and Derek respectively
HTH Emil
Documentation/devicetree/bindings/display/himax,hx8357d.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9225.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9341.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9486.yaml:2 Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt:2 Documentation/devicetree/bindings/display/panel/panel-common.yaml:2 Documentation/devicetree/bindings/display/sitronix,st7586.txt:1 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml:2
Rotation is a common DT panel property that is described in the panel-common.yaml.
The property was introduced almost exclusively for tiny drm panels. Those ones are a bit different from the rest (in panel/) - MIPI-DBI/SPI w/o (not connected at least) an actual GPU.
To make it a bit better, the rotation is seemingly performed in the tiny driver itself ouch.
This property is supported by all panel bindings because these bindings inherent the common properties from the panel-common.yaml.
Seems like that was an unintentional change with the conversion to YAML. Beforehand only a few selected panels had rotation. Upon closer look - some panels do have follow-up fixes, to remove/limit the implicit inclusion.
Interesting.. my understanding that the rotation property is supposed to be a generic property which represents physical orientation of a display panel and hence it should be applicable to all panels.
Adding a bit more food for thoughts, the DT rotation property for camera sensor modules has recently been documented with lots of details. See https://lore.kernel.org/linux-media/20200509090456.3496481-3-jacopo@jmondi.o..., part of the documentation may be useful for panels.
Thanks!
On Tue, 16 Jun 2020 at 18:20, Dmitry Osipenko digetx@gmail.com wrote:
16.06.2020 18:48, Emil Velikov пишет:
On Tue, 16 Jun 2020 at 12:40, Dmitry Osipenko digetx@gmail.com wrote:
16.06.2020 01:26, Emil Velikov пишет:
Hi Dmitry,
On Mon, 15 Jun 2020 at 08:28, Dmitry Osipenko digetx@gmail.com wrote:
Hello!
This series adds 180° display plane rotation support to the NVIDIA Tegra DRM driver which is needed for devices that have display panel physically mounted upside-down, like Nexus 7 tablet device for example [1]. Since DRM panel rotation is a new thing for a userspace, currently only Opentegra Xorg driver handles the rotated display panel [2], but this is good enough for the start.
Note that later on it should be possible to implement a transparent 180° display rotation for Tegra DRM driver which will remove the need to have a bleeding edge userspace that knows how to rotate display planes and I'm slowly working on it. For the starter we can go with the minimal rotation support, so it's not a blocker.
This series is based on the work that was made by Derek Basehore for the Mediatek driver [3], his patch is included into this patchset. I added my tested-by tag to the Derek's patch.
Please review and apply, thanks in advance!
[1] https://patchwork.ozlabs.org/project/linux-tegra/patch/20200607154327.18589-... [2] https://github.com/grate-driver/xf86-video-opentegra/commit/28eb20a3959bbe5b... [3] https://lkml.org/lkml/2020/3/5/1119
Changelog:
v2: - Dropped "drm/panel: Set display info in panel attach" patch, which turned out to be obsolete now.
- Renamed the cover-latter, hopefully this will fix the bouncing emails.
Derek Basehore (1): drm/panel: Add helper for reading DT rotation
Dmitry Osipenko (4): drm/panel: lvds: Set up panel orientation
IMHO it's perfectly reasonable to report the panel orientation to userspace, which can apply plane rotation as needed.
Although I see that this series, alike Derek's, has a couple of issues:
- only a single panel driver is updated
- rotation is _not_ listed as supported property, in said panel
driver device-tree bindings
My personal inclination is that we should aim for a comprehensive solution:
- wire all panel drivers, as currently documented (quick grep list below)
- document and wire-up the lvds and boe panels - as proposed by you
and Derek respectively
HTH Emil
Documentation/devicetree/bindings/display/himax,hx8357d.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9225.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9341.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9486.yaml:2 Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt:2 Documentation/devicetree/bindings/display/panel/panel-common.yaml:2 Documentation/devicetree/bindings/display/sitronix,st7586.txt:1 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml:2
Rotation is a common DT panel property that is described in the panel-common.yaml.
The property was introduced almost exclusively for tiny drm panels. Those ones are a bit different from the rest (in panel/) - MIPI-DBI/SPI w/o (not connected at least) an actual GPU.
To make it a bit better, the rotation is seemingly performed in the tiny driver itself ouch.
This property is supported by all panel bindings because these bindings inherent the common properties from the panel-common.yaml.
Seems like that was an unintentional change with the conversion to YAML. Beforehand only a few selected panels had rotation. Upon closer look - some panels do have follow-up fixes, to remove/limit the implicit inclusion.
Interesting.. my understanding that the rotation property is supposed to be a generic property which represents physical orientation of a display panel and hence it should be applicable to all panels.
You're spot on - it is/should be a generic property.
I believe that in general many panels were mounted in the correct orientation so the property, kernel and userspace were slow to catch up. In some cases panels will use flip x+y to denote 180 rotation, yet lacking the rotation property. The s6e8aa0 is an example of the last oddity. To make it better, the two dts in-tree always set both flip x and y.
Tl;Dr: Hysterical raisins
Sam seems like you've done most of the YAML conversion. IMHO it would make sense to revisit the patches and inherit common properties only as applicable.
I don't think that it makes sense to wire up rotation property to all panel drivers at once because those drivers will be untested, at least I don't know anything about those other panels and can't test them. It will be much better to support the rotation on by as-needed basis for each panel driver individually.
How about CCing the author and reviewer asking them to test the patch? The only place where the patches might cause an issue is with tiny, although patches would still be appreciated.
There are quite a lot of panel drivers and I'm a bit doubtful that at least half of devices that use those panels have any real use for the rotation property. I could write the patches.. but in the end it could be a wasted effort if nobody needs it, so I'd prefer not to do it.
That's why I mentioned the rotation introduction or "confusion" if I may. Skimming through the pre/post YAML device tree bindings and grep through the panel themselves will greatly reduce the list. In other words: if neither binding documentation/in-tree dts nor panel mentions rotation - omit it.
-Emil
16.06.2020 21:54, Emil Velikov пишет:
On Tue, 16 Jun 2020 at 18:20, Dmitry Osipenko digetx@gmail.com wrote:
16.06.2020 18:48, Emil Velikov пишет:
On Tue, 16 Jun 2020 at 12:40, Dmitry Osipenko digetx@gmail.com wrote:
16.06.2020 01:26, Emil Velikov пишет:
Hi Dmitry,
On Mon, 15 Jun 2020 at 08:28, Dmitry Osipenko digetx@gmail.com wrote:
Hello!
This series adds 180° display plane rotation support to the NVIDIA Tegra DRM driver which is needed for devices that have display panel physically mounted upside-down, like Nexus 7 tablet device for example [1]. Since DRM panel rotation is a new thing for a userspace, currently only Opentegra Xorg driver handles the rotated display panel [2], but this is good enough for the start.
Note that later on it should be possible to implement a transparent 180° display rotation for Tegra DRM driver which will remove the need to have a bleeding edge userspace that knows how to rotate display planes and I'm slowly working on it. For the starter we can go with the minimal rotation support, so it's not a blocker.
This series is based on the work that was made by Derek Basehore for the Mediatek driver [3], his patch is included into this patchset. I added my tested-by tag to the Derek's patch.
Please review and apply, thanks in advance!
[1] https://patchwork.ozlabs.org/project/linux-tegra/patch/20200607154327.18589-... [2] https://github.com/grate-driver/xf86-video-opentegra/commit/28eb20a3959bbe5b... [3] https://lkml.org/lkml/2020/3/5/1119
Changelog:
v2: - Dropped "drm/panel: Set display info in panel attach" patch, which turned out to be obsolete now.
- Renamed the cover-latter, hopefully this will fix the bouncing emails.
Derek Basehore (1): drm/panel: Add helper for reading DT rotation
Dmitry Osipenko (4): drm/panel: lvds: Set up panel orientation
IMHO it's perfectly reasonable to report the panel orientation to userspace, which can apply plane rotation as needed.
Although I see that this series, alike Derek's, has a couple of issues:
- only a single panel driver is updated
- rotation is _not_ listed as supported property, in said panel
driver device-tree bindings
My personal inclination is that we should aim for a comprehensive solution:
- wire all panel drivers, as currently documented (quick grep list below)
- document and wire-up the lvds and boe panels - as proposed by you
and Derek respectively
HTH Emil
Documentation/devicetree/bindings/display/himax,hx8357d.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9225.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9341.txt:2 Documentation/devicetree/bindings/display/ilitek,ili9486.yaml:2 Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt:2 Documentation/devicetree/bindings/display/panel/panel-common.yaml:2 Documentation/devicetree/bindings/display/sitronix,st7586.txt:1 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml:2
Rotation is a common DT panel property that is described in the panel-common.yaml.
The property was introduced almost exclusively for tiny drm panels. Those ones are a bit different from the rest (in panel/) - MIPI-DBI/SPI w/o (not connected at least) an actual GPU.
To make it a bit better, the rotation is seemingly performed in the tiny driver itself ouch.
This property is supported by all panel bindings because these bindings inherent the common properties from the panel-common.yaml.
Seems like that was an unintentional change with the conversion to YAML. Beforehand only a few selected panels had rotation. Upon closer look - some panels do have follow-up fixes, to remove/limit the implicit inclusion.
Interesting.. my understanding that the rotation property is supposed to be a generic property which represents physical orientation of a display panel and hence it should be applicable to all panels.
You're spot on - it is/should be a generic property.
I believe that in general many panels were mounted in the correct orientation so the property, kernel and userspace were slow to catch up. In some cases panels will use flip x+y to denote 180 rotation, yet lacking the rotation property. The s6e8aa0 is an example of the last oddity. To make it better, the two dts in-tree always set both flip x and y.
Tl;Dr: Hysterical raisins
Sam seems like you've done most of the YAML conversion. IMHO it would make sense to revisit the patches and inherit common properties only as applicable.
It looks to me that the conversion was done properly because rotation property was added as a common panel property from the start.
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=...
I don't think that it makes sense to wire up rotation property to all panel drivers at once because those drivers will be untested, at least I don't know anything about those other panels and can't test them. It will be much better to support the rotation on by as-needed basis for each panel driver individually.
How about CCing the author and reviewer asking them to test the patch? The only place where the patches might cause an issue is with tiny, although patches would still be appreciated.
There are quite a lot of panel drivers and I'm a bit doubtful that at least half of devices that use those panels have any real use for the rotation property. I could write the patches.. but in the end it could be a wasted effort if nobody needs it, so I'd prefer not to do it.
That's why I mentioned the rotation introduction or "confusion" if I may. Skimming through the pre/post YAML device tree bindings and grep through the panel themselves will greatly reduce the list. In other words: if neither binding documentation/in-tree dts nor panel mentions rotation - omit it.
I looked through the DT bindings and only those few tiny-DRM drivers use the DT rotation property. The parsed rotation value passed to the MIPI DBI core where it's validated and utilized further. I don't feel that it's worthwhile to touch that code because switching it to the common DRM helper for reading out DT orientation won't bring any real benefits.
The samsung-s6e8aa0 panel driver indeed uses the non-standard flip-x/y DT properties in order to achieve the 180 rotation, but I'm not sure whether it's worthwhile to touch this driver as well because it will require the board's DT change.
The panel's orientation could be parsed by any panel driver and then assigned as the connector's property in order to allow userspace/FB-core to decide what to do with the rotated display. Apparently upstream kernel supports only that one Samsung device which has display panel mounted upside-down and it already uses the custom DT properties for achieving the 180 rotation. So I don't quite see any panel drivers that instantly could benefit from using the rotation property. Perhaps I can add the orientation support to the panel-simple driver, but will it be useful to anyone?
Hi,
On Tue, 16 Jun 2020 at 22:16, Dmitry Osipenko digetx@gmail.com wrote:
The panel's orientation could be parsed by any panel driver and then assigned as the connector's property in order to allow userspace/FB-core to decide what to do with the rotated display. Apparently upstream kernel supports only that one Samsung device which has display panel mounted upside-down and it already uses the custom DT properties for achieving the 180 rotation. So I don't quite see any panel drivers that instantly could benefit from using the rotation property. Perhaps I can add the orientation support to the panel-simple driver, but will it be useful to anyone?
Yes, exposing it to userspace is helpful, since Weston at least will parse the property and then apply the correct transform: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/315
Cheers, Daniel
17.06.2020 12:34, Daniel Stone пишет:
Hi,
On Tue, 16 Jun 2020 at 22:16, Dmitry Osipenko digetx@gmail.com wrote:
The panel's orientation could be parsed by any panel driver and then assigned as the connector's property in order to allow userspace/FB-core to decide what to do with the rotated display. Apparently upstream kernel supports only that one Samsung device which has display panel mounted upside-down and it already uses the custom DT properties for achieving the 180 rotation. So I don't quite see any panel drivers that instantly could benefit from using the rotation property. Perhaps I can add the orientation support to the panel-simple driver, but will it be useful to anyone?
Yes, exposing it to userspace is helpful, since Weston at least will parse the property and then apply the correct transform: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/315
Hello Daniel,
Thank you very much for the pointer! I missed that Weston now uses the panel's orientation. I gave a quick test to the recent Weston and indeed it applies the transform in accordance to the connector's orientation property.
16.06.2020 01:26, Emil Velikov пишет: ...
Although I see that this series, alike Derek's, has a couple of issues:
- only a single panel driver is updated
I'll separate this series into two patchsets.
One will add orientation support to the panel drivers and I'll include the Derek's tv101wum-nl6 patch, so it will be two panel drivers \o/ :)
The other will add reflection-x support to the Tegra driver.
dri-devel@lists.freedesktop.org