Commit Graph

132 Commits

Author SHA1 Message Date
Maarten Lankhorst 613d2b2721 drm/atomic: pass old crtc state to atomic_begin/flush.
In intel it's useful to keep track of some state changes with old
crtc state vs new state, for example to disable initial planes or
when a modeset's prevented during fastboot.

Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
[danvet: squash in fixup for exynos provided by Maarten.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-07-27 16:23:22 +02:00
Laurent Pinchart 263b39fe33 drm: rcar-du: Use the drm atomic state duplication helpers for planes
Ensure that the duplicate and destroy plane state operations will always
be in sync with the DRM core implementation of the plane state by using
the __drm_atomic_helper_plane_duplicate_state() and
__drm_atomic_helper_plane_destroy_state() functions designed especially
for this purpose.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-16 14:25:55 +03:00
Laurent Pinchart 39a3d57065 drm: rcar-du: Clean up planes in the error paths of .atomic_commit()
When the .atomic_commit() handler fails, clean up planes previoulsy
prepared by drm_atomic_helper_prepare_planes() with a call to
drm_atomic_helper_cleanup_planes().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-16 14:25:54 +03:00
Laurent Pinchart 898a2f387d drm: rcar-du: Convert rcar_du_encoders_init_one() return value to 0/<0
The function returns 1 on success, and either 0 or a negative error code
on failure. As the 0 and negative values don't need to be differentiated
by the caller, convert it to the usual scheme of returning 0 on success
and a negative error code on failure.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-06-16 14:25:53 +03:00
Laurent Pinchart 64549cdf85 drm: rcar-du: Clarify error message when encoder initialization fails
A failure to initialize an encoder currently prints an error message in
the kernel log without mentioning which encoder failed to initialize. To
help debugging initialization issues print the encoder DT node name.

This requires moving the error message to the rcar_du_encoders_init_one
function and refactoring it slightly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-06-16 14:25:52 +03:00
Laurent Pinchart d6aed57481 drm: rcar-du: Fix crash with groups that have less than 9 planes
Commit 917de18037 ("drm: rcar-du: Implement universal plane support")
made the number of planes per group dynamic, but didn't update all loops
over the planes array, resulting in out-of-bound accesses on DU
instances that have an odd number of CRTCs (such as the R8A7790). Fix
it.

Fixes: 917de18037 ("drm: rcar-du: Implement universal plane support")
Cc: stable@vger.kernel.org
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-06-16 14:25:43 +03:00
Laurent Pinchart 911316fe2f drm: rcar-du: Disable all planes when stopping the CRTC
The DSnPR plane configuration registers are updated on vblank, and no
vblank will occur once the CRTC is stopped. We thus can't only disable
planes right before starting the CRTC as it would start scanning out
immediately from old frame buffers until the next vblank.

Fix the problem by disabling all planes when stopping the CRTC and wait
for the change to take effect. This increases the CRTC stop delay,
especially when multiple CRTCs are stopped in one operation as we now
wait for one vblank per CRTC. Whether this can be improved needs to be
researched.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-06-16 14:15:47 +03:00
Laurent Pinchart 6e0c6e1895 drm: rcar-du: Print the error value when DRM/KMS init fails
This helps debugging probe failures.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-06-16 14:15:47 +03:00
Laurent Pinchart 2610abfb3a drm: rcar-du: Split planes pre-association 4/4 between CRTCs
If we have more than one CRTCs in a group pre-associate planes 0-3 with
CRTC 0 and planes 4-7 with CRTC 1 to minimize flicker occurring when the
association is changed. The pre-association could be controlled by a
module parameter if needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-05-25 15:34:13 +03:00
Laurent Pinchart fe6fbe9a02 drm: rcar-du: Store the number of CRTCs per group in the group structure
The number of CRTCs in a group is only used to implement plane
initialization for now, but is also needed to implement pre-association
of planes to CRTCs. Store it in the group structure instead of computing
it on demand.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-05-25 15:34:12 +03:00
Laurent Pinchart c8af99b604 drm: rcar-du: Consider plane to CRTC associations in the plane allocator
Hardware planes are driven by the timing generator of the CRTC they are
associated to. Changing the association requires restarting the CRTC
group that the plane belongs to, resulting in flicker on the other CRTC.

To avoid flicker as much as possible, try to allocate planes first from
the free planes already associated with the target CRTC. If allocation
fails then fall back to allocation from all free planes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-05-25 15:34:12 +03:00
Laurent Pinchart 2a57e9b5af drm: rcar-du: Keep plane to CRTC associations when disabling a plane
Changing the plane to CRTC associations requires restarting the CRTC
group, creating visible flicker. Mitigate the issue by changing plane
association only when a plane becomes enabled, not when it get disabled.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-05-25 15:34:12 +03:00
Laurent Pinchart 0805861195 drm: rcar-du: Add plane allocation debugging
Plane allocation is a complex process, add debugging statements to help
finding out what could might wrong.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-05-25 15:34:11 +03:00
Laurent Pinchart ec69a40645 drm: rcar-du: Rename to_rcar_du_plane_state to to_rcar_plane_state
All other cast functions are named without using "du", make the plane
state cast consistent with them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-05-25 15:34:11 +03:00
Laurent Pinchart 99caede11d drm: rcar-du: Embed rcar_du_planes structure into rcar_du_group
The rcar_du_planes structure contains a single field and is only
instantiated in the rcar_du_group structure. Embed it directly and
remove the rcar_du_planes structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-05-25 15:34:11 +03:00
Laurent Pinchart 9f6aee952b drm: rcar-du: Move properties from rcar_du_planes to rcar_du_device
The plane property objects are instantiated once per CRTC group, while
they should be instantiated once globally for the device. Fix this and
move them to the rcar_du_device structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-05-25 15:34:11 +03:00
Laurent Pinchart 0855c6827f drm: rcar-du: Document the rcar_du_plane_state structure
Document the structure fields using kerneldoc.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-05-25 15:34:10 +03:00
Laurent Pinchart bce9936a0d drm: rcar-du: Document the rcar_du_crtc structure
Document the structure fields using kerneldoc.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-05-25 15:34:10 +03:00
Dave Airlie bb1dc08c94 drm: Use of-graph helpers to loop over endpoints
Convert all drm callers that use of_graph_get_next_endpoint to loop over
 of-graph endpoints to the newly introduced for_each_endpoint_of_node
 helper macro.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVJPGBAAoJEFDCiBxwnmDrsIIP/05ID1FxnfCCb14sF9cnfM3N
 LzZnLiD4mAUVB8H94BPz9M1Zu8aA06VjUt2Ay9DxXJRUhsil8YHoblHXORyABDH/
 E9/HAQkTluA39+rRvzv4fNr4oROMICbWpUGsczQf4cAv8fPheoOudXw2ENa26LbK
 KMmVwxgqPeDkSCqB/pBb6Nod5rN3m0aOGGAliGK+jb4t5bYx0p7+6VdizmOUR1Ax
 lUOXZWlB26Z/iEW5aWqSNAafFCqhZmPYiONk/xlReR83z3ZpvPYbeiKqh9JZ5u9F
 YxNLkIRbe73SX9Ss6hnorg17S/ONXE4wDovkUueFxKTCE6l8eUM6gBzo5+0X6Xgz
 iAU/aghflS28qmqWEN7uZvEh643A0TvKB2KRVURsS+3INuzn3+RzLRWDfHnUvF4t
 EGo9WjjpHTw5PRaE7qvk6VLoSx1ygbPnzSXhPiDqbuaeLoOJuZEVnknOwVNoEzoh
 +A3LiJJFmxWql+uM4QSCgjvpC4b9oscCAxS07Rt8BTIGZkkW8lyDDbkb4rdrosaN
 MfStFSvDSX/VJOXVcJgJ3Xq1nhusuDnaj8G4PASQGb6IXTbHtauVlLLmjJFgTC94
 xEr0EObJIvoNx1JeJw/8IzMWuQSTs3O2waderNyo6cyN6ycDsKtCUPsBv8iYHm+C
 3u6YWSyPXsEi8jcqa9SX
 =la2O
 -----END PGP SIGNATURE-----

Merge tag 'of-graph-drm-2015-04-08' of git://git.pengutronix.de/git/pza/linux into drm-next

drm: Use of-graph helpers to loop over endpoints

Convert all drm callers that use of_graph_get_next_endpoint to loop over
of-graph endpoints to the newly introduced for_each_endpoint_of_node
helper macro.

* tag 'of-graph-drm-2015-04-08' of git://git.pengutronix.de/git/pza/linux:
  drm/rockchip: use for_each_endpoint_of_node macro, drop endpoint reference on break
  drm/rcar-du: use for_each_endpoint_of_node macro
  drm/imx: use for_each_endpoint_of_node macro in imx_drm_encoder_get_mux_id
  drm: use for_each_endpoint_of_node macro in drm_of_find_possible_crtcs
  of: Explicitly include linux/types.h in of_graph.h
  dt-bindings: brcm: rationalize Broadcom documentation naming
  of/unittest: replace 'selftest' with 'unittest'
  Documentation: rename of_selftest.txt to of_unittest.txt
  Documentation: update the of_selftest.txt
  dt: OF_UNITTEST make dependency broken
  MAINTAINERS: Pantelis Antoniou device tree overlay maintainer
  of: Add of_graph_get_port_by_id function
  of: Add for_each_endpoint_of_node helper macro
  of: Decrement refcount of previous endpoint in of_graph_get_next_endpoint
2015-04-13 17:28:16 +10:00
Philipp Zabel 4af642d5bf drm/rcar-du: use for_each_endpoint_of_node macro
Using the for_each_... macro should make the code a bit shorter and
easier to read.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-04-08 11:14:26 +02:00
Laurent Pinchart 6dbe686b59 drm: rcar-du: Enable the atomic updates API
Set the DRIVER_ATOMIC flag to enable usage of the atomic updates API
with the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-19 12:00:22 +02:00
Laurent Pinchart 3515a9a20a drm: rcar-du: Don't initialize event->pipe field
The field is set by drm_send_vblank_event(), there's no need to
preinitialize it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-19 12:00:21 +02:00
Laurent Pinchart de115fac73 drm: rcar-du: Fix framebuffer reference leak through plane state
Plane state duplication takes a reference to the framebuffer stored in
the state, but state destroy doesn't release it. This causes a reference
leak. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-19 12:00:21 +02:00
Laurent Pinchart 5ee5a81df5 drm: rcar-du: Fix race condition in hardware plane allocator
The plane allocator has been inherently racy since the beginning of the
transition to atomic updates, as the allocator lock is released between
free plane check (at .atomic_check() time) and the reservation (at
.atomic_update() time).

To fix it, create a new allocator solely based on the atomic plane
states without keeping any external state and perform allocation in the
.atomic_check() handler. The core idea is to replace the free planes
bitmask with a collective knowledge based on the allocated hardware
plane(s) for each KMS plane. The allocator then loops over all plane
states to compute the free planes bitmask, allocates hardware planes
based on that bitmask, and stores the result back in the plane states.

For this to work we need to access the current state of planes not
touched by the atomic update. To ensure that it won't be modified, we
need to lock all planes using drm_atomic_get_plane_state(). This
effectively serializes atomic updates from .atomic_check() up to
completion, either when swapping the states if the check step has
succeeded, or when freeing the states if the check step has failed.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:30 +02:00
Laurent Pinchart 48596d502e drm: rcar-du: Move group locking inside rcar_du_crtc_update_planes()
Only the planes to CRTCs association control register DPTSR needs to be
protected by custom locking, don't hold the mutex around the whole code.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:29 +02:00
Laurent Pinchart 52055bafa1 drm: rcar-du: Move plane commit code from CRTC start to CRTC resume
As the DRM core will commit plane states when performing atomic updates,
those don't need to be committed manually when the CRTC is started except
in the system resume code path.

However, the atomic plane commit step is currently performed between
mode set disable and mode set enable to mimick the legacy mode setting
operations order. This causes the device clocks to be disabled after
applying plane settings and reenabled when enabling the CRTC,
potentially losing hardware in between.

Reorder the operations to enable the CRTC first and only then apply
plane settings, removing the need to manage clocks in the atomic begin
and flush handlers. We can then move the plane state commit code out of
the CRTC start handler to the system resume handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:28 +02:00
Laurent Pinchart 5bfcbce0ea drm: rcar-du: Move plane format to plane state
The format stored in the rcar_du_plane structure is part of the plane
state. Move it to the rcar_du_plane_state structure and precompute it in
the .atomic_check() handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:27 +02:00
Laurent Pinchart 53dff60179 drm: rcar-du: Remove unneeded rcar_du_crtc plane field
The rcar_du_crtc plane field is only used to check for an error that
can't occur. Remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:26 +02:00
Laurent Pinchart 47094194f0 drm: rcar-du: Replace plane crtc and enabled fields by plane state
The crtc and enabled fields duplicates information stored in the plane
state. Use the plane state instead and remove the fields.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:25 +02:00
Laurent Pinchart f398f344eb drm: rcar-du: Rework plane setup code
Now that the plane setup code isn't called outside of the plane
implementation, it can be simplified by merging the
rcar_du_plane_compute_base() and rcar_du_plane_update_base() functions.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:24 +02:00
Laurent Pinchart 4407cc02c9 drm: rcar-du: Switch plane set_property to atomic helpers
Allow setting up plane properties atomically using the plane
set_property atomic helper. The properties are now stored in the plane
state (requiring subclassing it) and applied when updating the planes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:23 +02:00
Laurent Pinchart d5746642f4 drm: rcar-du: Switch page flip to atomic helpers
The atomic page flip helper implements the page flip operation using
asynchronous commits.

As the legacy page flip was the last CRTC operation that needed direct
access to plane setup, the plane setup functions can now become private
to the plane implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:22 +02:00
Laurent Pinchart 8d3f9b2289 drm: rcar-du: Implement asynchronous commit support
Implement a custom .atomic_commit() handler that supports asynchronous
commits using a work queue. This can be used for userspace-driven
asynchronous commits, as well as for an atomic page flip implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:21 +02:00
Laurent Pinchart ede7714f2e drm: rcar-du: Replace encoder mode_fixup with atomic_check
The encoder .mode_fixup() operation is legacy, atomic updates uses the
new .atomic_check() operation. Convert the encoders drivers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:21 +02:00
Laurent Pinchart f348323240 drm: rcar-du: Switch connector DPMS to atomic helpers
The atomic connector DPMS helper implements the connector DPMS operation
using atomic commit, removing the need for DPMS helper operations on
CRTCs and encoders.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:20 +02:00
Laurent Pinchart cf1cc6f249 drm: rcar-du: Switch mode config to atomic helpers
This removes the legacy mode config code. The CRTC and encoder prepare
and commit operations are not used anymore, remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:19 +02:00
Laurent Pinchart 336d04a180 drm: rcar-du: Switch plane update to atomic helpers
This removes the legacy plane update code. Wire up the default atomic
check and atomic commit mode config helpers as needed by the plane
update atomic helpers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:18 +02:00
Laurent Pinchart beff155a7e drm: rcar-du: Rework CRTC enable/disable for atomic updates
When using atomic updates the CRTC .enable() and .disable() helper
operations are preferred over the (then legacy) .prepare() and .commit()
operations. Implement .enable() and rework .disable() to not depend on
DPMS, easing DPMS removal later on.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:17 +02:00
Laurent Pinchart 58706b88c4 drm: rcar-du: Rework HDMI encoder enable/disable for atomic updates
When using atomic updates the encoder .enable() and .disable() helper
operations are preferred over the (then legacy) .prepare() and .commit()
operations. Implement .enable() and .disable() and rework .prepare(),
.commit() and .dpms() as wrappers around .enable() and .disable(),
easing their future removal.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:16 +02:00
Laurent Pinchart f6638b6abc drm: rcar-du: Rework encoder enable/disable for atomic updates
When using atomic updates the encoder .enable() and .disable() helper
operations are preferred over the (then legacy) .prepare() and .commit()
operations. Implement .enable() and .disable() and rework .prepare(),
.commit() and .dpms() as wrappers around .enable() and .disable(),
easing their future removal.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:15 +02:00
Laurent Pinchart 44ef7ed5ac drm: rcar-du: Replace LVDS encoder DPMS by enable/disable
The LVDS encoder doesn't support DPMS states, replace the DPMS operation
by enable/disable to avoid propagating DPMS states down to the encoder
code.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:14 +02:00
Laurent Pinchart 287bdf0303 drm: rcar-du: Remove private copy of plane size and position
The plane source and destination size and positions are stored in the
plane state, and a private copy is kept in the rcar_du_plane objects.
Remove the private copy as it just duplicates the state.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:13 +02:00
Laurent Pinchart 3e8da87d0c drm: rcar-du: Wire up atomic state object scaffolding
Hook up the default .reset(), .atomic_duplicate_state() and
.atomic_free_state() helpers to ensure that state objects are properly
created and destroyed, and call drm_mode_config_reset() at init time to
create the initial state objects.

Framebuffer reference count also gets maintained automatically by the
transitional helpers except for the legacy page flip operation. Maintain
it explicitly there.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:12 +02:00
Laurent Pinchart 845f46356b drm: rcar-du: Handle primary plane config through atomic plane ops
Use the new CRTC atomic transitional helpers drm_helper_crtc_mode_set()
and drm_helper_crtc_mode_set_base() to implement the CRTC .mode_set and
.mode_set_base operations. This delegates primary plane configuration to
the plane .atomic_update and .atomic_disable operations, removing
duplicate code from the CRTC implementation.

There is now no code path available to the driver in which to drop the
reference to the CRTC acquired in the .prepare() operation if an error
then occurs. The driver thus now leaks a reference if an error occurs
during mode set. So be it, this will be fixed in a further step of the
atomic update transition.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:11 +02:00
Laurent Pinchart 920888a2d5 drm: rcar-du: Implement planes atomic operations
Implement the CRTC .atomic_begin() and .atomic_flush() operations, the
plane .atomic_check(), .atomic_update() and operations, and use the
transitional atomic helpers to implement the plane update and disable
operations on top of the new atomic operations.

The plane setup code can't be moved out of the CRTC start function
completely yet, as the atomic code paths are not taken every time the
CRTC needs to be started. This results in some code duplication that
will be fixed after switching to atomic updates completely.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:10 +02:00
Laurent Pinchart 3053460482 drm: rcar-du: Fix hardware plane allocation
The hardware plane allocator loops over all planes to find free
candidates. However, instead of looping over the number of hardware
planes, it loops over the number of software planes, which happens to be
larger by one unit. This has no effect in practise as the extra plane is
always cleared in the mask of free planes, but it should still be fixed
for correctness.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:09 +02:00
Laurent Pinchart 917de18037 drm: rcar-du: Implement universal plane support
Explicitly create the CRTC primary plane instead of relying on the core
helpers to do so. This simplifies the plane logic by merging the KMS and
software planes.

Reject plane API operations on the primary planes for now, as that code
will anyway be refactored when implementing support for atomic updates.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:08 +02:00
Laurent Pinchart a64b9c7e56 drm: rcar-du: Define macros for the max number of groups, CRTCs and LVDS
Let's avoid magic constants. Beside increasing code readability, it will
also ensure that no location will be forgotten when raising the maximum
number of groups, CRTCs or LVDS encoders

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:07 +02:00
Laurent Pinchart 931b733621 drm: rcar-du: Disable fbdev emulation when no connector is present
fbdev emulation requires at least one connector, and will fail to
initialize if no connector has been successfully instantiated. Disable
it in that case and print an informational message instead of failing
probe with a confusing fbdev emulation error message.

It could be argued that probe should fail when no connector is present,
but the DU could still be useful in that case with the to-be-implemented
memory write-back support.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:06 +02:00
Laurent Pinchart 0cd90a5428 drm: rcar-du: Turn vblank on/off when enabling/disabling CRTC
The DRM core vblank handling mechanism requires drivers to forcefully
turn vblank reporting off when disabling the CRTC, and to restore the
vblank reporting status when enabling the CRTC.

Implement this using the drm_crtc_vblank_on/off helpers. When disabling
vblank we must first wait for page flips to complete, so implement page
flip completion wait as well.

Finally, drm_crtc_vblank_off() must be called at startup to synchronize
the state of the vblank core code with the hardware, which is initially
disabled. This is performed at CRTC creation time, requiring vertical
blanking to be initialized before creating CRTCs.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:05 +02:00