summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/omapdrm
AgeCommit message (Collapse)AuthorFilesLines
2015-08-06drm/omap: Use new drm_fb_helper functionsArchit Taneja1-25/+13
Use the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation. v3: - Update error handling for new drm_fb_helper funcs. Check using IS_ERR() instead of checking for NULL. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> v2: - No changes Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-08-06drm/omap: Fixup compile failDaniel Vetter1-2/+4
Maarten didn't fully test his patches on all drm drivers and apparently missed a few places when grepping. Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-07-02drm/omap: replace ALIGN(PAGE_SIZE) by PAGE_ALIGNFabian Frederick1-1/+1
use mm.h definition Cc: David Airlie <airlied@linux.ie> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: dri-devel@lists.freedesktop.org Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-07-02drm/omap: fix align_pitch() for 24 bits per pixelTomi Valkeinen1-1/+1
align_pitch() uses ALIGN() to ensure the pitch is aligned to SGX's requirement of 8 pixels. However, ALIGN() expects the alignment value to be a power of two, which is not the case for 24 bits per pixels. Use roundup() instead, which works for all alignments. This fixes the error seen with 24 bits per pixel modes: "buffer pitch (2176 bytes) is not a multiple of pixel size (3 bytes)" Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-07-02drm/omap: fix omap_gem_put_paddr() error handlingTomi Valkeinen2-6/+4
If tiler_unpin() call in omap_gem_put_paddr() fails, omap_gem_put_paddr() will immediately stop processing and return an error. This patch remoes that error checking, and also removes omap_gem_put_paddr()'s return value, because: * The caller of omap_gem_put_paddr() can do nothing if an error happens, so it's pointless to return an error value * If tiler_unpin() fails, the GEM object will possibly be left in an undefined state, where the DMM mapping may have been removed, but the GEM object still thinks everything is as it should be, leading to crashes later. * There's no point in returning an error from a "free" call, as the caller can do nothing about it. So it's better to clean up as much as possible. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-07-02drm/omap: fix omap_framebuffer_unpin() error handlingTomi Valkeinen2-13/+5
omap_framebuffer_unpin() check the return value of omap_gem_put_paddr() and return immediately if omap_gem_put_paddr() fails. This patch removes the check for the return value, and also removes the return value of omap_framebuffer_unpin(), because: * Nothing checks the return value of omap_framebuffer_unpin(), and even something did check it, there's nothing the caller can do to handle the error. * If a omap_gem_put_paddr() fails, the framebuffer's other planes will be left unreleased. So it's better to call omap_gem_put_paddr() for all the planes, even if one would fail. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-07-02drm/omap: increase DMM transaction timeoutTomi Valkeinen1-1/+1
The DMM driver uses a timeout of 1 ms to wait for DMM transaction to finish. While DMM should always finish the operation within that time, the timeout is rather strict. Small misbehavior of the system (e.g. an irq taking too long) could trigger the timeout. As the DMM is a critical piece of code for display memory management, let's increase the timeout to 100 ms so that we are less likely to fail a memory allocation in case of system misbehaviors. 100 ms is just a guess of a reasonably large timeout. The HW should accomplish the task in less than 1 ms. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-07-02drm/omap: check that plane is inside crtcTomi Valkeinen1-0/+26
DRM allows planes to be partially off-screen, but DSS hardware does not. This patch adds the necessary check to reject plane configs if the plane is not fully inside the crtc. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-24drm/omap: return error if dma_alloc_writecombine failsTomi Valkeinen1-7/+11
On a platform with no TILER (e.g. omap3, am43xx), when the user wants to allocate buffer with flag OMAP_BO_SCANOUT, the buffer needs to be allocated with dma_alloc_writecombine. For some reason the driver does not return an error if that alloc fails, instead it continues without backing memory. This leads to errors later when the user tries to use the buffer. This patch makes the driver return an error if dma_alloc_writecombine fails. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-12drm: omapdrm: new vblank and event handlingTomi Valkeinen3-76/+70
Rework the crtc event/flip_wait system as follows: - If we enable a crtc (full modeset), we set omap_crtc->pending and register vblank irq. - If we need to set GO bit (page flip), we do the same but also set the GO bit. - On vblank we unregister the irq, clear the 'pending' flag, send vblank event to userspace if crtc->state->event != NULL, and wake up 'pending_wait' wq. - In omap_atomic_complete() we wait for the 'pending' flag to get reset for all enabled crtcs using 'pending_wait' wq. The above ensures that we send the events to userspace in vblank, and that after the wait in omap_atomic_complete() everything for the affected crtcs has been completed. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-12drm: omapdrm: merge omap_crtc_flush and omap_crtc_atomic_flushTomi Valkeinen1-21/+14
omap_crtc_atomic_flush() is the only user of omap_crtc_flush(), so just move the code from omap_crtc_flush() to omap_crtc_atomic_flush(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-12drm: omapdrm: add lock for fb pinningTomi Valkeinen1-1/+18
Before atomic modesetting omap_framebuffer_pin() and omap_framebuffer_unpin() were always called with modesetting locks taken. With atomic modesetting support this is no longer the case, and we need locking to protect the pin_count and the paddr, as multiple threads may pin the same fb concurrently. This patch adds a mutex to struct omap_framebuffer, and uses it in omap_framebuffer_pin() and omap_framebuffer_unpin(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-12drm: omapdrm: if omap_plane_atomic_update fails, disable planeTomi Valkeinen1-1/+3
omap_plane_atomic_update() calls dispc_ovl_setup(), which can fail (but shouldn't). To make the code a bit more robust, make sure the plane gets disabled if dispc_ovl_setup() fails, as otherwise we might get illegal HW configuration leading to error interrupts. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-12drm: omapdrm: inline omap_plane_setup into update/disableTomi Valkeinen1-27/+17
At the moment we have omap_plane_setup() function which handles both enabling (and configuring) and disabling the plane. With atomic modesetting we have separate hooks for plane enable/config and disable. This patch moves the code from omap_plane_setup() to omap_plane_atomic_update() and omap_plane_atomic_disable(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-12drm: omapdrm: omap_plane_setup() cannot fail, use WARNTomi Valkeinen1-9/+4
With atomic modesetting, omap_plane_setup()'s return value is ignored as the functions using it cannot fail. dispc_ovl_setup(), called by omap_plane_setup(), can fail (but shouldn't). Instead of returning an error from omap_plane_setup() which gets ignored, return void and use WARN if dispc_ovl_setup() fails. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-12drm: omapdrm: Don't setup planes manually from CRTC .enable()/.disable()Laurent Pinchart3-22/+1
Planes setup is handled by the DRM core through the atomic helpers, there's no need to duplicate the code in the CRTC .enable() and .disable() operations. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Don't flush CRTC when enabling or disabling itLaurent Pinchart1-4/+0
The omap_crtc_flush() call in omap_crtc_enable() and omap_crtc_disable() is a no-op, as the display manager is always disabled at this point. Just remove the function call. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Move encoder setup to encoder operationsLaurent Pinchart3-89/+34
Now that the driver is fully converted to atomic operations, and that the atomic helpers call the operations in the right order, we can move encoder setup to where it belongs, in the encoder operations. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Simplify DSS power managementLaurent Pinchart2-11/+4
Instead of sprinkling dispc_runtime_get() and dispc_runtime_put() calls in various CRTC operations, move all power management code to the atomic commit function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Remove nested PM get/sync when configuring encodersLaurent Pinchart1-4/+0
The omap_crtc_encoder_setup() function is always called with the DSS enabled. Remove the dispc_runtime_get() and dispc_runtime_put() calls. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Support unlinking page flip events prematurelyLaurent Pinchart3-29/+39
DRM page flip vblank events requested by page flips or atomic commits are created by the DRM core and then passed to driver through CRTC states (for atomic commit) or directly to the page flip handler (for legacy page flips). The events are then kept aside until the page flip completes, at which point drivers queue them for delivery with a call to drm_send_vblank_event(). When a DRM file handle is closed events pending for delivery are cleaned up automatically by the DRM core. Events that have been passed to the driver but haven't completed yet, however, are not handled by the DRM core. Drivers are responsible for destroying them and must not attempt to queue them for delivery. This is usually handled by drivers' preclose() handlers that cancel and destroy page flip events that reference the file handle being closed. With asynchronous atomic updates the story becomes more complex. Several asynchronous atomic updates can be pending, each of them carrying per-CRTC events. As the atomic_commit() operation doesn't receive a file handle context, drivers can't know which file handle a pending update refers to, making it difficult to cancel or wait for completion of updates related to the file handle being closed. It should be noted that cancelling page flips or waiting for atomic updates completion isn't required by the DRM core when closing a file handle. The only requirement is that no event gets queued for delivery after the preclose() operation returns. This can easily be achieved by storing events for atomic commits in a list, unlinking events from the file handle being closed by setting the file_priv field to NULL, and skipping delivery of unlinked events. This logic replaces the page flip cancellation completely. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: omap_crtc_flush() isn't called with modeset lockedLaurent Pinchart1-1/+0
When performing asynchronous atomic updates the modeset lock isn't taken around the callers of omap_crtc_flush(). This isn't an issue though, as access to the CRTC is properly serialized. Just drop the warning. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Don't get/put dispc in omap_crtc_flush()Laurent Pinchart1-4/+0
The omap_crtc_flush() function is always called with a reference to the dispc held. Remove unnecessary calls to dispc_runtime_get() and dispc_runtime_put(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Make the omap_crtc_flush function staticLaurent Pinchart2-2/+1
The function isn't used outside of its compilation unit, make it static. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Remove omap_plane enabled fieldLaurent Pinchart3-42/+16
The field tracks the plane state to avoid double-enable or -disable. This isn't required anymore, as - the DRM atomic core guarantees that the plane atomic_update and atomic_disable functions will never be called on an enabled/disabled plane - the CRTC enable/disable operations that enable/disable the plane are already guarded against double enable/disable We can thus remove the enabled field completely. The omap_plane_set_enable() function then becomes a wrapper around omap_plane_setup() which can be called directly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Remove omap_crtc enabled fieldLaurent Pinchart1-23/+9
The field tracks the CRTC state to avoid double-enable or -disable. As the DRM atomic core guarantees that the CRTC enable and disable functions won't be called on an already enabled or disabled CRTC, such tracking isn't needed. Remove the enabled field. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Move crtc info out of the crtc structureLaurent Pinchart1-10/+8
The crtc info structure is only used to setup the crtc through the DSS API. Move it from the crtc structure to local variables in omap_crtc_dss_enable(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Move plane info and win out of the plane structureLaurent Pinchart1-51/+41
The plane info and win structures are only used to setup the plane through the DSS API. Move them from the plane structure to local variables in omap_plane_setup(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Switch crtc and plane set_property to atomic helpersLaurent Pinchart3-71/+156
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. The CRTC exposes the properties of its primary plane for legacy reason. We can't get rid of that API, so simply delegate it to the primary plane. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Drop manual framebuffer pin handlingLaurent Pinchart3-77/+0
Since the removal of omap_plane_mode_set(), framebuffers are now pinned exclusively through the plane .prepare_fb() and .cleanup_fb() operations as the remaining callers of omap_plane_setup() don't modify the framebuffer. Remove the manual pin/unpin infrastructure. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Switch page flip to atomic helpersLaurent Pinchart3-212/+41
The atomic page flip helper implements the page flip operation using asynchronous commits. As the legacy page flip was the last caller of omap_plane_mode_set(), remove the function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Implement asynchronous commit supportLaurent Pinchart2-1/+120
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@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Replace encoder mode_fixup with atomic_checkLaurent Pinchart1-8/+8
The encoder .mode_fixup() operation is legacy, atomic updates uses the new .atomic_check() operation. Convert the encoder driver. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Switch connector DPMS to atomic helpersLaurent Pinchart3-32/+10
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@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Switch mode config to atomic helpersLaurent Pinchart2-46/+1
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@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Switch plane update to atomic helpersLaurent Pinchart2-2/+5
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@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Handle primary plane config through atomic plane opsLaurent Pinchart1-42/+27
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. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Implement planes atomic operationsLaurent Pinchart2-48/+93
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. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Wire up atomic state object scaffoldingLaurent Pinchart4-0/+17
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@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Implement encoder .disable() and .enable() operationsLaurent Pinchart1-0/+10
The operations are required by the atomic helpers, implement them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Rework CRTC enable/disable for atomic updatesLaurent Pinchart1-24/+59
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@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Rename CRTC DSS operations with an omap_crtc_dss_ prefixLaurent Pinchart1-18/+18
The omap_crtc_enable() and omap_crtc_disable() DSS operations functions will clash with the new CRTC enable and disable helpers. Rename them to omap_crtc_dss_*, as well as the other DSS operations for consistency. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Clean up #include'sLaurent Pinchart12-44/+43
Use the <...> include style instead of "..." for DRM headers and sort the headers alphabetically to ease detection of duplicates. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Fix page flip race with CRTC disableLaurent Pinchart1-5/+19
We can't rely on crtc->primary->fb in the page flip worker, as a racing CRTC disable (due for instance to an explicit framebuffer deletion from userspace) would set that field to NULL before the worker gets a change to run. Store the framebuffer queued for page flip in a new field of omap_crtc instead, and hold a reference to it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Turn vblank on/off when enabling/disabling CRTCLaurent Pinchart3-8/+79
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. An interesting side effect is that the .disable_vblank() operation will now be called for the first time with the CRTC disabled and the DISPC runtime suspended. The dispc_runtime_get() call in .disable_vblank() is supposed to take care of that, but the operation is called with a spinlock held, which prevents it from sleeping. To fix that move DISPC runtime PM handling out of the vblank operations to the CRTC code, ensuring that the display controller will always be powered when enabling or disabling vblank interrupts. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Rework page flip handlingLaurent Pinchart1-20/+64
To implement proper vblank control the driver will need to wait for page flip completion before disabling the vblank interrupt. This is made complex by the page flip implementation which queues and submits page flips to the hardware in two separate steps between which DRM locks are released. We thus need to avoid waiting on a page flip that has been queued but not submitted as submission and wait are covered by the same lock. Rework page flip handling as a first step by splitting the flip_pending boolean variable into an enumerated state and moving between states based on flip queue, submission and completion. The CANCELLED state will be used in a second step. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Cancel pending page flips when closing deviceLaurent Pinchart3-1/+27
Pending page flips must be cancelled when closing the device, otherwise their completion at next vblank will result in nasty effects, including possible oopses due to resources required to complete the page flip being freed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Simplify IRQ registrationLaurent Pinchart3-90/+25
The omapdrm can't use drm_irq_install() and drm_irq_uninstall() as it delegates IRQ handling to the omapdss driver. However, the code still declares IRQ-related operations used by the DRM IRQ helpers, and calls them indirectly. Simplify the implementation by calling the functions directly or inlining them. The irq_enabled checks can then also be simplified as the call stacks guarantees that omap_drm_irq_install() and omap_drm_irq_uninstall() will never run concurrently. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Rename omap_crtc page flip-related fieldsLaurent Pinchart1-21/+26
The old_fb field is only used to indicate whether a page flip is pending. Turn it into a bool named flip_pending. Rename event and page_flip_work to flip_event and flip_work for consistency. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-06-12drm: omapdrm: Rename omap_crtc_page_flip_locked to omap_crtc_page_flipLaurent Pinchart1-5/+5
The operation is called page_flip, rename its implementation accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>