aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/omapdrm/omap_plane.c
AgeCommit message (Collapse)Author
2015-10-05drm: Use DRM_ROTATE_MASK and DRM_REFLECT_MASKJoonas Lahtinen
Avoid magic numbers and use the introduced defines. Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-09-08drm/atomic: Make prepare_fb/cleanup_fb only take state, v3.Maarten Lankhorst
This removes the need to separately track fb changes i915. That will be done as a separate commit, however. Changes since v1: - Add dri-devel to cc. - Fix a check in intel's prepare and cleanup fb to take rotation into account. Changes since v2: - Split out i915 changes to a separate commit. Cc: dri-devel@lists.freedesktop.org Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Daniel Stone <daniels@collabora.com> [danvet: Squash in msm fixup from Maarten.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-07-02drm/omap: check that plane is inside crtcTomi Valkeinen
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-12drm: omapdrm: if omap_plane_atomic_update fails, disable planeTomi Valkeinen
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 Valkeinen
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 Valkeinen
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 Pinchart
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: Remove omap_plane enabled fieldLaurent Pinchart
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: Move plane info and win out of the plane structureLaurent Pinchart
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 Pinchart
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 Pinchart
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 Pinchart
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: Switch plane update to atomic helpersLaurent Pinchart
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: Implement planes atomic operationsLaurent Pinchart
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 Pinchart
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: Clean up #include'sLaurent Pinchart
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: Apply settings synchronouslyLaurent Pinchart
The omapdrm driver implements a mechanism to apply new settings (due to plane update, plane disable, plane property set, CRTC mode set or CRTC DPMS) asynchronously. While this improves performance, it adds a level of complexity that makes transition to the atomic update API close to impossible. Furthermore the atomic update API requires part of the apply operations to be synchronous (such as pinning the framebuffers), so the current implementation needs to be changed. Simplify the CRTC and plane code by making updates synchronous to prepare for the switch to the atomic update API. Asynchronous update will be implemented 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: Store the rotation property in dev->mode_configLaurent Pinchart
Rotation is a standard property, store it in dev->mode_config.rotation_property. While at it, extract the properties initialization code to a separate function instead of running it for every plane. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: use DRM_ERROR_RATELIMITED() for error irqsTomi Valkeinen
omapdrm uses normal DRM_ERROR() print when the HW reports an error. As we sometimes may get a flood of errors, let's rather use DRM_ERROR_RATELIMITED(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: fix plane's channel selectionTomi Valkeinen
omap_plane_pre_apply() sets the plane's output channel too late, only after the plane has already been otherwise configured and enabled. This causes problems, as at the configuration stage we need to make decisions based on the output channel. This may lead to bad plane settings or failing to setup the plane. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: add a comment why locking is missingTomi Valkeinen
unpin_worker() calls omap_framebuffer_unpin() without any locks, which looks very suspicious. However, both pin and unpin are always called via the driver's private workqueue, so the access is synchronized that way. Add a comment to make this clear. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-20drm: omapdrm: Planes are already disabled when destroyedLaurent Pinchart
Planes are destroyed after framebuffers, which has the side effect of disabling all planes. There is thus no need to disable planes explicitly when destroying them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Pass integer source coordinates to omap_plane_mode_set()Laurent Pinchart
The function will convert the Q16 source coordinates to integers, avoid converting integers to Q16 first and perform the opposite conversion. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Prefix all plane functions with omap_plane_Laurent Pinchart
This matches the rest of the file and clarifies the functions' purpose. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Remove manual update display supportLaurent Pinchart
All the manual update display code implements eventually ends up to just calls to omap_connector_flush(), currently implemented as an empty TODO stub. Remove it, the code can always be revived and implemented later if interest in manual update displays becomes a reality. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Reset the zorder property when disabling a planeLaurent Pinchart
Whether to reset plane properties at disable time isn't well-defined in DRM, but resetting only part of them is probably as bad as it can get. Make the behaviour coherent by resetting the zorder property in addition to the rotation property. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Rename omap_plane_dpms() to omap_plane_set_enable()Laurent Pinchart
The planes don't care about DPMS states, don't propagate it unnecessarily to the plane functions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Switch to the universal plane APILaurent Pinchart
Remove the CRTC private planes by switching to the universal plane API. This results in a merge of the CRTC private plane created by the driver (omap_crtc->plane) and the CRTC primary plane created by the DRM core (crtc->primary). Reference counting of the framebuffers in the update plane operation is thus simplified as no reference needs to be stored in the private plane anymore. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Remove unused variablesLaurent Pinchart
The ilace variable is unused and the replication variable is assigned to false and just passed to a function. Remove them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Refactor CRTC creation codeLaurent Pinchart
Create a omap_modeset_create_crtc() function to avoid duplicating plane and CRTC creation code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Fix indentation of structure and array initializersLaurent Pinchart
Indenting by one tab is enough. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2014-11-20drm: omapdrm: remove unused variableBoris BREZILLON
Commit f9b9faf6d94dd29eab8c128905c7d091f955481d "drm: flip-work: change drm_flip_work_init prototype" changed the drm_flip_work_init prototype to a void function, which makes 'ret' an unused variable. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-11-15drm: flip-work: change drm_flip_work_init prototypeBoris BREZILLON
Now that we're using lists instead of kfifo to store drm flip-work tasks we do not need the size parameter passed to drm_flip_work_init function anymore. Moreover this function cannot fail anymore, we can thus remove the return code. Modify drm_flip_work_init users to take account of these changes. [airlied: fixed two unused variable warnings] Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-07-29Merge remote-tracking branch 'airlied/drm-next' into drm-intel-nextDaniel Vetter
Pull in drm-next with Dave's DP MST support so that I can merge some conflicting patches which also touch the driver load sequencing around interrupt handling. Conflicts: drivers/gpu/drm/i915/intel_display.c drivers/gpu/drm/i915/intel_dp.c Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-07-22drm: omapdrm: fix compiler errorsRussell King
Regular randconfig nightly testing has detected problems with omapdrm. omapdrm fails to build when the kernel is built to support 64-bit DMA addresses and/or 64-bit physical addresses due to an assumption about the width of these types. Use %pad to print DMA addresses, rather than %x or %Zx (which is even more wrong than %x). Avoid passing a uint32_t pointer into a function which expects dma_addr_t pointer. drivers/gpu/drm/omapdrm/omap_plane.c: In function 'omap_plane_pre_apply': drivers/gpu/drm/omapdrm/omap_plane.c:145:2: error: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t' [-Werror=format] drivers/gpu/drm/omapdrm/omap_plane.c:145:2: error: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'dma_addr_t' [-Werror=format] make[5]: *** [drivers/gpu/drm/omapdrm/omap_plane.o] Error 1 drivers/gpu/drm/omapdrm/omap_gem.c: In function 'omap_gem_get_paddr': drivers/gpu/drm/omapdrm/omap_gem.c:794:4: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'dma_addr_t' [-Werror=format] drivers/gpu/drm/omapdrm/omap_gem.c: In function 'omap_gem_describe': drivers/gpu/drm/omapdrm/omap_gem.c:991:4: error: format '%Zx' expects argument of type 'size_t', but argument 7 has type 'dma_addr_t' [-Werror=format] drivers/gpu/drm/omapdrm/omap_gem.c: In function 'omap_gem_init': drivers/gpu/drm/omapdrm/omap_gem.c:1470:4: error: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t' [-Werror=format] make[5]: *** [drivers/gpu/drm/omapdrm/omap_gem.o] Error 1 drivers/gpu/drm/omapdrm/omap_dmm_tiler.c: In function 'dmm_txn_append': drivers/gpu/drm/omapdrm/omap_dmm_tiler.c:226:2: error: passing argument 3 of 'alloc_dma' from incompatible pointer type [-Werror] make[5]: *** [drivers/gpu/drm/omapdrm/omap_dmm_tiler.o] Error 1 make[5]: Target `__build' not remade because of errors. make[4]: *** [drivers/gpu/drm/omapdrm] Error 2 Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-07-11drm/omap: Switch omapdrm over to drm_mode_create_rotation_property()Ville Syrjälä
Use the new drm_mode_create_rotation_property() in omapdrm. Cc: dri-devel@lists.freedesktop.org Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Sagar Kamble <sagar.a.kamble@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-07-11drm: Add support_bits parameter to drm_property_create_bitmask()Ville Syrjälä
Make drm_property_create_bitmask() a bit more generic by allowing the caller to specify which bits are in fact supported. This allows multiple callers to use the same enum list, but still create different versions of the same property with different list of supported bits. v2: Populate values[] array as non-sparse Make supported_bits 64bit Fix up omapdrm call site (Rob) Cc: dri-devel@lists.freedesktop.org Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Sagar Kamble <sagar.a.kamble@intel.com> Acked-by: Dave Airlie <airlied@linux.ie> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-04-15drm/omap: fix the handling of fb ref countsTomi Valkeinen
With the recent primary-plane changes for drm, the primary plane's framebuffer needs to be ref counted the same way as for non-primary-planes. This was not done by the omapdrm driver, which caused the ref count to drop to 0 too early, causing problems. This patch moves the fb unref and ref from omap_plane_update to omap_plane_mode_set. This way the fb refs are updated for both primary and non-primary cases, as omap_plane_update calls omap_plane_mode_set. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2014-04-14drm/omap: fix plane rotationGrazvydas Ignotas
Plane rotation with omapdrm is currently broken. It seems omap_plane_mode_set() expects width and height in screen coordinates, so pass it like that. Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2013-08-19drm/omap: use flip-work helperRob Clark
And simplify how we hold a ref+pin to what is being scanned out by using fb refcnt'ing. The previous logic pre-dated fb refcnt, and as a result was less straightforward than it could have been. By holding a ref to the fb, we don't have to care about how many plane's there are and holding a ref to each color plane's bo. Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-04-11drm/omap: Take a fb reference in omap_plane_update()Archit Taneja
When userspace calls SET_PLANE ioctl, drm core takes a reference of the fb and passes control to the update_plane op defined by the drm driver. In omapdrm, we have a worker thread which queues framebuffers objects received from update_plane and displays them at the appropriate time. It is possible that the framebuffer is destoryed by userspace between the time of calling the ioctl and apply-worker being scheduled. If this happens, the apply-worker holds a pointer to a framebuffer which is already destroyed. Take an extra refernece/unreference of the fb in omap_plane_update() to prevent this from happening. A reference is taken of the fb passed to update_plane(), the previous framebuffer (held by plane->fb) is unreferenced. This will prevent drm from destroying the framebuffer till the time it's unreferenced by the apply-worker. This is in addition to the exisitng reference/unreference in update_pin(), which is taken for the scanout of the plane's current framebuffer, and an unreference the previous framebuffer. Signed-off-by: Archit Taneja <archit@ti.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2013-02-25Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linuxLinus Torvalds
Pull drm merge from Dave Airlie: "Highlights: - TI LCD controller KMS driver - TI OMAP KMS driver merged from staging - drop gma500 stub driver - the fbcon locking fixes - the vgacon dirty like zebra fix. - open firmware videomode and hdmi common code helpers - major locking rework for kms object handling - pageflip/cursor won't block on polling anymore! - fbcon helper and prime helper cleanups - i915: all over the map, haswell power well enhancements, valleyview macro horrors cleaned up, killing lots of legacy GTT code, - radeon: CS ioctl unification, deprecated UMS support, gpu reset rework, VM fixes - nouveau: reworked thermal code, external dp/tmds encoder support (anx9805), fences sleep instead of polling, - exynos: all over the driver fixes." Lovely conflict in radeon/evergreen_cs.c between commit de0babd60d8d ("drm/radeon: enforce use of radeon_get_ib_value when reading user cmd") and the new changes that modified that evergreen_dma_cs_parse() function. * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (508 commits) drm/tilcdc: only build on arm drm/i915: Revert hdmi HDP pin checks drm/tegra: Add list of framebuffers to debugfs drm/tegra: Fix color expansion drm/tegra: Split DC_CMD_STATE_CONTROL register write drm/tegra: Implement page-flipping support drm/tegra: Implement VBLANK support drm/tegra: Implement .mode_set_base() drm/tegra: Add plane support drm/tegra: Remove bogus tegra_framebuffer structure drm: Add consistency check for page-flipping drm/radeon: Use generic HDMI infoframe helpers drm/tegra: Use generic HDMI infoframe helpers drm: Add EDID helper documentation drm: Add HDMI infoframe helpers video: Add generic HDMI infoframe helpers drm: Add some missing forward declarations drm: Move mode tables to drm_edid.c drm: Remove duplicate drm_mode_cea_vic() gma500: Fix n, m1 and m2 clock limits for sdvo and lvds ...
2013-02-16drm/omap: move out of stagingRob Clark
Now that the omapdss interface has been reworked so that omapdrm can use dispc directly, we have been able to fix the remaining functional kms issues with omapdrm. And in the mean time the PM sequencing and many other of that open issues have been solved. So I think it makes sense to finally move omapdrm out of staging. Signed-off-by: Rob Clark <robdclark@gmail.com>