]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
8 years agodrm: Move DRM_MODE_OBJECT_* to uapi headers
Daniel Vetter [Wed, 30 Mar 2016 14:19:44 +0000 (16:19 +0200)]
drm: Move DRM_MODE_OBJECT_* to uapi headers

These type defines are officially part of the uapi, but ended up in
the wrong headers somehow when we split them all.

Cc: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1459347584-30566-3-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm: align #include directives with libdrm in uapi headers
Daniel Vetter [Wed, 30 Mar 2016 15:54:52 +0000 (17:54 +0200)]
drm: align #include directives with libdrm in uapi headers

We can't use <drm/*.h> because that upsets the serach paths in libdrm.
Also, drop the circular inclusion in drm_mode.h.

v2: Actually change the right headers.

v3: Drop the #include removal per Emil's request.

Cc: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1459353292-9063-1-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm: Make drm.h uapi header safe for C++
Daniel Vetter [Wed, 30 Mar 2016 15:12:33 +0000 (17:12 +0200)]
drm: Make drm.h uapi header safe for C++

virtual is a protected keyword in C++ and can't be used at all. Ugh.

This aligns the kernel versions of the drm headers with the ones in
libdrm.

v2: Also annote with __user, as request by Emil&Ilia.

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1459350753-18320-1-git-send-email-daniel.vetter@ffwll.ch
8 years agovgacon: dummy implementation for vgacon_text_force
Daniel Vetter [Wed, 30 Mar 2016 09:26:35 +0000 (11:26 +0200)]
vgacon: dummy implementation for vgacon_text_force

This allows us to ditch a ton of ugly #ifdefs from a bunch of drm modeset
drivers.

v2: Make the dummy function actually return a sane value, spotted by
Ville.

v3: Because the patch is still in limbo there's no more drivers to
convert, noticed by Emil.

v4: Rebase once more, because hooray. I'll just go ahead an apply this
one later on to drm-misc.

Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/sysfs: Nuke TV/DVI property files
Daniel Vetter [Wed, 30 Mar 2016 09:45:14 +0000 (11:45 +0200)]
drm/sysfs: Nuke TV/DVI property files

This goes all the way back to the original KMS commit aeons ago

commit f453ba0460742ad027ae0c4c7d61e62817b3e7ef
Author: Dave Airlie <airlied@redhat.com>
Date:   Fri Nov 7 14:05:41 2008 -0800

    DRM: add mode setting support

But it seems to be completely unused. Only i915 and nouveau even
register these properties, and the corresponding DDX don't even look
at them. Also the sysfs files are read-only, so not useful to
configure anything.

I suspect that this was added with the goal to have read-only access
to all properties in sysfs, but we never followed through on that.
Also, that should be done in a more generic fashion.

Since it would be real work to fix up the locking (with atomic we're
now chasing pointers when reading properties) and it seems unused lets
just nuke this all. It's easier. Of course we'll keep the properties
themselves, those are still exposed through the KMS ioctls.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1459331120-27864-5-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/ttm: Remove TTM_HAS_AGP
Daniel Vetter [Wed, 30 Mar 2016 11:24:06 +0000 (13:24 +0200)]
drm/ttm: Remove TTM_HAS_AGP

It tries to do fancy things with excluding agp support if ttm is
built-in, but agp isn't. Instead just express this depency like drm
does and use CONFIG_AGP everywhere.

Also use the neat Makefile magic to make the entire ttm_agp_backend
file optional.

v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville

v3: Review from Emil.

v4: Actually get it right as spotted by 0-day.

Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1459337046-25882-1-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm: bridge/dw-hdmi: Remove pre_enable/post_disable dummy funcs
Archit Taneja [Wed, 30 Mar 2016 09:23:24 +0000 (14:53 +0530)]
drm: bridge/dw-hdmi: Remove pre_enable/post_disable dummy funcs

We don't need to keep empty callbacks for the (pre/post) enable/disable
drm_bridge ops anymore. Remove the nop callback used here for
pre_enable and post_disable ops.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1459329804-10488-1-git-send-email-architt@codeaurora.org
8 years agoRevert "drm: Don't pass negative delta to ktime_sub_ns()"
Daniel Vetter [Tue, 29 Mar 2016 11:12:22 +0000 (13:12 +0200)]
Revert "drm: Don't pass negative delta to ktime_sub_ns()"

This reverts commit e91abf80a0998f326107874c88d549f94839f13c.

Since

commit 24e4a8c3e8868874835b0f1ad6dd417341e99822
Author: John Stultz <john.stultz@linaro.org>
Date:   Wed Jul 16 21:03:53 2014 +0000

    ktime: Kill non-scalar ktime_t implementation for 2038

there is no longer a 32bit version that's unsigned, and we don't have
to jump through ridiculous hoops to make the calculations correct.

I didn't look whether there's more of this pattern in the kernel.

Cc: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1459249942-21589-1-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/atmel: Fixup drm_connector_/unplug/unregister/_all
Daniel Vetter [Tue, 29 Mar 2016 12:14:25 +0000 (14:14 +0200)]
drm/atmel: Fixup drm_connector_/unplug/unregister/_all

Accidentally fell through the cracks in

commit 6c87e5c3ec6db052f3744804a517b6fb003906e1
Author: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Date:   Wed Mar 23 11:42:54 2016 +0300

    drm: Rename drm_connector_unplug_all() to drm_connector_unregister_all()

despite that Boris acked that patch.

Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
8 years agodrm: Rename drm_connector_unplug_all() to drm_connector_unregister_all()
Alexey Brodkin [Wed, 23 Mar 2016 08:42:54 +0000 (11:42 +0300)]
drm: Rename drm_connector_unplug_all() to drm_connector_unregister_all()

Current name is a bit misleading because what that helper function
really does it calls drm_connector_unregister() for all connectors.

This all has nothing to do with hotplugging so let's name things
properly.

And while at it remove potentially dangerous locking around
drm_connector_unregister() in rcar_du_remove() as mentioned
in kerneldoc for drm_connector_unregister_all().

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: linux-renesas-soc@vger.kernel.org
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1458722577-20283-2-git-send-email-abrodkin@synopsys.com
8 years agodrm: bridge: Make (pre/post) enable/disable callbacks optional
Laurent Pinchart [Fri, 26 Feb 2016 09:51:06 +0000 (11:51 +0200)]
drm: bridge: Make (pre/post) enable/disable callbacks optional

Instead of forcing bridges to implement empty callbacks make them all
optional.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1456480266-7904-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com
Acked-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
8 years agodma-buf/fence: fix fence_is_later v2
Christian König [Mon, 29 Feb 2016 15:53:11 +0000 (10:53 -0500)]
dma-buf/fence: fix fence_is_later v2

A fence is never later than itself. This caused a bunch of overhead for AMDGPU.

v2: simplify check as suggested by Michel.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodma-buf: Update docs for SYNC ioctl
Daniel Vetter [Mon, 21 Mar 2016 07:24:22 +0000 (08:24 +0100)]
dma-buf: Update docs for SYNC ioctl

Just a bit of wording polish plus mentioning that it can fail and must
be restarted.

Requested by Sumit.

v2: Fix them typos (Hans).

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tiago Vignatti <tiago.vignatti@intel.com>
Cc: Stéphane Marchesin <marcheu@chromium.org>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>
CC: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: intel-gfx@lists.freedesktop.org
Cc: devel@driverdev.osuosl.org
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
8 years agodrm: remove excess description
Luis de Bethencourt [Sat, 19 Mar 2016 17:22:36 +0000 (17:22 +0000)]
drm: remove excess description

Description of expected_size doesn't match any parameter of the function
drm_atomic_replace_property_blob. Removing it.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1458408156-15990-1-git-send-email-luisbg@osg.samsung.com
8 years agodma-buf, drm, ion: Propagate error code from dma_buf_start_cpu_access()
Chris Wilson [Fri, 18 Mar 2016 20:02:39 +0000 (20:02 +0000)]
dma-buf, drm, ion: Propagate error code from dma_buf_start_cpu_access()

Drivers, especially i915.ko, can fail during the initial migration of a
dma-buf for CPU access. However, the error code from the driver was not
being propagated back to ioctl and so userspace was blissfully ignorant
of the failure. Rendering corruption ensues.

Whilst fixing the ioctl to return the error code from
dma_buf_start_cpu_access(), also do the same for
dma_buf_end_cpu_access().  For most drivers, dma_buf_end_cpu_access()
cannot fail. i915.ko however, as most drivers would, wants to avoid being
uninterruptible (as would be required to guarrantee no failure when
flushing the buffer to the device). As userspace already has to handle
errors from the SYNC_IOCTL, take advantage of this to be able to restart
the syscall across signals.

This fixes a coherency issue for i915.ko as well as reducing the
uninterruptible hold upon its BKL, the struct_mutex.

Fixes commit c11e391da2a8fe973c3c2398452000bed505851e
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Feb 11 20:04:51 2016 -0200

    dma-buf: Add ioctls to allow userspace to flush

Testcase: igt/gem_concurrent_blit/*dmabuf*interruptible
Testcase: igt/prime_mmap_coherency/ioctl-errors
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tiago Vignatti <tiago.vignatti@intel.com>
Cc: Stéphane Marchesin <marcheu@chromium.org>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>
CC: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: intel-gfx@lists.freedesktop.org
Cc: devel@driverdev.osuosl.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1458331359-2634-1-git-send-email-chris@chris-wilson.co.uk
8 years agodrm/atmel-hlcdc: use helper to get crtc state
Andrzej Hajda [Tue, 15 Mar 2016 12:46:28 +0000 (13:46 +0100)]
drm/atmel-hlcdc: use helper to get crtc state

DRM core provide helper to access crtc state.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1458045988-25246-1-git-send-email-a.hajda@samsung.com
8 years agodrm/atomic: use helper to get crtc state
Andrzej Hajda [Tue, 15 Mar 2016 12:46:00 +0000 (13:46 +0100)]
drm/atomic: use helper to get crtc state

DRM core provide helper to access crtc state.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1458045960-25193-1-git-send-email-a.hajda@samsung.com
8 years agodrm: atomic helper: do not unreference error pointer
Lionel Landwerlin [Fri, 11 Mar 2016 12:17:26 +0000 (12:17 +0000)]
drm: atomic helper: do not unreference error pointer

562c5b4d8986 didn't quite fix the issue of dealing with an error
pointer. We can't free/unref an error pointer so reset it to NULL.

Many thanks to Dan Carpenter for pointing this out again.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: dri-devel@lists.freedesktop.org
Fixes: 562c5b4d8986 ("drm: fix blob pointer check")
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1457698646-22231-1-git-send-email-lionel.g.landwerlin@intel.com
8 years agodrm/edid: Extract SADs properly from multiple audio data blocks
Ville Syrjälä [Wed, 9 Mar 2016 20:07:46 +0000 (22:07 +0200)]
drm/edid: Extract SADs properly from multiple audio data blocks

SADs may span multiple CEA audio data blocks in the EDID.

CEA-861-E says:
"The order of the Data Blocks is not constrained. It is also possible
to have more than one of a specific type of data block if necessary to
include all of the descriptors needed to describe the sink’s capabilities."

Each audio data block can carry up to 10 SADs, whereas the ELD SAD limit
is 15 according to HDA 1.0a spec. So we should support at least two data
blocks. And apparently some devices take a more liberal interpretation
and stuff only one SAD per data block even when they would fit into one.

So let's try to extract all the SADs we can fit into the ELD even when
they span multiple data blocks.

While at it, toss in a comment to explain the 13 byte monitor name
string limit which confused me at first.

Cc: Arturo Pérez <artur999555@gmail.com>
Tested-by: Arturo Pérez <artur999555@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94197
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1457554066-8739-1-git-send-email-ville.syrjala@linux.intel.com
8 years agodrm: fix blob pointer check
Lionel Landwerlin [Thu, 10 Mar 2016 12:04:21 +0000 (12:04 +0000)]
drm: fix blob pointer check

Check properly that the allocated blob's pointer is valid.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Daniel Stone <daniels@collabora.com>
Fixes: 5488dc16fde7 ("drm: introduce pipe color correction properties")
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1457611461-9116-1-git-send-email-lionel.g.landwerlin@intel.com
8 years agodrm: introduce pipe color correction properties
Lionel Landwerlin [Fri, 26 Feb 2016 17:05:00 +0000 (17:05 +0000)]
drm: introduce pipe color correction properties

Patch based on a previous series by Shashank Sharma.

This introduces optional properties to enable color correction at the
pipe level. It relies on 3 transformations applied to every pixels
displayed. First a lookup into a degamma table, then a multiplication
of the rgb components by a 3x3 matrix and finally another lookup into
a gamma table.

The following properties can be added to a pipe :
  - DEGAMMA_LUT : blob containing degamma LUT
  - DEGAMMA_LUT_SIZE : number of elements in DEGAMMA_LUT
  - CTM : transformation matrix applied after the degamma LUT
  - GAMMA_LUT : blob containing gamma LUT
  - GAMMA_LUT_SIZE : number of elements in GAMMA_LUT

DEGAMMA_LUT_SIZE and GAMMA_LUT_SIZE are read only properties, set by
the driver to tell userspace applications what sizes should be the
lookup tables in DEGAMMA_LUT and GAMMA_LUT.

A helper is also provided so legacy gamma correction is redirected
through these new properties.

v2: Register LUT size properties as range

v3: Fix round in drm_color_lut_get_value() helper
    More docs on how degamma/gamma properties are used

v4: Update contributors

v5: Rename CTM_MATRIX property to CTM (Doh!)
    Add legacy gamma_set atomic helper
    Describe CTM/LUT acronyms in the kernel doc

v6: Fix missing blob unref in drm_atomic_helper_crtc_reset

Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
Signed-off-by: Kumar, Kiran S <kiran.s.kumar@intel.com>
Signed-off-by: Kausal Malladi <kausalmalladi@gmail.com>
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Acked-by: Rob Bradford <robert.bradford@intel.com>
[danvet: CrOS maintainers are also happy with the userspacde side:
https://codereview.chromium.org/1182063002/ ]
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1456506302-640-4-git-send-email-lionel.g.landwerlin@intel.com
8 years agodrm/atomic: Clean up update_connector_routing.
Maarten Lankhorst [Thu, 3 Mar 2016 09:17:42 +0000 (10:17 +0100)]
drm/atomic: Clean up update_connector_routing.

connector_state->crtc can no longer be unset by accident,
so that check can be removed. The other code open-codes
drm_atomic_get_existing_crtc_state, so use that.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[danvet: Resolve tiny conflict due to gcc warning fix on previous
patch.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/atomic: Clean up steal_encoder, v2.
Maarten Lankhorst [Thu, 3 Mar 2016 09:17:41 +0000 (10:17 +0100)]
drm/atomic: Clean up steal_encoder, v2.

Now that only encoders can be stolen that are part of the state
steal_encoder no longer needs to inspect all connectors,
just those that are part of the atomic state.

Changes since v1:
- Change return value to void, can no longer fail.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[danvet: Appease gcc, reported by kbuild.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1456996662-8704-7-git-send-email-maarten.lankhorst@linux.intel.com
8 years agodrm/atomic: Handle encoder assignment conflicts in a separate check, v3.
Maarten Lankhorst [Thu, 3 Mar 2016 09:17:40 +0000 (10:17 +0100)]
drm/atomic: Handle encoder assignment conflicts in a separate check, v3.

The current check doesn't handle the case where we don't steal an
encoder, but keep it on the current connector. If we repurpose
disable_conflicting_encoders to do the checking, we just have
to reject the ones that conflict.

Changes since v1:
- Return early with empty encoder_mask, drm_for_each_connector
  requires connection_mutex held.
Changes since v2:
- Add comments for the loops.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Testcase: kms_setmode.invalid-clone-single-crtc-stealing
Reviewed-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/1456996662-8704-6-git-send-email-maarten.lankhorst@linux.intel.com
8 years agodrm/atomic: Handle encoder stealing from set_config better.
Maarten Lankhorst [Thu, 3 Mar 2016 09:17:39 +0000 (10:17 +0100)]
drm/atomic: Handle encoder stealing from set_config better.

Instead of failing with -EINVAL when conflicting encoders are found,
the legacy set_config will disable other connectors when encoders
conflict.

With the previous commit this becomes a lot easier to implement.
set_config only adds connectors to the state that are modified,
and because of the previous commit that calls add_affected_connectors
only on set->crtc it means any connector not part of the modeset can
be stolen from. We disable the connector in that case, and possibly
the crtc if required.

Atomic modeset itself still doesn't allow encoder stealing, the results
would be too unpredictable.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-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/1456996662-8704-5-git-send-email-maarten.lankhorst@linux.intel.com
8 years agodrm/atomic: Always call steal_encoder, v2.
Maarten Lankhorst [Thu, 3 Mar 2016 09:17:38 +0000 (10:17 +0100)]
drm/atomic: Always call steal_encoder, v2.

There's no need to have a separate function to get the crtc
which is stolen, this can already be found when actually
stealing the encoder.

drm_for_each_connector already checks for connection_mutex, so
use that macro now.

Changes since v1:
- Do not check for NULL crtc in connector_state,
  this may happen when a crtc is disabled and its encoder stolen.
- Because of this, use connector->state->crtc instead of conn_state->crtc.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-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/1456996662-8704-4-git-send-email-maarten.lankhorst@linux.intel.com
8 years agodrm/ast: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:20:14 +0000 (14:20 +0000)]
drm/ast: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/0f8f948babd93fce8523253b0f525446e2f565db.1455630967.git.palminha@synopsys.com
8 years agodrm/bochs: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:20:02 +0000 (14:20 +0000)]
drm/bochs: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/40a78cafba2cd5b391d244e806613192b3a31413.1455630967.git.palminha@synopsys.com
8 years agodrm/fsl-dcu: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:19:46 +0000 (14:19 +0000)]
drm/fsl-dcu: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/a9827a57b25509dae29c0e8d09a9063a11970647.1455630967.git.palminha@synopsys.com
8 years agodrm/virtio: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:19:32 +0000 (14:19 +0000)]
drm/virtio: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/ae865f0deca4e64a0f47f2d2d14b54ff00c0672e.1455630967.git.palminha@synopsys.com
8 years agodrm/nouveau/dispnv04: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:19:19 +0000 (14:19 +0000)]
drm/nouveau/dispnv04: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/897eae438eec566078b1872d7654c4863e4e4e57.1455630967.git.palminha@synopsys.com
8 years agodrm/atmel-hlcdc: remove optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:19:06 +0000 (14:19 +0000)]
drm/atmel-hlcdc: remove optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/e4bdb8552c245f8b73084b93da60460a00f7798c.1455630967.git.palminha@synopsys.com
8 years agodrm/sti: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:18:53 +0000 (14:18 +0000)]
drm/sti: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/08d27e27582fb2daa48555ab542245c6cf0a2268.1455630967.git.palminha@synopsys.com
8 years agodrm/shmobile: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:18:40 +0000 (14:18 +0000)]
drm/shmobile: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/msm/mdp: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:18:26 +0000 (14:18 +0000)]
drm/msm/mdp: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/omapdrm: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:18:12 +0000 (14:18 +0000)]
drm/omapdrm: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/101f043d5fa747291c09ae765bac4d55c6e39988.1455630967.git.palminha@synopsys.com
8 years agodrm/rcar-du: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:18:00 +0000 (14:18 +0000)]
drm/rcar-du: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/becab4ff666eca77162e5cd978087f2d3fb3e308.1455630967.git.palminha@synopsys.com
8 years agodrm/gma: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:17:45 +0000 (14:17 +0000)]
drm/gma: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/udl: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:17:33 +0000 (14:17 +0000)]
drm/udl: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/11327d1a3c3b6623064f6d82efa96e7993f77f38.1455630967.git.palminha@synopsys.com
8 years agodrm/mgag200: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:17:20 +0000 (14:17 +0000)]
drm/mgag200: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/3d089c84bcb1aafd485d4944ad472f9843c38eaf.1455630967.git.palminha@synopsys.com
8 years agodrm/cirrus: removed optional dummy crtc mode_fixup function.
Carlos Palminha [Tue, 16 Feb 2016 14:16:51 +0000 (14:16 +0000)]
drm/cirrus: removed optional dummy crtc mode_fixup function.

This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/5a3c41fed15847549f9bdeae89b72705b4756cc4.1455630967.git.palminha@synopsys.com
8 years agodrm/atomic: Pass connector and state to update_connector_routing.
Maarten Lankhorst [Wed, 24 Feb 2016 08:37:29 +0000 (09:37 +0100)]
drm/atomic: Pass connector and state to update_connector_routing.

Minor cleanup, connector and connector_state are always non-NULL here.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-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/1456303053-28806-3-git-send-email-maarten.lankhorst@linux.intel.com
8 years agodrm/atomic: Clean up update_output_state.
Maarten Lankhorst [Wed, 24 Feb 2016 08:37:28 +0000 (09:37 +0100)]
drm/atomic: Clean up update_output_state.

With the addition of crtc_state->connector_mask other connectors from
different crtc's aren't needed any more to determine if a crtc has
connectors, so only call add_affected_connectors on the target crtc.
This allows a cleanup to first remove all current connectors, then
add all set->connectors to the target crtc.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-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/1456303053-28806-2-git-send-email-maarten.lankhorst@linux.intel.com
8 years agodrm/crtc: Use drm_mode_object_put() in __drm_framebuffer_unregister()
Liu Ying [Mon, 29 Feb 2016 03:21:10 +0000 (11:21 +0800)]
drm/crtc: Use drm_mode_object_put() in __drm_framebuffer_unregister()

The function __drm_framebuffer_unregister() has boilerplate code to drop idr
reference.  Let's replace it with drm_mode_object_put() to simplify the code.

Signed-off-by: Liu Ying <gnuiyl@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1456716070-2602-1-git-send-email-gnuiyl@gmail.com
8 years agoMerge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu into drm-next
Dave Airlie [Fri, 26 Feb 2016 03:02:57 +0000 (13:02 +1000)]
Merge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu into drm-next

As previously discussed, this is my first pull request for the DCU DRM
driver along with the change in MAINTAINERS.
https://lkml.org/lkml/2016/1/7/26

The pull contains some code cleanup changes (e.g. removing all error
handling for the regmap calls) and several fixes.

* 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu:
  drm/fsl-dcu: fix register initialization
  drm/fsl-dcu: use mode flags for hsync/vsync polarity
  drm/fsl-dcu: fix alpha blending
  drm/fsl-dcu: mask all interrupts on initialization
  drm/fsl-dcu: handle initialization errors properly
  drm/fsl-dcu: avoid memory leak on errors
  drm/fsl-dcu: remove regmap return value checks
  drm/fsl-dcu: specify volatile registers
  drm: fsl-dcu: Fix no fb check bug
  MAINTAINERS: update for Freescale DCU DRM driver

8 years agodrm/fsl-dcu: fix register initialization
Stefan Agner [Fri, 15 Jan 2016 01:24:29 +0000 (17:24 -0800)]
drm/fsl-dcu: fix register initialization

The layer enumeration start with 0 (0-15 for LS1021a and 0-63 for
Vybrid) whereas the register enumeration start from 1 (1-10 for
LS1021a and 1-9 for Vybrid). The loop started off from 0 for both
iterations and initialized the number of layers inclusive, which
is one layer too many.

All extensively written registers seem to be unassigned, it seems
that the write to those registers did not do any harm in practice.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: use mode flags for hsync/vsync polarity
Stefan Agner [Wed, 18 Nov 2015 03:10:29 +0000 (19:10 -0800)]
drm/fsl-dcu: use mode flags for hsync/vsync polarity

The current default configuration is as follows:
- Invert VSYNC signal (active LOW)
- Invert HSYNC signal (active LOW)

The mode flags allow to specify the required polarity per
mode. Furthermore, none of the current driver settings is
actually a standard polarity.

This patch applies the current driver default polarities as
explicit flags to the display which has been introduced with
the driver (NEC WQVGA "nec,nl4827hc19-05b"). The driver now
also parses the flags field and applies the configuration
accordingly, by using the following values as standard
polarities: (e.g. when no flags are specified):
- VSYNC signal not inverted (active HIGH)
- HSYNC signal not inverted (active HIGH)

Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: fix alpha blending
Stefan Agner [Wed, 18 Nov 2015 22:47:35 +0000 (14:47 -0800)]
drm/fsl-dcu: fix alpha blending

Fix alpha blending by enabling alpha blending for the whole frame if
a color mode with alpha channel is selected (DRM_FORMAT_ARGB*). Also
support color modes without alpha channel (DRM_FORMAT_XRGB*) by just
not enabling alpha blending on layer level.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: mask all interrupts on initialization
Stefan Agner [Thu, 19 Nov 2015 01:27:04 +0000 (17:27 -0800)]
drm/fsl-dcu: mask all interrupts on initialization

The state of the interrupt mask register on initialization is
unknown, e.g. U-Boot could already used the DCU. So depending on
the boot loader, the outcome of the interrupt mask register could
be different. A defined state is much more preferable. Also, there
is no value in keeping interrupts enabled which we don't need.
Therefor, mask all interrupts on initialization.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: handle initialization errors properly
Stefan Agner [Tue, 17 Nov 2015 00:25:17 +0000 (16:25 -0800)]
drm/fsl-dcu: handle initialization errors properly

If initialization fails (e.g. due to missing panel node or deferred
probe) make sure to roll-back all operations and return the error
code.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: avoid memory leak on errors
Stefan Agner [Mon, 16 Nov 2015 23:43:34 +0000 (15:43 -0800)]
drm/fsl-dcu: avoid memory leak on errors

Improve error handling during CRTC initialization. Especially avoid
memory leaks in the primary plane initialization error path.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: remove regmap return value checks
Stefan Agner [Thu, 19 Nov 2015 00:50:55 +0000 (16:50 -0800)]
drm/fsl-dcu: remove regmap return value checks

It is not common to do regmap return value checks, especially not
for memory mapped device. We can rule out most error returns since
the conditions are static and we know they are ok (e.g. offset
aligned to register stride). Also without proper error handling
they are not really valuable for the user. Hence remove most of
them.

The check in the interrupt handler is worth keeping since a
volatile register won't be readable in case register caching is
still enabled.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: specify volatile registers
Stefan Agner [Wed, 18 Nov 2015 02:05:25 +0000 (18:05 -0800)]
drm/fsl-dcu: specify volatile registers

Since we are using cached registers, we need to specify volatile
registers explicitly to avoid reading their value from the cache.
This allows to read the correct interrupt status in fsl_dcu_drm_irq
and clear the asserted bits only.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm: fsl-dcu: Fix no fb check bug
Meng Yi [Wed, 6 Jan 2016 04:12:05 +0000 (12:12 +0800)]
drm: fsl-dcu: Fix no fb check bug

For state->fb or state->crtc may be NULL in fsl_dcu_drm_plane_atomic_check
function, if so, return 0.

Signed-off-by: Meng Yi <meng.yi@nxp.com>
Signed-off-by: Jianwei Wang <jianwei.wang.chn@gmail.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agoMAINTAINERS: update for Freescale DCU DRM driver
Stefan Agner [Thu, 7 Jan 2016 06:02:46 +0000 (22:02 -0800)]
MAINTAINERS: update for Freescale DCU DRM driver

Promote myself as new maintainer of the Freescale DCU DRM driver.

Acked-by: Jianwei Wang <jianwei.wang.chn@gmail.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agoMerge branch 'drm/next/du' of git://linuxtv.org/pinchartl/fbdev into drm-next
Dave Airlie [Thu, 25 Feb 2016 00:30:59 +0000 (10:30 +1000)]
Merge branch 'drm/next/du' of git://linuxtv.org/pinchartl/fbdev into drm-next

rcar-du updates.

* 'drm/next/du' of git://linuxtv.org/pinchartl/fbdev: (281 commits)
  drm: rcar-du: Add tri-planar memory formats support
  drm: rcar-du: Add probe deferral debug messages
  drm: rcar-du: lvds: Add R-Car Gen3 support
  drm: rcar-du: lvds: Rename PLLEN bit to PLLON
  drm: rcar-du: lvds: Fix PLL frequency-related configuration
  drm: rcar-du: lvds: Avoid duplication of clock clamp code
  drm: rcar-du: Add R8A7795 device support
  drm: rcar-du: Output the DISP signal on the ODDF pin
  drm: rcar-du: Output the DISP signal on the DISP pin
  drm: rcar-du: Support up to 4 CRTCs
  drm: rcar-du: Drop LVDS double dependency on OF
  drm: rcar-du: Enable compilation on ARM64
  drm: rcar-du: Fix compile warning on 64-bit platforms
  drm: rcar-du: Expose the VSP1 compositor through KMS planes
  drm: rcar-du: Move plane allocator to rcar_du_plane.c
  drm: rcar-du: Restart the DU group when a plane source changes
  drm: rcar-du: Add VSP1 compositor support
  drm: rcar-du: Add VSP1 support to the planes allocator
  drm: rcar-du: Refactor plane setup
  drm: rcar-du: Compute plane DDCR4 register value directly
  ...

8 years agodrm: rcar-du: Add tri-planar memory formats support
Laurent Pinchart [Thu, 12 Nov 2015 00:03:47 +0000 (02:03 +0200)]
drm: rcar-du: Add tri-planar memory formats support

Those formats are supported on Gen3 only.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Add probe deferral debug messages
Laurent Pinchart [Wed, 21 Oct 2015 22:09:30 +0000 (01:09 +0300)]
drm: rcar-du: Add probe deferral debug messages

Print a message when the HDMI I2C slave encoder can't be found to help
debugging probe deferral issues.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: lvds: Add R-Car Gen3 support
Koji Matsuoka [Tue, 28 Jul 2015 11:12:43 +0000 (20:12 +0900)]
drm: rcar-du: lvds: Add R-Car Gen3 support

The LVDS encoder differs slightly in Gen3 SoCs in its PLL configuration.
Add support for the Gen3 LVDS PLL parameters and startup procedure.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: lvds: Rename PLLEN bit to PLLON
Laurent Pinchart [Mon, 7 Sep 2015 12:28:17 +0000 (15:28 +0300)]
drm: rcar-du: lvds: Rename PLLEN bit to PLLON

The bit is named PLLON in the datasheet, rename it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: lvds: Fix PLL frequency-related configuration
Laurent Pinchart [Mon, 7 Sep 2015 13:03:25 +0000 (16:03 +0300)]
drm: rcar-du: lvds: Fix PLL frequency-related configuration

The frequency checks don't match the datasheet, fix them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: lvds: Avoid duplication of clock clamp code
Laurent Pinchart [Mon, 7 Sep 2015 12:44:44 +0000 (15:44 +0300)]
drm: rcar-du: lvds: Avoid duplication of clock clamp code

Replace the duplicate code by a single central function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Add R8A7795 device support
Laurent Pinchart [Mon, 7 Sep 2015 14:34:26 +0000 (17:34 +0300)]
drm: rcar-du: Add R8A7795 device support

Document the R8A7795-specific DT bindings and support them in the
driver. The HDMI and LVDS outputs are currently not supported.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Output the DISP signal on the ODDF pin
Laurent Pinchart [Mon, 7 Sep 2015 15:09:55 +0000 (18:09 +0300)]
drm: rcar-du: Output the DISP signal on the ODDF pin

The ODDF signal, output by default on the ODDF pin, isn't used on any
board supported in the kernel. As the Gen3 Salvator-X board uses the
ODDF pin as a DISP signal, hardcode that configuration in the driver.

Use of the ODDF signal will be implemented later through proper DT-based
configuration of the DU pins.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Output the DISP signal on the DISP pin
Laurent Pinchart [Mon, 7 Sep 2015 19:02:14 +0000 (22:02 +0300)]
drm: rcar-du: Output the DISP signal on the DISP pin

The DE signal is currently configured to be identical to the DISP
signal and is used for the same purpose. To make it clearer that the
DISP pin outputs the DISP signal, select it explicitly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Support up to 4 CRTCs
Koji Matsuoka [Fri, 4 Sep 2015 10:49:05 +0000 (19:49 +0900)]
drm: rcar-du: Support up to 4 CRTCs

The Gen3 R8A7795 DU has 4 CRTCs, support them all.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Drop LVDS double dependency on OF
Laurent Pinchart [Mon, 7 Sep 2015 11:47:01 +0000 (14:47 +0300)]
drm: rcar-du: Drop LVDS double dependency on OF

LVDS support depends on DRM_RCAR_DU which already depends on OF. Drop
the explicit dependency.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Enable compilation on ARM64
Koji Matsuoka [Fri, 7 Aug 2015 12:22:24 +0000 (21:22 +0900)]
drm: rcar-du: Enable compilation on ARM64

The R8A7795 SoC is ARM64-based and include a DU. Enable driver
compilation on ARM64.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Fix compile warning on 64-bit platforms
Koji Matsuoka [Wed, 26 Aug 2015 00:37:08 +0000 (09:37 +0900)]
drm: rcar-du: Fix compile warning on 64-bit platforms

Use %tu instead of %u to print difference between pointers.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Expose the VSP1 compositor through KMS planes
Laurent Pinchart [Mon, 7 Sep 2015 14:14:58 +0000 (17:14 +0300)]
drm: rcar-du: Expose the VSP1 compositor through KMS planes

On R-Car Gen3 SoCs the DU lost its ability to access memory directly and
needs to work in conjunction with the VSP to do so. This commit handles
the VSP internally to hide it from the user.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Move plane allocator to rcar_du_plane.c
Laurent Pinchart [Mon, 27 Jul 2015 12:34:18 +0000 (15:34 +0300)]
drm: rcar-du: Move plane allocator to rcar_du_plane.c

The plane allocator is specific to DU planes and won't be used for
VSP-based planes, move it with the rest of the DU planes code where it
belongs.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Restart the DU group when a plane source changes
Laurent Pinchart [Sat, 24 Aug 2013 00:17:03 +0000 (02:17 +0200)]
drm: rcar-du: Restart the DU group when a plane source changes

Plane sources are configured by the VSPS bit in the PnDDCR4 register.
Although the datasheet states that the bit is updated during vertical
blanking, it seems that updates only occur when the DU group is held in
reset through the DSYSR.DRES bit. Restart the group if the source
changes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Add VSP1 compositor support
Laurent Pinchart [Fri, 21 Jun 2013 15:54:50 +0000 (17:54 +0200)]
drm: rcar-du: Add VSP1 compositor support

Configure the plane source at plane setup time to source frames from
memory or from the VSP1.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Add VSP1 support to the planes allocator
Laurent Pinchart [Fri, 21 Jun 2013 15:36:15 +0000 (17:36 +0200)]
drm: rcar-du: Add VSP1 support to the planes allocator

The R8A7790 DU can source frames directly from the VSP1 devices VSPD0
and VSPD1. VSPD0 feeds DU0/1 plane 0, and VSPD1 feeds either DU2 plane 0
or DU0/1 plane 1.

Allocate the correct fixed plane when sourcing frames from VSPD0 or
VSPD1, and allocate planes in reverse index order otherwise to ensure
maximum availability of planes 0 and 1.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Refactor plane setup
Laurent Pinchart [Mon, 27 Jul 2015 10:43:09 +0000 (13:43 +0300)]
drm: rcar-du: Refactor plane setup

Rename plane setup functions using more explicit names, and use local
variables to store intermediate values to increase readability. This
also prepares for VSP compositor support.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Compute plane DDCR4 register value directly
Laurent Pinchart [Mon, 27 Jul 2015 09:46:44 +0000 (12:46 +0300)]
drm: rcar-du: Compute plane DDCR4 register value directly

There's no need for a read-modify-write pattern, all register bits can
be set explicitly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Don't update planes on disabled CRTCs
Laurent Pinchart [Thu, 10 Sep 2015 15:52:55 +0000 (18:52 +0300)]
drm: rcar-du: Don't update planes on disabled CRTCs

A disabled CRTC can't display planes, the driver shouldn't try to
configure it when updating planes. The DRM core will store the plane
state for us, and the plane will be configured appropriately the next
time the CRTC is enabled.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Remove local CRTC enabled state
Laurent Pinchart [Sun, 24 Jan 2016 22:28:11 +0000 (00:28 +0200)]
drm: rcar-du: Remove local CRTC enabled state

The atomic framework guarantees that the CRTC enable and disable
functions will only be called when needed, there's no need to duplicate
the CRTC state check. By replacing the local CRTC enabled state check at
resume time with the CRTC active state we can remove the local CRTC
enabled state altogether.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Perform initialization/cleanup at probe/remove time
Laurent Pinchart [Mon, 28 Sep 2015 15:39:53 +0000 (18:39 +0300)]
drm: rcar-du: Perform initialization/cleanup at probe/remove time

The drm driver .load() operation is prone to race conditions as it
initializes the driver after registering the device nodes. Its usage is
deprecated, inline it in the probe function and call drm_dev_alloc() and
drm_dev_register() explicitly.

For consistency inline the .unload() handler in the remove function as
well.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agoMerge remote-tracking branch 'linuxtv/vsp1' into HEAD
Laurent Pinchart [Sat, 20 Feb 2016 00:58:43 +0000 (02:58 +0200)]
Merge remote-tracking branch 'linuxtv/vsp1' into HEAD

8 years ago[media] vsp1_drm.h: add missing prototypes
Mauro Carvalho Chehab [Fri, 19 Feb 2016 12:02:53 +0000 (10:02 -0200)]
[media] vsp1_drm.h: add missing prototypes

drivers/media/platform/vsp1/vsp1_drm.c:47:5: warning: no previous prototype for 'vsp1_du_init' [-Wmissing-prototypes]
 int vsp1_du_init(struct device *dev)
     ^
drivers/media/platform/vsp1/vsp1_drm.c:76:5: warning: no previous prototype for 'vsp1_du_setup_lif' [-Wmissing-prototypes]
 int vsp1_du_setup_lif(struct device *dev, unsigned int width,
     ^
drivers/media/platform/vsp1/vsp1_drm.c:221:6: warning: no previous prototype for 'vsp1_du_atomic_begin' [-Wmissing-prototypes]
 void vsp1_du_atomic_begin(struct device *dev)
      ^
drivers/media/platform/vsp1/vsp1_drm.c:273:5: warning: no previous prototype for 'vsp1_du_atomic_update' [-Wmissing-prototypes]
 int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
     ^
drivers/media/platform/vsp1/vsp1_drm.c:451:6: warning: no previous prototype for 'vsp1_du_atomic_flush' [-Wmissing-prototypes]
 void vsp1_du_atomic_flush(struct device *dev)
      ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Configure device based on IP version
Laurent Pinchart [Sat, 5 Dec 2015 22:17:10 +0000 (20:17 -0200)]
[media] v4l: vsp1: Configure device based on IP version

The IP version number carries enough information to identify the exact
device instance features. Drop the related DT properties and use the IP
version instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add display list support
Takashi Saito [Mon, 7 Sep 2015 04:40:25 +0000 (01:40 -0300)]
[media] v4l: vsp1: Add display list support

Display lists contain lists of registers and associated values to be
applied atomically by the hardware. They lower the pressure on interrupt
processing delays when reprogramming the device as settings can be
prepared well in advance and queued to the hardware without waiting for
the end of the current frame.

Display list support is currently limited to the DRM pipeline.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add support for the R-Car Gen3 VSP2
Laurent Pinchart [Mon, 7 Sep 2015 11:05:39 +0000 (08:05 -0300)]
[media] v4l: vsp1: Add support for the R-Car Gen3 VSP2

Add DT compatible strings for the VSP2 instances found in the R-Car Gen3
SoCs and support them in the vsp1 driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Implement atomic update for the DRM driver
Laurent Pinchart [Thu, 10 Sep 2015 12:28:39 +0000 (09:28 -0300)]
[media] v4l: vsp1: Implement atomic update for the DRM driver

Add two API functions named vsp1_du_atomic_begin() and
vsp1_du_atomic_flush() to signal the start and end of an atomic update.
The vsp1_du_setup_rpf() function is renamed to vsp1_du_atomic_update()
for consistency.

With this new API, the driver will reprogram all modified inputs
atomically before restarting the video stream.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Disconnect unused RPFs from the DRM pipeline
Laurent Pinchart [Thu, 10 Sep 2015 18:56:29 +0000 (15:56 -0300)]
[media] v4l: vsp1: Disconnect unused RPFs from the DRM pipeline

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add VSP+DU support
Laurent Pinchart [Sun, 2 Aug 2015 21:37:01 +0000 (18:37 -0300)]
[media] v4l: vsp1: Add VSP+DU support

Implement internal control of the VSP pipeline to be used by the DU
DRM/KMS driver when using the VSP as an internal composer handled
through DRM/KMS only.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Don't validate links when the userspace API is disabled
Laurent Pinchart [Wed, 5 Aug 2015 20:14:41 +0000 (17:14 -0300)]
[media] v4l: vsp1: Don't validate links when the userspace API is disabled

As the pipeline is configured internally by the driver when the
userspace API is disabled its configuration can be trusted and link
validation isn't needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Set the alpha value manually in RPF and WPF s_stream handlers
Laurent Pinchart [Wed, 5 Aug 2015 19:57:35 +0000 (16:57 -0300)]
[media] v4l: vsp1: Set the alpha value manually in RPF and WPF s_stream handlers

The RPF and WPF alpha values are set through V4L2 controls and applied
when starting the video stream by a call to v4l2_ctrl_handler_setup().
As that function uses the control handler mutex it can't be called in
interrupt context, where the VSP+DU pipeline handler might need to
reconfigure the pipeline.

Set the alpha value manually in the RPF and WPF s_stream handler to
ensure that the hardware is properly configured even when controlled
without the userspace API. If the userspace API is enabled protect that
with the control lock to avoid race conditions with userspace.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make pipeline inputs array index by RPF index
Laurent Pinchart [Wed, 5 Aug 2015 19:40:31 +0000 (16:40 -0300)]
[media] v4l: vsp1: Make pipeline inputs array index by RPF index

The pipeline inputs array stores pointers to all RPFs contained in the
pipeline. It's currently indexed contiguously by adding RPFs in the
order they are found during graph walk. This can't easily support
dynamic addition and removal of RPFs while streaming, which will be
required for combined VSP+DU support.

Make the array indexed by RPF index instead and skip NULL elements when
iterating over RPFs.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make the userspace API optional
Laurent Pinchart [Tue, 28 Jul 2015 19:16:05 +0000 (16:16 -0300)]
[media] v4l: vsp1: Make the userspace API optional

The R-Car Gen3 SoCs include VSP instances dedicated to the DU that will
be controlled entirely by the rcar-du-drm driver through the KMS API. To
support that use case make the userspace V4L2 API optional.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move format info to vsp1_pipe.c
Laurent Pinchart [Mon, 3 Aug 2015 13:21:49 +0000 (10:21 -0300)]
[media] v4l: vsp1: Move format info to vsp1_pipe.c

Format information and the related helper function are not specific to
the V4L2 API, move them from vsp1_video.c to vsp1_pipe.c.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make the BRU optional
Laurent Pinchart [Fri, 14 Aug 2015 16:53:45 +0000 (13:53 -0300)]
[media] v4l: vsp1: Make the BRU optional

Not all VSP instances have a BRU on R-Car Gen3, make it optional. Set
the feature unconditionally for now, this will be fixed when adding Gen3
support.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make number of BRU inputs configurable
Laurent Pinchart [Mon, 3 Aug 2015 12:46:26 +0000 (09:46 -0300)]
[media] v4l: vsp1: Make number of BRU inputs configurable

The R-Car Gen3 family has 5-inputs BRUs, support them by making the
number of BRU inputs configurable.

As the driver assumes that the number of BRU inputs is equal to the
number of RPFs, replace the BRU_MAX_INPUTS macro with VSP1_MAX_RPF to
make the assumption apparent.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move entity route setup function to vsp1_entity.c
Laurent Pinchart [Sun, 2 Aug 2015 21:58:31 +0000 (18:58 -0300)]
[media] v4l: vsp1: Move entity route setup function to vsp1_entity.c

The function will be used by the DU code, move it out of vsp1_video.c.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Remove unused module read functions
Laurent Pinchart [Wed, 9 Sep 2015 14:32:06 +0000 (11:32 -0300)]
[media] v4l: vsp1: Remove unused module read functions

Several module read functions are not used, remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream
Laurent Pinchart [Wed, 9 Sep 2015 14:38:56 +0000 (11:38 -0300)]
[media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream

Commit 58f896d859ce ("[media] v4l: vsp1: sru: Make the intensity
controllable during streaming") refactored the stream start code and
removed the SRU CTRL0 register write by mistake. Add it back.

Fixes: 58f896d859ce ("[media] v4l: vsp1: sru: Make the intensity controllable during streaming")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Fix typo in VI6_DISP_IRQ_STA_DST register bit name
Laurent Pinchart [Thu, 10 Sep 2015 07:55:46 +0000 (04:55 -0300)]
[media] v4l: vsp1: Fix typo in VI6_DISP_IRQ_STA_DST register bit name

Rename the VI6_DISP_IRQ_STA_DSE register bit to VI6_DISP_IRQ_STA_DST to
fix a typo and match the datasheet.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Document the vsp1_pipeline structure
Laurent Pinchart [Sun, 2 Aug 2015 21:24:55 +0000 (18:24 -0300)]
[media] v4l: vsp1: Document the vsp1_pipeline structure

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Extract link creation to separate function
Laurent Pinchart [Sun, 2 Aug 2015 21:21:12 +0000 (18:21 -0300)]
[media] v4l: vsp1: Extract link creation to separate function

Link creation will be handled differently for the DU pipeline.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>