]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/log
mirror_ubuntu-eoan-kernel.git
6 years agodrm/sun4i: Add A83T support
Maxime Ripard [Thu, 21 Dec 2017 11:02:34 +0000 (12:02 +0100)]
drm/sun4i: Add A83T support

Add support for the A83T display pipeline.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/614b430adf3a67320362a75c01b01bd53013da8a.1513854122.git-series.maxime.ripard@free-electrons.com
6 years agodrm/sun4i: Add LVDS support
Maxime Ripard [Thu, 21 Dec 2017 11:02:33 +0000 (12:02 +0100)]
drm/sun4i: Add LVDS support

The TCON supports the LVDS interface to output to a panel or a bridge.
Let's add support for it.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/7fbb85f33ee1d5009fde4f0d7d236e11ca58b114.1513854122.git-series.maxime.ripard@free-electrons.com
6 years agodrm/sun4i: Create minimal multipliers and dividers
Maxime Ripard [Thu, 21 Dec 2017 11:02:32 +0000 (12:02 +0100)]
drm/sun4i: Create minimal multipliers and dividers

The various outputs the TCON can provide have different constraints on the
dotclock divider. Let's make them configurable by the various mode_set
functions.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/92ff5881c8f8674056d34458b2f264cd48d4e136.1513854122.git-series.maxime.ripard@free-electrons.com
6 years agodrm/sun4i: Force the mixer rate at 150MHz
Maxime Ripard [Thu, 21 Dec 2017 11:02:31 +0000 (12:02 +0100)]
drm/sun4i: Force the mixer rate at 150MHz

It seems like the mixer can only run properly when clocked at 150MHz. In
order to have something more robust than simply a fire-and-forget
assigned-clocks-rate, let's put that in the code.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f5f05307972ed05250e8094b302d68b9e7e167f6.1513854122.git-series.maxime.ripard@free-electrons.com
6 years agodt-bindings: display: sun4i-drm: Add A83T pipeline
Maxime Ripard [Thu, 21 Dec 2017 11:02:30 +0000 (12:02 +0100)]
dt-bindings: display: sun4i-drm: Add A83T pipeline

The A83T has two video pipelines in parallel that looks quite similar to
the other SoCs.

The video planes are handled through a controller called the mixer, and the
video signal is then passed to the timing controller (TCON).

And while there is two instances of the mixers and TCONs, they have a
significant number of differences. The TCONs are quite easy to deal with,
one is supposed to generate TV (in the broader term, so including things
like HDMI) signals, the other one LCD (so RGB, LVDS, DSI) signals. And
while they are called TCON0 and TCON1 in the A83t datasheet, newer SoCs
call them TCON-TV and TCON-LCD, which seems more appropriate.

However, the mixers differ mostly by their capabilities, with some features
being available only in the first one, or the number of planes they expose,
but also through their register layout. And while the capabilities could be
represented as properties, the register layout differences would need to
express all the registers offsets as properties, which is usually quite
bad. Especially since documentation on that hardware block is close to
non-existent and we don't even have the list of all those registers in the
first place.

So let's call them mixer 0 and 1 in our compatibles, even though the name
is pretty bad...

At the moment, we only have tested the code on a board that has a single
display output, so we're leaving the tcon-tv and mixer1 out.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2702a5c1d224af1c51743492ad1b917966f2ad43.1513854122.git-series.maxime.ripard@free-electrons.com
6 years agodt-bindings: display: sun4i-drm: Add LVDS properties
Maxime Ripard [Thu, 21 Dec 2017 11:02:29 +0000 (12:02 +0100)]
dt-bindings: display: sun4i-drm: Add LVDS properties

Some clocks and resets supposed to drive the LVDS logic in the display
engine have been overlooked when the driver was first introduced.

Add those additional resources to the binding, and we'll deal with the ABI
stability in the code.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ddbde28fe2e4f21412974e4c69fbfe1c5ff9383f.1513854122.git-series.maxime.ripard@free-electrons.com
6 years agodrm/tinydrm: add driver for ST7735R panels
David Lechner [Mon, 1 Jan 2018 19:02:16 +0000 (13:02 -0600)]
drm/tinydrm: add driver for ST7735R panels

This adds a new driver for Sitronix ST7735R display panels.

This has been tested using an Adafruit 1.8" TFT.

Signed-off-by: David Lechner <david@lechnology.com>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1514833336-22564-4-git-send-email-david@lechnology.com
6 years agodt-bindings: Add binding for Sitronix ST7735R display panels
David Lechner [Mon, 1 Jan 2018 19:02:15 +0000 (13:02 -0600)]
dt-bindings: Add binding for Sitronix ST7735R display panels

This adds a new device tree binding for Sitronix ST7735R display panels,
such as the Adafruit 1.8" TFT.

Signed-off-by: David Lechner <david@lechnology.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1514833336-22564-3-git-send-email-david@lechnology.com
6 years agodt-bindings: add jianda vendor prefix
David Lechner [Mon, 1 Jan 2018 19:02:14 +0000 (13:02 -0600)]
dt-bindings: add jianda vendor prefix

This adds a vendor prefix "jianda" for Jiandangjing Technology Co., Ltd.

Signed-off-by: David Lechner <david@lechnology.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1514833336-22564-2-git-send-email-david@lechnology.com
6 years agodrm/tinydrm: Update ILI9225 compatible string
David Lechner [Thu, 21 Dec 2017 18:33:07 +0000 (12:33 -0600)]
drm/tinydrm: Update ILI9225 compatible string

This updates the compatible string for a no-name LCD panel to
"vot,v220hf01a-t", "ilitek,ili9225".

The original bindings were the generic "ilitek,ili9225-2.2in-176x220"
because I could not find a datasheet. However, after some more research,
I finally found one, so the actual vendor and model name are now known.

This previous bindings have not made it to the mainline kernel yet, so
this is not breaking backwards compatibility.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1513881187-3197-4-git-send-email-david@lechnology.com
6 years agodt-bindings: update compatible string for ILI9225
David Lechner [Thu, 21 Dec 2017 18:33:06 +0000 (12:33 -0600)]
dt-bindings: update compatible string for ILI9225

This updates the compatible string for a no-name LCD panel to
"vot,v220hf01a-t", "ilitek,ili9225".

The original bindings [1] were the generic "ilitek,ili9225-2.2in-176x220"
because I could not find a datasheet. However, after some more research,
I finally found one, so the actual vendor and model name are now known.

This previous bindings have not made it to the mainline kernel yet, so
this is not breaking backwards compatibility.

This is also following the precedence of the ILI9322 bindings [2] by using
the pattern "vendor,specific-system-config", "vendor,ip-part";

[1]: https://patchwork.ozlabs.org/patch/839352/
[2]: https://patchwork.ozlabs.org/patch/843576/

Signed-off-by: David Lechner <david@lechnology.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1513881187-3197-3-git-send-email-david@lechnology.com
6 years agodt-bindings: Add "vot" vendor prefix
David Lechner [Thu, 21 Dec 2017 18:33:05 +0000 (12:33 -0600)]
dt-bindings: Add "vot" vendor prefix

This adds a vendor prefix "vot" for Vision Optical Technology Co., Ltd.
They make LCD displays.

Signed-off-by: David Lechner <david@lechnology.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1513881187-3197-2-git-send-email-david@lechnology.com
6 years agodrm: fix tainted kernel caused by drm_panel_orientation_quirks.c
David Lechner [Thu, 21 Dec 2017 18:46:19 +0000 (12:46 -0600)]
drm: fix tainted kernel caused by drm_panel_orientation_quirks.c

drm_panel_orientation_quirks.c introduced in commit 404d1a3edc38 ("drm:
Add panel orientation quirks, v6.") taints the kernel when compiled as a
module. Fix this by adding MODULE_LICENSE().

Signed-off-by: David Lechner <david@lechnology.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1513881979-13801-1-git-send-email-david@lechnology.com
6 years agodrm/panel: Add Ilitek ILI9322 driver
Linus Walleij [Thu, 21 Dec 2017 23:44:11 +0000 (00:44 +0100)]
drm/panel: Add Ilitek ILI9322 driver

This adds support for the Ilitek ILI9322 QVGA (320x240)
TFT panel driver.

This panel driver supports serial or parallel RGB or
YUV input and also ITU-T BT.656 input streams.

The controller is combined with a physical panel and
configured through the device tree.

Cc: David Lechner <david@lechnology.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Ben Dooks <ben.dooks@codethink.co.uk>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171221234411.12156-1-linus.walleij@linaro.org
6 years agodrm/panel: Add DT bindings for Ilitek ILI9322
Linus Walleij [Fri, 1 Dec 2017 16:16:57 +0000 (17:16 +0100)]
drm/panel: Add DT bindings for Ilitek ILI9322

This adds device tree bindings for the Ilitek ILI9322
320x240 TFT panel driver.

Cc: David Lechner <david@lechnology.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Ben Dooks <ben.dooks@codethink.co.uk>
Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201161659.9588-1-linus.walleij@linaro.org
6 years agodrm/framebuffer: Print task that allocated the fb in debug info.
Maarten Lankhorst [Wed, 20 Dec 2017 09:35:44 +0000 (10:35 +0100)]
drm/framebuffer: Print task that allocated the fb in debug info.

This is is very useful to finding sources of leaked framebufers.
The fbcon fb is annotated with [fbcon], to give it a better name
than kworker.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171220093545.613-3-maarten.lankhorst@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agodrm/fb-helper: Add drm_fb_helper_defio_init()
Noralf Trønnes [Fri, 15 Dec 2017 17:51:17 +0000 (18:51 +0100)]
drm/fb-helper: Add drm_fb_helper_defio_init()

Add helper for initializing fbdev deferred I/O.

The cleanup could have happened in drm_fb_helper_fini(), but that would
have required me to set fb_info->fbdefio to NULL in a couple of drivers
before they call _fini() to avoid double defio cleanup. The problem is
that one of those is vboxvideo which lives in Greg's staging tree.
So I put the cleanup in drm_fb_helper_fbdev_teardown(), not perfect
but not that bad either.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171215175119.36181-6-noralf@tronnes.org
6 years agodrm/fb-helper: Update DOC with new helpers
Noralf Trønnes [Fri, 15 Dec 2017 17:51:16 +0000 (18:51 +0100)]
drm/fb-helper: Update DOC with new helpers

Promote new helpers for dealing with fbdev emulation.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171215175119.36181-5-noralf@tronnes.org
6 years agodrm/docs: Add todo entry for drm_fb_helper_fbdev_setup()
Noralf Trønnes [Fri, 15 Dec 2017 17:51:15 +0000 (18:51 +0100)]
drm/docs: Add todo entry for drm_fb_helper_fbdev_setup()

Add entry for conversion of drivers to new helpers.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171215175119.36181-4-noralf@tronnes.org
6 years agodrm/fb-helper: Add drm_fb_helper_fbdev_setup/teardown()
Noralf Trønnes [Fri, 15 Dec 2017 17:51:14 +0000 (18:51 +0100)]
drm/fb-helper: Add drm_fb_helper_fbdev_setup/teardown()

Add helpers to setup and teardown fbdev emulation.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171215175119.36181-3-noralf@tronnes.org
6 years agodrm/fb-helper: Set/clear dev->fb_helper in dummy init/fini
Noralf Trønnes [Fri, 15 Dec 2017 17:51:13 +0000 (18:51 +0100)]
drm/fb-helper: Set/clear dev->fb_helper in dummy init/fini

Set dev->fb_helper even when fbdev emulation is compiled out,
so drivers can use it to free the structure.
Clear it for consistency.

Fixes: 29ad20b22c8f ("drm: Add drm_device->fb_helper pointer")
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171215175119.36181-2-noralf@tronnes.org
6 years agodrm/stm: ltdc: Remove unnecessary platform_get_resource() error check
Fabio Estevam [Mon, 18 Dec 2017 13:02:29 +0000 (11:02 -0200)]
drm/stm: ltdc: Remove unnecessary platform_get_resource() error check

devm_ioremap_resource() already checks if the resource is NULL, so
remove the unnecessary platform_get_resource() error check.

Cc: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Acked-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1513602150-7542-6-git-send-email-festevam@gmail.com
6 years agodrm/stm: dsi: Remove unnecessary platform_get_resource() error check
Fabio Estevam [Mon, 18 Dec 2017 13:02:28 +0000 (11:02 -0200)]
drm/stm: dsi: Remove unnecessary platform_get_resource() error check

devm_ioremap_resource() already checks if the resource is NULL, so
remove the unnecessary platform_get_resource() error check.

Cc: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Acked-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1513602150-7542-5-git-send-email-festevam@gmail.com
6 years agodrm/doc: Move legacy kms helpers to the very end
Daniel Vetter [Thu, 14 Dec 2017 20:30:54 +0000 (21:30 +0100)]
drm/doc: Move legacy kms helpers to the very end

We don't want people to accidentally stumble over there.

Also rename the plane helpers to legacy plane helpers. After Ville's
patch to make the clipping helper atomic and move it to
drm_atomic_helper.c there's nothing left in there that should be
useful for modern drivers.

v2: Laurent had a few questions around how state is added to
drm_atomic_state, tried to clarify that. And spotted another sentence
where the docs suggested subclassing.

v3: Small polish (Alex).

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171214203054.20141-6-daniel.vetter@ffwll.ch
6 years agodrm/atomic: document how to handle driver private objects
Daniel Vetter [Thu, 14 Dec 2017 20:30:53 +0000 (21:30 +0100)]
drm/atomic: document how to handle driver private objects

DK put some nice docs into the commit introducing driver private
state, but in the git history alone it'll be lost.

Also, since Ville remove the void* usage it's a good opportunity to
give the driver private stuff some tlc on the doc front.

Finally try to explain why the "let's just subclass drm_atomic_state"
approach wasn't the greatest, and annotate all those functions as
deprecated in favour of more standardized driver private states. Also
note where we could/should extend driver private states going forward
(atm neither locking nor synchronization is handled in core/helpers,
which isn't really all that great).

v2: Spelling and phrasing improvements (Alex, DK).

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171214203054.20141-5-daniel.vetter@ffwll.ch
6 years agodrm/syncobj: some kerneldoc polish
Daniel Vetter [Thu, 14 Dec 2017 20:30:52 +0000 (21:30 +0100)]
drm/syncobj: some kerneldoc polish

Complete a few missing bits, fix up the existing xcross-references and
add a bunch more.

v2: Fix typos (Alex).

Cc: Dave Airlie <airlied@gmail.com> via lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171214203054.20141-4-daniel.vetter@ffwll.ch
6 years agodrm/print: Unconfuse kerneldoc
Daniel Vetter [Thu, 14 Dec 2017 20:30:51 +0000 (21:30 +0100)]
drm/print: Unconfuse kerneldoc

It thinks we want to document the __printf(2,0) annotion. Not sure we
want to teach it about all possible gcc-only flags, hence why I opted
for the cheap trick of just moving it ahead of the kerneldoc.

This is only a problem for static inline functions, since for
non-inline function the kerneldoc is in the .c file, but the special
annotations are all in the header.

Cc'ing kernel-doc maintainers as fyi.

Cc: linux-doc@vger.kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171214203054.20141-3-daniel.vetter@ffwll.ch
6 years agodrm/edid: kerneldoc for is_hdmi2_sink
Daniel Vetter [Thu, 14 Dec 2017 20:30:50 +0000 (21:30 +0100)]
drm/edid: kerneldoc for is_hdmi2_sink

Also some breadcrumbs for how exactly to find this. Probably should
pass drm_connector * or at least drm_display_info * to that function
instead. But drm_hdmi_avi_infoframe_quant_range probably also wants
drm_connector_state (and the hdmi stuff moved into that), so this is a
bit more work.

v2: Fix typo (Alex).

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Fixes: 9271c0ca573e ("drm/edid: Don't send non-zero YQ in AVI infoframe for HDMI 1.x sinks")
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171214203054.20141-2-daniel.vetter@ffwll.ch
6 years agodrm/atomic-helper: Make zpos property kerneldoc less misleading
Thierry Reding [Mon, 20 Nov 2017 15:09:59 +0000 (16:09 +0100)]
drm/atomic-helper: Make zpos property kerneldoc less misleading

kerneldoc for drm_plane_create_zpos_property() says that the DRM core
will automatically calculate the normalized zpos values, but it doesn't
actually do that anymore since commit 38d868e41c4b ("drm: Don't force
all planes to be added to the state due to zpos"). Instead, drivers are
supposed to explicitly call the drm_atomic_normalize_zpos() function.
Change the kerneldoc comment to reflect that.

v2: reference the commit that introduced the kerneldoc unclarity

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171120150959.26913-1-thierry.reding@gmail.com
6 years agodrm: Update edid-derived drm_display_info fields at edid property set [v2]
Keith Packard [Wed, 13 Dec 2017 08:44:26 +0000 (00:44 -0800)]
drm: Update edid-derived drm_display_info fields at edid property set [v2]

There are a set of values in the drm_display_info structure for each
connector which hold information derived from EDID. These are computed
in drm_add_display_info. Before this patch, that was only called in
drm_add_edid_modes. This meant that they were only set when EDID was
present and never reset when EDID was not, as happened when the
display was disconnected.

One of these fields, non_desktop, is used from
drm_mode_connector_update_edid_property, the function responsible for
assigning the new edid value to the application-visible property.

Various drivers call these two functions (drm_add_edid_modes and
drm_mode_connector_update_edid_property) in different orders. This
means that even when EDID is present, the drm_display_info fields may
not have been computed at the time that
drm_mode_connector_update_edid_property used the non_desktop value to
set the non_desktop property.

I've added a public function (drm_reset_display_info) that resets the
drm_display_info field values to default values and then made the
drm_add_display_info function public. These two functions are now
called directly from drm_mode_connector_update_edid_property so that
the drm_display_info fields are always computed from the current EDID
information before being used in that function.

This means that the drm_display_info values are often computed twice,
once when the EDID property it set and a second time when EDID is used
to compute modes for the device. The alternative would be to uniformly
ensure that the values were computed once before being used, which
would require that all drivers reliably invoke the two paths in the
same order. The computation is inexpensive enough that it seems more
maintainable in the long term to simply compute them in both paths.

The API to drm_add_display_info has been changed so that it no longer
takes the set of edid-based quirks as a parameter. Rather, it now
computes those quirks itself and returns them for further use by
drm_add_edid_modes.

This patch also includes a number of 'const' additions caused by
drm_mode_connector_update_edid_property taking a 'const struct edid *'
parameter and wanting to pass that along to drm_add_display_info.

v2: after review by Daniel Vetter <daniel.vetter@ffwll.ch>

Removed EXPORT_SYMBOL_GPL for drm_reset_display_info and
drm_add_display_info.

Added FIXME in drm_mode_connector_update_edid_property about
potentially merging that with drm_add_edid_modes to avoid
the need for two driver calls.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171213084427.31199-1-keithp@keithp.com
6 years agoMAINTAINERS: Remove Jani as drm-misc co-maintainer
Jani Nikula [Thu, 23 Nov 2017 12:13:08 +0000 (14:13 +0200)]
MAINTAINERS: Remove Jani as drm-misc co-maintainer

I'm juggling too many things, and drm-misc maintenance is one that I
keep dropping on the floor. Admit reality and remove myself as
maintainer. This still leaves us with a nice team of three who are
actually doing the drm-misc work, while I focus on drm-intel.

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Dave Airlie <airlied@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Relunctantly-Acked-By: Sean Paul <seanpaul@chromium.org>
Acked-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171123121308.12818-1-jani.nikula@intel.com
6 years agodrm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini()
Noralf Trønnes [Fri, 8 Dec 2017 19:37:42 +0000 (20:37 +0100)]
drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini()

Use drm_fb_cma_fbdev_init_with_funcs() and drm_fb_cma_fbdev_fini() which
relies on the fact that drm_device holds a pointer to the drm_fb_helper
structure. This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.
Remove todo entry.

Cc: David Lechner <david@lechnology.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: David Lechner <david@lechnology.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: David Lechner <david@lechnolgy.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171208193743.34450-11-noralf@tronnes.org
6 years agodrm/arm/mali: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:58 +0000 (15:19 +0100)]
drm/arm/mali: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-20-noralf@tronnes.org
6 years agodrm/zte: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:57 +0000 (15:19 +0100)]
drm/zte: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-19-noralf@tronnes.org
6 years agodrm/vc4: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:56 +0000 (15:19 +0100)]
drm/vc4: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-18-noralf@tronnes.org
6 years agodrm/tve200: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:55 +0000 (15:19 +0100)]
drm/tve200: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-17-noralf@tronnes.org
6 years agodrm/tilcdc: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:54 +0000 (15:19 +0100)]
drm/tilcdc: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Jyri Sarha <jsarha@ti.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Jyri Sarha <jsarha@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-16-noralf@tronnes.org
6 years agodrm/sun4i: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:53 +0000 (15:19 +0100)]
drm/sun4i: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-15-noralf@tronnes.org
6 years agodrm/stm: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:52 +0000 (15:19 +0100)]
drm/stm: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.
Remove duplicate ldev assignment.

Cc: Yannick Fertre <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>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Philippe Cornu <philippe.cornu@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-14-noralf@tronnes.org
6 years agodrm/sti: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:51 +0000 (15:19 +0100)]
drm/sti: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-13-noralf@tronnes.org
6 years agodrm/pl111: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:49 +0000 (15:19 +0100)]
drm/pl111: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-11-noralf@tronnes.org
6 years agodrm/imx: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:46 +0000 (15:19 +0100)]
drm/imx: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-8-noralf@tronnes.org
6 years agodrm/atmel-hlcdc: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:44 +0000 (15:19 +0100)]
drm/atmel-hlcdc: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-6-noralf@tronnes.org
6 years agodrm/cma-helper: Add drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Wed, 15 Nov 2017 14:19:41 +0000 (15:19 +0100)]
drm/cma-helper: Add drm_fb_cma_fbdev_init/fini()

Add functions drm_fb_cma_fbdev_init(), drm_fb_cma_fbdev_fini() and
drm_fb_cma_fbdev_init_with_funcs(). These functions relies on the fact
that the drm_fb_helper struct is stored in dev->drm_fb_helper_private
so drivers don't need to store it.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-3-noralf@tronnes.org
6 years agodrm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional
Noralf Trønnes [Wed, 15 Nov 2017 14:19:40 +0000 (15:19 +0100)]
drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional

Make the drm_framebuffer_funcs argument optional for drivers that
don't need to set the dirty callback.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-2-noralf@tronnes.org
6 years agodrm/tegra: Use drm_fb_helper_lastclose() and _poll_changed()
Noralf Trønnes [Tue, 5 Dec 2017 18:25:04 +0000 (19:25 +0100)]
drm/tegra: Use drm_fb_helper_lastclose() and _poll_changed()

This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171205182504.41923-12-noralf@tronnes.org
6 years agodrm/rockchip: Use drm_fb_helper_lastclose() and _poll_changed()
Noralf Trønnes [Tue, 5 Dec 2017 18:25:03 +0000 (19:25 +0100)]
drm/rockchip: Use drm_fb_helper_lastclose() and _poll_changed()

This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171205182504.41923-11-noralf@tronnes.org
6 years agodrm/omap: Use drm_fb_helper_lastclose() and _poll_changed()
Noralf Trønnes [Tue, 5 Dec 2017 18:25:01 +0000 (19:25 +0100)]
drm/omap: Use drm_fb_helper_lastclose() and _poll_changed()

This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171205182504.41923-9-noralf@tronnes.org
6 years agodrm/nouveau: Use drm_fb_helper_output_poll_changed()
Noralf Trønnes [Tue, 5 Dec 2017 18:25:00 +0000 (19:25 +0100)]
drm/nouveau: Use drm_fb_helper_output_poll_changed()

This driver can use drm_fb_helper_output_poll_changed() instead of
its own nouveau_fbcon_output_poll_changed().

Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171205182504.41923-8-noralf@tronnes.org
6 years agodrm/msm: Use drm_fb_helper_lastclose() and _poll_changed()
Noralf Trønnes [Tue, 5 Dec 2017 18:24:59 +0000 (19:24 +0100)]
drm/msm: Use drm_fb_helper_lastclose() and _poll_changed()

This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171205182504.41923-7-noralf@tronnes.org
6 years agodrm/gma500: Use drm_fb_helper_lastclose() and _poll_changed()
Noralf Trønnes [Tue, 5 Dec 2017 18:24:58 +0000 (19:24 +0100)]
drm/gma500: Use drm_fb_helper_lastclose() and _poll_changed()

This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171205182504.41923-6-noralf@tronnes.org
6 years agodrm/exynos: Use drm_fb_helper_lastclose() and _poll_changed()
Noralf Trønnes [Tue, 5 Dec 2017 18:24:57 +0000 (19:24 +0100)]
drm/exynos: Use drm_fb_helper_lastclose() and _poll_changed()

This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Inki Dae <inki.dae@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Inki Dae <inki.dae@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171205182504.41923-5-noralf@tronnes.org
6 years agodrm/armada: Use drm_fb_helper_lastclose() and _poll_changed()
Noralf Trønnes [Tue, 5 Dec 2017 18:24:56 +0000 (19:24 +0100)]
drm/armada: Use drm_fb_helper_lastclose() and _poll_changed()

This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171205182504.41923-4-noralf@tronnes.org
6 years agodrm/meson: Add missing VPU init
Neil Armstrong [Wed, 6 Dec 2017 11:54:28 +0000 (12:54 +0100)]
drm/meson: Add missing VPU init

The VPU init misses these configurations values.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1512561268-29806-5-git-send-email-narmstrong@baylibre.com
6 years agodrm/meson: dw_hdmi: Add support for an optional external 5V regulator
Neil Armstrong [Wed, 6 Dec 2017 11:54:27 +0000 (12:54 +0100)]
drm/meson: dw_hdmi: Add support for an optional external 5V regulator

On reference boards and derivatives, the HDMI Logic is powered by an external
5V regulator.
This regulator was set by the Vendor U-Boot, add optional support for it.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1512561268-29806-4-git-send-email-narmstrong@baylibre.com
6 years agodt-bindings: display: amlogic, meson-dw-hdmi: Add optional HDMI 5V regulator
Neil Armstrong [Wed, 6 Dec 2017 11:54:26 +0000 (12:54 +0100)]
dt-bindings: display: amlogic, meson-dw-hdmi: Add optional HDMI 5V regulator

On reference boards and derivatives, the HDMI Logic is powered by an external
5V regulator.
This regulator was set by the Vendor U-Boot, add optional support for it.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1512561268-29806-3-git-send-email-narmstrong@baylibre.com
6 years agodt-bindings: display: amlogic, meson-vpu: Add optional power domain property
Neil Armstrong [Wed, 6 Dec 2017 11:54:25 +0000 (12:54 +0100)]
dt-bindings: display: amlogic, meson-vpu: Add optional power domain property

The Video Processing Unit power domain was setup by the Vendor U-Boot,
add support for an optional Power Domain phandle to setup it from the kernel.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1512561268-29806-2-git-send-email-narmstrong@baylibre.com
6 years agodrm: More debug info for fb leaks in mode_config_cleanup
Daniel Vetter [Thu, 7 Dec 2017 14:49:25 +0000 (15:49 +0100)]
drm: More debug info for fb leaks in mode_config_cleanup

We're spotting this very rarely in CI, but have no idea. Let's add
more debug info about what's going on here.

References: https://bugs.freedesktop.org/show_bug.cgi?id=102707
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171207144925.14191-1-daniel.vetter@ffwll.ch
6 years agodrm/sun4i: Fix uninitialized variables in vi layer
Jernej Skrabec [Wed, 6 Dec 2017 15:26:03 +0000 (16:26 +0100)]
drm/sun4i: Fix uninitialized variables in vi layer

min_scale and max_scale in sun8i_vi_layer_atomic_check() can be used
without initialization.

Fix that.

Fixes: b862a648de3b ("drm/sun4i: Add support for HW scaling to DE2")
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171206152603.25937-1-jernej.skrabec@siol.net
6 years agodrm/fb-helper: Fix potential NULL pointer dereference
Gustavo A. R. Silva [Tue, 5 Dec 2017 17:46:28 +0000 (11:46 -0600)]
drm/fb-helper: Fix potential NULL pointer dereference

fb_helper is being dereferenced before it is null checked,
hence there is a potential null pointer dereference.

Fix this by moving the pointer dereference after fb_helper
has been null checked.

This issue was detected with the help of Coccinelle.

Fixes: c777990fb45b ("drm/fb-helper: Handle function NULL argument")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171205174628.GA31189@embeddedor.com
6 years agogpu: drm: stm: Adopt SPDX identifiers
Benjamin Gaignard [Wed, 6 Dec 2017 11:29:46 +0000 (12:29 +0100)]
gpu: drm: stm: Adopt SPDX identifiers

Add SPDX identifiers to files under stm directory

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Acked-by: Vincent Abriou <vincent.abriou@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171206112947.9569-1-benjamin.gaignard@st.com
6 years agogpu: drm: sti: Adopt SPDX identifiers
Benjamin Gaignard [Wed, 6 Dec 2017 11:29:47 +0000 (12:29 +0100)]
gpu: drm: sti: Adopt SPDX identifiers

Add SPDX identifiers to files under sti directory

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Acked-by: Vincent Abriou <vincent.abriou@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171206112947.9569-2-benjamin.gaignard@st.com
6 years agodrm/fsl-dcu: Use drm_mode_config_helper_suspend/resume()
Noralf Trønnes [Tue, 14 Nov 2017 21:25:15 +0000 (22:25 +0100)]
drm/fsl-dcu: Use drm_mode_config_helper_suspend/resume()

Replace driver's code with the generic helpers that do the same thing.

Cc: Stefan Agner <stefan@agner.ch>
Cc: Alison Wang <alison.wang@freescale.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Stefan Agner <stefan@agner.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171114212517.23536-5-noralf@tronnes.org
6 years agodrm/sun4i: Wire in DE2 YUV support
Jernej Skrabec [Fri, 1 Dec 2017 06:05:49 +0000 (07:05 +0100)]
drm/sun4i: Wire in DE2 YUV support

Now that we have all required bits, add support for YUV formats.

DRM subsystem doesn't know YUV411 semi-planar format, so leave that out
for now.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-27-jernej.skrabec@siol.net
6 years agodrm/sun4i: Expand DE2 scaler lib with YUV support
Jernej Skrabec [Fri, 1 Dec 2017 06:05:48 +0000 (07:05 +0100)]
drm/sun4i: Expand DE2 scaler lib with YUV support

Basic principle of operation when using YUV framebuffer is that chroma
planes have to be upscaled to same size as luma.

Because of that, expand DE2 scaler library to support that.

BSP driver uses another set of FIR filter coefficients for YUV planes.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-26-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add DE2 definitions for YUV formats
Jernej Skrabec [Fri, 1 Dec 2017 06:05:47 +0000 (07:05 +0100)]
drm/sun4i: Add DE2 definitions for YUV formats

This commit expands translation of DRM YUV format to HW specific
information.

It doesn't do any functional changes.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-25-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add DE2 CSC library
Jernej Skrabec [Fri, 1 Dec 2017 06:05:46 +0000 (07:05 +0100)]
drm/sun4i: Add DE2 CSC library

DE2 have many CSC units - channel input CSC, channel output CSC and
mixer output CSC and maybe more.

Fortunately, they have all same register layout, only base offsets
differs.

Add support only for channel output CSC for now.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-24-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add CCSC property to DE2 configuration
Jernej Skrabec [Fri, 1 Dec 2017 06:05:45 +0000 (07:05 +0100)]
drm/sun4i: Add CCSC property to DE2 configuration

Base addresses of channel output CSC (CCSC) depends whether mixer in
question is first or second and if it is second, if supports VEP or not.
This new property will tell which set of base addresses to take.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-23-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add support for HW scaling to DE2
Jernej Skrabec [Fri, 1 Dec 2017 06:05:44 +0000 (07:05 +0100)]
drm/sun4i: Add support for HW scaling to DE2

Scaling is currently supported only for RGB framebuffers

Coefficients and algorithm which coefficients to select are taken
from BSP driver.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-22-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add scaler configuration to DE2 mixers
Jernej Skrabec [Fri, 1 Dec 2017 06:05:43 +0000 (07:05 +0100)]
drm/sun4i: Add scaler configuration to DE2 mixers

No all SoCs support scaling on all channels. For example, V3s support
scaling only on VI channels. Because of that, add additional
configuration bitmask which tells which channel support scaler.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-21-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add support for DE2 VI planes
Jernej Skrabec [Fri, 1 Dec 2017 06:05:42 +0000 (07:05 +0100)]
drm/sun4i: Add support for DE2 VI planes

This commit adds basic support for VI planes. They are meant for video
overlay and because of that they support YUV formats too. However, using
YUV format is not straightforward, so only RGB formats are supported for
now.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-20-jernej.skrabec@siol.net
6 years agodrm/sun4i: Reorganize UI layer code in DE2
Jernej Skrabec [Fri, 1 Dec 2017 06:05:41 +0000 (07:05 +0100)]
drm/sun4i: Reorganize UI layer code in DE2

Till now, DE2 driver supported only UI planes. Before we add support for
VI planes, lets split out UI layer specific code from common parts. This
commit does the following:
- renames sun8i_layer.c to sun8i_ui_layer.c
- moves UI channel specific code to sun8i_ui_layer.c
- moves common code from sun8i_layer.c to sun8i_mixer.c
- renames function and structure names so it is apparent where they
belong to

No functional change is made.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-19-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add support for all HW supported DE2 RGB formats
Jernej Skrabec [Fri, 1 Dec 2017 06:05:40 +0000 (07:05 +0100)]
drm/sun4i: Add support for all HW supported DE2 RGB formats

Currently only a few RGB formats are supported by the DE2 driver. Add
support for all formats supported by the HW.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-18-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add multi plane support to DE2 driver
Jernej Skrabec [Fri, 1 Dec 2017 06:05:39 +0000 (07:05 +0100)]
drm/sun4i: Add multi plane support to DE2 driver

Support for multiple UI planes can now be easily enabled just by adding
more planes with different index.

For now, add immutable zpos property.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-17-jernej.skrabec@siol.net
6 years agodrm/sun4i: Move interlace related code in DE2
Jernej Skrabec [Fri, 1 Dec 2017 06:05:38 +0000 (07:05 +0100)]
drm/sun4i: Move interlace related code in DE2

There is no point having code which sets interlace mode of mixer in
channel related function. Interlace mode will only change when CRTC
state will change, so let's move it to the block which is executed only
when primary plane state is changed.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-16-jernej.skrabec@siol.net
6 years agodrm/sun4i: Move channel size related code in DE2
Jernej Skrabec [Fri, 1 Dec 2017 06:05:37 +0000 (07:05 +0100)]
drm/sun4i: Move channel size related code in DE2

Channel size should be set every time plane is changed, not only when
primary plane changes. Current code works only because only one
(primary) plane is supported at the moment.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-15-jernej.skrabec@siol.net
6 years agodrm/sun4i: Move line width setting in DE2
Jernej Skrabec [Fri, 1 Dec 2017 06:05:36 +0000 (07:05 +0100)]
drm/sun4i: Move line width setting in DE2

Line width is a property of a framebuffer and it belongs to
sun8i_mixer_update_layer_buffer(). This will became even more obvious
when support for multi-plane formats will be added.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-14-jernej.skrabec@siol.net
6 years agodrm/sun4i: Use values calculated by atomic check
Jernej Skrabec [Fri, 1 Dec 2017 06:05:35 +0000 (07:05 +0100)]
drm/sun4i: Use values calculated by atomic check

Now that we have properly clipped coordinates in plane state structure,
use them.

This also fixes bug where source x and y were adjusted for negative
value, but width and height weren't. It wasn't discovered because
primary plane usually doesn't have negative coordinates.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-13-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add constraints checking to DE2 driver
Jernej Skrabec [Fri, 1 Dec 2017 06:05:34 +0000 (07:05 +0100)]
drm/sun4i: Add constraints checking to DE2 driver

Since current DE2 driver doesn't know how to scale yet, add atomic check
function which checks that.

Nice side effect of that function is that populates clipped coordinates
and checks visibility of the plane. That data will be used in the
future.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-12-jernej.skrabec@siol.net
6 years agodrm/sun4i: Start using layer id in DE2 driver
Jernej Skrabec [Fri, 1 Dec 2017 06:05:33 +0000 (07:05 +0100)]
drm/sun4i: Start using layer id in DE2 driver

Till now, plane selection was hardcoded to first overlay in first UI
channel and layer parameter is unused.

Rename and add parameters to layer functions so they would represent HW
more accurately and start using then.

It turns out that overlays don't fit well in current DRM design, because
they can't be blended together or scaled independetly when they are set
to same channel. Because of that, always use only first overlay in each
channel.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-11-jernej.skrabec@siol.net
6 years agodrm/sun4i: Rework enabling plane in DE2 driver
Jernej Skrabec [Fri, 1 Dec 2017 06:05:32 +0000 (07:05 +0100)]
drm/sun4i: Rework enabling plane in DE2 driver

If we want to support multiple planes in the future, code which enables
pipe has to be moved to appropriate place and it must depend on channel
id instead of being hardcoded.

Side effect of that rework is definition of default Z position. For now,
put first channel at the bottom, second above it and so on.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-10-jernej.skrabec@siol.net
6 years agodrm/sun4i: Rename some macros in DE2 driver
Jernej Skrabec [Fri, 1 Dec 2017 06:05:31 +0000 (07:05 +0100)]
drm/sun4i: Rename some macros in DE2 driver

Now that some knowledge of DE2 is gained, rename or add some macros to
make code more readable.

Max channel macro is removed, since it is not used and it is not clear
if it has right value. Structures in BSP driver shows possibility of 5
channels maximum although there is no SoC with such configuration.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-9-jernej.skrabec@siol.net
6 years agodrm/sun4i: Set blending mode for all channels (DE2)
Jernej Skrabec [Fri, 1 Dec 2017 06:05:30 +0000 (07:05 +0100)]
drm/sun4i: Set blending mode for all channels (DE2)

BSP driver always sets blend mode for all channels, no matter if they
are really used or not. Do the same here.

The exact meaning of the value is not exactly known, but BSP driver
mentions "SRC OVER" and by digging through code some more info can be
found.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-8-jernej.skrabec@siol.net
6 years agodrm/sun4i: Explain color macro in DE2 driver
Jernej Skrabec [Fri, 1 Dec 2017 06:05:29 +0000 (07:05 +0100)]
drm/sun4i: Explain color macro in DE2 driver

Color attribute have same format troughout the whole driver.

Rename macro, add comment with simple explanation and remove redundant
definitions.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-7-jernej.skrabec@siol.net
6 years agodrm/sun4i: Remove setting default values in DE2 driver
Jernej Skrabec [Fri, 1 Dec 2017 06:05:28 +0000 (07:05 +0100)]
drm/sun4i: Remove setting default values in DE2 driver

Premultiply and color key control registers are already set to zero by
initialization code few lines above. Furthermore, it seems that
colorkeying doesn't really work. It's not used in BSP driver and
experiments with it all failed.

Just remove the code.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-6-jernej.skrabec@siol.net
6 years agodrm/sun4i: Fix debug message in DE2
Jernej Skrabec [Fri, 1 Dec 2017 06:05:27 +0000 (07:05 +0100)]
drm/sun4i: Fix debug message in DE2

Debug message would print "Enabling" even when disabling plane.

Fix it.

Fixes: 9d75b8c0b999 (drm/sun4i: add support for Allwinner DE2 mixers)
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-5-jernej.skrabec@siol.net
6 years agodrm/sun4i: Remove setting alpha mode in DE2 driver
Jernej Skrabec [Fri, 1 Dec 2017 06:05:26 +0000 (07:05 +0100)]
drm/sun4i: Remove setting alpha mode in DE2 driver

Current code sets alpha mode to global alpha mode and global alpha
value to 0xff which is totaly opaque. That is not needed for two
reasons:

- only one plane is active and thus it can be blended only with
background, which is black,
- it will hinder proper blending when more than one plane is supported

Default mode (0) considers pixel alpha value or 0xff if pixel has
no alpha information. Global alpha value is ignored in this case.

Because of that, just remove the code.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-4-jernej.skrabec@siol.net
6 years agodrm/sun4i: Rename DE2 RGB format macros
Jernej Skrabec [Fri, 1 Dec 2017 06:05:25 +0000 (07:05 +0100)]
drm/sun4i: Rename DE2 RGB format macros

Current RGB formats macros are actually not specific to UI planes.
Rename it to something more universal and introduce shift macro.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-3-jernej.skrabec@siol.net
6 years agodrm/sun4i: Fix format mask in DE2 driver
Jernej Skrabec [Fri, 1 Dec 2017 06:05:24 +0000 (07:05 +0100)]
drm/sun4i: Fix format mask in DE2 driver

Format mask is one bit too short. Fix it.

Fixes: 9d75b8c0b999 (drm/sun4i: add support for Allwinner DE2 mixers)
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-2-jernej.skrabec@siol.net
6 years agodrm: Document that drm_panel_orientation_quirks.c is shared with fbdev
Hans de Goede [Mon, 4 Dec 2017 22:33:21 +0000 (23:33 +0100)]
drm: Document that drm_panel_orientation_quirks.c is shared with fbdev

Add a comment to the DRM_PANEL_ORIENTATION_QUIRKS documenting that the
reason for a separate Kconfig for this is because
drm_panel_orientation_quirks.c code is shared with fbdev.

Suggested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171204223321.15799-1-hdegoede@redhat.com
6 years agofbcon: Remove dmi quirk table
Hans de Goede [Sat, 25 Nov 2017 19:35:53 +0000 (20:35 +0100)]
fbcon: Remove dmi quirk table

This is now all handled in the drivers and communicated through
fb_info.fbcon_rotate_hint.

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171125193553.23986-8-hdegoede@redhat.com
6 years agoefifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk
Hans de Goede [Sat, 25 Nov 2017 19:35:52 +0000 (20:35 +0100)]
efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk

On some hardware the LCD panel is not mounted upright in the casing,
but rotated by 90 degrees. In this case we want the console to
automatically be rotated to compensate.

The drm subsys has a quirk table for this, use the
drm_get_panel_orientation_quirk function to get the panel orientation
and set info->fbcon_rotate_hint based on this, so that the fbcon console
on top of efifb gets automatically rotated to compensate for the panel
orientation.

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171125193553.23986-7-hdegoede@redhat.com
6 years agodrm/i915: Add "panel orientation" property to the panel connector, v6.
Hans de Goede [Sat, 25 Nov 2017 19:35:51 +0000 (20:35 +0100)]
drm/i915: Add "panel orientation" property to the panel connector, v6.

Ideally we could use the VBT for this, that would be simple, in
intel_dsi_init() check dev_priv->vbt.dsi.config->rotation, set
connector->display_info.panel_orientation accordingly and call
drm_connector_init_panel_orientation_property(), done.

Unfortunately vbt.dsi.config->rotation is always 0 even on tablets
with an upside down LCD and where the GOP is properly rotating the
EFI fb in hardware.

So instead we end up reading the rotation from the primary plane.

This commit only implements the panel orientation property for DSI
panels on BYT / CHT hardware, as all known non normal oriented panels
sofar are only found on this hardware.

Changes in v2:
-Read back the rotation applied by the GOP from the primary plane
 instead of relying on dev_priv->vbt.dsi.config->rotation, because it
 seems that the VBT rotation filed is always 0 even on devices where the
 GOP does apply a rotation

Changes in v3:
-Rewrite the code to read back the orientation from the primary
 plane to contain all of this in intel_dsi.c instead of poking a bunch
 of holes between all the different layers

Changes in v6:
-Move hardware readout to intel_dsi_init()

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171125193553.23986-6-hdegoede@redhat.com
6 years agodrm/fb-helper: Apply panel orientation connector prop to the primary plane, v6.
Hans de Goede [Sat, 25 Nov 2017 19:35:50 +0000 (20:35 +0100)]
drm/fb-helper: Apply panel orientation connector prop to the primary plane, v6.

Apply the "panel orientation" drm connector prop to the primary plane so
that fbcon and fbdev using userspace programs display the right way up.

Changes in v3:
-Use a rotation member in struct drm_fb_helper_crtc and set that from
 drm_setup_crtcs instead of looping over all crtc's to find the right one
 later
-Since we now no longer look at rotation quirks directly in the fbcon
 code, set fb_info.fbcon_rotate_hint when the panel is not mounted upright
 and we cannot use hardware rotation

Changes in v4:
-Make drm_fb_helper_init() init drm_fb_helper_crtc.rotation to
 DRM_MODE_ROTATE_0 for all crtcs, so that we do not end up setting the
 plane_state's rotation to an invalid value for disabled crtcs
 (caught by Fi.CI)

Changes in v5:
-Only use hardware (crtc primary plane) rotation for DRM_ROTATE_180,
 90 / 270 degree rotation requires special handling which we lack atm
-Add a TODO comment for 90 / 270 degree hardware rotation
-Add some comments to better document the default case when mapping
 sw_rotations to fbcon_rotate_hints

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=94894
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171125193553.23986-5-hdegoede@redhat.com
6 years agodrm: Add support for a panel-orientation connector property, v6
Hans de Goede [Sat, 25 Nov 2017 19:35:49 +0000 (20:35 +0100)]
drm: Add support for a panel-orientation connector property, v6

On some devices the LCD panel is mounted in the casing in such a way that
the up/top side of the panel does not match with the top side of the
device (e.g. it is mounted upside-down).

This commit adds the necessary infra for lcd-panel drm_connector-s to
have a "panel orientation" property to communicate how the panel is
orientated vs the casing.

Userspace can use this property to check for non-normal orientation and
then adjust the displayed image accordingly by rotating it to compensate.

Changes in v2:
-Store panel_orientation in drm_display_info, so that drm_fb_helper.c can
 access it easily
-Have a single drm_connector_init_panel_orientation_property rather then
 create and attach functions. The caller is expected to set
 drm_display_info.panel_orientation before calling this, then this will
 check for platform specific quirks overriding the panel_orientation and if
 the panel_orientation is set after this then it will attach the property.

Changes in v6:
-Use an enum (with kerneldoc) rather then #defines for
 DRM_MODE_PANEL_ORIENTATION_*

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171125193553.23986-4-hdegoede@redhat.com
6 years agodrm: Add panel orientation quirks, v6.
Hans de Goede [Sat, 25 Nov 2017 19:35:48 +0000 (20:35 +0100)]
drm: Add panel orientation quirks, v6.

Some x86 clamshell design devices use portrait tablet screens and a display
engine which cannot rotate in hardware, so the firmware just leaves things
as is and we cannot figure out that the display is oriented non upright
from the hardware.

So at least on x86, we need a quirk table for this. This commit adds a DMI
based quirk table which is initially populated with 5 such devices: Asus
T100HA, GPD Pocket, GPD win, I.T.Works TW891 and the VIOS LTH17.

This quirk table will be used by the drm code to let userspace know that
the display is not mounted upright inside the devices case through a new
panel orientation drm-connector property, as well as to tell fbcon to
rotate the console so that it shows the right way up.

Changes in v5:
-Add a kernel-doc comment documenting drm_get_panel_orientation_quirk()
-Remove board_* matches from the dmi-matches for the VIOS LTH17 laptop,
 keeping only the (identical) sys_vendor and product_name matches.
 This is necessary because an older version of the bios has
 board_vendor set to VOIS instead of VIOS

Changes in v6:
-Add reference to added kernel-docs in Documentation/gpu/drm-kms-helpers.rst

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171125193553.23986-3-hdegoede@redhat.com
6 years agofbcon: Add fbcon_rotate_hint to struct fb_info
Hans de Goede [Sat, 25 Nov 2017 19:35:47 +0000 (20:35 +0100)]
fbcon: Add fbcon_rotate_hint to struct fb_info

On some hardware the LCD panel is not mounted upright in the casing,
but upside-down or rotated 90 degrees. In this case we want the console
to automatically be rotated to compensate.

The fbdev-driver may know about the need to rotate. Add a new
fbcon_rotate_hint field to struct fb_info, which gets initialized to -1.
If the fbdev-driver knows that some sort of rotation is necessary then
it can set this field to a FB_ROTATE_* value to tell the fbcon console
driver to rotate the console.

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171125193553.23986-2-hdegoede@redhat.com
6 years agoMerge arlied/drm-next into drm-misc-next
Gustavo Padovan [Mon, 4 Dec 2017 18:04:45 +0000 (16:04 -0200)]
Merge arlied/drm-next into drm-misc-next

We need to pull 66660d4cf21b (drm: add connector info/property for
non-desktop displays [v2]) into drm-misc-next to continue the development
of the display rotation series.

Effectively this also pulls 4.15-r2 into drm-misc-next.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
6 years agodrm/prime: skip CPU sync in map/unmap dma_buf
Lucas Stach [Thu, 30 Nov 2017 17:34:28 +0000 (18:34 +0100)]
drm/prime: skip CPU sync in map/unmap dma_buf

Dma-bufs should already be device coherent, as they are only pulled in the
CPU domain via the begin/end cpu_access calls. As we cache the mapping set
up by dma_map_sg a CPU sync at this point will not actually guarantee proper
coherency on non-coherent architectures, so we can as well stop pretending.

This is an important performance fix for architectures which need explicit
cache synchronization and userspace doing lots of dma-buf imports.
Improves Weston on Etnaviv performance 5x, where before this patch > 90%
of Weston CPU time was spent synchronizing caches for buffers which are
already device coherent.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171130173428.8666-1-l.stach@pengutronix.de
6 years agoMerge tag 'drm-intel-next-2017-11-17-1' of git://anongit.freedesktop.org/drm/drm...
Dave Airlie [Sun, 3 Dec 2017 23:40:35 +0000 (09:40 +1000)]
Merge tag 'drm-intel-next-2017-11-17-1' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

More change sets for 4.16:

- Many improvements for selftests and other igt tests (Chris)
- Forcewake with PUNIT->PMIC bus fixes and robustness (Hans)
- Define an engine class for uABI (Tvrtko)
- Context switch fixes and improvements (Chris)
- GT powersavings and power gating simplification and fixes (Chris)
- Other general driver clean-ups (Chris, Lucas, Ville)
- Removing old, useless and/or bad workarounds (Chris, Oscar, Radhakrishna)
- IPS, pipe config, etc in preparation for another Fast Boot attempt (Maarten)
- OA perf fixes and support to Coffee Lake and Cannonlake (Lionel)
- Fixes around GPU fault registers (Michel)
- GEM Proxy (Tina)
- Refactor of Geminilake and Cannonlake plane color handling (James)
- Generalize transcoder loop (Mika Kahola)
- New HW Workaround for Cannonlake and Geminilake (Rodrigo)
- Resume GuC before using GEM (Chris)
- Stolen Memory handling improvements (Ville)
- Initialize entry in PPAT for older compilers (Chris)
- Other fixes and robustness improvements on execbuf (Chris)
- Improve logs of GEM_BUG_ON (Mika Kuoppala)
- Rework with massive rename of GuC functions and files (Sagar)
- Don't sanitize frame start delay if pipe is off (Ville)
- Cannonlake clock fixes (Rodrigo)
- Cannonlake HDMI 2.0 support (Rodrigo)
- Add a GuC doorbells selftest (Michel)
- Add might_sleep() check to our wait_for() (Chris)

Many GVT changes for 4.16:

- CSB HWSP update support (Weinan)
- GVT debug helpers, dyndbg and debugfs (Chuanxiao, Shuo)
- full virtualized opregion (Xiaolin)
- VM health check for sane fallback (Fred)
- workload submission code refactor for future enabling (Zhi)
- Updated repo URL in MAINTAINERS (Zhenyu)
- other many misc fixes

* tag 'drm-intel-next-2017-11-17-1' of git://anongit.freedesktop.org/drm/drm-intel: (260 commits)
  drm/i915: Update DRIVER_DATE to 20171117
  drm/i915: Add a policy note for removing workarounds
  drm/i915/selftests: Report ENOMEM clearly for an allocation failure
  Revert "drm/i915: Display WA #1133 WaFbcSkipSegments:cnl, glk"
  drm/i915: Calculate g4x intermediate watermarks correctly
  drm/i915: Calculate vlv/chv intermediate watermarks correctly, v3.
  drm/i915: Pass crtc_state to ips toggle functions, v2
  drm/i915: Pass idle crtc_state to intel_dp_sink_crc
  drm/i915: Enable FIFO underrun reporting after initial fastset, v4.
  drm/i915: Mark the userptr invalidate workqueue as WQ_MEM_RECLAIM
  drm/i915: Add might_sleep() check to wait_for()
  drm/i915/selftests: Add a GuC doorbells selftest
  drm/i915/cnl: Extend HDMI 2.0 support to CNL.
  drm/i915/cnl: Simplify dco_fraction calculation.
  drm/i915/cnl: Don't blindly replace qdiv.
  drm/i915/cnl: Fix wrpll math for higher freqs.
  drm/i915/cnl: Fix, simplify and unify wrpll variable sizes.
  drm/i915/cnl: Remove useless conversion.
  drm/i915/cnl: Remove spurious central_freq.
  drm/i915/selftests: exercise_ggtt may have nothing to do
  ...