openwrt/staging/blogic.git
6 years agoMerge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm...
Dave Airlie [Tue, 7 Aug 2018 20:07:06 +0000 (06:07 +1000)]
Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next

From: Lucas Stach <l.stach@pengutronix.de>
"not much to de-stage this time. Changes from Philipp and Souptick to
use memset32 more and switch the fault handler to the new vm_fault_t
and two small fixes for issues that can be hit in rare corner cases
from me."

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1533563808.2809.7.camel@pengutronix.de
6 years agoMerge branch 'drm-tda998x-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into...
Dave Airlie [Tue, 7 Aug 2018 19:52:15 +0000 (05:52 +1000)]
Merge branch 'drm-tda998x-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next

From: Russell King <rmk@armlinux.org.uk>
As per the patches posted, discussed and tested by Peter Rosin, this
converts TDA998x to a bridge driver, while still allowing Armada and
TI LCDC to continue using it as they always have done.  It also gets
rid of the private .fill_modes function, and tweaks the TMDS divider
calculation to be more correct to the available information.

[airlied: fixed two conflicts]
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180802093421.GA29670@rmk-PC.armlinux.org.uk
6 years agoMerge branch 'for-upstream/hdlcd' of git://linux-arm.org/linux-ld into drm-next
Dave Airlie [Tue, 7 Aug 2018 19:51:16 +0000 (05:51 +1000)]
Merge branch 'for-upstream/hdlcd' of git://linux-arm.org/linux-ld into drm-next

From: Liviu Dudau <Liviu.Dudau@arm.com>
"I managed to loose track of a few patches for HDLCD while focusing
on Mali DP and found them again when investigating an issue with
the way HDLCD behaves on teardown. They can go into drm-next for
one of the v4.19-rcX if you're not going to do another pull request
before the merge window."

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180731170831.GF17455@e110455-lin.cambridge.arm.com
6 years agodrm/i2c: tda998x: correct PLL divider calculation
Russell King [Thu, 2 Aug 2018 09:27:15 +0000 (10:27 +0100)]
drm/i2c: tda998x: correct PLL divider calculation

The serializer PLL divider is a power-of-two divider, so our calculation
which assumes that it's a numerical divider is incorrect.  Replace it
with one that results in a power-of-two divider value instead.

Tested with all supported modes with a Samsung S24C750.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/i2c: tda998x: get rid of private fill_modes function
Russell King [Thu, 2 Aug 2018 09:27:15 +0000 (10:27 +0100)]
drm/i2c: tda998x: get rid of private fill_modes function

We can achieve the same effect via the get_modes() method, rather than
wrapping the fill_modes helper.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/i2c: tda998x: move mode_valid() to bridge
Russell King [Thu, 2 Aug 2018 09:27:15 +0000 (10:27 +0100)]
drm/i2c: tda998x: move mode_valid() to bridge

Move the mode_valid() implementation to the bridge instead of the
connector, as we're checking the bridge's capabilities.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/i2c: tda998x: register bridge outside of component helper
Russell King [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: register bridge outside of component helper

Register the bridge outside of the component helper as we have
drivers that wish to use the tda998x without its encoder.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/i2c: tda998x: cleanup from previous changes
Russell King [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: cleanup from previous changes

Cleanup the code a little from the effects of the previous changes:
- Move tda998x_destroy() to be above tda998x_create()
- Use 'dev' directly in tda998x_create() where appropriate.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/i2c: tda998x: allocate tda998x_priv inside tda998x_create()
Russell King [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: allocate tda998x_priv inside tda998x_create()

Move the tda998x_priv allocation inside tda998x_create() and simplify
the tda998x_create()'s arguments.  Pass the same to tda998x_destroy().

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/i2c: tda998x: convert to bridge driver
Russell King [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: convert to bridge driver

Convert tda998x to a bridge driver with built-in encoder support for
compatibility with existing component drivers.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/etnaviv: fix crash in GPU suspend when init failed due to buffer placement
Lucas Stach [Mon, 23 Jul 2018 12:27:23 +0000 (14:27 +0200)]
drm/etnaviv: fix crash in GPU suspend when init failed due to buffer placement

When the suballocator was unable to provide a suitable buffer for the MMUv1
linear window, we roll back the GPU initialization. As the GPU is runtime
resumed at that point we need to clear the kernel cmdbuf suballoc entry to
properly skip any attempt to manipulate the cmdbuf when the GPU gets shut
down in the runtime suspend later on.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
6 years agodrm/etnaviv: change return type to vm_fault_t
Souptick Joarder [Tue, 29 May 2018 13:47:27 +0000 (19:17 +0530)]
drm/etnaviv: change return type to vm_fault_t

Use new return type vm_fault_t for fault handler. For
now, this is just documenting that the function returns
a VM_FAULT value rather than an errno. Once all instances
are converted, vm_fault_t will become a distinct type.

Ref- commit 1c8f422059ae ("mm: change return type to vm_fault_t")

Previously vm_insert_page() returns err which driver
mapped into VM_FAULT_* type. The new function
vmf_insert_page() will replace this inefficiency by
returning VM_FAULT_* type.

vmf_error() is the newly introduce inline function
in 4.17-rc6.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
6 years agodrm/etnaviv: protect sched job submission with fence mutex
Lucas Stach [Fri, 25 May 2018 14:51:25 +0000 (16:51 +0200)]
drm/etnaviv: protect sched job submission with fence mutex

The documentation of drm_sched_job_init and drm_sched_entity_push_job has
been clarified. Both functions should be called under a shared lock, to
avoid jobs getting pushed into the scheduler queue in a different order
than their sched_fence seqnos, which will confuse checks that are looking
at the seqnos to infer information about completion order.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
6 years agodrm/etnaviv: mmuv2: use memset32 to init scratch page
Philipp Zabel [Tue, 15 May 2018 14:09:15 +0000 (16:09 +0200)]
drm/etnaviv: mmuv2: use memset32 to init scratch page

Replace the open-coded scratch page initialization loop with memset32

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
6 years agodrm/i2c: tda998x: move tda998x_set_config() into tda998x_create()
Russell King [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: move tda998x_set_config() into tda998x_create()

Move the non-DT configuration of the TDA998x into tda998x_create()
so that we do all setup in one place.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable
Peter Rosin [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable

This fits better with the drm_bridge callbacks for when this
driver becomes a drm_bridge.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
[edited by rmk to just split the tda998x_encoder_dpms() function
 and restore the double-disable protection we originally had,
 preserving original behaviour.]
Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/i2c: tda998x: find the drm_device via the drm_connector
Peter Rosin [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: find the drm_device via the drm_connector

This prepares for being a drm_bridge which will not register the
encoder. That makes the connector the better choice.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agoMerge branch 'drm-armada-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into...
Dave Airlie [Tue, 31 Jul 2018 23:02:12 +0000 (09:02 +1000)]
Merge branch 'drm-armada-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next

This set of changes migrates Armada DRM from legacy modeset to atomic
modeset.  This is everything from the "Transition Armada DRM planes to
atomic state" and "Finish Armada DRM transition to atomic modeset"
patch sets as posted on drm-devel, excluding the "Finish Armada DRM DT
support" series.

These series did not evoke any comments - if there are any, these can
be addressed via follow up patches.

Developed and tested on Dove Cubox with xf86-video-armada including the
overlay plane, and also tested with the tools in libdrm.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180730110543.GA30664@rmk-PC.armlinux.org.uk
6 years agoMerge tag 'drm-msm-next-2018-07-30' of git://people.freedesktop.org/~robclark/linux...
Dave Airlie [Tue, 31 Jul 2018 22:52:15 +0000 (08:52 +1000)]
Merge tag 'drm-msm-next-2018-07-30' of git://people.freedesktop.org/~robclark/linux into drm-next

A bit larger this time around, due to introduction of "dpu1" support
for the display controller in sdm845 and beyond.  This has been on
list and undergoing refactoring since Feb (going from ~110kloc to
~30kloc), and all my review complaints have been addressed, so I'd be
happy to see this upstream so further feature work can procede on top
of upstream.

Also includes the gpu coredump support, which should be useful for
debugging gpu crashes.  And various other misc fixes and such.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGv-8y3zguY0Mj1vh=o+vrv_bJ8AwZ96wBXYPvMeQT2XcA@mail.gmail.com
6 years agodrm/arm/hdlcd: Reject atomic commits that disable only the plane
Liviu Dudau [Mon, 23 Jul 2018 11:05:53 +0000 (12:05 +0100)]
drm/arm/hdlcd: Reject atomic commits that disable only the plane

The HDLCD engine needs an active plane while the CRTC is active, as
it will start scanning out data from HDLCD_REG_FB_BASE once it gets
enabled. Make sure that the only available plane doesn't get disabled
while the CRTC remains active, as this will scanout invalid data.

Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
6 years agodrm: arm: hdlcd: Use drm_atomic_helper_shutdown() to disable planes on removal
Laurent Pinchart [Wed, 17 Jan 2018 21:55:28 +0000 (23:55 +0200)]
drm: arm: hdlcd: Use drm_atomic_helper_shutdown() to disable planes on removal

The plane cleanup handler currently calls drm_plane_helper_disable(),
which is a legacy helper function. Replace it with a call to
drm_atomic_helper_shutdown() at removal time. The plane .destroy()
handler now consisting only of a call to drm_plane_cleanup(), replace it
with direct calls to that function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
6 years agodrm: arm: hdlcd: Don't destroy plane manually in hdlcd_setup_crtc()
Laurent Pinchart [Wed, 17 Jan 2018 21:55:27 +0000 (23:55 +0200)]
drm: arm: hdlcd: Don't destroy plane manually in hdlcd_setup_crtc()

The top-level error handler calls drm_mode_config_cleanup() which will
destroy all planes. There's no need to destroy them manually in lower
error handlers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
6 years agodrm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Fri, 8 Dec 2017 19:37:35 +0000 (20:37 +0100)]
drm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini()

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

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
6 years agodrm/arm/hdlcd: Use drm_mode_config_helper_suspend/resume()
Noralf Trønnes [Fri, 8 Dec 2017 19:37:34 +0000 (20:37 +0100)]
drm/arm/hdlcd: Use drm_mode_config_helper_suspend/resume()

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

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
6 years agoMerge branch 'drm-udl-next' of git://people.freedesktop.org/~airlied/linux into drm...
Dave Airlie [Mon, 30 Jul 2018 22:24:02 +0000 (08:24 +1000)]
Merge branch 'drm-udl-next' of git://people.freedesktop.org/~airlied/linux into drm-next

A set of cleanups and fixes for Mikulas for using udl on arm boards.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CAPM=9twQNgrmfe0=Okq1NTgWHRQXy+AzeDy8A0p_-y856p4vtA@mail.gmail.com
6 years agoudl-kms: dont spam the syslog with debug messages
Mikulas Patocka [Sun, 3 Jun 2018 14:41:03 +0000 (16:41 +0200)]
udl-kms: dont spam the syslog with debug messages

The udl kms driver writes messages to the syslog whenever some application
opens or closes /dev/fb0 and whenever the user switches between the
Xserver and the console.

This patch changes the priority of these messages to debug.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoudl-kms: use spin_lock_irq instead of spin_lock_irqsave
Mikulas Patocka [Sun, 3 Jun 2018 14:41:02 +0000 (16:41 +0200)]
udl-kms: use spin_lock_irq instead of spin_lock_irqsave

spin_lock_irqsave and spin_unlock_irqrestore is inteded to be called from
a context where it is unknown if interrupts are enabled or disabled (such
as interrupt handlers). From a process context, we should call
spin_lock_irq and spin_unlock_irq, that avoids the costly pushf and popf
instructions.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoudl-kms: avoid prefetch
Mikulas Patocka [Sun, 3 Jun 2018 14:41:01 +0000 (16:41 +0200)]
udl-kms: avoid prefetch

Modern processors can detect linear memory accesses and prefetch data
automatically, so there's no need to use prefetch.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoudl-kms: avoid division
Mikulas Patocka [Sun, 3 Jun 2018 14:41:00 +0000 (16:41 +0200)]
udl-kms: avoid division

Division is slow, so it shouldn't be done by the pixel generating code.
The driver supports only 2 or 4 bytes per pixel, so we can replace
division with a shift.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoudl-kms: fix crash due to uninitialized memory
Mikulas Patocka [Sun, 3 Jun 2018 14:40:57 +0000 (16:40 +0200)]
udl-kms: fix crash due to uninitialized memory

We must use kzalloc when allocating the fb_deferred_io structure.
Otherwise, the field first_io is undefined and it causes a crash.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoudl-kms: handle allocation failure
Mikulas Patocka [Sun, 3 Jun 2018 14:40:56 +0000 (16:40 +0200)]
udl-kms: handle allocation failure

Allocations larger than PAGE_ALLOC_COSTLY_ORDER are unreliable and they
may fail anytime. This patch fixes the udl kms driver so that when a large
alloactions fails, it tries to do multiple smaller allocations.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoudl-kms: change down_interruptible to down
Mikulas Patocka [Sun, 3 Jun 2018 14:40:55 +0000 (16:40 +0200)]
udl-kms: change down_interruptible to down

If we leave urbs around, it causes not only leak, but also memory
corruption. This patch fixes the function udl_free_urb_list, so that it
always waits for all urbs that are in progress.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agodt-bindings: msm/disp: Add bindings for Snapdragon 845 DPU
Jeykumar Sankaran [Fri, 20 Jul 2018 20:43:09 +0000 (16:43 -0400)]
dt-bindings: msm/disp: Add bindings for Snapdragon 845 DPU

Adds bindings for Snapdragon 845 display processing unit

Changes in v2:
- Use SoC specific compatibles for mdss and dpu (Rob Herring)
- Use assigned-clocks to set initial clock frequency (Rob Herring)

Changes in v3 (all suggested by Rob Herring):
- Rename mdss_phys to mdss
- Correct description for clocks/assigned-clocks
- Rename mdp_phys to mdp
- Rename vbif_phys to vbif
- Remove redundant interrupt-parent from mdss_mdp
- Fully specify 'ranges' and use relative reg address in mdss_mdp

Cc: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Rajesh Yadav <ryadav@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodt-bindings: msm/dsi: Add mdp transfer time to msm dsi binding
Jeykumar Sankaran [Fri, 20 Jul 2018 20:42:52 +0000 (16:42 -0400)]
dt-bindings: msm/dsi: Add mdp transfer time to msm dsi binding

Adds mdp transfer time to msm dsi binding

Changes in v3:
- Added Rob's R-b

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Rajesh Yadav <ryadav@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/disp/dpu: Mark a handful of functions as static
Jordan Crouse [Thu, 26 Jul 2018 20:30:14 +0000 (14:30 -0600)]
drm/msm/disp/dpu: Mark a handful of functions as static

Mark a number of static functions that are only unsed in the file
that defines them and remove the prototypes from the headers where
needed.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/disp/dpu: Remove unused functions from dpu_formats.c
Jordan Crouse [Thu, 26 Jul 2018 20:30:13 +0000 (14:30 -0600)]
drm/msm/disp/dpu: Remove unused functions from dpu_formats.c

Remove dpu_format_get_block_size, dpu_format_get_framebuffer_size,
dpu_set_scaler_v2 and dpu_copy_formats they are unused and unneeded.

Signed-off-by: Jordan Crouse <jcrouse@codeauorora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/disp/dpu: Remove dpu_kms_utils
Jordan Crouse [Thu, 26 Jul 2018 20:30:12 +0000 (14:30 -0600)]
drm/msm/disp/dpu: Remove dpu_kms_utils

None of the functions in dpu_kms_utils.c seem to be used so
remove them all.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/disp/dpu: Remove unused code from drm_crtc.c
Jordan Crouse [Thu, 26 Jul 2018 20:30:11 +0000 (14:30 -0600)]
drm/msm/disp/dpu: Remove unused code from drm_crtc.c

Remove a chunk of unused code from drm_crtc.c, namely
dpu_crtc_res_add, dpu_crtc_res_get, dpu_crtc_res_put
and associated static functions.

Also zap dpu_crtc_event_queue(), helper functions
and members.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/disp/dpu: Remove unused code from drm_encoder.c
Jordan Crouse [Thu, 26 Jul 2018 20:30:10 +0000 (14:30 -0600)]
drm/msm/disp/dpu: Remove unused code from drm_encoder.c

Remove dpu_encoder_check_mode and dpu_encoder_helper_hw_release
frmo drm_encoder.c as they appear to be unused.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: Replace PTR_RET with PTR_ERR_OR_ZERO
Gustavo A. R. Silva [Mon, 23 Jul 2018 18:46:55 +0000 (13:46 -0500)]
drm/msm: Replace PTR_RET with PTR_ERR_OR_ZERO

PTR_RET is deprecated, use PTR_ERR_OR_ZERO instead.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: mark PM functions as __maybe_unused
Arnd Bergmann [Tue, 24 Jul 2018 15:35:37 +0000 (17:35 +0200)]
drm/msm: mark PM functions as __maybe_unused

The suspend/resume functions are not referenced when power
management is disabled:

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c:1288:12: error: 'dpu_runtime_resume' defined but not used [-Werror=unused-function]
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c:1261:12: error: 'dpu_runtime_suspend' defined but not used [-Werror=unused-function]

This marks them as __maybe_unused to let the compiler
drop the functions without complaining.

Fixes: 591225291ca2 ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/dpu: fix mismatch in function argument.
zhong jiang [Tue, 24 Jul 2018 11:51:59 +0000 (19:51 +0800)]
drm/msm/dpu: fix mismatch in function argument.

Fix the sparse error. the dpu_rm_init declaration is not consistent
with the implement.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
[robclark un-typo'd subject line]
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/gpu: avoid deprecated do_gettimeofday
Arnd Bergmann [Thu, 26 Jul 2018 12:39:25 +0000 (14:39 +0200)]
drm/msm/gpu: avoid deprecated do_gettimeofday

All users of do_gettimeofday() have been removed, but this one recently
crept in, along with an incorrect printing of the microseconds portion.

This converts it to using ktime_get_real_timespec64() as a direct
replacement, and adds the leading zeroes. I considered using monotonic
times (ktime_get()) instead, but as this timestamp appears to only
be used for humans rather than compared with other timestamps, the
real time domain is probably good enough.

Fixes: e43b045e2c82 ("drm/msm/gpu: Capture the state of the GPU")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: dsi: Handle dual-channel for 6G as well
Sean Paul [Wed, 25 Jul 2018 20:34:45 +0000 (16:34 -0400)]
drm/msm: dsi: Handle dual-channel for 6G as well

This fixes up a collision between introducing dual-channel support and
the dsi refactors. This patch applies the same dual-channel
considerations and pclk calculations to both v2 and 6G, with a bit of
abstracting for good measure.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: dpu: Use clock-names instead of assigned-clock-names
Sean Paul [Wed, 25 Jul 2018 20:34:44 +0000 (16:34 -0400)]
drm/msm: dpu: Use clock-names instead of assigned-clock-names

In these cases, we want to enumerate _all_ clocks, not just the ones
that are assigned a rate.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: dpu: Use 'vsync' instead of 'vsync_clk' in cmdmode encoder
Sean Paul [Wed, 25 Jul 2018 20:34:43 +0000 (16:34 -0400)]
drm/msm: dpu: Use 'vsync' instead of 'vsync_clk' in cmdmode encoder

Should work with the legacy handling in of, but we shouldn't rely on
that.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/gpu: Add the buffer objects from the submit to the crash dump
Jordan Crouse [Tue, 24 Jul 2018 16:33:31 +0000 (10:33 -0600)]
drm/msm/gpu: Add the buffer objects from the submit to the crash dump

For hangs, dump copy out the contents of the buffer objects attached to the
guilty submission and print them in the crash dump report.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/adreno: Add a5xx specific registers for the GPU state
Jordan Crouse [Tue, 24 Jul 2018 16:33:30 +0000 (10:33 -0600)]
drm/msm/adreno: Add a5xx specific registers for the GPU state

HLSQ, SP and TP registers are only accessible from a special
aperture and to make matters worse the aperture is blocked from
the CPU on targets that can support secure rendering. Luckily the
GPU hardware has its own purpose built register dumper that can
access the registers from the aperture. Add a5xx specific code
to program the crashdumper and retrieve the wayward registers
and dump them for the crash state.

Also, remove a block of registers the regular CPU accessible
list that aren't useful for debug which helps reduce the size
of the crash state file by a goodly amount.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/adreno: Add ringbuffer data to the GPU state
Jordan Crouse [Tue, 24 Jul 2018 16:33:29 +0000 (10:33 -0600)]
drm/msm/adreno: Add ringbuffer data to the GPU state

Add the contents of each ringbuffer to the GPU state and dump the
data in the crash file encoded with ascii85. To save space only
the used portions of the ringbuffer are dumped.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/adreno: Convert the show/crash file format
Jordan Crouse [Tue, 24 Jul 2018 16:33:28 +0000 (10:33 -0600)]
drm/msm/adreno: Convert the show/crash file format

Convert the format of the 'show' debugfs file and the crash
dump to a  format resembling YAML. This should be easier to
parse and be more flexible for future changes and expansions.

v2: Use a standard .rst for the msm crashdump documentation

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/gpu: Capture the GPU state on a GPU hang
Jordan Crouse [Tue, 24 Jul 2018 16:33:27 +0000 (10:33 -0600)]
drm/msm/gpu: Capture the GPU state on a GPU hang

Capture the GPU state on a GPU hang and store it for later playback
via the devcoredump facility. Only one crash state is stored at a
time on the assumption that the first hang is usually the most
interesting. The existing crash state can be cleared after capturing
it and then a new one will be captured on the next hang.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/gpu: Rearrange the code that collects the task during a hang
Jordan Crouse [Tue, 24 Jul 2018 16:33:26 +0000 (10:33 -0600)]
drm/msm/gpu: Rearrange the code that collects the task during a hang

Do a bit of cleanup to prepare for upcoming changes to pass the
hanging task comm and cmdline to the crash dump function.

v2: Use GFP_ATOMIC while holding the rcu lock per Chris Wilson

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/gpu: Convert the GPU show function to use the GPU state
Jordan Crouse [Tue, 24 Jul 2018 16:33:25 +0000 (10:33 -0600)]
drm/msm/gpu: Convert the GPU show function to use the GPU state

Convert the existing GPU show function to use the GPU state to
dump the information rather than reading it directly from the hardware.
This will require an additional step to capture the state before
dumping it for the existing nodes but it will greatly facilitate reusing
the same code for dumping a previously captured state from a GPU hang.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/gpu: Capture the state of the GPU
Jordan Crouse [Tue, 24 Jul 2018 16:33:24 +0000 (10:33 -0600)]
drm/msm/gpu: Capture the state of the GPU

Add the infrastructure to capture the current state of the GPU and
store it in memory so that it can be dumped later.

For now grab the same basic ringbuffer information and registers
that are provided by the debugfs 'gpu' node but obviously this should
be extended to capture a much larger set of GPU information.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm: Add puts callback for the coredump printer
Jordan Crouse [Tue, 24 Jul 2018 16:33:23 +0000 (10:33 -0600)]
drm: Add puts callback for the coredump printer

Add a puts function for the coredump printer to bypass printf()
for constant strings for a speed boost. Reorganize the
coredump printf callback to share as much code as possible.

v2: Try to reuse code between print and puts as suggested by
    Chris Wilson

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm: Add a -puts() function for the seq_file printer
Jordan Crouse [Tue, 24 Jul 2018 16:33:22 +0000 (10:33 -0600)]
drm: Add a -puts() function for the seq_file printer

Add a puts() function to use seq_puts() to help speed up
up print time for constant strings.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm: Add drm_puts() to complement drm_printf()
Jordan Crouse [Tue, 24 Jul 2018 16:33:21 +0000 (10:33 -0600)]
drm: Add drm_puts() to complement drm_printf()

Add drm_puts() for a much faster path to print constant strings
into a drm_printer object with memcpy and friends. This can
have seconds off of really large outputs such as GPU dumps.

If the drm_printer object supports a custom puts function then
use that otherwise fall back to the slower legacy printf call.

v2: Add documentation for drm_puts() per Daniel Vetter

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
[robclark fix minor htmldocs warning]
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm: drm_printer: Add printer for devcoredump
Jordan Crouse [Tue, 24 Jul 2018 16:33:20 +0000 (10:33 -0600)]
drm: drm_printer: Add printer for devcoredump

Add a drm printer suitable for use with the read callback for
devcoredump or other suitable buffer based output format that
isn't otherwise covered by seq_file.

v2: Add improved documentation per Daniel Vetter

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agoinclude: Move ascii85 functions from i915 to linux/ascii85.h
Jordan Crouse [Tue, 24 Jul 2018 16:33:19 +0000 (10:33 -0600)]
include: Move ascii85 functions from i915 to linux/ascii85.h

The i915 DRM driver very cleverly used ascii85 encoding for their
GPU state file. Move the encode functions to a general header file to
support other drivers that might be interested in the same
functionality.

v4: Make the return value const char * as suggested by Chris Wilson
v3: Fix error_puts -> err_puts pointed out by the 01.org bot
v2: Update API to be cleaner for the caller as suggested by Chris Wilson

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/armada: remove obsolete fb unreferencing kfifo and workqueue
Russell King [Mon, 30 Jul 2018 10:53:06 +0000 (11:53 +0100)]
drm/armada: remove obsolete fb unreferencing kfifo and workqueue

Remove the obsolete fb unreferencing system that is no longer used
since we've transitioned to atomic modeset.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: remove unnecessary armada_plane structure
Russell King [Mon, 30 Jul 2018 10:53:06 +0000 (11:53 +0100)]
drm/armada: remove unnecessary armada_plane structure

We no longer require a private armada_plane structure, so eliminate
it, and use the drm_plane structure directly.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: remove unnecessary armada_ovl_plane structure
Russell King [Mon, 30 Jul 2018 10:53:06 +0000 (11:53 +0100)]
drm/armada: remove unnecessary armada_ovl_plane structure

We no longer need a private plane structure, so get rid of it.  Use the
drm_plane structure directly.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: update primary framebuffer parameters on mode change
Russell King [Mon, 30 Jul 2018 10:53:06 +0000 (11:53 +0100)]
drm/armada: update primary framebuffer parameters on mode change

The framebuffer base address and toggling mode needs to be updated
when the interlaced flag for mode changes is updated.  Arrange to
reprogram these parameters when only the mode has changed.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: update planes after the dumb frame is complete
Russell King [Mon, 30 Jul 2018 10:53:06 +0000 (11:53 +0100)]
drm/armada: update planes after the dumb frame is complete

Write out the plane updates after the dumb frame has completed, but
just before the blank period.  This allows all the plane updates to
be performed in a flicker-free non-tearing manner.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: switch overlay plane to atomic modeset
Russell King [Mon, 30 Jul 2018 10:53:06 +0000 (11:53 +0100)]
drm/armada: switch overlay plane to atomic modeset

Switch the overlay plane away from the transitional helpers and legacy
methods, and use atomic helpers instead to implement the legacy
set_plane ioctl methods.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: switch primary plane to atomic modeset
Russell King [Mon, 30 Jul 2018 10:53:06 +0000 (11:53 +0100)]
drm/armada: switch primary plane to atomic modeset

Switch the primary plane away from the transitional helpers, and
use the atomic helpers instead to implement the legacy set_plane
ioctl call for this plane.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: switch legacy modeset to atomic modeset
Russell King [Mon, 30 Jul 2018 10:53:06 +0000 (11:53 +0100)]
drm/armada: switch legacy modeset to atomic modeset

Switch the legacy set_config() method to use the atomic modeset
helper, which allows us to get rid of the legacy dpms, prepare,
commit, mode_set, mode_set_base and disable helper methods.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: enable atomic modeset support
Russell King [Mon, 30 Jul 2018 10:53:06 +0000 (11:53 +0100)]
drm/armada: enable atomic modeset support

Enable atomic modeset helpers, and internal DRM use of atomic modeset
with armada-drm.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: implement atomic_enable()/atomic_disable() methods
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: implement atomic_enable()/atomic_disable() methods

Implement the atomic_enable()/atomic_disable() methods used by the
atomic modeset helpers.  atomic_disable() will need some transitional
code during conversion to ensure proper ordering is maintained.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: unhook dpms state from armada_drm_crtc_update()
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: unhook dpms state from armada_drm_crtc_update()

Explicitly pass in the desired enable/disable state into
armada_drm_crtc_update() rather than having it use the DPMS state
stored in our crtc structure.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: push responsibility for clock management to backend
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: push responsibility for clock management to backend

Push responsibility for managing the clock during DPMS down into the
variant backend, rather than the CRTC layer having knowledge of its
state.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: handle atomic modeset crtc events
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: handle atomic modeset crtc events

Prepare handling for atomic modeset CRTC events.  Currently, using the
transition helpers, CRTC events do not exist, but once we switch to
proper atomic modeset, they have to be handled.

We queue an event for the next vblank in two places:
- armada_drm_crtc_atomic_flush() provided we aren't doing an
  atomic modeset.
- armada_drm_crtc_commit() if we are committing a modeset.

This ensures that the event is sent at the correct time (after all
updates have been written to the hardware and after the following
vblank.)

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: clean up SPU_ADV_REG
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: clean up SPU_ADV_REG

Rather than writing all bits of SPU_ADV_REG on modeset, only write
what we need to change, and initialise the register in the variant
initialisation.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: update debug in armada_drm_crtc_mode_set_nofb()
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: update debug in armada_drm_crtc_mode_set_nofb()

Update debug to use KMS level, and print the mode using the standard
format for mode lines, but print the adjusted CRTC parameters as
that's what we will be programming for.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: move sync signal polarity to mode_set_nofb() method
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: move sync signal polarity to mode_set_nofb() method

For atomic modeset, we need to set the sync signal polarities from the
CRTC state structure rather than the legacy mode structure stored in
CRTC.  In any case, we should update this from our mode_set_nofb()
method, rather than the commit() method.  Move it there, and ensure
that armada_drm_crtc_update() will not overwrite these bits.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: push interlace calculation into armada_drm_plane_calc()
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: push interlace calculation into armada_drm_plane_calc()

Push the interlaced frame calculation down into armada_drm_plane_calc()
which needs to apply the same correction for both the overlay and
primary planes.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: provide pitches from armada_drm_plane_calc_addrs()
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: provide pitches from armada_drm_plane_calc_addrs()

Provide the framebuffer pitches from armada_drm_plane_calc_addrs() as
well as the base addresses for each plane.  Since this is now about
more than just addresses, rename to armada_drm_plane_calc().

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: pass plane state into armada_drm_plane_calc_addrs()
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: pass plane state into armada_drm_plane_calc_addrs()

armada_drm_plane_calc_addrs() gets all its information from the plane
state, so it makes sense to pass the plane state pointer down into this
function, rather than extracting the information in identical ways,
sometimes a couple of layers up.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: move armada_drm_mode_config_funcs to armada_drv.c
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: move armada_drm_mode_config_funcs to armada_drv.c

Move the armada_drm_mode_config_funcs to armada_drv.c, since this now
has less to do with FBs than it does with general mode configuration.
In doing so, we need to make armada_fb_create() visible to armada_drv.c,
which reveals a function name clash with armada_fbdev.c.  Rename the
version in armada_fbdev.c.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: add plane colorspace properties
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: add plane colorspace properties

Use the DRM standard plane properties for specifying the YUV
colour encoding parameter.  Our colour range is fixed at limited
range.

Since we are transitioning to atomic modeset, we need to explicitly
add handling of these properties to our atomic_set_property() method,
but once the transition is complete, these will be removed.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: remove crtc YUV colourspace properties
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: remove crtc YUV colourspace properties

Remove the unused CRTC colourspace properties - userspace does not make
use of these.  In any case, these are not a property of the CRTC, since
they demonstrably only affect the video (overlay) plane, irrespective
of the format of the graphics (primary) plane.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: move colorkey properties into overlay plane state
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: move colorkey properties into overlay plane state

Move the overlay plane colorkey properties into the plane state,
keeping the existing driver behaviour to avoid breaking userspace.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: move CBSH properties into overlay plane state
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: move CBSH properties into overlay plane state

Move the contrast, brightness, and saturation properties to the overlay
plane state structure, and call our overlay commit function to update
the hardware via the planes atomic_update() method.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: move plane works to overlay
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: move plane works to overlay

Only overlay makes use of these now, so move these to the overlay code.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: move primary plane to separate file
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: move primary plane to separate file

Split out the primary plane support; this is now entirely separate from
the CRTC support.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: use old_state for update tracking in atomic_update()
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: use old_state for update tracking in atomic_update()

Rather than tracking the register state, we can now check the previous
state and decide which registers need updating from that since the old
plane state indicates the previous state which was programmed into the
hardware.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: remove temporary crtc state
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: remove temporary crtc state

Now that we have the CRTC using the atomic modeset transitional helper,
there is no need to build a temporary crtc state anymore - we can use
the CRTC atomic state directly.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: convert overlay plane to atomic state
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: convert overlay plane to atomic state

The overlay plane support updates asynchronously to the request, but the
drm_plane_helper_update() transitional helper waits for a vblank event
before releasing the framebuffer.  Using the transitional helper would
make the call block, which would introduce a performance regression.

Convert the overlay plane update to use the atomic state structures and
methods for the plane, but implement our own legacy update method
rather than the transitional helper.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: convert page_flip to use primary plane atomic_update()
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: convert page_flip to use primary plane atomic_update()

page_flip requests happen asynchronously, so we can't wait on the
vblank event before returning to userspace, as the transitional plane
update helper would do.  Craft our own implementation that keeps the
asynchronous behaviour of this request, while making use of the atomic
infrastructure for the primary plane update.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: convert primary plane to atomic state
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: convert primary plane to atomic state

Convert the primary plane as a whole to use its atomic state and the
transitional helpers.  The CRTC is also switched to use the transitional
helpers for mode_set() and mode_set_base().

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: reset all atomic state during driver initialisation
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: reset all atomic state during driver initialisation

Reset the atomic state of any converted components during driver
initialisation to ensure that we have the atomic state initialised for
any component converted to atomic modeset.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: merge armada_drm_gra_plane_regs() into only caller
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: merge armada_drm_gra_plane_regs() into only caller

armada_drm_gra_plane_regs() is now only ever called from within
armada_drm_primary_update_state(), so merge it into this function.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: use core of primary update_plane for mode set
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: use core of primary update_plane for mode set

Use the core of the update_plane method to configure the primary plane
within mode_set() rather than duplicating this code.  This moves us
closer to the same code structure that the atomic modeset transitional
helpers will use.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: move mode set vblank handling and disable/enable
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: move mode set vblank handling and disable/enable

Move the mode set vblank handling and controller enable/disable to the
prepare() and commit() callbacks.  This will be needed when we move to
mode_set_nofb() as we should not enable the controller without the
plane coordinates and location having been properly updated.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: add rectangle helpers
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: add rectangle helpers

Add helpers to convert rectangle width/height and x/y to register
values.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: clean up armada_drm_crtc_page_flip()
Russell King [Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)]
drm/armada: clean up armada_drm_crtc_page_flip()

drm_mode_page_flip_ioctl() already takes care of checking the
framebuffer format, and also assigns primary->fb after a successful
call to this handler.  These are both redundant, and can be removed.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: Adding new typedef vm_fault_t
Souptick Joarder [Mon, 30 Jul 2018 10:52:31 +0000 (11:52 +0100)]
drm/armada: Adding new typedef vm_fault_t

Use new return type vm_fault_t for fault handler in struct
vm_operations_struct. For now, this is just documenting that the
function returns a VM_FAULT value rather than an errno. Once all
instances are converted, vm_fault_t will become a distinct type.

commit 1c8f422059ae ("mm: change return type to vm_fault_t")

Previously vm_insert_pfn() returns err which driver mapped into
VM_FAULT_* type. The new function vmf_insert_pfn() will replace this
inefficiency by returning VM_FAULT_* type.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agodrm/armada: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Mon, 30 Jul 2018 10:52:31 +0000 (11:52 +0100)]
drm/armada: Replace drm_dev_unref with drm_dev_put

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

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
6 years agoBackMerge v4.18-rc7 into drm-next
Dave Airlie [Mon, 30 Jul 2018 00:39:22 +0000 (10:39 +1000)]
BackMerge v4.18-rc7 into drm-next

rmk requested this for armada and I think we've had a few
conflicts build up.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoMerge tag 'drm-amdkfd-next-2018-07-28' of git://people.freedesktop.org/~gabbayo/linux...
Dave Airlie [Mon, 30 Jul 2018 00:23:40 +0000 (10:23 +1000)]
Merge tag 'drm-amdkfd-next-2018-07-28' of git://people.freedesktop.org/~gabbayo/linux into drm-next

This is amdkfd pull for 4.19. The major changes are:

- Add Raven support. Raven refers to Ryzen APUs with integrated GFXv9 GPU.
- Integrate GPU reset support

In addition, there are a couple of small fixes and improvements, such as:

- Better handling and reporting to user of VM faults
- Fix race upon context restore
- Allow the user to use specific Compute Units
- Basic power management

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180728122306.GA5235@ogabbay-vm