platform/kernel/linux-exynos.git
7 years agodrm/sun4i: Check return value of drm_vblank_init
Chen-Yu Tsai [Fri, 17 Feb 2017 03:13:26 +0000 (11:13 +0800)]
drm/sun4i: Check return value of drm_vblank_init

drm_vblank_init can fail due to insufficient memory. Ignoring the error
and proceeding may cause the kernel to dereference an invalid pointer
when vblank is enabled.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agodrm/sun4i: Fix up error path cleanup for master bind function
Chen-Yu Tsai [Fri, 17 Feb 2017 03:13:25 +0000 (11:13 +0800)]
drm/sun4i: Fix up error path cleanup for master bind function

The master bind function calls numerous drm functions which initialize
underlying structures. It also tries to bind the various components
of the display pipeline, some of which may add additional drm objects.

This patch adds proper cleanup functions in the error path of the
master bind function.

This requires the patch "drm/sun4i: Move drm_mode_config_cleanup call
to main driver", which splits out drm_mode_config_cleanup from
sun4i_framebuffer_free so we can call it separately.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agodrm/sun4i: Move drm_mode_config_cleanup call to main driver
Chen-Yu Tsai [Fri, 17 Feb 2017 03:13:24 +0000 (11:13 +0800)]
drm/sun4i: Move drm_mode_config_cleanup call to main driver

drm_mode_config_cleanup is the complement of drm_mode_config_init, which
is called in the bind function of sun4i_drv. drm_mode_config_cleanup
should be put in the unbind function to match.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agodrm/vc4: Fix OOPSes from trying to cache a partially constructed BO.
Eric Anholt [Wed, 1 Mar 2017 18:56:02 +0000 (10:56 -0800)]
drm/vc4: Fix OOPSes from trying to cache a partially constructed BO.

If a CMA allocation failed, the partially constructed BO would be
unreferenced through the normal path, and we might choose to put it in
the BO cache.  If we then reused it before it expired from the cache,
the kernel would OOPS.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: c826a6e10644 ("drm/vc4: Add a BO cache.")
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170301185602.6873-2-eric@anholt.net
7 years agodrm/vc4: Fulfill user BO creation requests from the kernel BO cache.
Eric Anholt [Wed, 1 Mar 2017 18:56:01 +0000 (10:56 -0800)]
drm/vc4: Fulfill user BO creation requests from the kernel BO cache.

The from_cache flag was actually "the BO is invisible to userspace",
so we can repurpose it to just zero out a cached BO and return it to
userspace.

Improves wall time for a loop of 5 glsl-algebraic-add-add-1 by
-1.44989% +/- 0.862891% (n=28, 1 outlier removed from each that
appeared to be other system noise)

Note that there's an intel-gpu-tools test to check for the proper
zeroing behavior here, which we continue to pass.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170301185602.6873-1-eric@anholt.net
7 years agoRevert "drm/i915: Implement Link Rate fallback on Link training failure"
Daniel Vetter [Wed, 1 Mar 2017 17:17:49 +0000 (18:17 +0100)]
Revert "drm/i915: Implement Link Rate fallback on Link training failure"

This reverts commit 233ce881dd91fb13eb6b09deefae33168e6ead4c.

I assumed it's ok, but really should have double-checked - CI caught
tons of fail :(

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Acked-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170301171749.13053-1-daniel.vetter@ffwll.ch
7 years agodrm/fb-helper: implement ioctl FBIO_WAITFORVSYNC
Maxime Ripard [Tue, 28 Feb 2017 15:36:51 +0000 (16:36 +0100)]
drm/fb-helper: implement ioctl FBIO_WAITFORVSYNC

Implement legacy framebuffer ioctl FBIO_WAITFORVSYNC in the generic
framebuffer emulation driver. Legacy framebuffer users like non kms/drm
based OpenGL(ES)/EGL implementations may require the ioctl to
synchronize drawing or buffer flip for double buffering. It is tested on
the i.MX6.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
7 years agodrm: Update drm_fbdev_cma_init documentation
Gabriel Krisman Bertazi [Wed, 1 Mar 2017 19:01:05 +0000 (16:01 -0300)]
drm: Update drm_fbdev_cma_init documentation

Commit be7f735cd5ea ("drm: Rely on mode_config data for fb_helper
initialization") dropped the num_crtc argument.  Update the
documentation to reflect that and prevent the kernel-doc warnings below:

./drivers/gpu/drm/drm_fb_cma_helper.c:557: warning: Excess function parameter 'num_crtc' description in 'drm_fbdev_cma_init'
./drivers/gpu/drm/drm_fb_cma_helper.c:558: warning: Excess function parameter 'num_crtc' description in 'drm_fbdev_cma_init'

Fixes: be7f735cd5ea ("drm: Rely on mode_config data for fb_helper initialization")
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/87o9xkvn2m.fsf@dilma.collabora.co.uk
7 years agodrm/rockchip/dsi: add dw-mipi power domain support
Chris Zhong [Mon, 20 Feb 2017 08:02:23 +0000 (16:02 +0800)]
drm/rockchip/dsi: add dw-mipi power domain support

Reference the power domain incase dw-mipi power down when
in use.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1487577744-2855-8-git-send-email-zyw@rock-chips.com
7 years agodrm/rockchip/dsi: fix insufficient bandwidth of some panel
Chris Zhong [Mon, 20 Feb 2017 08:02:22 +0000 (16:02 +0800)]
drm/rockchip/dsi: fix insufficient bandwidth of some panel

Set the lanes bps to 1 / 0.9 times of pclk, the margin is not enough
for some panel, it will cause the screen display is not normal, so
increases the badnwidth to 1 / 0.8.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1487577744-2855-7-git-send-email-zyw@rock-chips.com
7 years agodt-bindings: add power domain node for dw-mipi-rockchip
Chris Zhong [Mon, 20 Feb 2017 08:02:21 +0000 (16:02 +0800)]
dt-bindings: add power domain node for dw-mipi-rockchip

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1487577744-2855-6-git-send-email-zyw@rock-chips.com
7 years agodrm/rockchip/dsi: remove mode_valid function
Chris Zhong [Mon, 20 Feb 2017 08:02:20 +0000 (16:02 +0800)]
drm/rockchip/dsi: remove mode_valid function

The MIPI DSI do not need check the validity of resolution, the max
resolution should depend VOP. Hence, remove rk3288_mipi_dsi_mode_valid
here.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1487577744-2855-5-git-send-email-zyw@rock-chips.com
7 years agodrm/rockchip/dsi: dw-mipi: correct the coding style
Chris Zhong [Mon, 20 Feb 2017 08:02:19 +0000 (16:02 +0800)]
drm/rockchip/dsi: dw-mipi: correct the coding style

correct the coding style, according the checkpatch scripts

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1487577744-2855-4-git-send-email-zyw@rock-chips.com
7 years agodrm/rockchip/dsi: dw-mipi: support RK3399 mipi dsi
Chris Zhong [Mon, 20 Feb 2017 08:02:18 +0000 (16:02 +0800)]
drm/rockchip/dsi: dw-mipi: support RK3399 mipi dsi

The vopb/vopl switch register of RK3399 mipi is different from RK3288,
the default setting for mipi dsi mode is different too, so add a
of_device_id structure to distinguish them, and make sure set the
correct mode before mipi phy init.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1487577744-2855-3-git-send-email-zyw@rock-chips.com
7 years agodt-bindings: add rk3399 support for dw-mipi-rockchip
Chris Zhong [Mon, 20 Feb 2017 08:02:17 +0000 (16:02 +0800)]
dt-bindings: add rk3399 support for dw-mipi-rockchip

The dw-mipi-dsi of rk3399 is almost the same as rk3288, the rk3399 has
additional phy config clock.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1487577744-2855-2-git-send-email-zyw@rock-chips.com
7 years agodrm/rockchip: dw-mipi-dsi: add reset control
John Keeping [Fri, 24 Feb 2017 12:55:06 +0000 (12:55 +0000)]
drm/rockchip: dw-mipi-dsi: add reset control

In order to fully reset the state of the MIPI controller we must assert
this reset.

This is slightly more complicated than it could be in order to maintain
compatibility with device trees that do not specify the reset property.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-24-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: support non-burst modes
John Keeping [Fri, 24 Feb 2017 12:55:05 +0000 (12:55 +0000)]
drm/rockchip: dw-mipi-dsi: support non-burst modes

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-23-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: defer probe if panel is not loaded
John Keeping [Fri, 24 Feb 2017 12:55:04 +0000 (12:55 +0000)]
drm/rockchip: dw-mipi-dsi: defer probe if panel is not loaded

This ensures that the output resolution is known before fbcon loads.
mipi_dsi_host_register() is moved above dw_mipi_dsi_register() to
simplify error cleanup since the order of these operations does not
matter.

Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-22-john@metanate.com
7 years agodrm/rockchip: vop: test for P{H,V}SYNC
John Keeping [Fri, 24 Feb 2017 12:55:03 +0000 (12:55 +0000)]
drm/rockchip: vop: test for P{H,V}SYNC

When connected to the MIPI DSI output, we need to use N{H,V}SYNC for the
internal connection but these flags are meaningless for DSI panels.
Switch the test so that we do not set the P{H,V}SYNC bits unless the
mode requires it.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Mark Yao <mark.yao@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
[seanpaul resolved conflict using macros instead of hardcoded values]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-21-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: use positive check for N{H, V}SYNC
John Keeping [Fri, 24 Feb 2017 12:55:02 +0000 (12:55 +0000)]
drm/rockchip: dw-mipi-dsi: use positive check for N{H, V}SYNC

This matches other drivers.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-20-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: use specific poll helper
John Keeping [Fri, 24 Feb 2017 12:55:01 +0000 (12:55 +0000)]
drm/rockchip: dw-mipi-dsi: use specific poll helper

As the documentation for readx_poll_timeout says, we want to use the
specialized macro for readl rather than using the generic version
directly.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-19-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: improve PLL configuration
John Keeping [Fri, 24 Feb 2017 12:55:00 +0000 (12:55 +0000)]
drm/rockchip: dw-mipi-dsi: improve PLL configuration

The multiplication ratio for the PLL is required to be even due to the
use of a "by 2 pre-scaler".  Currently we are likely to end up with an
odd multiplier even though there is an equivalent set of parameters with
an even multiplier.

For example, using the 324MHz bit rate with a reference clock of 24MHz
we end up with M = 27, N = 2 whereas the example in the PHY databook
gives M = 54, N = 4 for this bit rate and reference clock.

By walking down through the available multiplier instead of up we are
more likely to hit an even multiplier.  With the above example we do now
get M = 54, N = 4 as given by the databook.

While doing this, change the loop limits to encode the actual limits on
the divisor, which are:

40MHz >= (pllref / N) >= 5MHz

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-18-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: properly configure PHY timing
John Keeping [Fri, 24 Feb 2017 12:54:59 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: properly configure PHY timing

These values are specified as constant time periods but the PHY
configuration is in terms of the current lane byte clock so using
constant values guarantees that the timings will be outside the
specification with some display configurations.

Derive the necessary configuration from the byte clock in order to
ensure that the PHY configuration is correct.

Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-17-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: configure PHY before enabling
John Keeping [Fri, 24 Feb 2017 12:54:58 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: configure PHY before enabling

The bias, bandgap and PLL should all be configured before we enable
them.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-16-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: ensure PHY is reset
John Keeping [Fri, 24 Feb 2017 12:54:57 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: ensure PHY is reset

Also don't power up the DSI host at this point since this is not
necessary in order to configure the PHY and we do so later when
selecting video or command mode.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-15-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: fix escape clock rate
John Keeping [Fri, 24 Feb 2017 12:54:56 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: fix escape clock rate

This clock rate is derived from the PHY PLL, so it should be calculated
dynamically.  This calculation is the same as that used by the vendor
kernel and ensures that the escape clock runs at <20MHz as required by
the MIPI specification.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-14-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: allow commands in panel_disable
John Keeping [Fri, 24 Feb 2017 12:54:55 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: allow commands in panel_disable

Panel drivers may want to sent commands during the disable function, for
example MIPI_DCS_SET_DISPLAY_OFF before the video signal ends.  In order
to send commands we need to write to registers, so pclk must be enabled.

While changing this, remove the unnecessary code after the panel
unprepare call which seems to be a workaround for a specific panel and
thus belongs in the panel driver.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-13-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: prepare panel after phy init
John Keeping [Fri, 24 Feb 2017 12:54:54 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: prepare panel after phy init

Some panels need to be configured with commands sent over the MIPI link,
which they will do in the prepare hook.  Call this after the PHY has
been initialized so that we are able to send commands to the panel.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-12-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: don't assume buffer is aligned
John Keeping [Fri, 24 Feb 2017 12:54:53 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: don't assume buffer is aligned

By dereferencing the MIPI command buffer as a u32* we rely on it being
correctly aligned on ARM, but this may not be the case.  Copy it into a
stack variable that will be correctly aligned.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-11-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: only request HS clock when required
John Keeping [Fri, 24 Feb 2017 12:54:52 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: only request HS clock when required

Requesting the HS clock from the PHY before we initialize it causes an
invalid signal to be sent out since the input clock is not yet
configured.  The PHY databook suggests only asserting this signal when
performing HS transfers, so let's do that.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-10-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: respect message flags
John Keeping [Fri, 24 Feb 2017 12:54:51 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: respect message flags

Instead of always sending commands in LP mode, respect the
MIPI_DSI_MSG_USE_LPM flag to decide how to send each message.  Also
request acks if MIPI_DSI_MSG_REQ_ACK is set.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-9-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: include bad value in error message
John Keeping [Fri, 24 Feb 2017 12:54:50 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: include bad value in error message

As an aid to debugging.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-8-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: avoid out-of-bounds read on tx_buf
John Keeping [Fri, 24 Feb 2017 12:54:49 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: avoid out-of-bounds read on tx_buf

As a side-effect of this, encode the endianness explicitly rather than
casting a u16.

Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-7-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: fix generic packet status check
John Keeping [Fri, 24 Feb 2017 12:54:48 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: fix generic packet status check

We want to check that both the GEN_CMD_EMPTY and GEN_PLD_W_EMPTY bits
are set so we can't just check "val & mask" because that will be true if
either bit is set.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-6-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: fix command header writes
John Keeping [Fri, 24 Feb 2017 12:54:47 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: fix command header writes

In a couple of places here we use "val" for the value that is about to
be written to a register but then reuse the same variable for the value
of a status register before we get around to writing it.  Rename the
value to be written to so that we write the value we intend to and not
what we have just read from the status register.

Signed-off-by: John Keeping <john@metanate.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-5-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: remove mode_set hook
John Keeping [Fri, 24 Feb 2017 12:54:46 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: remove mode_set hook

This is not needed since we can access the mode via the CRTC from the
enable hook.  Also remove the "mode" field that is no longer used.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-4-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: pass mode in where needed
John Keeping [Fri, 24 Feb 2017 12:54:45 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: pass mode in where needed

This shows that we only use the mode from the enable function and
prepares us to remove the "mode" field and the mode_set hook in the next
commit.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-3-john@metanate.com
7 years agodrm/rockchip: dw-mipi-dsi: don't configure hardware in mode_set for MIPI
John Keeping [Fri, 24 Feb 2017 12:54:44 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: don't configure hardware in mode_set for MIPI

With atomic modesetting the hardware will be powered off when the
mode_set function is called.  We should configure the hardware in the
enable function, which is the atomic version of "commit" so let's use
the enable hook rather than commit while we're at it.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-2-john@metanate.com
7 years agodrm/i915: Implement Link Rate fallback on Link training failure
Manasi Navare [Fri, 16 Dec 2016 10:29:07 +0000 (12:29 +0200)]
drm/i915: Implement Link Rate fallback on Link training failure

If link training at a link rate optimal for a particular
mode fails during modeset's atomic commit phase, then we
let the modeset complete and then retry. We save the link rate
value at which link training failed, update the link status property
to "BAD" and use a lower link rate to prune the modes. It will redo
the modeset on the current mode at lower link rate or if the current
mode gets pruned due to lower link constraints then, it will send a
hotplug uevent for userspace to handle it.

This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4,
4.3.1.6.

v9:
* Use the trimmed max values of link rate/lane count based on
link train fallback (Daniel Vetter)
v8:
* Set link_status to BAD first and then call mode_valid (Jani Nikula)
v7:
Remove the redundant variable in previous patch itself
v6:
* Obtain link rate index from fallback_link_rate using
the helper intel_dp_link_rate_index (Jani Nikula)
* Include fallback within intel_dp_start_link_train (Jani Nikula)
v5:
* Move set link status to drm core (Daniel Vetter, Jani Nikula)
v4:
* Add fallback support for non DDI platforms too
* Set connector->link status inside set_link_status function
(Jani Nikula)
v3:
* Set link status property to BAd unconditionally (Jani Nikula)
* Dont use two separate variables link_train_failed and link_status
to indicate same thing (Jani Nikula)
v2:
* Squashed a few patches (Jani Nikula)

Acked-by: Tony Cheng <tony.cheng@amd.com>
Acked-by: Harry Wentland <Harry.wentland@amd.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/d796cc0c2814d668a47ef43c464f9a4089d46d64.1481883920.git.jani.nikula@intel.com
7 years agodrm: Fix the kernel doc warning for drm_link_status
Manasi Navare [Wed, 1 Mar 2017 14:45:10 +0000 (06:45 -0800)]
drm: Fix the kernel doc warning for drm_link_status

This fixes the kernel doc warning that was introduced in
the 'commit 40ee6fbef75fe6 ("drm: Add a new connector
atomic property for link status")'. Description has
been added for the enum values.

Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1488379510-15059-1-git-send-email-manasi.d.navare@intel.com
7 years agodrm/msm: Remove drm_debugfs_remove_files() calls
Noralf Trønnes [Thu, 26 Jan 2017 22:56:11 +0000 (23:56 +0100)]
drm/msm: Remove drm_debugfs_remove_files() calls

drm_debugfs_cleanup() now removes all minor->debugfs_list entries
automatically, so it's not necessary to call
drm_debugfs_remove_files(). Additionally it uses
debugfs_remove_recursive() to clean up the debugfs files, so no need
to do that.

Cc: robdclark@gmail.com
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170126225621.12314-10-noralf@tronnes.org
7 years agodrm/i915: Remove i915_debugfs_unregister()
Noralf Trønnes [Thu, 26 Jan 2017 22:56:21 +0000 (23:56 +0100)]
drm/i915: Remove i915_debugfs_unregister()

drm_debugfs_cleanup() now removes all minor->debugfs_list entries
automatically, so no need to do this explicitly. Additionally it
uses debugfs_remove_recursive() to clean up the debugfs files,
so no need for adding fake drm_info_node entries.

Cc: daniel.vetter@intel.com
Cc: jani.nikula@linux.intel.com
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170126225621.12314-20-noralf@tronnes.org
7 years agodrm/qxl: Remove qxl_debugfs_takedown()
Noralf Trønnes [Thu, 26 Jan 2017 22:56:20 +0000 (23:56 +0100)]
drm/qxl: Remove qxl_debugfs_takedown()

drm_debugfs_cleanup() now removes all minor->debugfs_list entries
automatically, so the drm_driver.debugfs_cleanup callback is not
needed.

Cc: airlied@linux.ie
Cc: kraxel@redhat.com
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170126225621.12314-19-noralf@tronnes.org
7 years agodrm/virtio: Remove virtio_gpu_debugfs_takedown()
Noralf Trønnes [Thu, 26 Jan 2017 22:56:19 +0000 (23:56 +0100)]
drm/virtio: Remove virtio_gpu_debugfs_takedown()

drm_debugfs_cleanup() now removes all minor->debugfs_list entries
automatically, so the drm_driver.debugfs_cleanup callback is not
needed.

Cc: airlied@linux.ie
Cc: kraxel@redhat.com
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170126225621.12314-18-noralf@tronnes.org
7 years agodrm/nouveau: Remove nouveau_drm_debugfs_cleanup()
Noralf Trønnes [Thu, 26 Jan 2017 22:56:12 +0000 (23:56 +0100)]
drm/nouveau: Remove nouveau_drm_debugfs_cleanup()

drm_debugfs_cleanup() now removes all minor->debugfs_list entries
automatically, so the drm_driver.debugfs_cleanup callback is not
needed. Additionally it uses debugfs_remove_recursive() to clean
up the debugfs files, so no need for adding fake drm_info_node
entries.

Cc: bskeggs@redhat.com
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170126225621.12314-11-noralf@tronnes.org
7 years agodrm/armada: Remove armada_drm_debugfs_cleanup()
Noralf Trønnes [Thu, 26 Jan 2017 22:56:07 +0000 (23:56 +0100)]
drm/armada: Remove armada_drm_debugfs_cleanup()

drm_debugfs_cleanup() now removes all minor->debugfs_list entries
automatically, so no need to do this explicitly. Additionally it
uses debugfs_remove_recursive() to clean up the debugfs files,
so no need for adding fake drm_info_node entries.
And finally there's no need to clean up on error,
drm_debugfs_cleanup() is called in the error path.

Cc: linux@armlinux.org.uk
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170126225621.12314-6-noralf@tronnes.org
7 years agoMAINTAINERS: drm-meson: Update git entries
Neil Armstrong [Wed, 1 Mar 2017 09:20:18 +0000 (10:20 +0100)]
MAINTAINERS: drm-meson: Update git entries

Add the main git entry and the drm-misc experiment git for small
patches.

Cc: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488360018-16835-1-git-send-email-narmstrong@baylibre.com
7 years agodrivers:gpu: vga :vga_switcheroo.c : Fixed some coding style issues
Joan Jani [Tue, 28 Feb 2017 18:59:52 +0000 (18:59 +0000)]
drivers:gpu: vga :vga_switcheroo.c : Fixed some coding style issues

Fixed the following style issues

drivers/gpu/vga/vga_switcheroo.c:98: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:99: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:102: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:103: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:129: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:135: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:217: WARNING: line over 80 characters
drivers/gpu/vga/vga_switcheroo.c:218: WARNING: line over 80 characters
drivers/gpu/vga/vga_switcheroo.c:308: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:340: WARNING: line over 80 characters
drivers/gpu/vga/vga_switcheroo.c:1087: WARNING: Block comments use * on subsequent lines
drivers/gpu/vga/vga_switcheroo.c:1087: WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: Joan Jani <igiann@hotmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/HE1PR1001MB1148F38207BC31C860FAF06DC9560@HE1PR1001MB1148.EURPRD10.PROD.OUTLOOK.COM
7 years agogpu: drm: drivers: Convert printk(KERN_<LEVEL> to pr_<level>
Joe Perches [Tue, 28 Feb 2017 12:55:54 +0000 (04:55 -0800)]
gpu: drm: drivers: Convert printk(KERN_<LEVEL> to pr_<level>

Use a more common logging style.

Miscellanea:

o Coalesce formats and realign arguments
o Neaten a few macros now using pr_<level>

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Sinclair Yeh <syeh@vmware.com>
Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/76355db47b31668bb64d996865ceee53bd66b11f.1488285953.git.joe@perches.com
7 years agoMAINTAINERS: Update git entries for drivers in drm-misc
Daniel Vetter [Tue, 28 Feb 2017 19:36:57 +0000 (20:36 +0100)]
MAINTAINERS: Update git entries for drivers in drm-misc

It's still just an experiment, but one lesson learned from drm-misc is
that not updating MAINTAINERS just leads to confusion. And this is
easy to revert.

Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Mark Yao <mark.yao@rock-chips.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Eric Anholt <eric@anholt.net>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228193657.3559-1-daniel.vetter@ffwll.ch
7 years agodrm/vc4: Add a paragraph at the top of vc4 docs introducing what it is.
Eric Anholt [Mon, 27 Feb 2017 20:11:44 +0000 (12:11 -0800)]
drm/vc4: Add a paragraph at the top of vc4 docs introducing what it is.

This makes for more sensible documentation of the whole module than
jumping straight into the details of display.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227201144.10970-5-eric@anholt.net
7 years agodrm/vc4: Extend and edit documentation for output from the RST
Eric Anholt [Mon, 27 Feb 2017 20:11:43 +0000 (12:11 -0800)]
drm/vc4: Extend and edit documentation for output from the RST

I had written most of my comments as if I was describing the
individual code files the way I used to for doxygen, while for RST we
want to describe things in a more chapter/section way where there's no
obvious relation to .c files.

Additionally, several of the files had stub descriptions that I've
taken this opportunity to extend.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227201144.10970-4-eric@anholt.net
7 years agodrm/vc4: Add RST to bring together vc4 kerneldoc.
Eric Anholt [Mon, 27 Feb 2017 20:11:42 +0000 (12:11 -0800)]
drm/vc4: Add RST to bring together vc4 kerneldoc.

This doesn't yet produce coherent documentation of the module, but at
least gets the kerneldoc built and somewhat glued together.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227201144.10970-3-eric@anholt.net
7 years agodrm/vc4: Convert existing documentation to actual kerneldoc.
Eric Anholt [Mon, 27 Feb 2017 20:11:41 +0000 (12:11 -0800)]
drm/vc4: Convert existing documentation to actual kerneldoc.

I'm going to hook vc4 up to the sphinx build, so clean up its comments
to not generate warnings when we do.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227201144.10970-2-eric@anholt.net
7 years agodrm/vc4: Don't wait for vblank when updating the cursor
Michael Zoran [Fri, 24 Feb 2017 01:54:31 +0000 (17:54 -0800)]
drm/vc4: Don't wait for vblank when updating the cursor

Commonly used desktop environments such as xfce4 and gnome
on debian sid can flood the graphics drivers with cursor
updates.  Because the current implementation is waiting
for a vblank between cursor updates, this will cause the
display to hang for a long time since a typical refresh
rate is only 60Hz.

This is unnecessary and unexpected by user mode software,
so simply swap out the cursor frame buffer without waiting.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: http://patchwork.freedesktop.org/patch/msgid/20170224015431.24583-1-mzoran@crowfest.net
7 years agodrm: qxl: Enable atomic modesetting ioctl
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:28 +0000 (17:43 -0300)]
drm: qxl: Enable atomic modesetting ioctl

Now that atomic support is implemented, enable the atomic flag.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-15-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Atomic phase 3: Wire up atomic page_flip helper
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:27 +0000 (17:43 -0300)]
drm: qxl: Atomic phase 3: Wire up atomic page_flip helper

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-14-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Atomic phase 3: Wire up atomic set_config helper
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:26 +0000 (17:43 -0300)]
drm: qxl: Atomic phase 3: Wire up atomic set_config helper

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-13-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Atomic phase 3: Use atomic handlers for planes
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:25 +0000 (17:43 -0300)]
drm: qxl: Atomic phase 3: Use atomic handlers for planes

Now that the state objects are wired up, we can move to the final atomic
handlers.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-12-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Atomic phase 2: Use drm_atomic_set_fb_for_plane helper
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:24 +0000 (17:43 -0300)]
drm: qxl: Atomic phase 2: Use drm_atomic_set_fb_for_plane helper

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-11-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Atomic phase 2: Wire up state object handlers
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:23 +0000 (17:43 -0300)]
drm: qxl: Atomic phase 2: Wire up state object handlers

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-10-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Atomic phase 1: Don't unpin primary when disabling crtc
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:22 +0000 (17:43 -0300)]
drm: qxl: Atomic phase 1: Don't unpin primary when disabling crtc

In the qxl atomic model, the primary doesn't stay pinned all the time,
instead it is only pinned/unpinned between prepare_fb and cleanup_fb.
So, we no longer need a final unpin of the primary framebuffer when
disabling the crtc.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-9-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Atomic phase 1: Implement mode_set_nofb
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:21 +0000 (17:43 -0300)]
drm: qxl: Atomic phase 1: Implement mode_set_nofb

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-8-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Atomic phase 1: Use drm_plane_helpers for primary plane
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:20 +0000 (17:43 -0300)]
drm: qxl: Atomic phase 1: Use drm_plane_helpers for primary plane

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-7-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Atomic phase 1: convert cursor to universal plane
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:19 +0000 (17:43 -0300)]
drm: qxl: Atomic phase 1: convert cursor to universal plane

In preparation for atomic conversion, let's use the transitional atomic
helpers drm_plane_helper_update/disable.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-6-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Expose creation of universal primary plane
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:18 +0000 (17:43 -0300)]
drm: qxl: Expose creation of universal primary plane

Let's expose the primary plane initialization inside the qxl driver in
preparation for universal planes and atomic.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-5-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Don't initialize vblank support
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:17 +0000 (17:43 -0300)]
drm: qxl: Don't initialize vblank support

qxl don't have support for hardware vblanks so we can't initialize it
here, otherwise we risk getting stuck in drm_wait_one_vblank.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-4-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Consolidate bo reservation when pinning
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:16 +0000 (17:43 -0300)]
drm: qxl: Consolidate bo reservation when pinning

Every attempt to pin/unpin objects in memory requires
qxl_bo_reserve/unreserve calls around the pinning operation to protect
the object from concurrent access, which causes that call sequence to be
reproduced every place where pinning is needed.  In some cases, that
sequence was not executed correctly, resulting in potential unprotected
pinning operations.

This commit encapsulates the reservation inside a new wrapper to make
sure it is always handled properly.  In cases where reservation must be
done beforehand, for some reason, one can use the unprotected version
__qxl_bo_pin/unpin.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-3-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Drop device flags attribute
Gabriel Krisman Bertazi [Mon, 27 Feb 2017 20:43:15 +0000 (17:43 -0300)]
drm: qxl: Drop device flags attribute

There are no device specific flags that we need to keep track of here.
Let it vanish.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227204328.18761-2-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: Rename connector list iterator API
Thierry Reding [Tue, 28 Feb 2017 14:46:43 +0000 (15:46 +0100)]
drm: Rename connector list iterator API

Currently the functions that initialize and tear down a connector
iterator use the _get() and _put() suffixes. However, these suffixes
are typically used by reference counting functions.

Make these function names a little more consistent by changing the
suffixes to _begin() and _end(), which is a fairly common pattern in
the rest of the Linux kernel.

Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228144643.5668-8-thierry.reding@gmail.com
7 years agodrm: Introduce drm_property_blob_{get,put}()
Thierry Reding [Tue, 28 Feb 2017 14:46:42 +0000 (15:46 +0100)]
drm: Introduce drm_property_blob_{get,put}()

For consistency with other reference counting APIs in the kernel, add
drm_property_blob_get() and drm_property_blob_put() to reference count
DRM blob properties.

Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.

A semantic patch is provided that can be used to convert all drivers to
the new helpers.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228144643.5668-7-thierry.reding@gmail.com
7 years agodrm: Introduce drm_gem_object_{get,put}()
Thierry Reding [Tue, 28 Feb 2017 14:46:41 +0000 (15:46 +0100)]
drm: Introduce drm_gem_object_{get,put}()

For consistency with other reference counting APIs in the kernel, add
drm_gem_object_get() and drm_gem_object_put(), as well as an unlocked
variant of the latter, to reference count GEM buffer objects.

Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.

The existing semantic patch for the DRM subsystem-wide conversion is
extended to account for these new helpers.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228144643.5668-6-thierry.reding@gmail.com
7 years agodrm: Introduce drm_framebuffer_{get,put}()
Thierry Reding [Tue, 28 Feb 2017 14:46:40 +0000 (15:46 +0100)]
drm: Introduce drm_framebuffer_{get,put}()

For consistency with other reference counting APIs in the kernel, add
drm_framebuffer_get() and drm_framebuffer_put() to reference count DRM
framebuffers.

Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.

The existing semantic patch for the DRM subsystem-wide conversion is
extended to account for these new helpers.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228144643.5668-5-thierry.reding@gmail.com
7 years agodrm: Introduce drm_connector_{get,put}()
Thierry Reding [Tue, 28 Feb 2017 14:46:39 +0000 (15:46 +0100)]
drm: Introduce drm_connector_{get,put}()

For consistency with other reference counting APIs in the kernel, add
drm_connector_get() and drm_connector_put() functions to reference count
connectors.

Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.

The existing semantic patch for mode object reference count conversion
is extended for these new helpers.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228144643.5668-4-thierry.reding@gmail.com
7 years agodrm: Introduce drm_mode_object_{get,put}()
Thierry Reding [Tue, 28 Feb 2017 14:46:38 +0000 (15:46 +0100)]
drm: Introduce drm_mode_object_{get,put}()

For consistency with other reference counting APIs in the kernel, add
drm_mode_object_get() and drm_mode_object_put() to reference count DRM
mode objects.

Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.

A semantic patch is provided that can be used to convert all drivers to
the new helpers.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228144643.5668-3-thierry.reding@gmail.com
7 years agodrm: Rename drm_mode_object_get()
Thierry Reding [Tue, 28 Feb 2017 14:46:37 +0000 (15:46 +0100)]
drm: Rename drm_mode_object_get()

Subsequent patches will introduce reference counting APIs that are more
consistent with similar APIs throughout the Linux kernel. These APIs use
the _get() and _put() suffixes and will collide with this existing
function.

Rename the function to drm_mode_object_add() which is a slightly more
accurate description of what it does. Also the kerneldoc for this
function gives an indication that it's badly named because it doesn't
actually acquire a reference to anything.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228144643.5668-2-thierry.reding@gmail.com
7 years agogpu: drm: core: Convert printk(KERN_<LEVEL> to pr_<level>
Joe Perches [Tue, 28 Feb 2017 12:55:53 +0000 (04:55 -0800)]
gpu: drm: core: Convert printk(KERN_<LEVEL> to pr_<level>

Use a more common logging style.

Miscellanea:

o Coalesce formats and realign arguments

Signed-off-by: Joe Perches <joe@perches.com>
[danvet: Resolve minor conflict in drm_edid.c]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
7 years agodrm/doc: Capture TODO for deferred fbdev setup
Daniel Vetter [Sun, 26 Feb 2017 19:38:51 +0000 (20:38 +0100)]
drm/doc: Capture TODO for deferred fbdev setup

Also became a bit a FAQ recently.

Cc: John Stultz <john.stultz@linaro.org
Cc: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170226193851.3245-2-daniel.vetter@ffwll.ch
7 years agodrm/docs: Record TODO about plane clipping
Daniel Vetter [Sun, 26 Feb 2017 19:38:50 +0000 (20:38 +0100)]
drm/docs: Record TODO about plane clipping

It's such a mess that it's become a FAQ :(

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Russell King - ARM Linux <linux@armlinux.org.uk>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170226193851.3245-1-daniel.vetter@ffwll.ch
7 years agodrm: Convert drm_framebuffer_remove to atomic, v4.
Maarten Lankhorst [Tue, 21 Feb 2017 13:51:41 +0000 (14:51 +0100)]
drm: Convert drm_framebuffer_remove to atomic, v4.

Instead of trying to do everything in 1 go, just do a basic safe
conversion first. We've been bitten by too many regressions in the
past.

This patch only converts drm_framebuffer_remove to atomic. The
regression sensitive part is split out to a separate patch.

v2:
- Remove plane->fb assignment, done by drm_atomic_clean_old_fb.
- Add WARN_ON when atomic_remove_fb fails.
- Always call drm_atomic_state_put.
v3:
- Use drm_drv_uses_atomic_modeset
- Handle the case where the first plane-disable-only commit fails
  with -EINVAL. Some drivers do not support this, fall back to
  disabling all crtc's in this case.
v4:
- Solve vmwgfx compatibility issue in their driver, was fixed in this
  patch by v3.
- Move only disabling primary to a separate patch.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1487685102-31991-3-git-send-email-maarten.lankhorst@linux.intel.com
7 years agodrm/atomic: Make disable_all helper fully disable the crtc.
Maarten Lankhorst [Tue, 21 Feb 2017 13:51:40 +0000 (14:51 +0100)]
drm/atomic: Make disable_all helper fully disable the crtc.

It seems that nouveau requires this, so best to do this in the helper.
This allows nouveau to use the atomic suspend helper.

Cc: nouveau@lists.freedesktop.org
Acked-by: Ben Skeggs <bskeggs@redhat.com> #irc
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1487685102-31991-2-git-send-email-maarten.lankhorst@linux.intel.com
7 years agodrm/atmel-hlcdc: Simplify the HLCDC layer logic
Boris Brezillon [Mon, 6 Feb 2017 17:57:19 +0000 (18:57 +0100)]
drm/atmel-hlcdc: Simplify the HLCDC layer logic

An HLCDC layers in Atmel's nomenclature is either a DRM plane or a 'Post
Processing Layer' which can be used to output the results of the HLCDC
composition in a memory buffer.

atmel_hlcdc_layer.c was designed to be generic enough to be re-usable in
both cases, but we're not exposing the post-processing layer yet, and
even if we were, I'm not sure the code would provide the necessary tools
to manipulate this kind of layer.

Moreover, the code in atmel_hlcdc_{plane,layer}.c was designed before the
atomic modesetting API, and was trying solve the
check-setting/commit-if-ok/rollback-otherwise problem, which is now
entirely solved by the existing core infrastructure.

And finally, the code in atmel_hlcdc_layer.c is over-complicated compared
to what we really need. This rework is a good excuse to simplify it. Note
that this rework solves an existing resource leak (leading to a -EBUSY
error) which I failed to clearly identify.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Nicolas Ferre <nicolas.ferre@microchip.com>
7 years agodrm: add drm_get_connector_force_name
Jani Nikula [Mon, 20 Feb 2017 08:51:48 +0000 (10:51 +0200)]
drm: add drm_get_connector_force_name

Follow the naming in debugfs also for logging, add "unknown" for values
beyond the enumerated ones.

v2: add \n in connector_show, make internal to drm (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487580708-29340-1-git-send-email-jani.nikula@intel.com
7 years agodrm/via: use get_user_pages_unlocked()
Lorenzo Stoakes [Mon, 27 Feb 2017 21:50:08 +0000 (21:50 +0000)]
drm/via: use get_user_pages_unlocked()

Moving from get_user_pages() to get_user_pages_unlocked() simplifies the code
and takes advantage of VM_FAULT_RETRY functionality when faulting in pages.

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227215008.21457-1-lstoakes@gmail.com
7 years agodrm: sti: make driver use devm_of_platform_populate()
Benjamin Gaignard [Fri, 24 Feb 2017 16:14:34 +0000 (17:14 +0100)]
drm: sti: make driver use devm_of_platform_populate()

This make sure that of_platform_depopulate() is called if an error
occur in probe after populating the date from the device tree.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1487952874-23635-3-git-send-email-benjamin.gaignard@linaro.org
7 years agoof: add devm_ functions for populate and depopulate
Benjamin Gaignard [Fri, 24 Feb 2017 16:14:33 +0000 (17:14 +0100)]
of: add devm_ functions for populate and depopulate

Lots of calls to of_platform_populate() are not unbalanced by a call
to of_platform_depopulate(). This create issues while drivers are
bind/unbind.

In way to solve those issues is to add devm_of_platform_populate()
which will call of_platform_depopulate() when the device is unbound
from the bus.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1487952874-23635-2-git-send-email-benjamin.gaignard@linaro.org
7 years agodrm: Add a new connector atomic property for link status
Manasi Navare [Fri, 16 Dec 2016 10:29:06 +0000 (12:29 +0200)]
drm: Add a new connector atomic property for link status

At the time userspace does setcrtc, we've already promised the mode
would work. The promise is based on the theoretical capabilities of
the link, but it's possible we can't reach this in practice. The DP
spec describes how the link should be reduced, but we can't reduce
the link below the requirements of the mode. Black screen follows.

One idea would be to have setcrtc return a failure. However, it
already should not fail as the atomic checks have passed. It would
also conflict with the idea of making setcrtc asynchronous in the
future, returning before the actual mode setting and link training.

Another idea is to train the link "upfront" at hotplug time, before
pruning the mode list, so that we can do the pruning based on
practical not theoretical capabilities. However, the changes for link
training are pretty drastic, all for the sake of error handling and
DP compliance, when the most common happy day scenario is the current
approach of link training at mode setting time, using the optimal
parameters for the mode. It is also not certain all hardware could do
this without the pipe on; not even all our hardware can do this. Some
of this can be solved, but not trivially.

Both of the above ideas also fail to address link degradation *during*
operation.

The solution is to add a new "link-status" connector property in order
to address link training failure in a way that:
a) changes the current happy day scenario as little as possible, to
avoid regressions, b) can be implemented the same way by all drm
drivers, c) is still opt-in for the drivers and userspace, and opting
out doesn't regress the user experience, d) doesn't prevent drivers
from implementing better or alternate approaches, possibly without
userspace involvement. And, of course, handles all the issues presented.
In the usual happy day scenario, this is always "good". If something
fails during or after a mode set, the kernel driver can set the link
status to "bad" and issue a hotplug uevent for userspace to have it
re-check the valid modes through GET_CONNECTOR IOCTL, and try modeset
again. If the theoretical capabilities of the link can't be reached,
the mode list is trimmed based on that.

v7 by Jani:
* Rebase, simplify set property while at it, checkpatch fix
v6:
* Fix a typo in kernel doc (Sean Paul)
v5:
* Clarify doc for silent rejection of atomic properties by driver (Daniel Vetter)
v4:
* Add comments in kernel-doc format (Daniel Vetter)
* Update the kernel-doc for link-status (Sean Paul)
v3:
* Fixed a build error (Jani Saarinen)
v2:
* Removed connector->link_status (Daniel Vetter)
* Set connector->state->link_status in drm_mode_connector_set_link_status_property
(Daniel Vetter)
* Set the connector_changed flag to true if connector->state->link_status changed.
* Reset link_status to GOOD in update_output_state (Daniel Vetter)
* Never allow userspace to set link status from Good To Bad (Daniel Vetter)

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Tony Cheng <tony.cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Eric Anholt <eric@anholt.net> (for the -modesetting patch)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/0182487051aa9f1594820e35a4853de2f8747b4e.1481883920.git.jani.nikula@intel.com
7 years agodrm/doc: Fix up some kms function names
Archit Taneja [Wed, 22 Feb 2017 08:47:41 +0000 (14:17 +0530)]
drm/doc: Fix up some kms function names

A couple of the kms functions didn't have the correct/newest names.
This prevented them to be identified as refs in the html doc.

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170222084741.8485-1-architt@codeaurora.org
7 years agodrm/tinydrm: fix semicolon.cocci warnings
kbuild test robot [Thu, 23 Feb 2017 16:46:48 +0000 (00:46 +0800)]
drm/tinydrm: fix semicolon.cocci warnings

drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c:454:2-3: Unneeded semicolon

 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170223164647.GA2519@lkp-ws02
7 years agodrm: kselftest: fix spelling mistake: "misalinged" -> "misaligned"
Colin Ian King [Thu, 23 Feb 2017 00:07:17 +0000 (00:07 +0000)]
drm: kselftest: fix spelling mistake: "misalinged" -> "misaligned"

trivial fix to spelling mistake in pr_err message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170223000717.8898-1-colin.king@canonical.com
7 years agodma-buf/reservation: Wrap ww_mutex_trylock
Chris Wilson [Tue, 21 Feb 2017 09:30:00 +0000 (09:30 +0000)]
dma-buf/reservation: Wrap ww_mutex_trylock

In a similar fashion to reservation_object_lock() and
reservation_object_unlock(), ww_mutex_trylock is also useful and so is
worth wrapping for consistency.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
[danvet: Add __must_check Joonas wants.]
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170221093000.22802-1-chris@chris-wilson.co.uk
7 years agodrm/fb-helper: Add multi buffer support for cma fbdev
Xinliang Liu [Wed, 15 Feb 2017 16:19:08 +0000 (17:19 +0100)]
drm/fb-helper: Add multi buffer support for cma fbdev

This patch add a config to support to create multi buffer for cma fbdev.
Such as double buffer and triple buffer.

Cma fbdev is convient to add a legency fbdev. And still many Android
devices use fbdev now and at least double buffer is needed for these
Android devices, so that a buffer flip can be operated. It will need
some time for Android device vendors to abondon legency fbdev. So multi
buffer for fbdev is needed.

Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
[s.christ@phytec.de: Picking patch from
                     https://lkml.org/lkml/2015/9/14/188]
Signed-off-by: Stefan Christ <s.christ@phytec.de>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/075ffb50cc16ab055b5d47b30163401bb356ab51.1487175046.git-series.maxime.ripard@free-electrons.com
7 years agodrm: Always prepare null framebuffer in transitional helper
Gabriel Krisman Bertazi [Thu, 16 Feb 2017 16:44:42 +0000 (14:44 -0200)]
drm: Always prepare null framebuffer in transitional helper

Despite the documentation claim that cleanup_fb will match prior calls
to prepare_fb, in case of NULL framebuffers in the transitional helpers,
the code will skip the call to prepare_fb but not the corresponding
cleanup_fb call.  This asymmetry in semantics is unnecessarily surprising
for developers transitioning drivers to atomic model, specially because
the final atomic handlers don't have the issue - the prepare_fb is
always called, despite the new state framebuffer being null.

The only current user of the transitional helper that doesn't take care
of null framebuffers explicitly inside the prepare_fb hook is
atmel_hlcdc, so we take special care to make sure we don't break
anything there.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170216164442.28704-1-krisman@collabora.co.uk
7 years agodrm: drm_printer: add __printf validation
Joe Perches [Wed, 15 Feb 2017 23:33:18 +0000 (15:33 -0800)]
drm: drm_printer: add __printf validation

drm_printf does not currently use the compiler to verify
format and arguments.  Make it do so.

Miscellanea:

o Add appropriate #include files for __printf and struct va_format
o Convert dev_printk to dev_info

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/133858f214e9b90f92bb8eb44c6b1dc04429933d.1487201526.git.joe@perches.com
7 years agoMerge airlied/drm-next into drm-misc-next
Daniel Vetter [Sun, 26 Feb 2017 20:34:42 +0000 (21:34 +0100)]
Merge airlied/drm-next into drm-misc-next

Backmerge the main pull request to sync up with all the newly landed
drivers. Otherwise we'll have chaos even before 4.12 started in
earnest.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
7 years agolib/Kconfig: make PRIME_NUMBERS not user selectable.
Dave Airlie [Fri, 24 Feb 2017 02:11:21 +0000 (12:11 +1000)]
lib/Kconfig: make PRIME_NUMBERS not user selectable.

Linus doesn't like it user selectable, so kill it until
someone needs it for something else.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrm/tinydrm: helpers: Properly fix backlight dependency
Noralf Trønnes [Thu, 23 Feb 2017 13:29:57 +0000 (14:29 +0100)]
drm/tinydrm: helpers: Properly fix backlight dependency

BACKLIGHT_CLASS_DEVICE was selected in the last version of the
tinydrm patchset to fix the backlight dependency, but the
ifdef CONFIG_BACKLIGHT_CLASS_DEVICE was forgotten. Fix that.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrm/tinydrm: mipi-dbi: Fix field width specifier warning
Noralf Trønnes [Thu, 23 Feb 2017 13:29:56 +0000 (14:29 +0100)]
drm/tinydrm: mipi-dbi: Fix field width specifier warning

This warning is seen on 64-bit builds in functions:
   'mipi_dbi_typec1_command':
   'mipi_dbi_typec3_command_read':
   'mipi_dbi_typec3_command':

>> drivers/gpu/drm/tinydrm/mipi-dbi.c:65:20: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'size_t {aka long unsigned int}' [-Wformat=]
      DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, len, data); \
                       ^
   include/drm/drmP.h:228:40: note: in definition of macro 'DRM_DEBUG_DRIVER'
     drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
                                           ^~~
>> drivers/gpu/drm/tinydrm/mipi-dbi.c:671:2: note: in expansion of macro 'MIPI_DBI_DEBUG_COMMAND'
     MIPI_DBI_DEBUG_COMMAND(cmd, parameters, num);
     ^~~~~~~~~~~~~~~~~~~~~~

Fix by casting 'len' to int in the macro MIPI_DBI_DEBUG_COMMAND().
There is no chance of overflow.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized
Noralf Trønnes [Thu, 23 Feb 2017 13:29:55 +0000 (14:29 +0100)]
drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized

Fix this warning:
drivers/gpu/drm/tinydrm/mipi-dbi.c: In function ‘mipi_dbi_debugfs_command_write’:
drivers/gpu/drm/tinydrm/mipi-dbi.c:905:8: warning: ‘cmd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  ret = mipi_dbi_command_buf(mipi, cmd, parameters, i);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cmd can't be used uninitialized, but to satisfy the compiler,
initialize it to zero.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoMerge branch 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Thu, 23 Feb 2017 22:35:23 +0000 (08:35 +1000)]
Merge branch 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux into drm-next

Some ttm/amd fixes.

* 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux:
  drm/amd/powerplay: fix PSI feature on Polars12.
  drm/amdgpu: refuse to reserve io mem for split VRAM buffers
  drm/ttm: fix use-after-free races in vm fault handling
  drm/amd/amdgpu: post card if there is real hw resetting performed