platform/kernel/linux-starfive.git
6 years agodrm/sun4i: Don't change clock bits in DW HDMI PHY driver
Jernej Skrabec [Mon, 25 Jun 2018 12:02:57 +0000 (14:02 +0200)]
drm/sun4i: Don't change clock bits in DW HDMI PHY driver

DW HDMI PHY driver and PHY clock driver share same registers. Make sure
that DW HDMI PHY setup code doesn't change any clock related bits.
During initialization, set PHY PLL parent bit to 0.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-18-jernej.skrabec@siol.net
6 years agodrm/sun4i: Enable DW HDMI PHY clock
Jernej Skrabec [Mon, 25 Jun 2018 12:02:56 +0000 (14:02 +0200)]
drm/sun4i: Enable DW HDMI PHY clock

Current DW HDMI PHY code never prepares and enables PHY clock after it is
created. It's just used as it is. This may work in some cases, but it's
clearly wrong. Fix it by adding proper calls to enable/disable PHY
clock.

Fixes: 4f86e81748fe ("drm/sun4i: Add support for H3 HDMI PHY variant")

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-17-jernej.skrabec@siol.net
6 years agodt-bindings: display: sun4i-drm: Add description of A64 HDMI PHY
Jernej Skrabec [Mon, 25 Jun 2018 12:02:55 +0000 (14:02 +0200)]
dt-bindings: display: sun4i-drm: Add description of A64 HDMI PHY

A64 HDMI PHY is similar to H3 HDMI PHY except it has two possible PLL
clock parents. It is compatible to other HDMI PHYs, like that found in
R40.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-16-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add support for R40 mixers
Jernej Skrabec [Mon, 25 Jun 2018 12:02:54 +0000 (14:02 +0200)]
drm/sun4i: Add support for R40 mixers

Both mixers have similar capabilities as others SoCs with DE2.

First mixer has 1 VI and 3 UI planes and supports HW scaling on all
planes.

Second mixer has 1 VI and 1 UI planes and also supports HW scaling on
all planes.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-15-jernej.skrabec@siol.net
6 years agodrm/sun4i: Don't check for panel or bridge on TV TCONs
Jernej Skrabec [Mon, 25 Jun 2018 12:02:52 +0000 (14:02 +0200)]
drm/sun4i: Don't check for panel or bridge on TV TCONs

TV TCONs are always connected to TV or HDMI encoder, so it doesn't make
sense to check if panel or bridge is connected to them.

Check if TCON has channel 0 and only then check for connected panel or
bridges.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-13-jernej.skrabec@siol.net
6 years agodrm/sun4i: Don't check for LVDS and RGB when TCON has only ch1
Jernej Skrabec [Mon, 25 Jun 2018 12:02:51 +0000 (14:02 +0200)]
drm/sun4i: Don't check for LVDS and RGB when TCON has only ch1

LVDS and RGB interfaces are always connected to TCONs which have channel
0. It doesn't make sense to try to init them on TV TCONs.

Add a check if TCON has channel 0 before trying to init LVDS or RGB
interface.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-12-jernej.skrabec@siol.net
6 years agodrm/sun4i: tcon: Generalize engine search algorithm
Jernej Skrabec [Mon, 25 Jun 2018 12:02:50 +0000 (14:02 +0200)]
drm/sun4i: tcon: Generalize engine search algorithm

Current "old" method to find engine worked pretty well for DE2. However,
it doesn't work when TCON TOP is between  mixer (engine) and TCON. TCON
TOP has multiple input ports, but current engine search algorithm
expects only one.

This can be fixed by first looking for output port id and selecting
matching input by subtracting 1 for the next round. This work even if
there is only one input and output.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-11-jernej.skrabec@siol.net
6 years agodrm/sun4i: Don't skip TCONs if they don't have channel 0
Jernej Skrabec [Mon, 25 Jun 2018 12:02:49 +0000 (14:02 +0200)]
drm/sun4i: Don't skip TCONs if they don't have channel 0

TV TCONs (channel 1 only) are always connected to TV or HDMI encoder.
Because of that, all output endpoints on such TCON node will point to a
encoder which is part of component framework.

Correct current graph traversing algorithm in such way that it doesn't
skip output enpoints with id 0 on TV TCONs.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-10-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add support for traversing graph with TCON TOP
Jernej Skrabec [Mon, 25 Jun 2018 12:02:48 +0000 (14:02 +0200)]
drm/sun4i: Add support for traversing graph with TCON TOP

TCON TOP is different from other nodes in graph by having 3 input and 3
output ports. Additionally, connection to TV TCON might lead back to
HDMI mux input port, creating loops.

Add support for traversing such graph.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-9-jernej.skrabec@siol.net
6 years agodrm/sun4i: Split out code for enumerating endpoints in output port
Jernej Skrabec [Mon, 25 Jun 2018 12:02:47 +0000 (14:02 +0200)]
drm/sun4i: Split out code for enumerating endpoints in output port

Until now, each node has one input port and one output port. However,
with TCON TOP this is no longer true. It has 3 input and 3 output ports.

In order to prepare to this situation, split out the code which checks
all endpoints in input port and adds available components to fifo.

This patch doesn't do any functional change.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-8-jernej.skrabec@siol.net
6 years agodrm/sun4i: Fix releasing node when enumerating enpoints
Jernej Skrabec [Mon, 25 Jun 2018 12:02:46 +0000 (14:02 +0200)]
drm/sun4i: Fix releasing node when enumerating enpoints

sun4i_drv_add_endpoints() has a memory leak since it uses of_node_put()
when remote is equal to NULL and does nothing when remote has a valid
pointer.

Invert the logic to fix memory leak.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-7-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add TCON TOP driver
Jernej Skrabec [Mon, 25 Jun 2018 12:02:45 +0000 (14:02 +0200)]
drm/sun4i: Add TCON TOP driver

As already described in DT binding, TCON TOP is responsible for
configuring display pipeline. In this initial driver focus is on HDMI
pipeline, so TVE and LCD configuration is not implemented.

Implemented features:
- HDMI source selection
- clock driver (TCON and DSI gating)
- connecting mixers and TCONS

Something similar also existed in previous SoCs, except that it was part
of first TCON.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-6-jernej.skrabec@siol.net
6 years agodt-bindings: display: sunxi-drm: Add TCON TOP description
Jernej Skrabec [Mon, 25 Jun 2018 12:02:44 +0000 (14:02 +0200)]
dt-bindings: display: sunxi-drm: Add TCON TOP description

TCON TOP main purpose is to configure whole display pipeline. It
determines relationships between mixers and TCONs, selects source TCON
for HDMI, muxes LCD and TV encoder GPIO output, selects TV encoder
clock source and contains additional TV TCON and DSI gates.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-5-jernej.skrabec@siol.net
6 years agodrm/tinydrm: new driver for ILI9341 display panels
David Lechner [Fri, 25 May 2018 19:36:23 +0000 (14:36 -0500)]
drm/tinydrm: new driver for ILI9341 display panels

This adds a new driver for display panels that use the Ilitek ILI9341
controller. It currently supports a single display panel, namely
the YX240QV29-T (e.g. Adafruit 2.4" TFT).

The init sequence is from the Adafruit Python library for the ILI9341
controller. https://github.com/adafruit/Adafruit_Python_ILI9341

Signed-off-by: David Lechner <david@lechnology.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525193623.15533-5-david@lechnology.com
6 years agodt-bindings: new binding for Ilitek ILI9341 display panels
David Lechner [Fri, 25 May 2018 19:36:22 +0000 (14:36 -0500)]
dt-bindings: new binding for Ilitek ILI9341 display panels

This adds a new binding for Ilitek ILI9341 display panels. It includes
a compatible string for one display (more can be added in the future).

The YX240QV29-T panel[1] is found, for example, in an Adafruit breakout
board[2] and in Mindsensors' PiStorms[3].

The vendor prefix "adafruit" is used because the actual vendor is not
known, but Adafruit is the most common source for a product that
contains this panel.

[1]: https://cdn-learn.adafruit.com/assets/assets/000/046/879/original/SPEC-YX240QV29-T_Rev.A__1_.pdf
[2]: https://www.adafruit.com/product/2478
[3]: http://www.mindsensors.com/stem-with-robotics/13-pistorms-v2-base-kit-raspberry-pi-brain-for-lego-robot

Signed-off-by: David Lechner <david@lechnology.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525193623.15533-4-david@lechnology.com
6 years agodt-bindings: Add vendor prefix for Adafruit
David Lechner [Fri, 25 May 2018 19:36:21 +0000 (14:36 -0500)]
dt-bindings: Add vendor prefix for Adafruit

This adds a device tree vendor prefix for Adafruit Industries, LLC.

Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525193623.15533-3-david@lechnology.com
6 years agoMAINTAINERS: fix path to ilitek, ili9225 device tree bindings
David Lechner [Fri, 25 May 2018 19:36:20 +0000 (14:36 -0500)]
MAINTAINERS: fix path to ilitek, ili9225 device tree bindings

This fixes the path to the ilitek,ili9225 device tree binding file.

Signed-off-by: David Lechner <david@lechnology.com>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525193623.15533-2-david@lechnology.com
6 years agodrm/rockchip: vop: fixup linebuffer mode calc error
Sandy Huang [Tue, 26 Jun 2018 08:16:44 +0000 (16:16 +0800)]
drm/rockchip: vop: fixup linebuffer mode calc error

linebuffer mode should be LB_YUV_3840X5 when width is bigger than 1280
in yuv mode.

Separate yuv and rgb case makes the scl_vop_cal_lb_mode() logic clearer.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1530001004-25036-1-git-send-email-hjc@rock-chips.com
6 years agodrm/rockchip: Use drm_crtc_mask()
Ville Syrjälä [Tue, 26 Jun 2018 19:47:13 +0000 (22:47 +0300)]
drm/rockchip: Use drm_crtc_mask()

Use drm_crtc_mask() where appropriate.

Cc: Sandy Huang <hjc@rock-chips.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20180626194716.12522-7-ville.syrjala@linux.intel.com
6 years agodrm/gma500: Fix compile warning
Gustavo A. R. Silva [Mon, 25 Jun 2018 12:33:55 +0000 (07:33 -0500)]
drm/gma500: Fix compile warning

Fix the following compile warning:

warning: unused variable ‘psbfb’ [-Wunused-variable]
  struct psb_framebuffer *psbfb = to_psb_fb(fb);

Fixes: c7cbed560ce2 ("drm/gma500: Fix Medfield for drm_framebuffer move")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625123355.GA16757@embeddedor.com
6 years agodrm/gma500: Fix potential NULL pointer dereference
Gustavo A. R. Silva [Mon, 25 Jun 2018 12:18:44 +0000 (07:18 -0500)]
drm/gma500: Fix potential NULL pointer dereference

fb 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 has been
properly null checked at line 74: if (!fb)

Addresses-Coverity-ID: 1470169 ("Dereference before null check")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625121844.GA12466@embeddedor.com
6 years agodrm/gma500: Replace drm_gem_object_unreference_unlocked with put function
Thomas Zimmermann [Mon, 25 Jun 2018 15:21:48 +0000 (17:21 +0200)]
drm/gma500: Replace drm_gem_object_unreference_unlocked with put function

This patch unifies the naming of DRM functions for reference counting
of struct drm_gem_object. The resulting code is more aligned with the
rest of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <contact@tzimmermann.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625152148.29555-1-contact@tzimmermann.org
6 years agodrm/panel: Add Ilitek ILI9881c panel driver
Maxime Ripard [Tue, 29 May 2018 09:49:15 +0000 (11:49 +0200)]
drm/panel: Add Ilitek ILI9881c panel driver

The LHR050H41 panel is the panel shipped with the BananaPi M2-Magic, and is
based on the Ilitek ILI9881c Controller. Add a driver for it, modelled
after the other Ilitek controller drivers.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/acb5453112ab7c7b801cf4f1669e351b391e77e8.1527587352.git-series.maxime.ripard@bootlin.com
6 years agodt-bindings: panel: Add the Ilitek ILI9881c panel documentation
Maxime Ripard [Tue, 29 May 2018 09:49:14 +0000 (11:49 +0200)]
dt-bindings: panel: Add the Ilitek ILI9881c panel documentation

The LHR050H41 from BananaPi is a 1280x700 4-lanes DSI panel based on the
ILI9881c from Ilitek.

Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a348cdd07d3287e8203ee8d840ea279fe10a6204.1527587352.git-series.maxime.ripard@bootlin.com
6 years agodrm: kirin: Remove useless "Scale not support" error message
John Stultz [Thu, 21 Jun 2018 23:01:16 +0000 (16:01 -0700)]
drm: kirin: Remove useless "Scale not support" error message

The driver doesn't support scaling, but when an atomic test is done
it repeatedly spits out this warning which isn't particularly useful.

So just remove the error message.

Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Cc: Rongrong Zou <zourongrong@gmail.com>
Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: Chen Feng <puck.chen@hisilicon.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Peter Griffin <peter.griffin@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1529622076-20386-1-git-send-email-john.stultz@linaro.org
6 years agodrm: Make ioctls available for in-kernel clients
Noralf Trønnes [Mon, 18 Jun 2018 14:17:30 +0000 (16:17 +0200)]
drm: Make ioctls available for in-kernel clients

Make ioctl wrappers for functions that will be used by the in-kernel API.
The following functions are touched:
- drm_mode_create_dumb_ioctl()
- drm_mode_destroy_dumb_ioctl()
- drm_mode_addfb()
- drm_mode_rmfb()

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180618141739.48151-4-noralf@tronnes.org
6 years agodrm/file: Don't set master on in-kernel clients
Noralf Trønnes [Mon, 18 Jun 2018 14:17:29 +0000 (16:17 +0200)]
drm/file: Don't set master on in-kernel clients

It only makes sense for userspace clients.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180618141739.48151-3-noralf@tronnes.org
6 years agodrm: provide management functions for drm_file
David Herrmann [Mon, 18 Jun 2018 14:17:28 +0000 (16:17 +0200)]
drm: provide management functions for drm_file

Rather than doing drm_file allocation/destruction right in the fops, lets
provide separate helpers. This decouples drm_file management from the
still-mandatory drm-fops. It prepares for use of drm_file without the
fops, both by possible separate fops implementations and APIs (not that I
am aware of any such plans), and more importantly from in-kernel use where
no real file is available.

Signed-off-by: David Herrmann <dh.herrmann@gmail.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/20180618141739.48151-2-noralf@tronnes.org
6 years agodrm: Consider drivers setting DRIVER_ATOMIC as atomic.
Eric Anholt [Thu, 21 Jun 2018 19:54:28 +0000 (12:54 -0700)]
drm: Consider drivers setting DRIVER_ATOMIC as atomic.

Drivers such as vc4 don't initialize mode_config.funcs until later in
initialization, but we know they're atomic since they've got the flag
set.  This avoids oopsing on dereferencing funcs in the new atomic
methods sanity checks.

I moved the atomic check function down below the core flag check, to
avoid needing a prototype.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: ba1f665f161c ("drm: Add checks for atomic_[duplicate/destroy]_state with atomic drivers")
Link: https://patchwork.freedesktop.org/patch/msgid/20180621195428.17447-1-eric@anholt.net
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agodrm/omap: remove now unused functions
Christian König [Fri, 22 Jun 2018 09:23:26 +0000 (11:23 +0200)]
drm/omap: remove now unused functions

Some functions are unused after removal of the kmap_atomic
DMA-buf interface.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Fixes: f664a5269542 ("dma-buf: remove kmap_atomic interface")
Link: https://patchwork.freedesktop.org/series/45245/
6 years agodrm/v3d: Remove the bad signaled() implementation.
Eric Anholt [Tue, 5 Jun 2018 19:03:01 +0000 (12:03 -0700)]
drm/v3d: Remove the bad signaled() implementation.

Since our seqno value comes from a counter associated with the GPU
ring, not the entity (aka client), they'll be completed out of order.
There's actually no need for this code at all, since we don't have
enable_signaling() and thus DMA_FENCE_SIGNALED_BIT will be set before
we could be called.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180605190302.18279-2-eric@anholt.net
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
6 years agodrm/v3d: Take a lock across GPU scheduler job creation and queuing.
Eric Anholt [Wed, 6 Jun 2018 17:48:51 +0000 (10:48 -0700)]
drm/v3d: Take a lock across GPU scheduler job creation and queuing.

Between creation and queueing of a job, you need to prevent any other
job from being created and queued.  Otherwise the scheduler's fences
may be signaled out of seqno order.

v2: move mutex unlock to the error label.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Link: https://patchwork.freedesktop.org/patch/msgid/20180606174851.12433-1-eric@anholt.net
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
6 years agodrm/bridge: Move the struct drm_bridge member kerneldoc inline.
Eric Anholt [Wed, 6 Jun 2018 19:04:29 +0000 (12:04 -0700)]
drm/bridge: Move the struct drm_bridge member kerneldoc inline.

This makes it more likely that the docs stay updated with the code.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180606190431.1833-1-eric@anholt.net
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
6 years agogpu: drm: vc4: Adding new typedef vm_fault_t
Souptick Joarder [Sat, 14 Apr 2018 16:23:21 +0000 (21:53 +0530)]
gpu: drm: vc4: Adding new typedef vm_fault_t

Use new return type vm_fault_t for fault handler.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agodrm: Document mode_config.max_width/height as the max fb dimensions
Ville Syrjälä [Fri, 15 Jun 2018 17:39:39 +0000 (20:39 +0300)]
drm: Document mode_config.max_width/height as the max fb dimensions

The meaning of the mode_config max_width/height fields has not been
entirely clear. They are used both as the max framebuffer dimensions,
and they are also used by drm_mode_getconnector() to filter out
any mode whose hdisplay/vdisplay exceed those limits.

Let's put it in writing that max_width/height only refrer to the max
framebuffer dimensions, and should those be higher than the hardware
limits for display timings the driver must validate the latter using
some other means.

We'll keep the max_width/height usage in drm_mode_getconnector()
because setcrtc treats hdisplay/vdisplay also as the primary plane
width, and having a plane bigger than the max fb size doesn't make
much sense (if we ignore scaling that is). It all works out fine
as long as the max fb dimensions are at least equal to the max
timing limits. If the opposite were true we may want to rethink
what drm_mode_getconnector() does. Maybe do the mode filtering
only for non-atomic userspace?

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180615173939.11353-1-ville.syrjala@linux.intel.com
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
6 years agostaging: android: ion: fix ion_dma_buf_attach signatur
Christian König [Wed, 20 Jun 2018 18:48:59 +0000 (20:48 +0200)]
staging: android: ion: fix ion_dma_buf_attach signatur

Fixup for "dma_buf: remove device parameter from attach callback v2".

I missed this driver, sorry for the noise. Patch is not even compile
tested.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/230641/
6 years agodrm/i915/selftests: Remove unused dmabuf->kmap routines, fix the build
Chris Wilson [Wed, 20 Jun 2018 16:21:52 +0000 (17:21 +0100)]
drm/i915/selftests: Remove unused dmabuf->kmap routines, fix the build

Fix i915's CI build after the removal of the dmabuf->kmap interface that
left the mock routines intact.

In file included from drivers/gpu/drm/i915/i915_gem_dmabuf.c:335:0:
drivers/gpu/drm/i915/selftests/mock_dmabuf.c:104:13: error: ‘mock_dmabuf_kunmap_atomic’ defined but not used [-Werror=unused-function]
 static void mock_dmabuf_kunmap_atomic(struct dma_buf *dma_buf, unsigned long page_num, void *addr)
drivers/gpu/drm/i915/selftests/mock_dmabuf.c:97:14: error: ‘mock_dmabuf_kmap_atomic’ defined but not used [-Werror=unused-function]
 static void *mock_dmabuf_kmap_atomic(struct dma_buf *dma_buf, unsigned long page_num)

Fixes: f664a5269542 ("dma-buf: remove kmap_atomic interface")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Christian König <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180620162152.1158-1-chris@chris-wilson.co.uk
Reviewed-by: Christian König <christian.koenig@amd.com>
6 years agoMerge drm-upstream/drm-next into drm-misc-next
Gustavo Padovan [Wed, 20 Jun 2018 16:22:22 +0000 (13:22 -0300)]
Merge drm-upstream/drm-next into drm-misc-next

We got a few conflicts in drm_atomic.c after merging the DRM writeback support,
now we need a backmerge to unlock develop development on drm-misc-next.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
6 years agodrm: writeback: Add client capability for exposing writeback connectors
Liviu Dudau [Wed, 28 Feb 2018 14:11:23 +0000 (14:11 +0000)]
drm: writeback: Add client capability for exposing writeback connectors

Due to the fact that writeback connectors behave in a special way
in DRM (they always report being disconnected) we might confuse some
userspace. Add a client capability for writeback connectors that will
filter them out for clients that don't understand the capability.

Changelog:
 - only accept the capability if the client has already set the
DRM_CLIENT_CAP_ATOMIC one.

Cc: Sean Paul <seanpaul@chromium.org>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Link: https://patchwork.freedesktop.org/patch/229038/
6 years agodrm: writeback: Add out-fences for writeback connectors
Brian Starkey [Wed, 29 Mar 2017 16:42:33 +0000 (17:42 +0100)]
drm: writeback: Add out-fences for writeback connectors

Add the WRITEBACK_OUT_FENCE_PTR property to writeback connectors, to
enable userspace to get a fence which will signal once the writeback is
complete. It is not allowed to request an out-fence without a
framebuffer attached to the connector.

A timeline is added to drm_writeback_connector for use by the writeback
out-fences.

In the case of a commit failure or DRM_MODE_ATOMIC_TEST_ONLY, the fence
is set to -1.

Changes from v2:
 - Rebase onto Gustavo Padovan's v9 explicit sync series
 - Change out_fence_ptr type to s32 __user *
 - Set *out_fence_ptr to -1 in drm_atomic_connector_set_property
 - Store fence in drm_writeback_job
 Gustavo Padovan:
 - Move out_fence_ptr out of connector_state
 - Signal fence from drm_writeback_signal_completion instead of
   in driver directly

Changes from v3:
 - Rebase onto commit 7e9081c5aac7 ("drm/fence: fix memory overwrite
   when setting out_fence fd") (change out_fence_ptr to s32 __user *,
   for real this time.)
 - Update documentation around WRITEBACK_OUT_FENCE_PTR

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
[rebased and fixed conflicts]
Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/229036/
6 years agodrm: Add writeback connector type
Brian Starkey [Wed, 29 Mar 2017 16:42:32 +0000 (17:42 +0100)]
drm: Add writeback connector type

Writeback connectors represent writeback engines which can write the
CRTC output to a memory framebuffer. Add a writeback connector type and
related support functions.

Drivers should initialize a writeback connector with
drm_writeback_connector_init() which takes care of setting up all the
writeback-specific details on top of the normal functionality of
drm_connector_init().

Writeback connectors have a WRITEBACK_FB_ID property, used to set the
output framebuffer, and a WRITEBACK_PIXEL_FORMATS blob used to expose the
supported writeback formats to userspace.

When a framebuffer is attached to a writeback connector with the
WRITEBACK_FB_ID property, it is used only once (for the commit in which
it was included), and userspace can never read back the value of
WRITEBACK_FB_ID. WRITEBACK_FB_ID can only be set if the connector is
attached to a CRTC.

Changes since v1:
 - Added drm_writeback.c + documentation
 - Added helper to initialize writeback connector in one go
 - Added core checks
 - Squashed into a single commit
 - Dropped the client cap
 - Writeback framebuffers are no longer persistent

Changes since v2:
 Daniel Vetter:
 - Subclass drm_connector to drm_writeback_connector
 - Relax check to allow CRTC to be set without an FB
 - Add some writeback_ prefixes
 - Drop PIXEL_FORMATS_SIZE property, as it was unnecessary
 Gustavo Padovan:
 - Add drm_writeback_job to handle writeback signalling centrally

Changes since v3:
 - Rebased
 - Rename PIXEL_FORMATS -> WRITEBACK_PIXEL_FORMATS

Chances since v4:
 - Embed a drm_encoder inside the drm_writeback_connector to
   reduce the amount of boilerplate code required from the drivers
   that are using it.

Changes since v5:
 - Added Rob Clark's atomic_commit() vfunc to connector helper
   funcs, so that writeback jobs are committed from atomic helpers
 - Updated create_writeback_properties() signature to return an
   error code rather than a boolean false for failure.
 - Free writeback job with the connector state rather than when
   doing the cleanup_work()

Changes since v7:
 - fix extraneous use of out_fence that is only introduced in a
   subsequent patch.

Changes since v8:
 - whitespace changes pull from subsequent patch

Changes since v9:
 - Revert the v6 changes that free the writeback job in the connector
   state cleanup and return to doing it in the cleanup_work() function

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
[rebased and fixed conflicts]
Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
[rebased and added atomic_commit() vfunc for writeback jobs]
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/229037/
6 years agodma-buf: remove kmap_atomic interface
Christian König [Mon, 28 May 2018 11:34:01 +0000 (13:34 +0200)]
dma-buf: remove kmap_atomic interface

Neither used nor correctly implemented anywhere. Just completely remove
the interface.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/226645/
6 years agodma_buf: remove device parameter from attach callback v2
Christian König [Mon, 28 May 2018 09:47:52 +0000 (11:47 +0200)]
dma_buf: remove device parameter from attach callback v2

The device parameter is completely unused because it is available in the
attachment structure as well.

v2: fix kerneldoc as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/226643/
6 years agodrm/vc4: Always obey implicit sync
Daniel Vetter [Thu, 5 Apr 2018 15:44:48 +0000 (17:44 +0200)]
drm/vc4: Always obey implicit sync

Same justification as for drm_gem_fb_prepare_fb.

Cc: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180405154449.23038-9-daniel.vetter@ffwll.ch
Link: https://patchwork.freedesktop.org/patch/msgid/20180409085134.27321-1-daniel.vetter@ffwll.ch
6 years agodrm/gem-fb-helper: Always do implicit sync
Daniel Vetter [Thu, 5 Apr 2018 15:44:47 +0000 (17:44 +0200)]
drm/gem-fb-helper: Always do implicit sync

I've done a lot of history digging. The first signs of this
optimization was introduced in i915:

commit 25067bfc060d1a481584dcb51ef4b5680176ecb6
Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Date:   Wed Sep 10 12:03:17 2014 -0300

    drm/i915: pin sprite fb only if it changed

without much justification. Pinning already pinned stuff is real cheap
(it's just obj->pin_count++ really), and the missing implicit sync was
entirely forgotten about it seems. It's at least not mentioned
anywhere it the commit message.

It was also promptly removed shortly afterwards in

commit ea2c67bb4affa84080c616920f3899f123786e56
Author: Matt Roper <matthew.d.roper@intel.com>
Date:   Tue Dec 23 10:41:52 2014 -0800

    drm/i915: Move to atomic plane helpers (v9)

again without really mentioning the side-effect that plane updates
with the same fb now again obey implicit syncing.

Note that this only ever applied to the plane_update hook, all other
legacy entry points (set_base, page_flip) always obeyed implicit sync
in the drm/i915 driver.

The real source of this code here seems to be msm, copied to vc4, then
copied to tinydrm. I've also tried to dig around in all available msm
sources, but the corresponding check for fb != old_fb is present ever
since the initial merge in

commit cf3a7e4ce08e6876cdcb80390876647f28a7cf8f
Author: Rob Clark <robdclark@gmail.com>
Date:   Sat Nov 8 13:21:06 2014 -0500

    drm/msm: atomic core bits

The only older version I've found of msm atomic code predates the
atomic helpers, and so didn't even use any of this. It also does not
have a corresponding check (because it simply did no implicit sync at
all).

I've chatted with Rob on irc, and he didn't remember the reason for
this either.

Note we had epic amounts of fun with too much syncing against
_vblank_, especially around cursor updates. But I don't ever
discussing a need for less syncing against implicit fences.

Also note that explicit fencing allows you to sidetrack all of this,
at least for all the drivers correctly implemented using
drm_atomic_set_fence_for_plane().

Given that it seems to be an accident of history, and that big drivers
like i915 (and also nouveau it seems, I didn't follow the
amdgpu/radeon sync code to figure this out properly there) never have
done it, let's remove this.

Cc: Rob Clark <robdclark@gmail.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180405154449.23038-8-daniel.vetter@ffwll.ch
6 years agodrm/rockchip: vop: fix irq disabled after vop driver probed
Sandy Huang [Tue, 12 Jun 2018 13:20:28 +0000 (15:20 +0200)]
drm/rockchip: vop: fix irq disabled after vop driver probed

The vop irq is shared between vop and iommu and irq probing in the
iommu driver moved to the probe function recently. This can in some
cases lead to a stall if the irq is triggered while the vop driver
still has it disabled, but the vop irq handler gets called.

But there is no real need to disable the irq, as the vop can simply
also track its enabled state and ignore irqs in that case.
For this we can simply check the power-domain state of the vop,
similar to how the iommu driver does it.

So remove the enable/disable handling and add appropriate condition
to the irq handler.

changes in v2:
- move to just check the power-domain state
- add clock handling
changes in v3:
- clarify comment to speak of runtime-pm not power-domain
changes in v4:
- address Marc's comments (clk-enable WARN_ON and style improvement)

Fixes: d0b912bd4c23 ("iommu/rockchip: Request irqs in rk_iommu_probe()")
Cc: stable@vger.kernel.org
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180612132028.27490-3-heiko@sntech.de
6 years agodrm/rockchip: vop: split out core clock enablement into separate functions
Heiko Stuebner [Tue, 12 Jun 2018 13:20:27 +0000 (15:20 +0200)]
drm/rockchip: vop: split out core clock enablement into separate functions

Judging from the iommu code, both the hclk and aclk are necessary for
register access. Split them off into separate functions from the regular
vop enablement, so that we can use them elsewhere as well.

Fixes: d0b912bd4c23 ("iommu/rockchip: Request irqs in rk_iommu_probe()")
[prerequisite change for the actual fix]
Cc: stable@vger.kernel.org
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180612132028.27490-2-heiko@sntech.de
6 years agodrm: Add checks for atomic_[duplicate/destroy]_state with atomic drivers
Haneen Mohammed [Fri, 25 May 2018 01:25:55 +0000 (04:25 +0300)]
drm: Add checks for atomic_[duplicate/destroy]_state with atomic drivers

This patch add checks for atomic_[duplicate/destroy]_state of
drm_[connector/crtc/plane]_funcs for atomic drivers in the relevant
drm_*_init functions since these callback are mandatory for atomic drivers.

Update the kerneldoc comments for those callbacks.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525012555.GA8448@haneen-vb
6 years agodrm/rockchip: cnd-dp: adjust spdif register setting
Lin Huang [Tue, 22 May 2018 08:53:41 +0000 (16:53 +0800)]
drm/rockchip: cnd-dp: adjust spdif register setting

We use jitter bypass mode for spdif, so do not need to set jitter mode
related bit in SPDIF_CTRL_ADDR register. But of course we need to keep
the SPDIF_ENABLE bit.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1526979222-32478-1-git-send-email-hl@rock-chips.com
6 years agodrm/rockchip: lvds: add missing of_node_put
Julia Lawall [Wed, 23 May 2018 19:07:16 +0000 (21:07 +0200)]
drm/rockchip: lvds: add missing of_node_put

The device node iterators perform an of_node_get on each iteration, so a
jump out of the loop requires an of_node_put.

The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
iterator name for_each_child_of_node;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
+  of_node_put(child);
?  break;
   ...
}
... when != child
// </smpl>

Fixes: 34cc0aa25456 ("drm/rockchip: Add support for Rockchip Soc LVDS")
Cc: stable@vger.kernel.org
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1527102436-13447-6-git-send-email-Julia.Lawall@lip6.fr
6 years agodrm/atomic: Set current atomic state in drm_private_state
Alexandru Gheorghe [Wed, 30 May 2018 17:30:52 +0000 (18:30 +0100)]
drm/atomic: Set current atomic state in drm_private_state

drm_private_state has a back pointer to the drm_atomic_state,
however that was not initialized in drm_atomic_get_private_obj_state
after duplication, as it is the case for other drm atomic getters

Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1527701452-1934-1-git-send-email-alexandru-cosmin.gheorghe@arm.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
6 years agodrm: Print bad user modes
Ville Syrjälä [Mon, 11 Jun 2018 19:34:02 +0000 (22:34 +0300)]
drm: Print bad user modes

Print out the modeline when we reject a bad user mode. Avoids having to
guess why it was rejected.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180611193403.16118-2-ville.syrjala@linux.intel.com
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
6 years agodrm/atomic: Improve debug messages
Ville Syrjälä [Mon, 11 Jun 2018 19:34:01 +0000 (22:34 +0300)]
drm/atomic: Improve debug messages

Print the id/name of the object we're dealing with. Makes it easier to
figure out what's going on. Also toss in a few extra debug prints that
might be useful.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180611193403.16118-1-ville.syrjala@linux.intel.com
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
6 years agoMerge branch 'drm-next-4.18' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Fri, 15 Jun 2018 01:32:23 +0000 (11:32 +1000)]
Merge branch 'drm-next-4.18' of git://people.freedesktop.org/~agd5f/linux into drm-next

Fixes for 4.18. Highlights:
- Fixes for gfxoff on Raven
- Remove an ATPX quirk now that the root cause is fixed
- Runtime PM fixes
- Vega20 register header update
- Wattman fixes
- Misc bug fixes

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180614141428.2909-1-alexander.deucher@amd.com
6 years agodrm/amd/powerplay: Set higher SCLK&MCLK frequency than dpm7 in OD (v2)
Kenneth Feng [Tue, 12 Jun 2018 07:07:37 +0000 (15:07 +0800)]
drm/amd/powerplay: Set higher SCLK&MCLK frequency than dpm7 in OD (v2)

Fix the issue that SCLK&MCLK can't be set higher than dpm7 when
OD is enabled in SMU7.

v2: fix warning (Alex)

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Acked-by: Rex Zhu<rezhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/bridge: sil_sii8620: do not have a dependency of RC_CORE
Inki Dae [Thu, 24 May 2018 09:32:59 +0000 (18:32 +0900)]
drm/bridge: sil_sii8620: do not have a dependency of RC_CORE

This patch makes RC_CORE to be selected with this driver.

sil_sii8620 driver calls remote controller interfaces directly
so RC_CORE should be enabled mandatorily.

And some boards not using remote controller device don't really
need to know that RC_CORE config should be enabled to use sil_sii8620
driver only for HDMI.

Changelog v2:
- select INPUT because compiling will fail without INPUT.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1527154379-31886-1-git-send-email-inki.dae@samsung.com
6 years agodrm/amd/powerplay: remove uncessary extra gfxoff control call
Evan Quan [Tue, 12 Jun 2018 09:01:23 +0000 (17:01 +0800)]
drm/amd/powerplay: remove uncessary extra gfxoff control call

Gfxoff is already enabled in amdgpu_device_ip_set_powergating_state.
So, no need to enable it again in pp_late_init.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix parsing indirect register list v2
Evan Quan [Tue, 29 May 2018 08:31:05 +0000 (16:31 +0800)]
drm/amdgpu: fix parsing indirect register list v2

WARN_ON possible buffer overflow and avoid unnecessary dereference.

v2: change BUG_ON to WARN_ON

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/include: Update df 3.6 mask and shift definition
Shaoyun Liu [Tue, 12 Jun 2018 17:35:44 +0000 (13:35 -0400)]
drm/amd/include: Update df 3.6 mask and shift definition

The register field hsas been changed in df 3.6, update to correct setting

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Fix OD feature enable failed on Vega10 workstation cards
Rex Zhu [Tue, 12 Jun 2018 06:26:00 +0000 (14:26 +0800)]
drm/amd/pp: Fix OD feature enable failed on Vega10 workstation cards

As hw required, soc clock must large than mclk, So we set max soc
clock to OD Max Memory clk.
But on workstation, vbios do not support OD feature, the OD max memory
clock is equal to 0. In this case, driver can support underclocking.
and set od max memory clock to the value in highest memory dpm level.
So the od max memory clock should be less than highest soc clock.
and driver should not change the soc clock.

caused by commit ca57b9b0a156
("drm/amd/pp: Allow underclocking when od table is empty in vbios")

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fix stale buffer object (bo) use
Pratik Vishwakarma [Thu, 7 Jun 2018 06:18:40 +0000 (11:48 +0530)]
drm/amd/display: Fix stale buffer object (bo) use

Fixes stale buffer object (bo) usage for cursor plane

Cursor plane's bo operations are handled in DC code.
Currently, atomic_commit() does not handle bo operations
for cursor plane, as a result the bo assigned for cursor
plane in dm_plane_helper_prepare_fb() is not coherent
with the updates to the same made in dc code.This mismatch
leads to "bo" corruption and hence crashes during S3 entry.

This patch cleans up the code which was added as a hack
for 4.9 version only.

Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: initialize result to before or'ing in data
Colin Ian King [Wed, 6 Jun 2018 12:18:31 +0000 (13:18 +0100)]
drm/amd/pp: initialize result to before or'ing in data

The current use of result is or'ing in values and checking for
a non-zero result, however, result is not initialized to zero
so it potentially contains garbage to start with. Fix this by
initializing it to the first return from the call to
vega10_program_didt_config_registers.

Detected by cppcheck:
"(error) Uninitialized variable: result"

Fixes: 9b7b8154cdb8 ("drm/amd/powerplay: added didt support for vega10")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Huang Rui <ray.huang@amd.com>
[Fix the subject as Colin's comment]
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/powerplay: fix wrong clock adjust sequence
Evan Quan [Wed, 6 Jun 2018 03:54:45 +0000 (11:54 +0800)]
drm/amd/powerplay: fix wrong clock adjust sequence

The clocks should be adjusted after display configuration changed.
Otherwise, the socclk and memclk may be forced on an unnecessary higher
level.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Grab/put runtime PM references in atomic_commit_tail()
Lyude Paul [Mon, 4 Jun 2018 19:35:03 +0000 (15:35 -0400)]
drm/amdgpu: Grab/put runtime PM references in atomic_commit_tail()

So, unfortunately I recently made the discovery that in the upstream
kernel, the only reason that amdgpu is not currently suffering from
issues with runtime PM putting the GPU into suspend while it's driving
displays is due to the fact that on most prime systems, we have sound
devices associated with the GPU that hold their own runtime PM ref for
the GPU.

What this means however, is that in the event that there isn't any kind
of sound device active (which can easily be reproduced by building a
kernel with sound drivers disabled), the GPU will fall asleep even when
there's displays active. This appears to be in part due to the fact that
amdgpu has not actually ever relied on it's rpm_idle() function to be
the only thing keeping it running, and normally grabs it's own power
references whenever there are displays active (as can be seen with the
original pre-DC codepath in amdgpu_display_crtc_set_config() in
amdgpu_display.c). This means it's very likely that this bug was
introduced during the switch over the DC.

So to fix this, we start grabbing runtime PM references every time we
enable a previously disabled CRTC in atomic_commit_tail(). This appears
to be the correct solution, as it matches up with what i915 does in
i915/intel_runtime_pm.c.

The one sideaffect of this is that we ignore the variable that the
pre-DC code used to use for tracking when it needed runtime PM refs,
adev->have_disp_power_ref. This is mainly because there's no way for a
driver to tell whether or not all of it's CRTCs are enabled or disabled
when we've begun committing an atomic state, as there may be CRTC
commits happening in parallel that aren't contained within the atomic
state being committed. So, it's safer to just get/put a reference for
each CRTC being enabled or disabled in the new atomic state.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>.
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/powerplay: fix missed hwmgr check warning before call gfx_off_control handler
Huang Rui [Fri, 18 May 2018 02:39:16 +0000 (10:39 +0800)]
drm/amd/powerplay: fix missed hwmgr check warning before call gfx_off_control handler

Patch 9667849bbb8d: "drm/amd/powerplay: add control gfxoff enabling in late
init" from Mar 13, 2018, leads to the following static checker warning:

drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c:194
pp_late_init()
error: we previously assumed 'hwmgr' could be null (see line 185)

drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c

This patch fixes the warning to add hwmgr checking.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix CG enabling hang with gfxoff enabled
Huang Rui [Fri, 1 Jun 2018 06:41:04 +0000 (14:41 +0800)]
drm/amdgpu: fix CG enabling hang with gfxoff enabled

After defer the execution of clockgating enabling, at that time, gfx already
enter into "off" state. Howerver, clockgating enabling will use MMIO to access
the gfx registers, then get the gfx hung.

So here we should move the gfx powergating and gfxoff enabling behavior at the
end of initialization behind clockgating.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix clear_all and replace handling in the VM (v2)
Junwei Zhang [Tue, 5 Jun 2018 09:31:51 +0000 (17:31 +0800)]
drm/amdgpu: fix clear_all and replace handling in the VM (v2)

v2: assign bo_va as well

We need to put the lose ends on the invalid list because it is possible
that we need to split up huge pages for them.

Cc: stable@vger.kernel.org
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com> (v2)
Reviewed-by: David Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add checking for sos version
Huang Rui [Sat, 12 May 2018 04:31:12 +0000 (12:31 +0800)]
drm/amdgpu: add checking for sos version

The sos ucode version will be changed to align with the value of
mmMP0_SMN_C2PMSG_58. Then we add a checking for this. Meanwhile, we have to be
compatibility backwards. So it adds serveral recent legacy versions as the white
list for the version checking.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix the missed vcn fw version report
Huang Rui [Wed, 23 May 2018 03:18:43 +0000 (11:18 +0800)]
drm/amdgpu: fix the missed vcn fw version report

It missed vcn.fw_version setting when init vcn microcode, and it will be used to
report vcn ucode version via amdgpu_firmware_info sysfs interface.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm: Stop updating plane->crtc/fb/old_fb on atomic drivers
Ville Syrjälä [Fri, 25 May 2018 18:50:45 +0000 (21:50 +0300)]
drm: Stop updating plane->crtc/fb/old_fb on atomic drivers

Stop playing around with plane->crtc/fb/old_fb with atomic
drivers. Make life a lot simpler when we don't have to do the
magic old_fb vs. fb dance around plane updates. That way we
can't risk plane->fb getting out of sync with plane->state->fb
and we're less likely to leak any refcounts as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-14-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/vc4: Stop updating plane->fb/crtc
Ville Syrjälä [Fri, 25 May 2018 18:50:44 +0000 (21:50 +0300)]
drm/vc4: Stop updating plane->fb/crtc

We want to get rid of plane->fb/crtc on atomic drivers. Stop setting
them.

Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-13-ville.syrjala@linux.intel.com
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/virtio: Stop updating plane->crtc
Ville Syrjälä [Fri, 25 May 2018 18:50:43 +0000 (21:50 +0300)]
drm/virtio: Stop updating plane->crtc

We want to get rid of plane->crtc on atomic drivers. Stop setting it.

v2: s/fb/crtc/ in the commit message (Gerd)

Cc: David Airlie <airlied@linux.ie>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-12-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/msm: Stop updating plane->fb/crtc
Ville Syrjälä [Fri, 25 May 2018 18:50:42 +0000 (21:50 +0300)]
drm/msm: Stop updating plane->fb/crtc

We want to get rid of plane->fb/crtc on atomic drivers. Stop setting
them.

v2: Catch a few more cases

Cc: Rob Clark <robdclark@gmail.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> #v1
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-11-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/exynos: Stop updating plane->crtc
Ville Syrjälä [Fri, 25 May 2018 18:50:41 +0000 (21:50 +0300)]
drm/exynos: Stop updating plane->crtc

We want to get rid of plane->crtc on atomic drivers. Stop setting it.

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: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Inki Dae <inki.dae@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-10-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/i915: Stop updating plane->fb/crtc
Ville Syrjälä [Fri, 25 May 2018 18:50:40 +0000 (21:50 +0300)]
drm/i915: Stop updating plane->fb/crtc

We want to get rid of plane->fb/crtc on atomic drivers. Stop setting
them.

v2: Fix up the comment in intel_crtc_active() and
    nuke the rest of the stale comments (Daniel)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> #v1
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-9-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/amdgpu/dc: Stop updating plane->fb
Ville Syrjälä [Fri, 25 May 2018 18:50:39 +0000 (21:50 +0300)]
drm/amdgpu/dc: Stop updating plane->fb

We want to get rid of plane->fb on atomic drivers. Stop setting it.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-8-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/vmwgfx: Stop messing about with plane->fb/old_fb/crtc
Ville Syrjälä [Fri, 25 May 2018 18:50:38 +0000 (21:50 +0300)]
drm/vmwgfx: Stop messing about with plane->fb/old_fb/crtc

plane->fb/old_fb/crtc should no longer be used by atomic
drivers. Stop messing about with them.

Cc: Deepak Rawat <drawat@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-7-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/vmwgfx: Stop using plane->fb in atomic_enable()
Ville Syrjälä [Fri, 25 May 2018 18:50:37 +0000 (21:50 +0300)]
drm/vmwgfx: Stop using plane->fb in atomic_enable()

Instead of looking at the (soon to be deprecated) plane->fb we'll
examing plane->state->fb instead. We can do this because
vmw_du_crtc_atomic_check() prevents us from enabling a crtc
without the primary plane also being enabled.

Due to that same reason, I'm actually not sure what the checks here are
for NULL fb. If we can't enable the crtc without an enabled plane
we should always have an fb. But I'll leave that for someone else
to figure out.

Cc: Deepak Rawat <drawat@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-6-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/vmwgfx: Stop updating plane->fb
Ville Syrjälä [Fri, 25 May 2018 18:50:36 +0000 (21:50 +0300)]
drm/vmwgfx: Stop updating plane->fb

We want to get rid of plane->fb on atomic drivers. Stop setting it.

Cc: Deepak Rawat <drawat@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-5-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/vmwgfx: Stop using plane->fb in vmw_kms_update_implicit_fb()
Ville Syrjälä [Fri, 25 May 2018 18:50:35 +0000 (21:50 +0300)]
drm/vmwgfx: Stop using plane->fb in vmw_kms_update_implicit_fb()

The only caller of vmw_kms_update_implicit_fb() is the page_flip
hook which itself gets called with the plane mutex already held.
Hence we can look at plane->state safely.

v2: Drop the bogus lockdep assert

Cc: Deepak Rawat <drawat@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-4-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/vmwgfx: Stop using plane->fb in vmw_kms_helper_dirty()
Ville Syrjälä [Fri, 25 May 2018 18:50:34 +0000 (21:50 +0300)]
drm/vmwgfx: Stop using plane->fb in vmw_kms_helper_dirty()

Instead of plane->fb (which we're going to deprecate for atomic drivers)
we need to look at plane->state->fb. The maze of code leading to
vmw_kms_helper_dirty() wasn't particularly clear, but my analysis
concluded that the calls originating from vmw_*_primary_plane_atomic_update()
all pass in the crtc which means we'll never end up in this branch
of the function. All other callers use drm_modeset_lock_all() somewhere
higher up, which means accessing plane->state is safe.

v2: Drop the comment and make the code do what it did before (Thomas)
v3: Drop the bogus lockdep assert

Cc: Deepak Rawat <drawat@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-3-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/vmwgfx: Stop using plane->fb in vmw_kms_atomic_check_modeset()
Ville Syrjälä [Fri, 25 May 2018 18:50:33 +0000 (21:50 +0300)]
drm/vmwgfx: Stop using plane->fb in vmw_kms_atomic_check_modeset()

Instead of looking at plane->fb let's look at the proper new
plane state.

Not that the code makes a ton of sense. It's only going through the
crtcs in the atomic state, so assuming not all of them are included
we're not even calculating the total bandwidth here. Also we're
not considering whether each crtc is actually enabled or not.

Cc: Deepak Rawat <drawat@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525185045.29689-2-ville.syrjala@linux.intel.com
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agoMerge tag 'drm-intel-next-fixes-2018-06-08-2' of git://anongit.freedesktop.org/drm...
Dave Airlie [Fri, 8 Jun 2018 20:34:39 +0000 (06:34 +1000)]
Merge tag 'drm-intel-next-fixes-2018-06-08-2' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

First batch of i915 fixes for v4.18:
- gvt fixes that missed v4.17, potentially need to be backported
- eDP resolution regression revert
- remove broken nv12 special casing
- remove stale asserts from find active requests

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87y3fp4h15.fsf@intel.com
6 years agoMerge tag 'drm-misc-next-fixes-2018-05-31' of git://anongit.freedesktop.org/drm/drm...
Dave Airlie [Fri, 8 Jun 2018 05:52:48 +0000 (15:52 +1000)]
Merge tag 'drm-misc-next-fixes-2018-05-31' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next-fixes for v4.18:

Driver changes:
- Plug small memory leak in vc4. (anholt)
- Depend on MMU in v3d. (arnd)

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/12faab25-e809-e73c-409c-5e9c08aa351c@linux.intel.com
6 years agoMerge tag 'drm-msm-next-2018-06-04' of git://people.freedesktop.org/~robclark/linux...
Dave Airlie [Fri, 8 Jun 2018 05:51:36 +0000 (15:51 +1000)]
Merge tag 'drm-msm-next-2018-06-04' of git://people.freedesktop.org/~robclark/linux into drm-next

A bunch of msm fixes and some atomic work.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGvXe157nd70=GPjre=HjiAH91tGM50+XtM59b2MEChvXQ@mail.gmail.com
6 years agoMerge tag 'gvt-fixes-2018-04-19' of https://github.com/intel/gvt-linux into drm-intel...
Jani Nikula [Thu, 7 Jun 2018 09:06:07 +0000 (12:06 +0300)]
Merge tag 'gvt-fixes-2018-04-19' of https://github.com/intel/gvt-linux into drm-intel-next-fixes

gvt-fixes-2018-04-19

- cmd parser error path mem leak fix (Colin)
- fix dp aux header validation (Changbin)
- sanity check on pfn after vfio pin page (Changbin)
- fix msi eventfd put (Xiong)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180419073948.4mojv7xaxxvfuyud@zhen-hp.sh.intel.com
6 years agodrm/i915/icl: Don't update enabled dbuf slices struct until updated in hw
Mahesh Kumar [Thu, 17 May 2018 13:26:26 +0000 (18:56 +0530)]
drm/i915/icl: Don't update enabled dbuf slices struct until updated in hw

Do not update number of enabled dbuf slices in dev_priv struct until we
actually enable/disable dbuf slice in hw. This is leading to never
updating dbuf slices and resulting in DBuf slice mismatch warning.

Fixes: aa9664ffe863 ("drm/i915/icl: Enable 2nd DBuf slice only when needed")
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180517132626.5885-1-mahesh1.kumar@intel.com
(cherry picked from commit 6ceb7277173597eeed8d635e08db51e35235ab21)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
6 years agodrm/i915/icl: fix icl_unmap/map_plls_to_ports
Mahesh Kumar [Fri, 25 May 2018 15:52:38 +0000 (08:52 -0700)]
drm/i915/icl: fix icl_unmap/map_plls_to_ports

All connectors may not have best_encoder attached, so don't dereference
encoder pointer for each connector.

Fixes: c27e917e2bda ("drm/i915/icl: add basic support for the ICL clocks")
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525155238.7054-1-lucas.demarchi@intel.com
(cherry picked from commit c46ef57d2008e5195f086a538550488b49644db7)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
6 years agodrm/i915: Remove bogus NV12 PLANE_COLOR_CTL setup
Ville Syrjälä [Mon, 21 May 2018 18:56:12 +0000 (21:56 +0300)]
drm/i915: Remove bogus NV12 PLANE_COLOR_CTL setup

We already handle the color encoding mode properly. Remove the broken
NV12 special case.

Cc: Vidya Srinivas <vidya.srinivas@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes: 8ed30ab6aced ("drm/i915: Enable YUV to RGB for Gen10 in Plane Ctrl Reg")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180521185613.5097-1-ville.syrjala@linux.intel.com
Reviewed-By: Vidya Srinivas <vidya.srinivas@intel.com>
(cherry picked from commit 012d79e6a33f095c293fe2a02b2b3b26d8c6402c)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
6 years agodrm/msm: Fix NULL deref on bind/probe deferral
Sean Paul [Thu, 31 May 2018 18:48:58 +0000 (14:48 -0400)]
drm/msm: Fix NULL deref on bind/probe deferral

This patch avoids dereferencing msm_host->dev when it is NULL.

If we find ourselves tearing down dsi before calling
(mdp4|mdp5|dpu)_kms_init(), we'll end up in a state where the dev
pointer is NULL and trying to extract priv from it will fail.

This was introduced in a seemingly innocuous commit to ensure the
arguments to msm_gem_put_iova() are correct (even though that
function has been a stub for ~5 years). Correctness FTW! \o/

Fixes: b01884a286b0 drm/msm: use correct aspace pointer in msm_gem_put_iova()
Cc: Daniel Mack <daniel@zonque.org>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: Switch to atomic_helper_commit()
Sean Paul [Wed, 28 Feb 2018 19:19:05 +0000 (14:19 -0500)]
drm/msm: Switch to atomic_helper_commit()

Now that all of the msm-specific goo is tucked safely away we can switch
over to using the atomic helper commit directly. \o/

Changes in v2:
- None
Changes in v3:
- Rebased on Archit's private_obj set
Changes in v4:
- None

Cc: Abhinav Kumar <abhinavk@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: Remove msm_commit/worker, use atomic helper commit
Sean Paul [Wed, 28 Feb 2018 19:19:01 +0000 (14:19 -0500)]
drm/msm: Remove msm_commit/worker, use atomic helper commit

Moving further towards switching fully to the the atomic helpers, this
patch removes the hand-rolled worker nonblock commit code and uses the
atomic helpers commit_work model.

Changes in v2:
- Remove commit_destroy()
- Shuffle order of commit_tail calls to further serialize commits
- Use stall in swap_state to avoid abandoned events on disable
Changes in v3:
- Rebased on Archit's private_obj set
Changes in v4:
- None

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: Issue queued events when disabling crtc
Sean Paul [Wed, 28 Mar 2018 18:41:23 +0000 (14:41 -0400)]
drm/msm: Issue queued events when disabling crtc

Ensure that any queued events are issued when disabling the crtc. This
avoids timeouts when we come back and wait for dependencies (like the
previous frame's flip_done).

Changes in v2:
- None
Changes in v3:
- Rebased on Archit's private_obj set
Changes in v4:
- None

Reviewed-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: Move implicit sync handling to prepare_fb
Sean Paul [Tue, 3 Apr 2018 14:42:23 +0000 (10:42 -0400)]
drm/msm: Move implicit sync handling to prepare_fb

In preparation for moving to atomic helpers, move the implicit sync
fence handling out of atomic commit and into the plane->prepare_fb()
hook. While we're at it, de-duplicate the mdp*_prepare_fb functions.

Changes in v4:
- Added

Reported-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: Refactor complete_commit() to look more the helpers
Sean Paul [Wed, 28 Feb 2018 19:18:58 +0000 (14:18 -0500)]
drm/msm: Refactor complete_commit() to look more the helpers

Factor out the commit_tail() portions of complete_commit() into a
separate function to facilitate moving to the atomic helpers in future
patches.

Changes in v2:
- None
Changes in v3:
- Rebased on Archit's private_obj set
Changes in v4:
- None

Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
Reviewed-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: Don't subclass drm_atomic_state anymore
Archit Taneja [Wed, 21 Feb 2018 14:37:24 +0000 (09:37 -0500)]
drm/msm: Don't subclass drm_atomic_state anymore

With the addition of "private_objs" in drm_atomic_state, we no longer
need to subclass drm_atomic_state to store state of share resources
that don't perfectly fit within planes/crtc/connector state information.
We can now save this state within drm_atomic_state itself using
the private objects.

Remove the infrastructure that allowed subclassing of drm_atomic_state
in the driver.

Changes in v3:
- Added to the msm atomic helper patch set
Changes in v4:
- None

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
6 years agodrm/msm/mdp5: Use the new private_obj state
Archit Taneja [Wed, 21 Feb 2018 14:37:23 +0000 (09:37 -0500)]
drm/msm/mdp5: Use the new private_obj state

This replaces the usage of the subclassed atomic state (mdp5_state)
with a private_obj state embedded within drm_atomic_state. The latter
method is the preferred approach, since it's simpler to implement
and less prone to errors.

The new API replaces the older and equivalent mdp5_state usage in the
following pattern:
- References to "mdp5_kms->state" (i.e, the old/existing state) is
  replaced with mdp5_get_existing_global_state(). In the atomic_check
  path, this should be called with the glob_state_lock drm_modeset_lock
  alredy taken.
- References to "mdp5_get_state()" are replaced with
  mdp5_get_global_state(). This acquires glob_state_lock and uses
  drm_atomic_get_private_obj_state() to create a new duplicated state.

Changes in v3:
- Acquire glob_state_lock in mdp5_smp.c
- Added to the msm atomic helper patch set
Changes in v4:
- None

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
6 years agodrm/msm/mdp5: Add global state as a private atomic object
Archit Taneja [Wed, 21 Feb 2018 14:37:22 +0000 (09:37 -0500)]
drm/msm/mdp5: Add global state as a private atomic object

Global shared resources (hwpipes, hwmixers and SMP) for MDP5 are
implemented as a part of atomic state by subclassing drm_atomic_state.

The preferred approach is to use the drm_private_obj infrastructure
available in the atomic core.

mdp5_global_state is introduced as a drm atomic private object. The two
funcs mdp5_get_global_state() and mdp5_get_existing_global_state() are
the two variants that will be used to access mdp5_global_state.

This will replace the existing mdp5_state struct (which subclasses
drm_atomic_state) and the funcs around it. These will be removed later
once we mdp5_global_state is put to use everywhere.

Changes in v3:
- Added glob_state_lock instead of pushing it into the core
- Added to the msm atomic helper patch set
Changes in v4:
- None

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
6 years agodrm/msm: use correct aspace pointer in msm_gem_put_iova()
Daniel Mack [Thu, 3 May 2018 12:00:56 +0000 (14:00 +0200)]
drm/msm: use correct aspace pointer in msm_gem_put_iova()

Even though msm_gem_put_iova() is currently a NOP function, the caller
should pass in the address space pointer it used to obtain the object.

Other call sites were changed in 8bdcd949bbe7e ("drm/msm: pass
address-space to _get_iova() and friends"), but this one seems to have
been forgotten.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: remove unbalanced mutex unlock
Daniel Mack [Thu, 3 May 2018 12:00:55 +0000 (14:00 +0200)]
drm/msm: remove unbalanced mutex unlock

This regression stems from 0e08270a1f01 ("drm/msm: Separate locking of
buffer resources from struct_mutex").

Signed-off-by: Daniel Mack <daniel@zonque.org>
Cc: Sushmita Susheelendra <ssusheel@codeaurora.org>
Cc: Rob Clark <rclark@redhat.com>
Fixes: 0e08270a1f01 ("drm/msm: Separate locking of buffer resources from struct_mutex")
Signed-off-by: Rob Clark <robdclark@gmail.com>