Jyri Sarha [Tue, 15 Nov 2016 21:57:42 +0000 (23:57 +0200)]
drm/tilcdc: Load palette at the end of mode_set_nofb()
Load palette at the end of mode_set_nofb(). Moving the palette loading
to mode_set_nofb() saves us from storing and restoring of framebuffer
addresses in dma registers that were just recently written there.
Jyri Sarha [Tue, 15 Nov 2016 21:37:24 +0000 (23:37 +0200)]
drm/tilcdc: Enable palette loading for revision 2 LCDC too
The LCDC revision 2 documentation also mentions the mandatory palette
for true color modes. Even if the rev 2 LCDC appears to work just fine
without the palette being loaded loading it helps in testing the
feature.
Jyri Sarha [Sat, 19 Nov 2016 16:00:32 +0000 (18:00 +0200)]
drm/tilcdc: Fix load mode bit-field setting in tilcdc_crtc_enable()
Set LCDC_PALETTE_LOAD_MODE bit-field with new tilcdc_write_mask()
instead of tilcdc_set(). Setting a bit-fields with tilcdc_set() is
fundamentally broken.
Jyri Sarha [Mon, 31 Oct 2016 15:34:22 +0000 (17:34 +0200)]
drm/tilcdc: Add drm bridge support for attaching drm bridge drivers
Adds drm bride support for attaching drm bridge drivers to tilcdc. The
decision whether a video port leads to an external encoder or bridge
is made simply based on remote device's compatible string. The code
has been tested with BeagleBone-Black with and without BeagleBone
DVI-D Cape Rev A3 using ti-tfp410 driver.
Jyri Sarha [Mon, 31 Oct 2016 15:21:31 +0000 (17:21 +0200)]
drm/bridge: Add ti-tfp410 DVI transmitter driver
Add very basic ti-tfp410 DVI transmitter driver. The only feature
separating this from a completely dummy bridge is the EDID read
support trough DDC I2C. Even that functionality should be in a
separate generic connector driver. However, because of missing DRM
infrastructure support the connector is implemented within the bridge
driver. Some tfp410 HW specific features may be added later if needed,
because there is a set of registers behind i2c if it is connected.
This implementation is tested against my new tilcdc bridge support
and it works with BeagleBone DVI-D Cape Rev A3. A DT binding document
is also updated.
Signed-off-by: Jyri Sarha <jsarha@ti.com> Acked-by: Rob Herring <robh@kernel.org>
drm/tilcdc: Recover from sync lost error flood by resetting the LCDC
Recover from sync lost error flood by resetting the LCDC instead of
turning off the SYNC_LOST error IRQ. When LCDC starves on limited
memory bandwidth it may sometimes result an error situation when the
picture may have shifted couple of pixels to right and SYNC_LOST
interrupt is generated on every frame. LCDC main reset recovers from
this situation and causes a brief blanking on the screen.
Jyri Sarha [Tue, 18 Oct 2016 20:23:27 +0000 (23:23 +0300)]
drm/tilcdc: Use unload to handle initialization failures
Use unload to handle initialization failures instead of complex goto
label mess. To do this the initialization sequence needed slight
reordering and some unload functions needed to become conditional.
Jyri Sarha [Mon, 17 Oct 2016 14:53:33 +0000 (17:53 +0300)]
drm/tilcdc: Stop using struct drm_driver load() callback
Stop using struct drm_driver load() and unload() callbacks. The
callbacks should not be used anymore. Instead of using load the
drm_device is allocated with drm_dev_alloc() and registered with
drm_dev_register() only after the driver is completely initialized.
The deinitialization is done directly either in component unbind
callback or in platform driver demove callback.
Remove obsolete drm_connector_register() calls from tilcdc_panel.c and
tilcdc_tfp410.c. All connectors are registered when drm_dev_register()
is called.
Daniel Schultz [Fri, 28 Oct 2016 11:52:42 +0000 (13:52 +0200)]
drm/tilcdc: Correct misspelling in error message
This error message will be printed when a FIFO underflow irq has
triggered. Since this happens sometimes and the error message will be
displayed on the console, it should have a correct spelling.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Jyri Sarha <jsarha@ti.com>
Daniel Schultz [Fri, 28 Oct 2016 11:52:41 +0000 (13:52 +0200)]
drm/tilcdc: Add revision handling for FB_CEILING
The commit d8ff0c63fbcb ("drm/tilcdc: Adjust the FB_CEILING address")
added an adjustment of the FB_CEILING address. This is done by decrementing
the address by one.
On the AM335x (rev 0x4F201000) the framebuffer is rotated left over the
display border, because the ceiling address is 8f276fff instead of 8f277000. Since this adjustment isn't necessary for the LCDC v2, the
origin ceiling address should be used.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Jyri Sarha <jsarha@ti.com>
drm/tilcdc: add a da850-specific compatible string
Due to some potential tweaks for the da850 LCDC (for example: the
required memory bandwith settings) we need a separate compatible
for the IP present on the da850 boards.
Suggested-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jyri Sarha <jsarha@ti.com>
drm/tilcdc: add a workaround for failed clk_set_rate()
Some architectures don't use the common clock framework and don't
implement all the clk interfaces for every clock. This is the case
for da850-lcdk where clk_set_rate() only works for PLL0 and PLL1.
Trying to set the clock rate for the LCDC clock results in -EINVAL
being returned.
As a workaround for that: if the call to clk_set_rate() fails, fall
back to adjusting the clock divider instead. Proper divider value is
calculated by dividing the current clock rate by the required pixel
clock rate in HZ.
This code is based on a hack initially developed internally for
baylibre by Karl Beldan <kbeldan@baylibre.com>.
Tested with a da850-lcdk with an LCD display connected over VGA.
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 http://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
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>
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>
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.
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
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>
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>
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
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;
Dave Airlie [Tue, 15 Nov 2016 23:39:55 +0000 (09:39 +1000)]
Merge tag 'sunxi-drm-for-4.10' of https://git.kernel.org/pub/scm/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
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.
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.
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
Adding new mode flags willy nilly breaks existing userspace. We need to
coordinate this better, potentially with a new client cap that only
exposes the aspect ratio flags when userspace is prepared for them
(similar to what we do with stereo 3D modes).
This also broke things so that we would always send out VIC==0 in
the AVI infoframe unless the user specified an aspect ratio via
the mode flags. And the automagic RGB full vs. limited range
handling was similartly broken as the user mode would never match
any CEA mode.
Cc: Shashank Sharma <shashank.sharma@intel.com> Cc: Lin, Jia <lin.a.jia@intel.com> Cc: Akashdeep Sharma <akashdeep.sharma@intel.com> Cc: Jim Bride <jim.bride@linux.intel.com> Cc: Jose Abreu <Jose.Abreu@synopsys.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Emil Velikov <emil.l.velikov@gmail.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1478176304-6743-2-git-send-email-ville.syrjala@linux.intel.com
Adding new mode flags willy nilly breaks existing userspace. We need to
coordinate this better, potentially with a new client cap that only
exposes the aspect ratio flags when userspace is prepared for them
(similar to what we do with stereo 3D modes).
Cc: Shashank Sharma <shashank.sharma@intel.com> Cc: Lin, Jia <lin.a.jia@intel.com> Cc: Akashdeep Sharma <akashdeep.sharma@intel.com> Cc: Jim Bride <jim.bride@linux.intel.com> Cc: Jose Abreu <Jose.Abreu@synopsys.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Emil Velikov <emil.l.velikov@gmail.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1478176304-6743-1-git-send-email-ville.syrjala@linux.intel.com
Daniel Vetter [Mon, 14 Nov 2016 11:58:19 +0000 (12:58 +0100)]
drm: Extract drm_drv.h
I want to move dumb buffer documentation into the right vfuncs, and
for that I first need to be able to pull that into kerneldoc without
having to clean up all of drmP.h. Also, header-splitting is nice.
While at it shuffle all the function declarations for drm_drv.c into
the right spots, and drop the kerneldoc for drm_minor_acquire/release
since it's only used internally.
v2: Keep all existing copyright notices (Chris).
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Daniel Vetter [Mon, 14 Nov 2016 11:58:18 +0000 (12:58 +0100)]
doc/dma-buf: Fix up include directives
Would be great if everony could add
$ make DOCBOOKS="" htmldocs
to their build scripts to catch these. 0day should also report them,
not sure why it failed to spot this.
Fixes: f54d1867005c ("dma-buf: Rename struct fence to dma_fence") Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Christian König <christian.koenig@amd.com> 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-4-daniel.vetter@ffwll.ch
Daniel Vetter [Mon, 14 Nov 2016 11:58:17 +0000 (12:58 +0100)]
drm/i915: Fixup kerneldoc includes
Would be great if everony could add
$ make DOCBOOKS="" htmldocs
to their build scripts to catch these. 0day should also report them,
not sure why it failed to spot this.
Fixes: b42fe9ca0a1e ("drm/i915: Split out i915_vma.c") Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> 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-3-daniel.vetter@ffwll.ch
Add missing forward declaration for struct drm_plane and drm_plane_state,
which causes the following warning in the VC4 driver (can be replicated
by building using bcm2835_defconfig):
In file included from drivers/gpu/drm/vc4/vc4_drv.c:18:0:
include/drm/drm_fb_cma_helper.h:45:13: warning: ‘struct drm_plane_state’ declared inside parameter list will not be visible outside of this definition or declaration
struct drm_plane_state *state);
^~~~~~~~~~~~~~~
include/drm/drm_fb_cma_helper.h:44:34: warning: ‘struct drm_plane’ declared inside parameter list will not be visible outside of this definition or declaration
int drm_fb_cma_prepare_fb(struct drm_plane *plane,