summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tegra
AgeCommit message (Collapse)Author
2015-02-19drm/tegra: dc: Move more code into ->init()Thierry Reding
The code in tegra_crtc_prepare() really belongs in tegra_dc_init(), or at least most of it. This fixes an issue with VBLANK handling because tegra_crtc_prepare() would overwrite the interrupt mask register that tegra_crtc_enable_vblank() had written to to enable VBLANK interrupts. Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-02-19drm/tegra: dc: Wire up CRTC parent of atomic stateThierry Reding
Store a pointer to the CRTC in its atomic state to make it easy for state handling code to get at the CRTC. Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-02-19drm/tegra: dc: Reset state's active_changed fieldThierry Reding
Commit eab3bbeffd15 ("drm/atomic: Add drm_crtc_state->active") added the field to track the DPMS state. However, the Tegra driver was in modified in parallel and subclasses the CRTC atomic state, so needed to duplicate the code in the atomic helpers. After the addition of the active_changed field it became out of sync and doesn't reset it when duplicating state. This causes a full modeset on things like page-flips, which will in turn cause warnings due to the VBLANK machinery being disabled when it really should remain on. Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-02-19drm/tegra: hdmi: Explicitly set clock rateThierry Reding
Recent changes in the clock framework have caused a behavioural change in that clocks that have not had their rate set explicitly will now be reset to their initial rate (or 0) when the clock is released. This is triggered in the deferred probing path, resulting in the clock running at a wrong frequency after the successful probe. This can be easily fixed by setting the rate explicitly rather than by relying on the implicit rate inherited by the parent. Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Use correct relocation target offsetsDavid Ung
When copying a relocation from userspace, copy the correct target offset. Signed-off-by: David Ung <davidu@nvidia.com> Fixes: 961e3beae3b2 ("drm/tegra: Make job submission 64-bit safe") Cc: stable@vger.kernel.org [treding@nvidia.com: provide a better commit message] Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Add minimal power managementThierry Reding
For now only disable the KMS hotplug polling helper logic upon suspend and re-enable it on resume. Reviewed-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Mark Zhang <markz@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dc: Unify enabling the display controllerThierry Reding
Previously output drivers would enable continuous display mode and power up the display controller at various points during the initialization. This is suboptimal because it accesses display controller registers in output drivers and duplicates a bit of code. Move this code into the display controller driver and enable the display controller as the final step of the ->mode_set_nofb() implementation. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Track tiling and format in plane stateThierry Reding
Tracking these in the plane state allows them to be computed in the ->atomic_check() callback and reused when applying the configuration in ->atomic_update(). Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Track active planes in CRTC stateThierry Reding
Wrap struct drm_crtc_state in a driver-specific structure and add the planes field which keeps track of which planes are updated or disabled during a modeset. This allows atomic updates of the the display engine at ->atomic_flush() time. v2: open-code getting the state of the CRTC that the plane is being attached to (Daniel Vetter) Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Remove unused ->mode_fixup() callbacksThierry Reding
All output drivers have now been converted to use the ->atomic_check() callback, so the ->mode_fixup() callbacks are no longer used. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Atomic conversion, phase 3, step 3Thierry Reding
Provide a custom ->atomic_commit() implementation which supports async commits. The generic atomic page-flip helper can use this to implement page-flipping. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Atomic conversion, phase 3, step 2Thierry Reding
Replace drm_crtc_helper_set_config() by drm_atomic_helper_set_config(). All drivers have now been converted to use ->atomic_check() to set the atomic state, therefore the atomic mode setting helpers can be used. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dc: Use atomic clock state in modesetThierry Reding
All clock state is now stored in the display controller's atomic state, so the output drivers no longer need to call back into the display controller driver to set up the clock. This is also required to make sure no hardware changes are made before validating a configuration. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: sor: Implement ->atomic_check()Thierry Reding
The implementation of the ->atomic_check() callback precomputes all parameters to check if the given configuration can be applied. If so the precomputed values are stored in the atomic state object for the encoder and applied during modeset. In that way the modeset no longer needs to perform any checking but simply program values into registers. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: hdmi: Implement ->atomic_check()Thierry Reding
The implementation of the ->atomic_check() callback precomputes all parameters to check if the given configuration can be applied. If so the precomputed values are stored in the atomic state object for the encoder and applied during modeset. In that way the modeset no longer needs to perform any checking but simply program values into registers. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dsi: Implement ->atomic_check()Thierry Reding
The implementation of the ->atomic_check() callback precomputes all parameters to check if the given configuration can be applied. If so the precomputed values are stored in the atomic state object for the encoder and applied during modeset. In that way the modeset no longer needs to perform any checking but simply program values into registers. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: rgb: Implement ->atomic_check()Thierry Reding
The implementation of the ->atomic_check() callback precomputes all parameters to check if the given configuration can be applied. If so the precomputed values are stored in the atomic state object for the encoder and applied during modeset. In that way the modeset no longer needs to perform any checking but simply program values into registers. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dc: Store clock setup in atomic stateThierry Reding
This allows the clock setup to be separated from the clock programming and better matches the expectations of the atomic modesetting where no code paths must fail during modeset. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Atomic conversion, phase 3, step 1Thierry Reding
Switch out the regular plane helpers for the atomic plane helpers. Also use the default atomic helpers to implement the ->atomic_check() and ->atomic_commit() callbacks. The driver now exclusively uses the atomic interfaces. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Atomic conversion, phase 2Thierry Reding
Hook up the default ->reset() and ->atomic_duplicate_state() helpers. This ensures that state objects are properly created and framebuffer reference counts correctly maintained. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Atomic conversion, phase 1Thierry Reding
Implement initial atomic state handling. Hook up the CRTCs, planes' and connectors' ->atomic_destroy_state() callback to ensure that the atomic state objects don't leak. Furthermore the CRTC now implements the ->mode_set_nofb() callback that is used by new helpers to implement ->mode_set() and ->mode_set_base(). These new helpers also make use of the new plane helper functions which the driver now provides. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dc: Do not needlessly deassert resetThierry Reding
Commit 9c0127004ff4 ("drm/tegra: dc: Add powergate support") changed the driver's ->probe() implementation to deassert the module reset, and with there being nobody else to assert it until ->remove() there is no need to deassert again later on. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Output cleanup functions cannot failThierry Reding
The tegra_output_exit() and tegra_output_remove() functions cannot fail, so make them return void. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Remove remnants of the output midlayerThierry Reding
The tegra_output midlayer is now completely gone and output drivers use it purely as a helper library. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: debugfs cleanup cannot failThierry Reding
The debugfs cleanup code never fails, so no error is returned. Therefore the functions can all return void instead. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: sor: DemidlayerThierry Reding
Implement encoder and connector within the eDP driver itself using the Tegra output helpers rather than using the Tegra output as midlayer. By doing so one level of indirection is removed and output drivers become more flexible while keeping the majority of the advantages provided by the common output helpers. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dsi: DemidlayerThierry Reding
Implement encoder and connector within the DSI driver itself using the Tegra output helpers rather than using the Tegra output as midlayer. By doing so one level of indirection is removed and output drivers become more flexible while keeping the majority of the advantages provided by the common output helpers. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: hdmi: DemidlayerThierry Reding
Implement encoder and connector within the HDMI driver itself using the Tegra output helpers rather than using the Tegra output as midlayer. By doing so one level of indirection is removed and output drivers become more flexible while keeping the majority of the advantages provided by the common output helpers. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: rgb: DemidlayerThierry Reding
Implement encoder and connector within the RGB driver itself using the Tegra output helpers rather than using the Tegra output as midlayer. By doing so one level of indirection is removed and output drivers become more flexible while keeping the majority of the advantages provided by the common output helpers. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Add tegra_dc_setup_clock() helperThierry Reding
This is a small helper that performs the basic steps required by all output drivers to prepare the display controller for use with a given encoder. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: output: Make ->setup_clock() optionalThierry Reding
In order to transition output drivers to using the struct tegra_output as a helper rather than midlayer, make this callback optional. Instead drivers should implement the equivalent as part of ->mode_fixup(). For the conversion to atomic modesetting a new callback ->atomic_check() should be implemented that updates the display controller's state with the corresponding parent clock, rate and shift clock divider. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Convert output midlayer to helpersThierry Reding
The output layer was initially designed to help reduce the amount of code duplicated in output drivers. An unfortunate side-effect of that was that it turned into a midlayer and it became difficult to make the output drivers work without bending over backwards to fit into the midlayer. This commit starts to convert the midlayer into a helper library by exporting most of the common functions so that they can be used by the output drivers directly. Doing so will allow output drivers to reuse common code paths but more easily override them where necessary. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dc: No longer disable planes at CRTC disableThierry Reding
The DRM core should take care of disabling all unneeded planes, so there is no need to do this explicitly. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Move tegra_drm_mode_funcs to the coreThierry Reding
This structure will be extended using non-framebuffer related callbacks in subsequent patches, so it should move to a more central location. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dc: Wait for idle when disabledThierry Reding
When disabling the display controller, stop it and wait for it to become idle. Doing so ensures that no further accesses to the framebuffer occur and the buffers can be safely unmapped or freed. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Stop CRTC at CRTC disable timeThierry Reding
Previously output drivers would all stop the display controller in their disable path. However with the transition to atomic modesetting the display controller needs to be kept running until all planes have been disabled so that software can properly determine (using VBLANK counts) when it is safe to remove the framebuffers associated with the planes. Moving this code into the display controller's disable path also gets rid of the duplication of this into all output drivers. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Use tegra_commit_dc() in output driversThierry Reding
All output drivers have open-coded variants of this function, so export it to remove some code duplication. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: gem: oops in error handlingDan Carpenter
kfree(ERR_PTR(-ENOMEM)) will not work very well. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dc: Fix bad irqsave/restore in tegra_dc_finish_page_flip()Dan Carpenter
We can't save two values to the IRQ flags at the same time so the IRQs are not enabled at the end. This kind of bug is easy to miss in testing if the function is normally called with IRQs disabled so we wouldn't enable IRQs anyway. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dsi: Adjust D-PHY timingDavid Ung
Compliance testing shows that HS Trail is off by -12%. Increase the HS Trail time to make this test pass. Signed-off-by: David Ung <davidu@nvidia.com> [treding@nvidia.com: update specification references, add comment] Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dsi: Reset across ->exit()/->init()Thierry Reding
This allows a DRM driver unload/reload cycle to completely reset the DSI controller and may help in situations where it's broken. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dsi: Soft-reset controller on ->disableThierry Reding
This reset is necessary to properly clean up the internal state of the controller. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dsi: Registers are 32-bitThierry Reding
Use a sized unsigned 32-bit data type (u32) to store register contents. The DSI registers are 32 bits wide irrespective of the architecture's data width. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: hdmi: Registers are 32-bitThierry Reding
Use a sized unsigned 32-bit data type (u32) to store register contents. The HDMI registers are 32 bits wide irrespective of the architecture's data width. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dc: Return planar flag for non-YUV modesThierry Reding
This prevents the compiler from warning about using a variable that is possibly uninitialized. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dc: Describe register copiesThierry Reding
Most of the display controller's registers are double-buffered, a few of them are triple-buffered. The ASSEMBLY shadow copy is latched intto the ACTIVE copy for double-buffered registers. For triple-buffered registers the ASSEMBLY copy is first latched into the ARM copy. Latching into the ACTIVE copy happens immediately if the controller is inactive. Otherwise the latching happens on the next frame boundary. The latching of the ASSEMBLY into the ARM copy happens immediately. Latching is controlled by a set of *_ACT_REQ and *_UPDATE bits in the DC_CMD_STATE_CONTROL register. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: dc: Initialize border colorThierry Reding
Tegra114 and earlier support specifying the color of the border (i.e. the active area of the screen that is not covered by any of the overlay windows). By default this is set to a light blue, so set it to black to comply with the requirements set by atomic modesetting. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Check for NULL pointer instead of IS_ERR()Dan Carpenter
iommu_domain_alloc() returns NULL on error, it never returns error pointers. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: plane: Use proper possible_crtcs maskThierry Reding
The possible_crtcs mask needs to be a mask of CRTC indices. There is no guarantee that the DRM indices match the hardware pipe number, so the mask must be computed from the CRTC index. Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-01-27drm/tegra: Remove redundant zeroing out of memoryThierry Reding
The DRM core now zeroes out the memory associated with CRTC, encoder and connector objects upon cleanup, so there's no need to explicitly do that in drivers anymore. Signed-off-by: Thierry Reding <treding@nvidia.com>