72bd9ea389
drm: Remove linux/media-bus-format.h from drm_crtc.h
...
drm_crtc.h has no need for linux/media-bus-format.h, so don't
include it. Avoids useless rebuilds of the entire universe when
touching linux/media-bus-format.h.
Quite a few placs do currently depend on linux/media-bus-format.h
without actually including it directly. All of those need to be
fixed up.
v2: Deal with ingenic as well
v3: Fix up mxsfb and remaining parts of imx
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Jani Nikula <jani.nikula@intel.com >
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220630195114.17407-4-ville.syrjala@linux.intel.com
2022-07-05 21:15:13 +03:00
7d008eecb0
drm/stm: ltdc: update hardware error management
...
The latest hardware version (0x40100) supports a hardware threshold
register (aka FUTR) to trigger a fifo underrun interrupt.
A software threshold has been implemented for other hardware versions.
The threshold is set to 128 by default.
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220603134654.594373-1-yannick.fertre@foss.st.com
2022-06-27 16:01:50 +02:00
c6193dc57f
drm/stm: ltdc: add support of horizontal & vertical mirroring
...
Support of vertical & horizontal mirroring features thanks to
the plane rotation property.
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220603134547.593790-1-yannick.fertre@foss.st.com
2022-06-27 16:01:40 +02:00
62467fccb7
drm/stm: ltdc: add support of the dynamic z-order
...
Zpos property is immutable for all hardware versions except the last
version (0x40100) which support the blending order feature
(dynamic z-order).
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220603134459.593379-1-yannick.fertre@foss.st.com
2022-06-27 16:01:17 +02:00
44b4e72822
drm/stm: ltdc: fix various coding-style warnings
...
Fix issues reported by checkpatch.pl:
- Braces {} should be used on all arms
- Blank lines
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Acked-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220603134334.592805-1-yannick.fertre@foss.st.com
2022-06-27 15:53:49 +02:00
fb37cfa032
drm/stm: ltdc: remove error message about scaling
...
Remove error message about scaling & replace it by a debug
message to avoid too much error.
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Acked-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220603134250.592408-1-yannick.fertre@foss.st.com
2022-06-27 15:53:49 +02:00
c4f218d46f
drm/stm: ltdc: disable all layers before crtc shutdown
...
All plans must be disabled before the CRTC shutdown helping
the crtc to restart from a clean situation (without unwanted
planes already enable).
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220603134151.591997-1-yannick.fertre@foss.st.com
2022-06-27 15:53:49 +02:00
90bb087f66
drm: Drop drm_blend.h from drm_crtc.h
...
drm_crtc.h has no need for drm_blend.h, so don't include it.
Avoids useless rebuilds of the entire universe when
touching drm_blend.h.
Quite a few placs do currently depend on drm_blend.h without
actually including it directly. All of those need to be fixed
up.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220613200317.11305-4-ville.syrjala@linux.intel.com
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Jani Nikula <jani.nikula@intel.com >
2022-06-20 23:53:55 +03:00
720cf96d8f
drm: Drop drm_framebuffer.h from drm_crtc.h
...
drm_crtc.h has no need for drm_frambuffer.h, so don't include it.
Avoids useless rebuilds of the entire universe when
touching drm_framebuffer.h.
Quite a few placs do currently depend on drm_framebuffer.h without
actually including it directly. All of those need to be fixed
up.
v2: Fix up msm some more
v2: Deal with ingenic and shmobile as well
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220614095449.29311-1-ville.syrjala@linux.intel.com
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Jani Nikula <jani.nikula@intel.com >
2022-06-20 23:53:55 +03:00
255490f915
drm: Drop drm_edid.h from drm_crtc.h
...
drm_crtc.h has no need for drm_edid.h, so don't include it.
Avoids useless rebuilds of the entire universe when
touching drm_edid.h.
Quite a few placs do currently depend on drm_edid.h without
actually including it directly. All of those need to be fixed
up.
v2: Fix up i915 and msm some more
v3: Fix alphabetical ordering (Sam)
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220614090245.30283-1-ville.syrjala@linux.intel.com
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Jani Nikula <jani.nikula@intel.com >
2022-06-20 23:53:55 +03:00
2e6c86be0e
stm: ltdc: fix two incorrect NULL checks on list iterator
...
The two bugs are here:
if (encoder) {
if (bridge && bridge->timings)
The list iterator value 'encoder/bridge' will *always* be set and
non-NULL by drm_for_each_encoder()/list_for_each_entry(), so it is
incorrect to assume that the iterator value will be NULL if the
list is empty or no element is found.
To fix the bug, use a new variable '*_iter' as the list iterator,
while use the old variable 'encoder/bridge' as a dedicated pointer
to point to the found element.
Cc: stable@vger.kernel.org
Fixes: 99e360442f
("drm/stm: Fix bus_flags handling")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com >
Acked-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220327055355.3808-1-xiam0nd.tong@gmail.com
2022-04-07 10:26:59 +02:00
79b44684a1
drm/stm: ltdc: add support for CRC hashing feature
...
This patch adds the CRC hashing feature supported by some recent hardware
versions of the LTDC. This is useful for test suite such as IGT-GPU-tools
[1] where a CRTC output frame can be compared to a test reference frame
thanks to their respective CRC hash.
[1] https://cgit.freedesktop.org/drm/igt-gpu-tools
Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Acked-by: Yannick Fertre <yannick.fertre@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220211104620.421177-1-raphael.gallais-pou@foss.st.com
2022-02-25 14:14:28 +01:00
3b2f68f196
drm/stm: Avoid using val uninitialized in ltdc_set_ycbcr_config()
...
Clang warns:
drivers/gpu/drm/stm/ltdc.c:625:2: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
drivers/gpu/drm/stm/ltdc.c:635:2: note: uninitialized use occurs here
val |= LxPCR_YCEN;
^~~
drivers/gpu/drm/stm/ltdc.c:600:9: note: initialize the variable 'val' to silence this warning
u32 val;
^
= 0
1 warning generated.
Use a return instead of break in the default case to fix the warning.
Add an error message so that this return is not silent, which could hide
issues in the future.
Fixes: 484e72d314
("drm/stm: ltdc: add support of ycbcr pixel formats")
Link: https://github.com/ClangBuiltLinux/linux/issues/1575
Acked-by: Yannick Fertre <yannick.fertre@foss.st.com >
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com >
Reviewed-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Signed-off-by: Nathan Chancellor <nathan@kernel.org >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220222152045.484610-1-nathan@kernel.org
2022-02-25 14:14:07 +01:00
d9168aa329
drm/stm: ltdc: Drop format_mod_supported function
...
The "drm_plane_funcs.format_mod_supported" can be removed in favor of
the default implementation.
Signed-off-by: José Expósito <jose.exposito89@gmail.com >
Reviewed-by: Yannick Fertre <yannick.fertre@foss.st.com >
Tested-by: Yannick Fertre <yannick.fertre@foss.st.com >
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com >
Tested-by: Jagan Teki <jagan@amarulasolutions.com > # i.Core STM32MP1
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20211222090552.25972-7-jose.exposito89@gmail.com
2022-01-13 14:11:56 +01:00
484e72d314
drm/stm: ltdc: add support of ycbcr pixel formats
...
This patch adds the following YCbCr input pixel formats on the latest
LTDC hardware version:
1 plane (co-planar) : YUYV, YVYU, UYVY, VYUY
2 planes (semi-planar): NV12, NV21
3 planes (full-planar): YU12=I420=DRM YUV420, YV12=DRM YVU420
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Acked-by: Philippe Cornu <philippe.cornu@foss.st.com >
Reviewed-by: Philippe Cornu <philippe.cornu@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20211215214843.20703-1-yannick.fertre@foss.st.com
2022-01-13 14:06:22 +01:00
8f2b5f6dcb
drm/stm: ltdc: add support of flexible pixel formats
...
This feature allows the generation of any RGB pixel format.
The list of supported formats is no longer linked to the
register LXPFCR_PF, that the reason why a list of drm formats is
defined for each display controller version.
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Acked-by: Philippe Cornu <philippe.cornu@foss.st.com >
Reviewed-by: Philippe Cornu <philippe.cornu@foss.st.com >
Reviewed-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Tested-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20211215214835.20593-1-yannick.fertre@foss.st.com
2022-01-13 14:06:22 +01:00
a55d08e0d4
drm/stm: ltdc: add per plane update support
...
Recent ltdc hardware versions offer the ability
to update a plane independently of others planes.
This is could be useful especially if a plane is
assigned to another OS.
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Acked-by: Philippe Cornu <philippe.cornu@foss.st.com >
Reviewed-by: Philippe Cornu <philippe.cornu@foss.st.com >
Reviewed-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20211215214817.20310-1-yannick.fertre@foss.st.com
2022-01-13 14:06:21 +01:00
fb998edf9e
drm/stm: ltdc: add YCbCr 422 output support
...
LTDC 40100 hw version supports the YCbCr 422 output,
reducing the output pins from 24 to 16. This feature
is useful for some external devices like HDMI bridges.
Both ITU-R BT.601 & ITU-R BT.709 are supported.
It is also possible to choose the chrominance order between
* Cb is output first (Y0Cb, then Y1Cr, Y2Cb and so on).
* Cr is output first (Y0Cr, then Y1Cb, Y2Cr and so on).
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Acked-by: Philippe Cornu <philippe.cornu@foss.st.com >
Reviewed-by: Philippe Cornu <philippe.cornu@foss.st.com >
Reviewed-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20211215214750.20105-1-yannick.fertre@foss.st.com
2022-01-13 14:06:20 +01:00
734c26450a
drm/stm: ltdc: switch to regmap
...
Replace the legacy register access by regmap API.
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Acked-by: Philippe Cornu <philippe.cornu@foss.st.com >
Reviewed-by: Philippe Cornu <philippe.cornu@foss.st.com >
Reviewed-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Tested-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20211215214738.19946-1-yannick.fertre@foss.st.com
2022-01-13 14:06:20 +01:00
1726cee3d0
drm/stm: ltdc: support of new hardware version
...
Add support of new hardware version 0x40100.
Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com >
Reviewed-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Tested-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Acked-by: Philippe Cornu <philippe.cornu@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20211203085618.11314-1-yannick.fertre@foss.st.com
2022-01-04 14:36:48 +01:00
c20351ad58
drm/stm: ltdc: add layer alpha support
...
Android Hardware Composer supports alpha values applied to layers.
Enabling non-opaque layers for the STM CRTC could help offload GPU
resources for screen composition.
Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Acked-by: Yannick Fertre <yannick.fertre@foss.st.com >
Reviewed-by: Yannick Fertre <yannick.fertre@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210907151534.6013-1-raphael.gallais-pou@foss.st.com
2021-09-09 14:58:27 +02:00
ee2cda7b02
drm/stm: ltdc: attach immutable zpos property to planes
...
Defines plane ordering by hard-coding an immutable Z position from the
first plane, used as primary layer, to the next ones as overlay in order
of instantiation.
This zpos is only an information as it is not possible to modify it,
blending operations are still applied from the top to the bottom layer.
This patch helps to remove a warning message from the Android
Hardware Composer.
Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com >
Acked-by: Yannick Fertre <yannick.fertre@foss.st.com >
Reviewed-by: Yannick Fertre <yannick.fertre@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210907151323.5850-1-raphael.gallais-pou@foss.st.com
2021-09-09 14:54:59 +02:00
648ce7fd18
drm/stm: ltdc: Silence -EPROBE_DEFER till bridge attached
...
As dw-mipi-dsi supported all possible ways to find the DSI
devices. It can take multiple iterations for ltdc to find
all components attached to the DSI bridge.
The current ltdc driver failed to find the endpoint as
it returned -EINVAL for the first iteration itself. This leads
to following error:
[ 3.099289] [drm:ltdc_load] *ERROR* init encoder endpoint 0
So, check the return value and cleanup the encoder only if it's
not -EPROBE_DEFER. This make all components in the attached DSI
bridge found properly.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com >
Tested-by: Yannick Fertre <yannick.fertre@foss.st.com >
Acked-by: Philippe Cornu <philippe.cornu@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210704135914.268308-1-jagan@amarulasolutions.com
2021-07-19 15:31:56 +02:00
aa2fcf1217
drm/stm: Don't set struct drm_device.irq_enabled
...
The field drm_device.irq_enabled is only used by legacy drivers
with userspace modesetting. Don't set it in stm.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Tested-by: Yannick Fertre <yannick.fertre@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210625082222.3845-20-tzimmermann@suse.de
2021-06-29 15:40:45 +02:00
29a8408427
drm/<driver>: drm_gem_plane_helper_prepare_fb is now the default
...
No need to set it explicitly.
Acked-by: Philipp Zabel <p.zabel@pengutronix.de >
Acked-by: Heiko Stuebner <heiko@sntech.de >
Acked-by: Paul Cercueil <paul@crapouillou.net >
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com >
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com >
Acked-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com >
Acked-by: Philippe Cornu <philippe.cornu@foss.st.com >
Acked-by: Lucas Stach <l.stach@pengutronix.de >
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com >
Cc: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com >
Cc: Lucas Stach <l.stach@pengutronix.de >
Cc: Shawn Guo <shawnguo@kernel.org >
Cc: Sascha Hauer <s.hauer@pengutronix.de >
Cc: Pengutronix Kernel Team <kernel@pengutronix.de >
Cc: Fabio Estevam <festevam@gmail.com >
Cc: NXP Linux Team <linux-imx@nxp.com >
Cc: Philipp Zabel <p.zabel@pengutronix.de >
Cc: Paul Cercueil <paul@crapouillou.net >
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org >
Cc: Matthias Brugger <matthias.bgg@gmail.com >
Cc: Neil Armstrong <narmstrong@baylibre.com >
Cc: Kevin Hilman <khilman@baylibre.com >
Cc: Jerome Brunet <jbrunet@baylibre.com >
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com >
Cc: Marek Vasut <marex@denx.de >
Cc: Stefan Agner <stefan@agner.ch >
Cc: Sandy Huang <hjc@rock-chips.com >
Cc: "Heiko Stübner" <heiko@sntech.de >
Cc: Yannick Fertre <yannick.fertre@foss.st.com >
Cc: Philippe Cornu <philippe.cornu@foss.st.com >
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org >
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com >
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com >
Cc: Maxime Ripard <mripard@kernel.org >
Cc: Chen-Yu Tsai <wens@csie.org >
Cc: Jernej Skrabec <jernej.skrabec@gmail.com >
Cc: Jyri Sarha <jyri.sarha@iki.fi >
Cc: Tomi Valkeinen <tomba@kernel.org >
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mips@vger.kernel.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-amlogic@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-sunxi@lists.linux.dev
Link: https://patchwork.freedesktop.org/patch/msgid/20210622165511.3169559-9-daniel.vetter@ffwll.ch
2021-06-24 15:35:24 +02:00
e99168f9f0
drm/stm: Remove usage of drm_display_mode_to_videomode()
...
There is not much value in the extra conversion step, the calculations
required for the LTDC IP are different than what is used in the
drm_display_mode_to_videomode(), so just do the right ones in the LTDC
driver right away.
Signed-off-by: Marek Vasut <marex@denx.de >
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com >
Cc: Antonio Borneo <antonio.borneo@foss.st.com >
Cc: Benjamin Gaignard <benjamin.gaignard@foss.st.com >
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com >
Cc: Philippe Cornu <philippe.cornu@foss.st.com >
Cc: Sam Ravnborg <sam@ravnborg.org >
Cc: Vincent Abriou <vincent.abriou@foss.st.com >
Cc: Yannick Fertre <yannick.fertre@foss.st.com >
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-stm32@st-md-mailman.stormreply.com
To: dri-devel@lists.freedesktop.org
Tested-by: Yannick Fertré <yannick.fertre@st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210607172457.14471-1-marex@denx.de
2021-06-08 18:49:36 +02:00
b397027b8e
drm/stm: Don't set allow_fb_modifiers explicitly
...
Since
commit 890880ddfd
Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com >
Date: Fri Jan 4 09:56:10 2019 +0100
drm: Auto-set allow_fb_modifiers when given modifiers at plane init
this is done automatically as part of plane init, if drivers set the
modifier list correctly. Which is the case here.
Acked-by: Philippe Cornu <philippe.cornu@st.com >
Reviewed-by: Lyude Paul <lyude@redhat.com >
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com >
Cc: Yannick Fertre <yannick.fertre@foss.st.com >
Cc: Philippe Cornu <philippe.cornu@foss.st.com >
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org >
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com >
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com >
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Link: https://patchwork.freedesktop.org/patch/msgid/20210427092018.832258-7-daniel.vetter@ffwll.ch
2021-05-06 11:43:50 +02:00
a9cdf68092
drm/stm: ltdc: Use simple encoder
...
STM ltdc driver uses an empty implementation for its encoder.
Replace the code with the generic simple encoder.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Tested-by: Yannick Fertre <yannick.fertre@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210302175700.28640-1-jagan@amarulasolutions.com
2021-03-08 11:40:29 +01:00
37418bf14c
drm: Use state helper instead of the plane state pointer
...
Many drivers reference the plane->state pointer in order to get the
current plane state in their atomic_update or atomic_disable hooks,
which would be the new plane state in the global atomic state since
_swap_state happened when those hooks are run.
Use the drm_atomic_get_new_plane_state helper to get that state to make it
more obvious.
This was made using the coccinelle script below:
@ plane_atomic_func @
identifier helpers;
identifier func;
@@
(
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
|
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_update = func,
...,
};
)
@ adds_new_state @
identifier plane_atomic_func.func;
identifier plane, state;
identifier new_state;
@@
func(struct drm_plane *plane, struct drm_atomic_state *state)
{
...
- struct drm_plane_state *new_state = plane->state;
+ struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, plane);
...
}
@ include depends on adds_new_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_new_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Signed-off-by: Maxime Ripard <maxime@cerno.tech >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Link: https://lore.kernel.org/r/20210219120032.260676-1-maxime@cerno.tech
2021-02-25 08:05:28 +01:00
977697e20b
drm/atomic: Pass the full state to planes atomic disable and update
...
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's convert the remaining helpers to provide a consistent interface,
this time with the planes atomic_update and atomic_disable.
The conversion was done using the coccinelle script below, built tested on
all the drivers.
@@
identifier plane, plane_state;
symbol state;
@@
struct drm_plane_helper_funcs {
...
void (*atomic_update)(struct drm_plane *plane,
- struct drm_plane_state *plane_state);
+ struct drm_atomic_state *state);
...
}
@@
identifier plane, plane_state;
symbol state;
@@
struct drm_plane_helper_funcs {
...
void (*atomic_disable)(struct drm_plane *plane,
- struct drm_plane_state *plane_state);
+ struct drm_atomic_state *state);
...
}
@ plane_atomic_func @
identifier helpers;
identifier func;
@@
(
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_update = func,
...,
};
|
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
)
@@
struct drm_plane_helper_funcs *FUNCS;
identifier f;
identifier crtc_state;
identifier plane, plane_state, state;
expression e;
@@
f(struct drm_crtc_state *crtc_state)
{
...
struct drm_atomic_state *state = e;
<+...
(
- FUNCS->atomic_disable(plane, plane_state)
+ FUNCS->atomic_disable(plane, state)
|
- FUNCS->atomic_update(plane, plane_state)
+ FUNCS->atomic_update(plane, state)
)
...+>
}
@@
identifier plane_atomic_func.func;
identifier plane;
symbol state;
@@
func(struct drm_plane *plane,
- struct drm_plane_state *state)
+ struct drm_plane_state *old_plane_state)
{
<...
- state
+ old_plane_state
...>
}
@ ignores_old_state @
identifier plane_atomic_func.func;
identifier plane, old_state;
@@
func(struct drm_plane *plane, struct drm_plane_state *old_state)
{
... when != old_state
}
@ adds_old_state depends on plane_atomic_func && !ignores_old_state @
identifier plane_atomic_func.func;
identifier plane, plane_state;
@@
func(struct drm_plane *plane, struct drm_plane_state *plane_state)
{
+ struct drm_plane_state *plane_state = drm_atomic_get_old_plane_state(state, plane);
...
}
@ depends on plane_atomic_func @
identifier plane_atomic_func.func;
identifier plane, plane_state;
@@
func(struct drm_plane *plane,
- struct drm_plane_state *plane_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_old_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_old_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
@@
identifier plane_atomic_func.func;
identifier plane, state;
identifier plane_state;
@@
func(struct drm_plane *plane, struct drm_atomic_state *state) {
...
struct drm_plane_state *plane_state = drm_atomic_get_old_plane_state(state, plane);
<+...
- plane_state->state
+ state
...+>
}
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Signed-off-by: Maxime Ripard <maxime@cerno.tech >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Link: https://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-9-maxime@cerno.tech
2021-02-25 08:05:28 +01:00
41016fe102
drm: Rename plane->state variables in atomic update and disable
...
Some drivers are storing the plane->state pointer in atomic_update and
atomic_disable in a variable simply called state, while the state passed
as an argument is called old_state.
In order to ease subsequent reworks and to avoid confusing or
inconsistent names, let's rename those variables to new_state.
This was done using the following coccinelle script, plus some manual
changes for mtk and tegra.
@ plane_atomic_func @
identifier helpers;
identifier func;
@@
(
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
|
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_update = func,
...,
};
)
@ moves_new_state_old_state @
identifier plane_atomic_func.func;
identifier plane;
symbol old_state;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *old_state)
{
...
- struct drm_plane_state *state = plane->state;
+ struct drm_plane_state *new_state = plane->state;
...
}
@ depends on moves_new_state_old_state @
identifier plane_atomic_func.func;
identifier plane;
identifier old_state;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *old_state)
{
<...
- state
+ new_state
...>
}
@ moves_new_state_oldstate @
identifier plane_atomic_func.func;
identifier plane;
symbol oldstate;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *oldstate)
{
...
- struct drm_plane_state *state = plane->state;
+ struct drm_plane_state *newstate = plane->state;
...
}
@ depends on moves_new_state_oldstate @
identifier plane_atomic_func.func;
identifier plane;
identifier old_state;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *old_state)
{
<...
- state
+ newstate
...>
}
@ moves_new_state_old_pstate @
identifier plane_atomic_func.func;
identifier plane;
symbol old_pstate;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *old_pstate)
{
...
- struct drm_plane_state *state = plane->state;
+ struct drm_plane_state *new_pstate = plane->state;
...
}
@ depends on moves_new_state_old_pstate @
identifier plane_atomic_func.func;
identifier plane;
identifier old_pstate;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *old_pstate)
{
<...
- state
+ new_pstate
...>
}
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Signed-off-by: Maxime Ripard <maxime@cerno.tech >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Link: https://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-8-maxime@cerno.tech
2021-02-24 20:27:12 +01:00
7c11b99a8e
drm/atomic: Pass the full state to planes atomic_check
...
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's convert all the remaining helpers to provide a consistent
interface, starting with the planes atomic_check.
The conversion was done using the coccinelle script below plus some
manual changes for vmwgfx, built tested on all the drivers.
@@
identifier plane, plane_state;
symbol state;
@@
struct drm_plane_helper_funcs {
...
int (*atomic_check)(struct drm_plane *plane,
- struct drm_plane_state *plane_state);
+ struct drm_atomic_state *state);
...
}
@ plane_atomic_func @
identifier helpers;
identifier func;
@@
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_check = func,
...,
};
@@
struct drm_plane_helper_funcs *FUNCS;
identifier f;
identifier dev;
identifier plane, plane_state, state;
@@
f(struct drm_device *dev, struct drm_atomic_state *state)
{
<+...
- FUNCS->atomic_check(plane, plane_state)
+ FUNCS->atomic_check(plane, state)
...+>
}
@ ignores_new_state @
identifier plane_atomic_func.func;
identifier plane, new_plane_state;
@@
func(struct drm_plane *plane, struct drm_plane_state *new_plane_state)
{
... when != new_plane_state
}
@ adds_new_state depends on plane_atomic_func && !ignores_new_state @
identifier plane_atomic_func.func;
identifier plane, new_plane_state;
@@
func(struct drm_plane *plane, struct drm_plane_state *new_plane_state)
{
+ struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state, plane);
...
}
@ depends on plane_atomic_func @
identifier plane_atomic_func.func;
identifier plane, new_plane_state;
@@
func(struct drm_plane *plane,
- struct drm_plane_state *new_plane_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_new_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_new_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Signed-off-by: Maxime Ripard <maxime@cerno.tech >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Link: https://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-4-maxime@cerno.tech
2021-02-24 20:27:00 +01:00
ba5c164946
drm: Rename plane atomic_check state names
...
Most drivers call the argument to the plane atomic_check hook simply
state, which is going to conflict with the global atomic state in a
later rework. Let's rename it to new_plane_state (or new_state depending
on the convention used in the driver).
This was done using the coccinelle script below, and built tested:
@ plane_atomic_func @
identifier helpers;
identifier func;
@@
static const struct drm_plane_helper_funcs helpers = {
.atomic_check = func,
};
@ has_old_state @
identifier plane_atomic_func.func;
identifier plane;
expression e;
symbol old_state;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *state)
{
...
struct drm_plane_state *old_state = e;
...
}
@ depends on has_old_state @
identifier plane_atomic_func.func;
identifier plane;
symbol old_state;
@@
func(struct drm_plane *plane,
- struct drm_plane_state *state
+ struct drm_plane_state *new_state
)
{
<+...
- state
+ new_state
...+>
}
@ has_state @
identifier plane_atomic_func.func;
identifier plane;
symbol state;
@@
func(struct drm_plane *plane, struct drm_plane_state *state)
{
...
}
@ depends on has_state @
identifier plane_atomic_func.func;
identifier plane;
symbol old_state;
@@
func(struct drm_plane *plane,
- struct drm_plane_state *state
+ struct drm_plane_state *new_plane_state
)
{
<+...
- state
+ new_plane_state
...+>
}
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Signed-off-by: Maxime Ripard <maxime@cerno.tech >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Link: https://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-2-maxime@cerno.tech
2021-02-24 20:26:55 +01:00
820c170717
drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpers
...
The function drm_gem_fb_prepare_fb() is a helper for atomic modesetting,
but currently located next to framebuffer helpers. Move it to GEM atomic
helpers, rename it slightly and adopt the drivers. Same for the rsp
simple-pipe helper.
Compile-tested with x86-64, aarch64 and arm. The patch is fairly large,
but there are no functional changes.
v3:
* remove out-comented line in drm_gem_framebuffer_helper.h
(Maxime)
v2:
* rename to drm_gem_plane_helper_prepare_fb() (Daniel)
* add tutorial-style documentation
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Acked-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20210222141756.7864-1-tzimmermann@suse.de
2021-02-23 08:54:22 +01:00
99e360442f
drm/stm: Fix bus_flags handling
...
The drm_display_mode_to_videomode() does not populate DISPLAY_FLAGS_DE_LOW
or DISPLAY_FLAGS_PIXDATA_NEGEDGE flags in struct videomode. Therefore, no
matter what polarity the next bridge or display might require, these flags
are never set, and thus the LTDC GCR_DEPOL and GCR_PCPOL bits are never set
and the LTDC behaves as if both DISPLAY_FLAGS_PIXDATA_POSEDGE and
DISPLAY_FLAGS_DE_HIGH were always set.
The fix for this problem is taken almost verbatim from MXSFB driver. In
case there is a bridge attached to the LTDC, the bridge might have extra
polarity requirements, so extract bus_flags from the bridge and use them
for LTDC configuration. Otherwise, extract bus_flags from the connector,
which is the display.
Fixes: b759012c5f
("drm/stm: Add STM32 LTDC driver")
Signed-off-by: Marek Vasut <marex@denx.de >
Signed-off-by: Yannick Fertre <yannick.fertre@st.com >
Cc: Alexandre Torgue <alexandre.torgue@st.com >
Cc: Antonio Borneo <antonio.borneo@st.com >
Cc: Benjamin Gaignard <benjamin.gaignard@st.com >
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com >
Cc: Philippe Cornu <philippe.cornu@st.com >
Cc: Sam Ravnborg <sam@ravnborg.org >
Cc: Vincent Abriou <vincent.abriou@st.com >
Cc: Yannick Fertre <yannick.fertre@st.com >
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-stm32@st-md-mailman.stormreply.com
To: dri-devel@lists.freedesktop.org
Tested-by: Yannick Fertre <yannick.fertre@foss.st.com >
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210127110756.125570-1-marex@denx.de
2021-02-15 17:05:59 +01:00
6ca2ab8086
drm: automatic legacy gamma support
...
To support legacy gamma ioctls the drivers need to set
drm_crtc_funcs.gamma_set either to a custom implementation or to
drm_atomic_helper_legacy_gamma_set. Most of the atomic drivers do the
latter.
We can simplify this by making the core handle it automatically.
Move the drm_atomic_helper_legacy_gamma_set() functionality into
drm_color_mgmt.c to make drm_mode_gamma_set_ioctl() use
drm_crtc_funcs.gamma_set if set or GAMMA_LUT property if not.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com >
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Reviewed-by: Philippe Cornu <philippe.cornu@st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20201211114237.213288-2-tomi.valkeinen@ti.com
2020-12-15 15:46:03 +02:00
f6ebe9f9c9
drm/atomic: Pass the full state to CRTC atomic begin and flush
...
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_begin and atomic_flush.
The conversion was done using the coccinelle script below, built tested on
all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier old_crtc_state, old_state;
identifier crtc;
identifier f;
@@
f(struct drm_crtc_state *old_crtc_state)
{
...
struct drm_atomic_state *old_state = old_crtc_state->state;
<...
- FUNCS->atomic_begin(crtc, old_crtc_state);
+ FUNCS->atomic_begin(crtc, old_state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier old_crtc_state, old_state;
identifier crtc;
identifier f;
@@
f(struct drm_crtc_state *old_crtc_state)
{
...
struct drm_atomic_state *old_state = old_crtc_state->state;
<...
- FUNCS->atomic_flush(crtc, old_crtc_state);
+ FUNCS->atomic_flush(crtc, old_state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state, ...)
{
<...
- FUNCS->atomic_begin(crtc, crtc_state);
+ FUNCS->atomic_begin(crtc, state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state, ...)
{
<...
- FUNCS->atomic_flush(crtc, crtc_state);
+ FUNCS->atomic_flush(crtc, state);
...>
}
@@
identifier crtc, old_state;
@@
struct drm_crtc_helper_funcs {
...
- void (*atomic_begin)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_begin)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_flush)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_flush)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_begin = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_flush = func,
...,
};
)
@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}
@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@@
identifier old_state;
identifier crtc;
@@
void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@@
identifier old_state;
identifier crtc;
@@
void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
);
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
...
}
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
);
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
...
}
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
);
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@
void func(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_old_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_old_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech >
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-2-maxime@cerno.tech
2020-11-02 12:37:49 +01:00
351f950db4
drm/atomic: Pass the full state to CRTC atomic enable/disable
...
If the CRTC driver ever needs to access the full DRM state, it can't do so
at atomic_enable / atomic_disable time since drm_atomic_helper_swap_state
will have cleared the pointer from the struct drm_crtc_state to the struct
drm_atomic_state before calling those hooks.
In order to allow that, let's pass the full DRM state to atomic_enable and
atomic_disable. The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@
disable_outputs(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- FUNCS->atomic_disable(crtc, crtc_state);
+ FUNCS->atomic_disable(crtc, state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@
drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- FUNCS->atomic_enable(crtc, crtc_state);
+ FUNCS->atomic_enable(crtc, state);
...>
}
@@
identifier crtc, old_state;
@@
struct drm_crtc_helper_funcs {
...
- void (*atomic_enable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_enable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_disable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_disable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_enable = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
)
@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}
@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@
void func(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_old_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_old_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef142a0c13f7870.1602161031.git-series.maxime@cerno.tech
2020-10-09 09:55:59 +02:00
ebd267b2e3
drm/stm: repair runtime power management
...
Add missing pm_runtime_get_sync() into ltdc_crtc_atomic_enable() to
match pm_runtime_put_sync() in ltdc_crtc_atomic_disable(), otherwise
the LTDC might suspend via runtime PM, disable clock, and then fail
to resume later on.
The test which triggers it is roughly -- run qt5 application which
uses eglfs platform and etnaviv, stop the application, sleep for 15
minutes, run the application again. This leads to a timeout waiting
for vsync, because the LTDC has suspended, but did not resume.
Fixes: 35ab6cfbf2
("drm/stm: support runtime power management")
Signed-off-by: Marek Vasut <marex@denx.de >
Cc: Yannick Fertré <yannick.fertre@st.com >
Cc: Philippe Cornu <philippe.cornu@st.com >
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org >
Cc: Vincent Abriou <vincent.abriou@st.com >
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com >
Cc: Alexandre Torgue <alexandre.torgue@st.com >
To: dri-devel@lists.freedesktop.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Acked-by: Philippe Cornu <philippe.cornu@st.com >
Tested-by: Yannick Fertre <yannick.fertre@st.com >
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200229221649.90813-1-marex@denx.de
2020-07-08 11:47:01 +02:00
a790ababbe
drm/stm: ltdc: remove call of pm-runtime functions
...
It is not necessary to suspend or stop the ltdc clocks
to modify the pixel clock.
Signed-off-by: Yannick Fertre <yannick.fertre@st.com >
Acked-by: Philippe Cornu <philippe.cornu@st.com >
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200701120402.6444-1-yannick.fertre@st.com
2020-07-08 11:46:26 +02:00
b430ff7ef8
drm/stm: ltdc: check number of endpoints
...
Number of endpoints could exceed the fix value MAX_ENDPOINTS(2).
Instead of increase simply this value, the number of endpoint
could be read from device tree. Load sequence has been a little
rework to take care of several panel or bridge which can be
connected/disconnected or enable/disable.
Signed-off-by: Yannick Fertre <yannick.fertre@st.com >
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/1582877258-1112-1-git-send-email-yannick.fertre@st.com
2020-04-27 15:42:12 +02:00
a25b988ff8
drm/bridge: Extend bridge API to disable connector creation
...
Most bridge drivers create a DRM connector to model the connector at the
output of the bridge. This model is historical and has worked pretty
well so far, but causes several issues:
- It prevents supporting more complex display pipelines where DRM
connector operations are split over multiple components. For instance a
pipeline with a bridge connected to the DDC signals to read EDID data,
and another one connected to the HPD signal to detect connection and
disconnection, will not be possible to support through this model.
- It requires every bridge driver to implement similar connector
handling code, resulting in code duplication.
- It assumes that a bridge will either be wired to a connector or to
another bridge, but doesn't support bridges that can be used in both
positions very well (although there is some ad-hoc support for this in
the analogix_dp bridge driver).
In order to solve these issues, ownership of the connector should be
moved to the display controller driver (where it can be implemented
using helpers provided by the core).
Extend the bridge API to allow disabling connector creation in bridge
drivers as a first step towards the new model. The new flags argument to
the bridge .attach() operation allows instructing the bridge driver to
skip creating a connector. Unconditionally set the new flags argument to
0 for now to keep the existing behaviour, and modify all existing bridge
drivers to return an error when connector creation is not requested as
they don't support this feature yet.
The change is based on the following semantic patch, with manual review
and edits.
@ rule1 @
identifier funcs;
identifier fn;
@@
struct drm_bridge_funcs funcs = {
...,
.attach = fn
};
@ depends on rule1 @
identifier rule1.fn;
identifier bridge;
statement S, S1;
@@
int fn(
struct drm_bridge *bridge
+ , enum drm_bridge_attach_flags flags
)
{
... when != S
+ if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) {
+ DRM_ERROR("Fix bridge driver to make connector optional!");
+ return -EINVAL;
+ }
+
S1
...
}
@ depends on rule1 @
identifier rule1.fn;
identifier bridge, flags;
expression E1, E2, E3;
@@
int fn(
struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags
) {
<...
drm_bridge_attach(E1, E2, E3
+ , flags
)
...>
}
@@
expression E1, E2, E3;
@@
drm_bridge_attach(E1, E2, E3
+ , 0
)
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com >
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com >
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-10-laurent.pinchart@ideasonboard.com
2020-02-26 13:31:23 +02:00
9661510e51
drm/stm: Convert to CRTC VBLANK callbacks
...
VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert stm over.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Tested-by: Yannick Fertré <yannick.fertre@st.com >
Acked-by: Philippe Cornu <philippe.cornu@st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200123135943.24140-16-tzimmermann@suse.de
2020-02-13 13:10:09 +01:00
b70fbfc7d5
drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
...
The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm
over.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Acked-by: Philippe Cornu <philippe.cornu@st.com >
Tested-by: Yannick Fertré <yannick.fertre@st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200123135943.24140-15-tzimmermann@suse.de
2020-02-13 13:09:22 +01:00
a6bd58c51a
drm/stm: ltdc: check crtc state before enabling LIE
...
Following investigations of a hardware bug, the LIE interrupt
can occur while the display controller is not activated.
LIE interrupt (vblank) don't have to be set if the CRTC is not
enabled.
Signed-off-by: Yannick Fertre <yannick.fertre@st.com >
Acked-by: Philippe Cornu <philippe.cornu@st.com >
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/1579601650-7055-1-git-send-email-yannick.fertre@st.com
2020-02-04 11:40:32 +01:00
544aa6cefb
drm/stm: ltdc: add number of interrupts
...
The number of interrupts depends on the ltdc version.
Don't try to get interrupt which not exist, avoiding
kernel warning messages.
Signed-off-by: Yannick Fertre <yannick.fertre@st.com >
Acked-by: Philippe Cornu <philippe.cornu@st.com >
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/1579601632-7001-1-git-send-email-yannick.fertre@st.com
2020-02-04 11:38:59 +01:00
f412af187a
drm/stm: ltdc: move pinctrl to encoder mode set
...
The pin control must be set to default as soon as possible to
establish a good video link between tv & bridge hdmi
(encoder mode set is call before encoder enable).
Signed-off-by: Yannick Fertre <yannick.fertre@st.com >
Acked-by: Philippe Cornu <philippe.cornu@st.com >
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com >
Link: https://patchwork.freedesktop.org/patch/msgid/1574850218-13257-1-git-send-email-yannick.fertre@st.com
2019-12-20 13:30:42 +01:00
92a57b3fb5
drm/stm: ltdc: add pinctrl for DPI encoder mode
...
The implementation of functions encoder_enable and encoder_disable
make possible to control the pinctrl according to the encoder type.
The pinctrl must be activated only if the encoder type is DPI.
This helps to move the DPI-related pinctrl configuration from
all the panel or bridge to the LTDC dt node.
Reviewed-by: Philippe Cornu <philippe.cornu@st.com >
Signed-off-by: Yannick Fertré <yannick.fertre@st.com >
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org >
Link: https://patchwork.freedesktop.org/patch/msgid/1567761708-31777-1-git-send-email-yannick.fertre@st.com
2019-09-09 11:30:54 +02:00
89958b7cd9
drm/bridge: panel: Infer connector type from panel by default
...
The drm panel bridge creates a connector using a connector type
explicitly passed by the display controller or bridge driver that
instantiates the panel bridge. Now that drm_panel reports its connector
type, we can use it to avoid passing an explicit (and often incorrect)
connector type to drm_panel_bridge_add() and
devm_drm_panel_bridge_add().
Several drivers report incorrect or unknown connector types to
userspace. Reporting a different type may result in a breakage. For that
reason, rename (devm_)drm_panel_bridge_add() to
(devm_)drm_panel_bridge_add_typed(), and add new
(devm_)drm_panel_bridge_add() functions that use the panel connector
type. Update all callers of (devm_)drm_panel_bridge_add() to the _typed
function, they will be converted one by one after testing.
The panel drivers have been updated with the following Coccinelle
semantic patch, with manual inspection and fixes to indentation.
@@
expression bridge;
expression dev;
expression panel;
identifier type;
@@
(
-bridge = drm_panel_bridge_add(panel, type);
+bridge = drm_panel_bridge_add_typed(panel, type);
|
-bridge = devm_drm_panel_bridge_add(dev, panel, type);
+bridge = devm_drm_panel_bridge_add_typed(dev, panel, type);
)
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20190904132804.29680-3-laurent.pinchart@ideasonboard.com
2019-09-08 19:04:23 +02:00
8fabc9c310
drm/stm: attach gem fence to atomic state
...
To properly synchronize with other devices the fence from the GEM
object backing the framebuffer needs to be attached to the atomic
state, so the commit work can wait on fence signaling.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de >
Signed-off-by: Lucas Stach <l.stach@pengutronix.de >
Acked-by: Philippe Cornu <philippe.cornu@st.com >
Tested-by: Philippe Cornu <philippe.cornu@st.com >
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20190712084228.8338-1-l.stach@pengutronix.de
2019-07-25 12:00:09 +02:00