Jordan Crouse [Mon, 28 Nov 2016 19:28:31 +0000 (12:28 -0700)]
drm/msm: Remove 'src_clk' from adreno configuration
The adreno code inherited a silly workaround from downstream
from the bad old days before decent clock control. grp_clk[0]
(named 'src_clk') doesn't actually exist - it was used as a proxy
for whatever the core clock actually was (usually 'core_clk').
All targets should be able to correctly request 'core_clk' and
get the right thing back so zap the anachronism and directly
use grp_clk[0] to control the clock rate.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Jordan Crouse [Mon, 28 Nov 2016 19:28:30 +0000 (12:28 -0700)]
drm/msm: gpu: Add OUT_TYPE4 and OUT_TYPE7
Add helper functions for TYPE4 and TYPE7 ME opcodes that replace
TYPE0 and TYPE3 starting with the A5XX targets.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Jordan Crouse [Mon, 28 Nov 2016 19:28:29 +0000 (12:28 -0700)]
drm/msm: Add adreno_gpu_write64()
Add a new generic function to write a "64" bit value. This isn't
actually a 64 bit operation, it just writes the upper and lower
32 bit of a 64 bit value to a specified LO and HI register. If
a particular target doesn't support one of the registers it can
mark that register as SKIP and writes/reads from that register
will be quietly dropped.
This can be immediately put in place for the ringbuffer base and
the RPTR address. Both writes are converted to use
adreno_gpu_write64() with their respective high and low registers
and the high register appropriately marked as SKIP for both 32 bit
targets (a3xx and a4xx). When a5xx comes it will define valid target
registers for the 'hi' option and everything else will just work.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Jordan Crouse [Mon, 28 Nov 2016 19:28:28 +0000 (12:28 -0700)]
drm/msm: gpu Add new gpu register read/write functions
Add some new functions to manipulate GPU registers. gpu_read64 and
gpu_write64 can read/write a 64 bit value to two 32 bit registers.
For 4XX and older these are normally perfcounter registers, but
future targets will use 64 bit addressing so there will be many
more spots where a 64 bit read and write are needed.
gpu_rmw() does a read/modify/write on a 32 bit register given a mask
and bits to OR in.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Jordan Crouse [Mon, 28 Nov 2016 19:28:27 +0000 (12:28 -0700)]
drm/msm: gpu: Return error on hw_init failure
When the GPU hardware init function fails (like say, ME_INIT timed
out) return error instead of blindly continuing on. This gives us
a small chance of saving the system before it goes boom.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Jordan Crouse [Mon, 28 Nov 2016 19:28:26 +0000 (12:28 -0700)]
drm/msm: gpu: Cut down the list of "generic" registers to the ones we use
There are very few register accesses in the common code. Cut down
the list of common registers to just those that are used. This
saves const space and saves us the effort of maintaining registers
for A3XX and A4XX that don't exist or are unused.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Mon, 7 Nov 2016 19:53:49 +0000 (14:53 -0500)]
drm/msm: update generated headers
Pull in a5xx registers.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Fri, 11 Nov 2016 19:46:00 +0000 (14:46 -0500)]
drm/msm/adreno: move scratch register dumping to per-gen code
Scratch registers move, annoyingly enough, in a5xx. Move to
per-generation aNxx_recover() fxn.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Fri, 11 Nov 2016 16:08:45 +0000 (11:08 -0500)]
drm/msm/rd: support for 64b iova
For backwards compat, the rd format puts the high 32b after the size
field in the GPUADDR packet.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Fri, 11 Nov 2016 17:06:46 +0000 (12:06 -0500)]
drm/msm: convert iova to 64b
For a5xx the gpu is 64b so we need to change iova to 64b everywhere. On
the display side, iova is still 32b so it can ignore the upper bits.
(Although all the armv8 devices have an iommu that can map 64b pa to 32b
iova.)
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Mon, 7 Nov 2016 18:31:30 +0000 (13:31 -0500)]
drm/msm: set dma_mask properly
Previous value really only made sense on armv7 without LPAE. Everything
that supports more than 4g of memory also has iommu's that can map
anything.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Archit Taneja [Thu, 17 Nov 2016 06:42:03 +0000 (12:12 +0530)]
drm/msm: Remove bad calls to of_node_put()
In add_components_mdp, we parse the endpoints in MDP output ports
using the helper for_each_endpoint_of_node(). Our function calls
of_node_put() on the endpoint node before we iterate over the
next one. This is already done by the helper, and results in
trying to decrement the refcount twice.
Remove the extra of_node_put calls. This fixes warnings seen when
we try to insert the driver as a module on IFC6410.
Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Sat, 5 Nov 2016 14:43:55 +0000 (10:43 -0400)]
drm/msm/mdp5: move LM bounds check into plane->atomic_check()
The mode_config->max_{width,height} is for the maximum size of a fb, not
the max scanout limits (of the layer-mixer). It is legal, and in fact
common, to create a larger fb, only only scan-out a smaller part of it.
For example multi-monitor configurations for x11, or android wallpaper
layer (which is created larger than the screen resolution for fast
scrolling by just changing the src x/y coordinates).
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Sat, 5 Nov 2016 13:04:31 +0000 (09:04 -0400)]
drm/msm/mdp5: dump smp state on errors too
If the dumpstate modparam is enabled, for debugging error irq's, also
dump SMP state.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Wed, 26 Oct 2016 18:06:55 +0000 (14:06 -0400)]
drm/msm/mdp5: add debugfs to show smp block status
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Tue, 1 Nov 2016 20:35:32 +0000 (16:35 -0400)]
drm/msm/mdp5: handle SMP block allocations "atomically"
Previously, SMP block allocation was not checked in the plane's
atomic_check() fxn, so we could fail allocation SMP block allocation at
atomic_update() time. Re-work the block allocation to request blocks
during atomic_check(), but not update the hw until committing the atomic
update.
Since SMP blocks allocated at atomic_check() time, we need to manage the
SMP state as part of mdp5_state (global atomic state). This actually
ends up significantly simplifying the SMP management, as the SMP module
does not need to manage the intermediate state between assigning new
blocks before setting flush bits and releasing old blocks after vblank.
(The SMP registers and SMP allocation is not double-buffered, so newly
allocated blocks need to be updated in kms->prepare_commit() released
blocks in kms->complete_commit().)
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Tue, 1 Nov 2016 15:56:54 +0000 (11:56 -0400)]
drm/msm/mdp5: dynamically assign hw pipes to planes
(re)assign the hw pipes to planes based on required caps, and to handle
situations where we could not modify an in-use plane (ie. SMP block
reallocation).
This means all planes advertise the superset of formats and properties.
Userspace must (as always) use atomic TEST_ONLY step for atomic updates,
as not all planes may be available for use on every frame.
The mapping of hwpipe to plane is stored in mdp5_state, so that state
updates are atomically committed in the same way that plane/etc state
updates are managed. This is needed because the mdp5_plane_state keeps
a pointer to the hwpipe, and we don't want global state to become out
of sync with the plane state if an atomic update fails, we hit deadlock/
backoff scenario, etc. The use of state_lock keeps multiple parallel
updates which both re-assign hwpipes properly serialized.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Fri, 4 Nov 2016 18:50:08 +0000 (14:50 -0400)]
drm/msm/mdp5: add skeletal mdp5_state
Add basic state duplication/apply mechanism. Following commits will
move actual global hw state into this.
The state_lock allows multiple concurrent updates to proceed as long as
they don't both try to alter global state. The ww_mutex mechanism will
trigger backoff in case of deadlock between multiple threads trying to
update state.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Archit Taneja <architt@codeaurora.org>
Rob Clark [Fri, 4 Nov 2016 17:51:42 +0000 (13:51 -0400)]
drm/msm: subclass drm_atomic_state
This will give the kms backends a slot to stash their own hw specific
global state.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Tue, 1 Nov 2016 13:56:51 +0000 (09:56 -0400)]
drm/msm/mdp5: introduce mdp5_hw_pipe
Split out the hardware pipe specifics from mdp5_plane. To start, the hw
pipes are statically assigned to planes, but next step is to assign the
hw pipes during plane->atomic_check() based on requested caps (scaling,
YUV, etc). And then hw pipe re-assignment if required if required SMP
blocks changes.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Archit Taneja <architt@codeaurora.org>
Rob Clark [Fri, 4 Nov 2016 21:12:44 +0000 (17:12 -0400)]
drm/msm/mdp5: rip out mode_changed
It wasn't really doing the right thing if, for example, position or
height changed.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Tue, 1 Nov 2016 15:33:58 +0000 (11:33 -0400)]
drm/msm/mdp5: don't be so casty
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Tue, 1 Nov 2016 13:31:21 +0000 (09:31 -0400)]
drm/msm/mdp5: drop mdp5_plane::name
Just use plane->name now that it is a thing. In a following patch, once
we dynamically assign hw pipes to planes, it won't make sense to name
planes the way we do, so this also partly reduces churn in following
patch.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Mon, 31 Oct 2016 23:38:15 +0000 (19:38 -0400)]
drm/msm/mdp5: nuke mdp5_plane_complete_flip()
We can do this all from mdp5_plane_complete_commit(), so simplify things
a bit and drop mdp5_plane_complete_flip().
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Mon, 31 Oct 2016 20:05:22 +0000 (16:05 -0400)]
drm/msm/mdp5: drop mdp5_crtc::name
Plane's (pipes) can be assigned dynamically with atomic, so it doesn't
make much sense to name the pipe after it's primary plane.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Fri, 21 Oct 2016 16:42:30 +0000 (12:42 -0400)]
drm/msm/mdp5: small rename
These are really plane-id's, not crtc-id's. Only connection to CRTCs is
that they are used as primary-planes.
Current name is just legacy from when we only supported RGB/primary
planes. Lets pick a better name now.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Wed, 28 Sep 2016 23:58:32 +0000 (19:58 -0400)]
drm/msm: support multiple address spaces
We can have various combinations of 64b and 32b address space, ie. 64b
CPU but 32b display and gpu, or 64b CPU and GPU but 32b display. So
best to decouple the device iova's from mmap offset.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Wed, 2 Nov 2016 13:51:06 +0000 (09:51 -0400)]
drm/msm/mdp5: clip img size to src size
If fb dimensions are larger than what can be scanned out, but the src
dimensions are not, the hw can still handle this. So clip.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Tue, 1 Nov 2016 21:42:33 +0000 (17:42 -0400)]
drm/msm: use DRM_DEBUG_DRIVER()
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Mon, 24 Oct 2016 15:46:44 +0000 (11:46 -0400)]
drm/msm/mdp5: 8x16 actually has 8 mixer stages
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Wed, 19 Oct 2016 21:53:53 +0000 (17:53 -0400)]
drm/msm: update uapi header license
The same file in libdrm is, as is the tradition with the rest of libdrm,
etc, using an MIT license. To avoid complications in the future with
sync'ing the uapi header to libdrm, lets fix the license mismatch now
before there are any non-trivial commits from someone other than myself.
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Gabriel Laskar <gabriel@lse.epita.fr>
Cc: Mikko Rapeli <mikko.rapeli@iki.fi>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
Rob Clark [Mon, 17 Oct 2016 16:00:21 +0000 (12:00 -0400)]
drm/msm/mdp5: no scaling support on RGBn pipes for 8x16
Looks like cut/paste error from the other device cfgs (which do support
scaling on RGBn pipes).
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Thu, 13 Oct 2016 16:43:17 +0000 (12:43 -0400)]
drm/msm/mdp5: handle non-fullscreen base plane case
If the bottom-most layer is not fullscreen, we need to use the BASE
mixer stage for solid fill (ie. MDP5_CTL_BLEND_OP_FLAG_BORDER_OUT). The
blend_setup() code pretty much handled this already, we just had to
figure this out in _atomic_check() and assign the stages appropriately.
Also fix the case where there are zero enabled planes, where we also
need to enable BORDER_OUT.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Dave Airlie [Thu, 24 Nov 2016 23:55:33 +0000 (09:55 +1000)]
Merge branch 'drm-tda998x-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next
These updates:
* improve the robustness of the driver wrt races
* improve the compliance for sending infoframes and audio
* re-organise the function order in the driver to group like functions
together. (This unfortunately causes a conflict with the change in
drm-misc, but it should be trivial to solve, although it looks more
scarey than it really is - sfr has already sent two reports about
this, one earlier today.)
* simplify tda998x_audio_get_eld and DPMS handling
* power down sections of the chip that we never use
* add some initial preparation for supporting the CEC driver
* 'drm-tda998x-devel' of git://git.armlinux.org.uk/~rmk/linux-arm:
drm/i2c: tda998x: fix spelling mistake
drm/i2c: tda998x: allow sharing of the CEC device accesses
drm/i2c: tda998x: allow interrupt to be shared
drm/i2c: tda998x: power down pre-filter and color conversion
drm/i2c: tda998x: switch to boolean is_on
drm/i2c: tda998x: remove complexity from tda998x_audio_get_eld()
drm/i2c: tda998x: group audio functions together
drm/i2c: tda998x: separate connector initialisation
drm/i2c: tda998x: group connector functions and funcs together
drm/i2c: tda998x: move and rename tda998x_encoder_set_config()
drm/i2c: tda998x: correct function name in comments
drm/i2c: tda998x: only enable audio if supported by sink
drm/i2c: tda998x: only configure infoframes and audio if supported
drm/i2c: tda998x: avoid race when programming audio
drm/i2c: tda998x: avoid racy access to mode clock
drm/i2c: tda998x: avoid race in tda998x_encoder_mode_set()
drm/i2c: tda998x: move audio mutex initialisation
Dave Airlie [Thu, 24 Nov 2016 23:03:27 +0000 (09:03 +1000)]
Merge branch 'drm-armada-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next
Building on top of the MALI change previously merged, these changes:
* add tracing support for overlay updates
* refactor some of the plane support code
* de-midlayer the driver
* cleanups from other folk reviewing the code
* 'drm-armada-devel' of git://git.armlinux.org.uk/~rmk/linux-arm:
drm/armada: fix NULL pointer comparison warning
drm/armada: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
drm/armada: remove some dead code
drm/armada: mark symbols static where possible
drm/armada: de-midlayer armada
drm/armada: use common helper for plane base address
drm/armada: move setting primary plane position to armada_drm_primary_set()
drm/armada: split out primary plane update
drm/armada: move plane state to struct armada_plane
drm/armada: clean up armada_drm_plane_work_run()
drm/armada: add tracing support
Dave Airlie [Mon, 21 Nov 2016 01:42:17 +0000 (11:42 +1000)]
Merge tag 'drm-hisilicon-next-2016-11-17' of github.com/zourongrong/linux into drm-next
hibmc drm driver for hisilicon.
* tag 'drm-hisilicon-next-2016-11-17' of http://github.com/zourongrong/linux:
MAINTAINERS: Update HISILICON DRM entries
drm/hisilicon/hibmc: Add support for vblank interrupt
drm/hisilicon/hibmc: Add support for VDAC
drm/hisilicon/hibmc: Add support for display engine
drm/hisilicon/hibmc: Add support for frame buffer
drm/hisilicon/hibmc: Add video memory management
drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver
Colin Ian King [Mon, 14 Nov 2016 22:46:43 +0000 (22:46 +0000)]
drm/i2c: tda998x: fix spelling mistake
Trivial fix to spelling mistake "configutation" to "configuration"
in dev_err message
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Thu, 3 Nov 2016 10:16:17 +0000 (10:16 +0000)]
drm/i2c: tda998x: allow sharing of the CEC device accesses
cec_read() is non-atomic in the presence of other I2C bus transactions
to the same device. This presents a problem when we add support for
the TDA9950 CEC engine part - both drivers can be trying to access the
device.
Avoid the inherent problems by switching to i2c_transfer() instead,
which allows us to perform more than one bus transaction atomically.
As this means we will be using I2C transactions rather than SMBUS, we
have to check that the host supports I2C functionality.
Tested-by: Brian Starkey <brian.starkey@arm.com>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Thu, 3 Nov 2016 08:58:04 +0000 (08:58 +0000)]
drm/i2c: tda998x: allow interrupt to be shared
Some TDA998x contain several different I2C devices - there is the HDMI
encoder, and there is a TDA9950 CEC engine. These two share the same
interrupt signal.
In order to allow a driver for the CEC engine to work, we need to be
able to share the interrupt with the CEC driver, so convert the handler
and registration to allow this to happen.
Tested-by: Brian Starkey <brian.starkey@arm.com>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Thu, 3 Nov 2016 15:19:06 +0000 (15:19 +0000)]
drm/i2c: tda998x: power down pre-filter and color conversion
Disabling the pre-filter block of the TDA998x saves 40mW and the colour
conversion block saves 15mW. As we always disable these two blocks, we
can power these sections of the chip down to save 55mW of unnecessary
power consumption.
Tested-by: Brian Starkey <brian.starkey@arm.com>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Sun, 23 Oct 2016 10:39:04 +0000 (11:39 +0100)]
drm/i2c: tda998x: switch to boolean is_on
Rather than storing the DPMS mode (which will always be on or off) use a
boolean to store this instead.
Tested-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Sun, 23 Oct 2016 10:31:44 +0000 (11:31 +0100)]
drm/i2c: tda998x: remove complexity from tda998x_audio_get_eld()
tda998x_audio_get_eld() is needlessly complex - the connector associated
with the encoder is always our own priv->connector. Remove this
complexity, but ensure that there are no races when copying out the ELD.
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Sun, 23 Oct 2016 10:30:56 +0000 (11:30 +0100)]
drm/i2c: tda998x: group audio functions together
Group the TDA998x audio functions together rather than split between
two different locations in the file, keeping like code together.
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Sun, 23 Oct 2016 10:30:56 +0000 (11:30 +0100)]
drm/i2c: tda998x: separate connector initialisation
Separate out the connector initialisation from the rest of the drivers
initialisation.
Tested-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Sun, 23 Oct 2016 10:29:59 +0000 (11:29 +0100)]
drm/i2c: tda998x: group connector functions and funcs together
Group the TDA998x connector functions and funcs structures together
before the encoder support, rather than scattered amongst the rest of
the file. This keeps like code together.
Tested-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Sun, 23 Oct 2016 10:25:02 +0000 (11:25 +0100)]
drm/i2c: tda998x: move and rename tda998x_encoder_set_config()
The naming of tda998x_encoder_set_config() is a left-over from when
TDA998x was a slave encoder. Since this is part of the initialisation,
drop the _encoder from the name, and move it near tda998x_bind().
Tested-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Sun, 23 Oct 2016 10:24:22 +0000 (11:24 +0100)]
drm/i2c: tda998x: correct function name in comments
Correct two references to tda998x_connector_get_modes() which were
incorrectly referring to tda998x_encoder_get_modes().
Tested-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Wed, 2 Nov 2016 21:15:04 +0000 (21:15 +0000)]
drm/i2c: tda998x: only enable audio if supported by sink
Check for audio support by the attached sink by consulting the EDID
prior to enabling audio over the TMDS link. We must consult the EDID
after calling drm_helper_probe_single_connector_modes(), as this can
use an override EDID, or load a replacement EDID.
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Sun, 23 Oct 2016 10:32:42 +0000 (11:32 +0100)]
drm/i2c: tda998x: only configure infoframes and audio if supported
The CEA 861B specification indicates the situations when we are able to
send each infoframe based on the version of the EDID's CEA extension.
Update the tda998x driver to follow the CEA specification wrt sending
of infoframes.
Since we only support the generation of AVI version 2, this limits us
to CEA extension version 3, so we treat CEA extension version 2 as
CEA 861 (no infoframes, no audio.)
Tested-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Wed, 2 Nov 2016 21:38:34 +0000 (21:38 +0000)]
drm/i2c: tda998x: avoid race when programming audio
Avoid a race between programming audio and an in-progress mode set.
A mode set is complex, and disables the ability to send infoframes
to the sink, and is disruptive to audio - we have to mute the audio
FIFO while doing a mode set.
If an attempt is made to start up the audio side, we will undo the
audio FIFO mute before the mode set has completed.
Move the lock so that we prevent audio interfering with an in-progress
mode set.
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Sun, 23 Oct 2016 10:32:43 +0000 (11:32 +0100)]
drm/i2c: tda998x: avoid racy access to mode clock
Avoid a racy access to the mode clock by storing the current mode clock
during a mode set under the audio mutex. This allows us to access it
from the audio path in a safe way.
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Sun, 23 Oct 2016 10:31:44 +0000 (11:31 +0100)]
drm/i2c: tda998x: avoid race in tda998x_encoder_mode_set()
As priv->audio_params can now be changed at run time, we need to be more
careful about how we deal with a mode set. We must take the audio lock
while checking if there's a valid audio configuration.
However, it's slightly worse than that - during mode set, we mute the
audio, and it must not be unmuted until we have finished the mode set.
It is possible that the audio side may start while a mode set is in
progress, so take the audio_mutex lock around the whole mode setting
procedure.
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Thu, 17 Nov 2016 23:55:00 +0000 (23:55 +0000)]
drm/i2c: tda998x: move audio mutex initialisation
We will need the audio mutex initialised in all cases, so lets move this
to be early, rather than only being initialised for the DT case.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Rongrong Zou [Wed, 16 Nov 2016 12:58:51 +0000 (20:58 +0800)]
MAINTAINERS: Update HISILICON DRM entries
Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
Rongrong Zou [Wed, 16 Nov 2016 12:57:01 +0000 (20:57 +0800)]
drm/hisilicon/hibmc: Add support for vblank interrupt
Add vblank interrupt.
Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
Rongrong Zou [Wed, 16 Nov 2016 12:55:55 +0000 (20:55 +0800)]
drm/hisilicon/hibmc: Add support for VDAC
VDAC(Video Digital-to-Analog converter) converts the RGB diaital data
stream from DE to VGA analog signals.
Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
Rongrong Zou [Wed, 16 Nov 2016 12:54:52 +0000 (20:54 +0800)]
drm/hisilicon/hibmc: Add support for display engine
Add display engine function, crtc/plane is initialized here.
Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
Rongrong Zou [Wed, 16 Nov 2016 12:52:37 +0000 (20:52 +0800)]
drm/hisilicon/hibmc: Add support for frame buffer
Add support for fbdev and kms fb management.
Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
Rongrong Zou [Wed, 16 Nov 2016 13:31:51 +0000 (21:31 +0800)]
drm/hisilicon/hibmc: Add video memory management
Hibmc have 32m video memory which can be accessed through PCIe by host,
we use ttm to manage these memory.
Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
Rongrong Zou [Wed, 16 Nov 2016 09:15:34 +0000 (17:15 +0800)]
drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver
Add DRM master driver for Hisilicon Hibmc SoC which used for
Out-of-band management. Blow is the general hardware connection,
both the Hibmc and the host CPU are on the same mother board.
+----------+ +----------+
| | PCIe | Hibmc |
|host CPU( |<----->| display |
|arm64,x86)| |subsystem |
+----------+ +----------+
Signed-off-by: Rongrong Zou <zourongrong@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Acked-by: Sean Paul <seanpaul@chromium.org>
Dave Airlie [Thu, 17 Nov 2016 00:08:29 +0000 (10:08 +1000)]
Merge branch 'linux-4.10' of git://github.com/skeggsb/linux into drm-next
- GP102/GP104 devinit (suspend/resume, optimus) hang fix
- GP102/GP104 hardware cursor fix
- Fix for a regression on some non-MST monitors that was caused by the
MST work
- Workaround for certain laptops where ACPI sends display hotkey presses
on a modeset, causing gnome-settings-daemon to go into a continuous loop
* 'linux-4.10' of git://github.com/skeggsb/linux:
drm/nouveau/disp/gp102: rename from gp104
drm/nouveau/ce/gp102: rename from gp104
drm/nouveau/fb/gp102: rename from gp104
drm/nouveau/disp/gp102: fix cursor/overlay immediate channel indices
drm/nouveau/disp/nv50-: specify ctrl/user separately when constructing classes
drm/nouveau/disp/nv50-: split chid into chid.ctrl and chid.user
drm/nouveau: Intercept ACPI_VIDEO_NOTIFY_PROBE
drm/nouveau/devinit/gm200: drop pmu reset sequence
drm/nouveau/devinit/gm200: replace while loops with PTIMER-based timeout loops
drm/nouveau/pmu/gp102: initial implementation
drm/nouveau/pmu/gp100: initial implementation
drm/nouveau/pmu: execute reset before running devinit
drm/nouveau/pmu: move ucode handling into gt215 implementation
drm/nouveau/core: initial support for GP102
drm/nouveau/device/pci: fix oops if no mmu subdev present
drm/nouveau/kms/nv50: avoid touching DP_MSTM_CTRL if !DP_MST_CAP
Ravikant B Sharma [Tue, 8 Nov 2016 06:00:09 +0000 (11:30 +0530)]
drm/armada: fix NULL pointer comparison warning
Replace direct comparisons to NULL i.e.
'x == NULL' with '!x'. As per coding standard.
Signed-off-by: Ravikant B Sharma <ravikant.s2@samsung.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Stefan Christ [Sun, 13 Nov 2016 23:03:14 +0000 (00:03 +0100)]
drm/armada: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Christophe JAILLET [Sun, 30 Oct 2016 15:38:42 +0000 (16:38 +0100)]
drm/armada: remove some dead code
'dma_buf_map_attachment()' can not return NULL, so there is no need to
check for it.
Also add a space in order to improve layout.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Baoyou Xie [Sat, 22 Oct 2016 09:03:58 +0000 (17:03 +0800)]
drm/armada: mark symbols static where possible
We get 2 warnings when building kernel with W=1:
drivers/gpu/drm/armada/armada_gem.c:215:27: warning: no previous prototype for 'armada_gem_alloc_object' [-Wmissing-prototypes]
drivers/gpu/drm/armada/armada_gem.c:423:1: warning: no previous prototype for 'armada_gem_prime_map_dma_buf' [-Wmissing-prototypes]
In fact, both functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King [Tue, 1 Nov 2016 20:05:47 +0000 (20:05 +0000)]
drm/armada: de-midlayer armada
Now that the drm_connector_register() is gone from tda998x, we can
remove the mid-layer from armada-drm, eliminating the load, unload,
debugfs_init, and debugfs_cleanup callbacks from armada's drm_driver
structure. No functional changes.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Ben Skeggs [Wed, 16 Nov 2016 05:03:07 +0000 (15:03 +1000)]
drm/nouveau/disp/gp102: rename from gp104
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Wed, 16 Nov 2016 05:01:37 +0000 (15:01 +1000)]
drm/nouveau/ce/gp102: rename from gp104
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Wed, 16 Nov 2016 04:59:49 +0000 (14:59 +1000)]
drm/nouveau/fb/gp102: rename from gp104
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Wed, 16 Nov 2016 04:53:08 +0000 (14:53 +1000)]
drm/nouveau/disp/gp102: fix cursor/overlay immediate channel indices
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Wed, 16 Nov 2016 04:49:35 +0000 (14:49 +1000)]
drm/nouveau/disp/nv50-: specify ctrl/user separately when constructing classes
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Wed, 16 Nov 2016 04:38:44 +0000 (14:38 +1000)]
drm/nouveau/disp/nv50-: split chid into chid.ctrl and chid.user
GP102/GP104 make life difficult by redefining the channel indices for
some registers, but not others.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Hans de Goede [Wed, 9 Nov 2016 17:17:44 +0000 (18:17 +0100)]
drm/nouveau: Intercept ACPI_VIDEO_NOTIFY_PROBE
Various notebooks with nvidia GPUs generate an ACPI_VIDEO_NOTIFY_PROBE
acpi-video event when an external device gets plugged in (and again on
modesets on that connector), the default behavior in the acpi-video
driver for this is to send a KEY_SWITCHVIDEOMODE evdev event, which
causes e.g. gnome-settings-daemon to ask us to rescan the connectors
(good), but also causes g-s-d to switch to mirror mode on a newly plugged
monitor rather then using the monitor to extend the desktop (bad)
as KEY_SWITCHVIDEOMODE is supposed to switch between extend the desktop
vs mirror mode.
More troublesome are the repeated ACPI_VIDEO_NOTIFY_PROBE events on
changing the mode on the connector, which cause g-s-d to switch
between mirror/extend mode, which causes a new ACPI_VIDEO_NOTIFY_PROBE
event and we end up with an endless loop.
This commit fixes this by adding an acpi notifier block handler to
nouveau_display.c to intercept ACPI_VIDEO_NOTIFY_PROBE and:
1) Wake-up runtime suspended GPUs and call drm_helper_hpd_irq_event()
on them, this is necessary in some cases for the GPU to detect connector
hotplug events while runtime suspended
2) Return NOTIFY_BAD to stop acpi-video from emitting a bogus
KEY_SWITCHVIDEOMODE key-press event
There already is another acpi notifier block handler registered in
drivers/gpu/drm/nouveau/nvkm/engine/device/acpi.c, but that is not
suitable since that one gets unregistered on runtime suspend, and
we also want to intercept ACPI_VIDEO_NOTIFY_PROBE when runtime suspended.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Ben Skeggs [Wed, 9 Nov 2016 00:42:47 +0000 (10:42 +1000)]
drm/nouveau/devinit/gm200: drop pmu reset sequence
This sequence is incorrect for GP102/GP104 boards. This is now being
handled correctly by the PMU subdev during preinit();
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Tue, 8 Nov 2016 01:54:24 +0000 (11:54 +1000)]
drm/nouveau/devinit/gm200: replace while loops with PTIMER-based timeout loops
It appears to be safe to access PTIMER on an unposted board with newer
chipsets.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Wed, 9 Nov 2016 00:41:43 +0000 (10:41 +1000)]
drm/nouveau/pmu/gp102: initial implementation
GP102/GP104 require a harder reset of PMU prior to DEVINIT, or the IFR
image will hang.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Wed, 9 Nov 2016 00:37:56 +0000 (10:37 +1000)]
drm/nouveau/pmu/gp100: initial implementation
Just enough to hookup preinit reset(), which DEVINIT will depend on later.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Wed, 9 Nov 2016 00:39:08 +0000 (10:39 +1000)]
drm/nouveau/pmu: execute reset before running devinit
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Wed, 9 Nov 2016 00:23:55 +0000 (10:23 +1000)]
drm/nouveau/pmu: move ucode handling into gt215 implementation
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Mon, 7 Nov 2016 07:38:43 +0000 (17:38 +1000)]
drm/nouveau/core: initial support for GP102
From visual inspection of traces, what we currently implement appears to
be identical to GP104. Seems to work well enough too.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Mon, 7 Nov 2016 23:43:50 +0000 (09:43 +1000)]
drm/nouveau/device/pci: fix oops if no mmu subdev present
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs [Mon, 7 Nov 2016 04:51:53 +0000 (14:51 +1000)]
drm/nouveau/kms/nv50: avoid touching DP_MSTM_CTRL if !DP_MST_CAP
Fixes certain displays not being detected due to DPAUX errors.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Dave Airlie [Wed, 16 Nov 2016 23:43:56 +0000 (09:43 +1000)]
Merge tag 'drm-vc4-next-2016-11-16' of https://github.com/anholt/linux into drm-next
This pull request brings in fragment shader threading and ETC1 support
for vc4.
Dave Airlie [Wed, 16 Nov 2016 22:55:26 +0000 (08:55 +1000)]
Merge branch 'drm-tda998x-mali' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next
Fix conncector registration with tda998x.
* 'drm-tda998x-mali' of git://git.armlinux.org.uk/~rmk/linux-arm:
drm/i2c: tda998x: mali-dp: hdlcd: refactor connector registration
Dave Airlie [Wed, 16 Nov 2016 22:02:46 +0000 (08:02 +1000)]
Merge tag 'drm-misc-next-2016-11-16' of git://anongit.freedesktop.org/git/drm-misc into drm-next
Another pile of misc:
- Explicit fencing for atomic! Big thanks to Gustavo, Sean, Rob 3x, Brian
and anyone else I've forgotten to make this happen.
- roll out fbdev helper ops to drivers (Stefan Christ)
- last bits of drm_crtc split-up&kerneldoc
- some drm_irq.c crtc functions cleanup
- prepare_fb helper for cma, works correctly with explicit fencing (Marek
Vasut)
- misc small patches all over
* tag 'drm-misc-next-2016-11-16' of git://anongit.freedesktop.org/git/drm-misc: (51 commits)
drm/fence: add out-fences support
drm/fence: add fence timeline to drm_crtc
drm/fence: add in-fences support
drm/bridge: analogix_dp: return error if transfer none byte
drm: drm_irq.h header cleanup
drm/irq: Unexport drm_vblank_on/off
drm/irq: Unexport drm_vblank_count
drm/irq: Make drm_vblank_pre/post_modeset internal
drm/nouveau: Use drm_crtc_vblank_off/on
drm/amdgpu: Use drm_crtc_vblank_on/off for dce6
drm/color: document NULL values and default settings better
drm: Drop externs from drm_crtc.h
drm: Move tile group code into drm_connector.c
drm: Extract drm_mode_config.[hc]
Revert "drm: Add aspect ratio parsing in DRM layer"
Revert "drm: Add and handle new aspect ratios in DRM layer"
drm/print: Move kerneldoc next to definition
drm: Consolidate dumb buffer docs
drm: Clean up kerneldoc for struct drm_driver
drm: Extract drm_drv.h
...
Jonas Pfeil [Mon, 7 Nov 2016 23:18:39 +0000 (00:18 +0100)]
drm/vc4: Add fragment shader threading support
FS threading brings performance improvements of 0-20% in glmark2.
The validation code checks for thread switch signals and ensures that
the registers of the other thread are not touched, and that our clamps
are not live across thread switches. It also checks that the
threading and branching instructions do not interfere.
(Original patch by Jonas, changes by anholt for style cleanup,
removing validation the kernel doesn't need to do, and adding the flag
for userspace).
v2: Minor style fixes from checkpatch.
Signed-off-by: Jonas Pfeil <pfeiljonas@gmx.de>
Signed-off-by: Eric Anholt <eric@anholt.net>
Gustavo Padovan [Wed, 16 Nov 2016 13:00:21 +0000 (22:00 +0900)]
drm/fence: add out-fences support
Support DRM out-fences by creating a sync_file with a fence for each CRTC
that sets the OUT_FENCE_PTR property.
We use the out_fence pointer received in the OUT_FENCE_PTR prop to send
the sync_file fd back to userspace.
The sync_file and fd are allocated/created before commit, but the
fd_install operation only happens after we know that commit succeed.
v2: Comment by Rob Clark:
- Squash commit that adds DRM_MODE_ATOMIC_OUT_FENCE flag here.
Comment by Daniel Vetter:
- Add clean up code for out_fences
v3: Comments by Daniel Vetter:
- create DRM_MODE_ATOMIC_EVENT_MASK
- userspace should fill out_fences_ptr with the crtc_ids for which
it wants fences back.
v4: Create OUT_FENCE_PTR properties and remove old approach.
v5: Comments by Brian Starkey:
- Remove extra fence_get() in atomic_ioctl()
- Check ret before iterating on the crtc_state
- check ret before fd_install
- set fence_state to NULL at the beginning
- check fence_state->out_fence_ptr before put_user()
- change order of fput() and put_unused_fd() on failure
- Add access_ok() check to the out_fence_ptr received
- Rebase after fence -> dma_fence rename
- Store out_fence_ptr in the drm_atomic_state
- Split crtc_setup_out_fence()
- return -1 as out_fence with TEST_ONLY flag
v6: Comments by Daniel Vetter
- Add prepare/unprepare_crtc_signaling()
- move struct drm_out_fence_state to drm_atomic.c
- mark get_crtc_fence() as static
Comments by Brian Starkey
- proper set fence_ptr fence_state array
- isolate fence_idx increment
- improve error handling
v7: Comments by Daniel Vetter
- remove prefix from internal functions
- make out_fence_ptr an s64 pointer
- degrade DRM_INFO to DRM_DEBUG_ATOMIC when put_user fail
- fix doc issues
- filter out OUT_FENCE_PTR == NULL and do not fail in this case
- add complete_crtc_signalling()
- krealloc fence_state on demand
Comment by Brian Starkey
- remove unused crtc_state arg from get_out_fence()
v8: Comment by Brian Starkey
- cancel events before check for !fence_state
- convert a few lefovers u64 types for out_fence_ptr
- fix memleak by assign fence_state earlier after realloc
- proper accout num_fences in case of error
v9: Comment by Brian Starkey
- memset last position of fence_state after krealloc
Comments by Sean Paul
- pass install_fds in complete_crtc_signaling() instead of ret
- put_user(-1, fence_ptr) when decoding props
v10: Comment by Brian Starkey
- remove unneeded num_fences increment on error path
- kfree fence_state after installing fences fd
v11: rebase against latest drm-misc
v12: rebase again against latest drm-misc
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Brian Starkey <brian.starkey@arm.com> (v10)
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Tested-by: Robert Foss <robert.foss@collabora.com> (v10)
[danvet: Appease checkpatch.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479301221-13056-1-git-send-email-gustavo@padovan.org
Gustavo Padovan [Tue, 15 Nov 2016 14:37:08 +0000 (23:37 +0900)]
drm/fence: add fence timeline to drm_crtc
Create one timeline context for each CRTC to be able to handle out-fences
and signal them. It adds a few members to struct drm_crtc: fence_context,
where we store the context we get from fence_context_alloc(), the
fence seqno and the fence lock, that we pass in fence_init() to be
used by the fence.
v2: Comment by Daniel Stone:
- add BUG_ON() to fence_to_crtc() macro
v3: Comment by Ville Syrjälä
- Use more meaningful name as crtc timeline name
v4: Comments by Brian Starkey
- Use even more meaninful name for the crtc timeline
- add doc for timeline_name
Comment by Daniel Vetter
- use in-line style for comments
- rebase after fence -> dma_fence rename
v5: Comment by Daniel Vetter
- Add doc for drm_crtc_fence_ops
v6: Comment by Chris Wilson
- Move fence_to_crtc to drm_crtc.c
- Move export of drm_crtc_fence_ops to drm_crtc_internal.h
- rebase against latest drm-misc
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v5)
Reviewed-by: Sean Paul <seanpaul@chromium.org> (v5)
Tested-by: Robert Foss <robert.foss@collabora.com> (v5)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479220628-10204-1-git-send-email-gustavo@padovan.org
Gustavo Padovan [Tue, 15 Nov 2016 13:06:39 +0000 (22:06 +0900)]
drm/fence: add in-fences support
There is now a new property called IN_FENCE_FD attached to every plane
state that receives sync_file fds from userspace via the atomic commit
IOCTL.
The fd is then translated to a fence (that may be a fence_array
subclass or just a normal fence) and then used by DRM to fence_wait() for
all fences in the sync_file to signal. So it only commits when all
framebuffers are ready to scanout.
v2: Comments by Daniel Vetter:
- remove set state->fence = NULL in destroy phase
- accept fence -1 as valid and just return 0
- do not call fence_get() - sync_file_fences_get() already calls it
- fence_put() if state->fence is already set, in case userspace
set the property more than once.
v3: WARN_ON if fence is set but state has no FB
v4: Comment from Maarten Lankhorst
- allow set fence with no related fb
v5: rename FENCE_FD to IN_FENCE_FD
v6: Comments by Daniel Vetter:
- rename plane_state->in_fence back to "fence"
- re-introduce WARN_ON if fence set but no fb
- rebase after fence -> dma_fence rename
v7: Comments by Brian Starkey
- set state->fence to NULL when duplicating the state
- fail if IN_FENCE_FD was already set
v8: rebase against latest drm-misc
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Tested-by: Robert Foss <robert.foss@collabora.com>
[danvet: Rebase onto extracted drm_mode_config.[hc].]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Jianqun Xu [Wed, 16 Nov 2016 00:13:39 +0000 (08:13 +0800)]
drm/bridge: analogix_dp: return error if transfer none byte
Reference from drm_dp_aux description (about transfer):
Upon success, the implementation should return the number of payload bytes
that were transferred, or a negative error-code on failure. Helpers
propagate errors from the .transfer() function, with the exception of
the -EBUSY error, which causes a transaction to be retried. On a short,
helpers will return -EPROTO to make it simpler to check for failure.
The analogix_dp_transfer will return num_transferred, but if there is none
byte been transferred, the return value will be 0, which means success, we
should return error-code if transfer none byte.
for (retry = 0; retry < 32; retry++) {
err = aux->transfer(aux, &msg);
if (err < 0) {
if (err == -EBUSY)
continue;
goto unlock;
}
}
Cc: zain wang <wzz@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1479255219-7243-1-git-send-email-jay.xu@rock-chips.com
Dave Airlie [Tue, 15 Nov 2016 23:39:55 +0000 (09:39 +1000)]
Merge tag 'sunxi-drm-for-4.10' of https://git./linux/kernel/git/mripard/linux into drm-next
sun4i-drm changes for 4.10
Support for the Allwinner A31 SoC display engine using the sun4i-drm
driver.
* tag 'sunxi-drm-for-4.10' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux:
drm/sun4i: Add a few formats
drm/sun4i: Add compatible strings for A31/A31s display pipelines
drm/sun4i: Add compatible string for A31/A31s TCON (timing controller)
drm/sun4i: tcon: Move SoC specific quirks to a DT matched data structure
drm/sun4i: sun6i-drc: Support DRC on A31 and A31s
Dave Airlie [Tue, 15 Nov 2016 23:39:21 +0000 (09:39 +1000)]
Merge branch 'drm/next/du' of git://linuxtv.org/pinchartl/media into drm-next
rcar-du -next branch.
* 'drm/next/du' of git://linuxtv.org/pinchartl/media:
drm: rcar-du: Fix LVDS start sequence on Gen3
drm: rcar-du: Fix H/V sync signal polarity configuration
drm: rcar-du: Fix display timing controller parameter
drm: rcar-du: Fix dot clock routing configuration
drm: rcar-du: Add R8A7796 support
drm: rcar-du: Add R8A7792 support
drm: rcar-du: Simplify and fix probe error handling
drm: rcar-du: Fix crash in encoder failure error path
drm: rcar-du: Remove memory allocation error message
drm: rcar-du: Remove test for impossible error condition
drm: rcar-du: Bring HDMI encoder comments in line with the driver
drm: rcar-du: Constify node argument to rcar_du_lvds_connector_init()
video: of: Constify node argument to display timing functions
Daniel Vetter [Mon, 14 Nov 2016 09:02:55 +0000 (10:02 +0100)]
drm: drm_irq.h header cleanup
- Drop extern for functions, it's noise.
- Move&consolidate drm.ko internal parts into drm-internal.h.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114090255.31595-6-daniel.vetter@ffwll.ch
Daniel Vetter [Mon, 14 Nov 2016 09:02:54 +0000 (10:02 +0100)]
drm/irq: Unexport drm_vblank_on/off
Only remaining use was in amdgpu, and trivial to convert over to
drm_crtc_vblank_* variants.
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114090255.31595-5-daniel.vetter@ffwll.ch
Daniel Vetter [Mon, 14 Nov 2016 09:02:53 +0000 (10:02 +0100)]
drm/irq: Unexport drm_vblank_count
No one outside of drm_irq.c should ever need this. The correct way to
implement get_vblank_count for hw lacking a vblank counter is
drm_vblank_no_hw_counter. Fix this up in mtk, which is the only
offender left over.
Cc: CK Hu <ck.hu@mediatek.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114090255.31595-4-daniel.vetter@ffwll.ch
Daniel Vetter [Mon, 14 Nov 2016 09:02:52 +0000 (10:02 +0100)]
drm/irq: Make drm_vblank_pre/post_modeset internal
Now that all drivers are switched over to drm_crtc_vblank_on/off we
can relegate pre/post_modeset to the purely drm_irq.c internal role of
supporting old ums userspace.
As usual switch to the drm_legacy_ prefix to make it clear this is
for old drivers only.
v2: Rebase on top of Thierry's s/int crtc/unsigned int pipe/ changes.
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Daniel Vetter [Tue, 15 Nov 2016 21:58:19 +0000 (22:58 +0100)]
drm/nouveau: Use drm_crtc_vblank_off/on
With atomic nv50+ is already converted over to them, but the old
display code is still using it. Found in a 2 year old patch I have
lying around to un-export these old helpers!
v2: Drop the hand-rolled versions from resume/suspend code. Now that
crtc callbacks do this, we don't need a special case for s/r anymore.
v3: Remove unused variables.
v4: Don't remove drm_crtc_vblank_off from suspend paths, non-atomic
nouveau still needs that. But still switch to drm_crtc_vblank_off
since drm_vblank_off will disappear.
Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114114101.21731-1-daniel.vetter@ffwll.ch
Daniel Vetter [Mon, 14 Nov 2016 09:02:50 +0000 (10:02 +0100)]
drm/amdgpu: Use drm_crtc_vblank_on/off for dce6
This old code pattern was reintroduced in
Author: Ken Wang <Qingqing.Wang@amd.com>
Date: Tue Jan 19 14:03:24 2016 +0800
drm/amdgpu: add display controller implementation for si v10
Realign it with later display code. Tsk, tsk for massive copypasting
;-)
Cc: Christian König <christian.koenig@amd.com>
Cc: Ken Wang <Qingqing.Wang@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com> for the whole series.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114090255.31595-1-daniel.vetter@ffwll.ch
Daniel Vetter [Mon, 26 Sep 2016 09:04:37 +0000 (11:04 +0200)]
drm/color: document NULL values and default settings better
Brought up in a discussion for enabling gamma on fsl-dcu.
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Meng Yi <meng.yi@nxp.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20160926090437.22676-1-daniel.vetter@ffwll.ch
Daniel Vetter [Mon, 14 Nov 2016 11:58:25 +0000 (12:58 +0100)]
drm: Drop externs from drm_crtc.h
Just noise.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114115825.22050-11-daniel.vetter@ffwll.ch