summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
Commit message (Collapse)AuthorAgeFilesLines
* drm: Convert atomic drivers from CRTC .disable() to .atomic_disable()Laurent Pinchart2017-06-301-2/+3
| | | | | | | | | | | | | | | | | | | The CRTC .disable() helper operation is deprecated for atomic drivers, the new .atomic_disable() helper operation being preferred. Convert all atomic drivers to .atomic_disable() to avoid cargo-cult use of .disable() in new drivers. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> # for sun4i Acked-by: Philipp Zabel <p.zabel@pengutronix.de> # for mediatek Acked-by: Alexey Brodkin <abrodkin@synopsys.com> # for arcpgu Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> # for atmel-hlcdc Tested-by: Philippe Cornu <philippe.cornu@st.com> # for stm Acked-by: Philippe Cornu <philippe.cornu@st.com> # for stm Acked-by: Vincent Abriou <vincent.abriou@st.com> # for sti Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> # for vmwgfx Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20170630093646.7928-3-laurent.pinchart+renesas@ideasonboard.com
* drm: Add old state pointer to CRTC .enable() helper functionLaurent Pinchart2017-06-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | The old state is useful for drivers that need to perform operations at enable time that depend on the transition between the old and new states. While at it, rename the operation to .atomic_enable() to be consistent with .atomic_disable(), as the .enable() operation is used by atomic helpers only. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> # for sun4i Acked-by: Philipp Zabel <p.zabel@pengutronix.de> # for imx-drm and mediatek Acked-by: Alexey Brodkin <abrodkin@synopsys.com> # for arcpgu Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> # for atmel-hlcdc Acked-by: Liviu Dudau <Liviu.Dudau@arm.com> # for hdlcd and mali-dp Acked-by: Stefan Agner <stefan@agner.ch> # for fsl-dcu Tested-by: Philippe Cornu <philippe.cornu@st.com> # for stm Acked-by: Philippe Cornu <philippe.cornu@st.com> # for stm Acked-by: Vincent Abriou <vincent.abriou@st.com> # for sti Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> # for vmwgfx Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20170630093646.7928-2-laurent.pinchart+renesas@ideasonboard.com
* drm: rcar-du: Register a completion callback with VSP1Kieran Bingham2017-05-221-2/+6
| | | | | | | | | | | | | | Currently we process page flip events on every display interrupt, however this does not take into consideration the processing time needed by the VSP1 utilised in the pipeline. Register a callback with the VSP driver to obtain completion events, and track them so that we only perform page flips when the full display pipeline has completed for the frame. Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
* drm: rcar-du: Arm the page flip event after queuing the page flipLaurent Pinchart2017-05-221-11/+11
| | | | | | | | | | | | | | | | The page flip event is armed in the atomic begin handler, creating a race condition with the frame end interrupt that could send the event before the atomic operation actually completes. To avoid that, arm the event in the atomic flush handler after queuing the page flip. This change doesn't fully close the race window, as the frame end interrupt could be generated before the page flip is committed to hardware but only handled after the event is armed. However, the race window is now much smaller. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
* drm: rcar-du: Add DPLL supportKoji Matsuoka2017-04-041-1/+80
| | | | | | | | | | The implementation hardcodes a workaround for the H3 ES1.x SoC regardless of the SoC revision, as the workaround can be safely applied on all devices in the Gen3 family without any side effect. Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
* drm: rcar-du: Clear handled event pointer in CRTC stateLaurent Pinchart2017-04-041-3/+3
| | | | | | | | The atomic commit helper requires drivers to clear the event pointer stored in the CRTC state when the event is handled. In preparation to using the helper, fix the driver. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
* drm: rcar-du: Handle event when disabling CRTCsLaurent Pinchart2017-04-041-0/+7
| | | | | | | | | The driver currently handles vblank events only when updating planes on a CRTC. The atomic update API however allows requesting an event when disabling a CRTC. This currently leads to event objects being leaked in the kernel and to events not being sent out. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
* drm: rcar-du: use vblank hooks in struct drm_crtc_funcsShawn Guo2017-02-091-10/+19
| | | | | | | | | | | The vblank hooks in struct drm_driver are deprecated and only meant for legacy drivers. For modern drivers with DRIVER_MODESET flag, the hooks in struct drm_crtc_funcs should be used instead. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: http://patchwork.freedesktop.org/patch/msgid/1486458995-31018-17-git-send-email-shawnguo@kernel.org
* drm: rcar-du: Fix H/V sync signal polarity configurationKoji Matsuoka2016-11-151-2/+2
| | | | | | | | | The VSL and HSL bits in the DSMR register set the corresponding horizontal and vertical sync signal polarity to active high. The code got it the wrong way around, fix it. Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
* drm: rcar-du: Fix display timing controller parameterKoji Matsuoka2016-11-151-1/+1
| | | | | | | | | | There is a bug in the setting of the DES (Display Enable Signal) register. This current setting occurs 1 dot left shift. The DES register should be set minus one value about the specifying value with H/W specification. This patch corrects it. Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
* drm: rcar: use generic code for managing zpos plane propertyBenjamin Gaignard2016-07-291-1/+1
| | | | | | | | | | | | | | | | | | | version 6: rebased patch on top rcar-du changes for zpos version 4: fix null pointer issue while setting zpos in plane reset function This patch replaces zpos property handling custom code in rcar DRM driver with calls to generic DRM code. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
* drm/rcar-du: use drm_crtc_handle_vblank()Gustavo Padovan2016-07-121-1/+1
| | | | | | | | Remove legacy usage of drm_handle_vblank() Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1467677092-5089-5-git-send-email-gustavo@padovan.org
* drm/rcar-du: use drm_crtc_send_vblank_event()Gustavo Padovan2016-05-021-1/+1
| | | | | | | | | Replace the legacy drm_send_vblank_event() with the new helper function. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1460656118-16766-9-git-send-email-gustavo@padovan.org
* drm/rcar-du: removed optional dummy crtc mode_fixup function.Carlos Palminha2016-03-041-9/+0
| | | | | | | | | | 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
* drm: rcar-du: Add R8A7795 device supportLaurent Pinchart2016-02-231-3/+8
| | | | | | | | 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>
* drm: rcar-du: Output the DISP signal on the DISP pinLaurent Pinchart2016-02-231-1/+1
| | | | | | | | 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>
* drm: rcar-du: Support up to 4 CRTCsKoji Matsuoka2016-02-231-1/+1
| | | | | | | 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>
* drm: rcar-du: Expose the VSP1 compositor through KMS planesLaurent Pinchart2016-02-231-7/+41
| | | | | | | | 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>
* drm: rcar-du: Restart the DU group when a plane source changesLaurent Pinchart2016-02-201-0/+4
| | | | | | | | | | 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>
* drm: rcar-du: Remove local CRTC enabled stateLaurent Pinchart2016-02-201-11/+1
| | | | | | | | | | 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>
* drm/rcar: Nuke preclose hookDaniel Vetter2016-02-081-20/+0
| | | | | | | | | | | | Again since the drm core takes care of event unlinking/disarming this is now just needless code. Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1453756616-28942-10-git-send-email-daniel.vetter@ffwll.ch
* drm: Pass 'name' to drm_crtc_init_with_planes()Ville Syrjälä2015-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Done with coccinelle for the most part. However, it thinks '...' is part of the semantic patch, so I put an 'int DOTDOTDOT' placeholder in its place and got rid of it with sed afterwards. I didn't convert drm_crtc_init() since passing the varargs through would mean either cpp macros or va_list, and I figured we don't care about these legacy functions enough to warrant the extra pain. @@ identifier dev, crtc, primary, cursor, funcs; @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, struct drm_plane *primary, struct drm_plane *cursor, const struct drm_crtc_funcs *funcs + ,const char *name, int DOTDOTDOT ) { ... } @@ identifier dev, crtc, primary, cursor, funcs; @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, struct drm_plane *primary, struct drm_plane *cursor, const struct drm_crtc_funcs *funcs + ,const char *name, int DOTDOTDOT ); @@ expression E1, E2, E3, E4, E5; @@ drm_crtc_init_with_planes(E1, E2, E3, E4, E5 + ,NULL ) v2: Split crtc and plane changes apart Pass NULL for no-name instead of "" Leave drm_crtc_init() alone v3: Add ', or NULL...' to @name kernel doc (Jani) Annotate the function with __printf() attribute (Jani) 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/1449670771-2751-1-git-send-email-ville.syrjala@linux.intel.com
* drm/atomic: pass old crtc state to atomic_begin/flush.Maarten Lankhorst2015-07-271-2/+4
| | | | | | | | | | | | 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>
* drm: rcar-du: Fix crash with groups that have less than 9 planesLaurent Pinchart2015-06-161-2/+2
| | | | | | | | | | | | Commit 917de180379d ("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: 917de180379d ("drm: rcar-du: Implement universal plane support") Cc: stable@vger.kernel.org Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
* drm: rcar-du: Disable all planes when stopping the CRTCLaurent Pinchart2015-06-161-0/+13
| | | | | | | | | | | | | | | 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>
* drm: rcar-du: Split planes pre-association 4/4 between CRTCsLaurent Pinchart2015-05-251-3/+0
| | | | | | | | | 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>
* drm: rcar-du: Keep plane to CRTC associations when disabling a planeLaurent Pinchart2015-05-251-20/+28
| | | | | | | | 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>
* drm: rcar-du: Rename to_rcar_du_plane_state to to_rcar_plane_stateLaurent Pinchart2015-05-251-3/+3
| | | | | | | 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>
* drm: rcar-du: Embed rcar_du_planes structure into rcar_du_groupLaurent Pinchart2015-05-251-5/+5
| | | | | | | | 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>
* drm: rcar-du: Don't initialize event->pipe fieldLaurent Pinchart2015-03-191-2/+0
| | | | | | | 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>
* drm: rcar-du: Fix race condition in hardware plane allocatorLaurent Pinchart2015-03-031-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* drm: rcar-du: Move group locking inside rcar_du_crtc_update_planes()Laurent Pinchart2015-03-031-7/+3
| | | | | | | 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>
* drm: rcar-du: Move plane commit code from CRTC start to CRTC resumeLaurent Pinchart2015-03-031-34/+20
| | | | | | | | | | | | | | | | | | | 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>
* drm: rcar-du: Move plane format to plane stateLaurent Pinchart2015-03-031-2/+8
| | | | | | | | 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>
* drm: rcar-du: Remove unneeded rcar_du_crtc plane fieldLaurent Pinchart2015-03-031-5/+2
| | | | | | | 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>
* drm: rcar-du: Replace plane crtc and enabled fields by plane stateLaurent Pinchart2015-03-031-4/+2
| | | | | | | 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>
* drm: rcar-du: Switch plane set_property to atomic helpersLaurent Pinchart2015-03-031-2/+7
| | | | | | | | 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>
* drm: rcar-du: Switch page flip to atomic helpersLaurent Pinchart2015-03-031-41/+14
| | | | | | | | | | | 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>
* drm: rcar-du: Switch connector DPMS to atomic helpersLaurent Pinchart2015-03-031-10/+1
| | | | | | | | 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>
* drm: rcar-du: Switch mode config to atomic helpersLaurent Pinchart2015-03-031-49/+6
| | | | | | | 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>
* drm: rcar-du: Rework CRTC enable/disable for atomic updatesLaurent Pinchart2015-03-031-25/+34
| | | | | | | | | 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>
* drm: rcar-du: Wire up atomic state object scaffoldingLaurent Pinchart2015-03-031-0/+7
| | | | | | | | | | | | | 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>
* drm: rcar-du: Handle primary plane config through atomic plane opsLaurent Pinchart2015-03-031-70/+11
| | | | | | | | | | | | | | | | 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>
* drm: rcar-du: Implement planes atomic operationsLaurent Pinchart2015-03-031-1/+36
| | | | | | | | | | | | | | 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>
* drm: rcar-du: Implement universal plane supportLaurent Pinchart2015-03-031-1/+2
| | | | | | | | | | | 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>
* drm: rcar-du: Turn vblank on/off when enabling/disabling CRTCLaurent Pinchart2015-03-031-5/+13
| | | | | | | | | | | | | | | | | 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>
* drm: rcar-du: Wait for page flip completion when turning the CRTC offLaurent Pinchart2015-03-031-0/+35
| | | | | | | | Turning a CRTC off will prevent a queued page flip from ever completing, potentially confusing userspace. Wait for queued page flips to complete before turning the CRTC off to avoid this. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
* drm: rcar-du: Reorder CRTC functionsLaurent Pinchart2015-03-031-59/+83
| | | | | | | | | The next commit will need functions to be reordered to avoid forward declarations. Do it separately to help review. This only moves functions without any change to the code. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
* drm: rcar-du: Implement support for interlaced modesLaurent Pinchart2014-12-231-8/+15
| | | | | | | Accept interlaced modes on the VGA and HDMI connectors and configure the hardware accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
* drm: rcar-du: Clamp DPMS states to on and offLaurent Pinchart2014-12-231-0/+3
| | | | | | | | | | | The intermediate DPMS standby and suspend states are a thing from the past. They only matter in practice for VGA CRT monitors, and are just a power saving vs. resume time optimization. Given that they have never been implemented properly in the rcar-du driver and that the Intel driver has dropped them on the vga port years ago, it's safe to only care about the on and off states. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>