aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/tegra/drm.c
AgeCommit message (Collapse)AuthorFilesLines
2015-08-13drm/tegra: dsi: Add Tegra132 supportThierry Reding1-0/+1
The DSI host controller hasn't changed from Tegra124 to Tegra132, but different characterization parameters may be required. Signed-off-by: Thierry Reding <[email protected]>
2015-08-13drm/tegra: dsi: Add Tegra124 supportThierry Reding1-0/+1
The DSI host controller hasn't changed from Tegra114 to Tegra124, but different characterization parameters may be required. Signed-off-by: Thierry Reding <[email protected]>
2015-08-13drm/tegra: dc: Add Tegra210 supportThierry Reding1-0/+1
Signed-off-by: Thierry Reding <[email protected]>
2015-08-13drm/tegra: dc: Reset VBLANK to offThierry Reding1-2/+2
Upon driver load, reset the VBLANK machinery to off to reflect the hardware state. Since the ->reset() callback is called from the initial drm_mode_config_reset() call, move the latter after the VBLANK machinery initialization by drm_vblank_init(). Signed-off-by: Thierry Reding <[email protected]>
2015-08-13drm/tegra: Use SIMPLE_DEV_PM_OPSThierry Reding1-3/+2
Use this macro to reduce some of the boilerplate. Signed-off-by: Thierry Reding <[email protected]>
2015-08-13drm/tegra: Allow VBLANK to be disabledThierry Reding1-0/+1
Signed-off-by: Thierry Reding <[email protected]>
2015-06-18Merge tag 'drm/tegra/for-4.2-rc1' of ↵Dave Airlie1-2/+10
git://anongit.freedesktop.org/tegra/linux into drm-next drm/tegra: Changes for v4.2-rc1 This contains a couple of mostly fixes for issues that have crept up in recent versions of linux-next. One issue is that DP AUX transactions of more than 4 bytes will access the wrong FIFO registers and hence become corrupt. Another fix is required to restore functionality of Tegra20 if using the GART. The current code expects the IOMMU aperture to be the complete 4 GiB address space, whereas the GART on Tegra20 only provides a 128 MiB aperture. One more issue with IOMMU support is that on 64-bit ARM, swiotlb is the default IOMMU implementation backing the DMA API. A side-effect of that is that when dma_map_sg() is called to flush caches (yes, this is a bit of a hack, but ARM does not provide a better API), swiotlb will immediately run out of memory because its bounce buffer is too small to make a framebuffer. Finally I've included a mostly cosmetic fix that stores register values in u32 rather than unsigned long to avoid sign-extension issues on 64- bit ARM. This is only a precaution since it hasn't caused any issues (yet). * tag 'drm/tegra/for-4.2-rc1' of git://anongit.freedesktop.org/tegra/linux: drm/tegra: dpaux: Registers are 32-bit drm/tegra: gem: Flush pages after allocation drm/tegra: gem: Take into account IOMMU aperture drm/tegra: dpaux: Fix transfers larger than 4 bytes
2015-06-12drm/tegra: gem: Take into account IOMMU apertureThierry Reding1-2/+10
The IOMMU may not always be able to address 2 GiB of memory. On Tegra20, the GART supports 32 MiB starting at 0x58000000. Also the aperture on Tegra30 and later is in fact the full 4 GiB, rather than just 2 GiB as currently assumed. Signed-off-by: Thierry Reding <[email protected]>
2015-05-08drm/tegra: Don't use vblank_disable_immediate on incapable driver.Mario Kleiner1-1/+0
Tegra would not only need a hardware vblank counter that increments at leading edge of vblank, but also support for instantaneous high precision vblank timestamp queries, ie. a proper implementation of dev->driver->get_vblank_timestamp(). Without these, there can be off-by-one errors during vblank disable/enable if the scanout is inside vblank at en/disable time, and additionally clients will never see any useable vblank timestamps when querying via drmWaitVblank ioctl. This would negatively affect swap scheduling under X11 and Wayland. Signed-off-by: Mario Kleiner <[email protected]> Acked-by: Thierry Reding <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2015-04-08Merge tag 'drm/tegra/for-4.1-rc1' of ↵Dave Airlie1-2/+16
git://anongit.freedesktop.org/tegra/linux into drm-next drm/tegra: Changes for v4.1-rc1 Perhaps the most noteworthy change in this set is the implementation of a hardware VBLANK counter using host1x syncpoints. The SOR registers can now be dumped via debugfs, which can be useful while debugging. The IOVA address space maintained by the driver can also be dumped via debugfs. Other than than, these changes are mostly cleanup work, such as making register names more consistent or removing unused code (that was left over after the atomic mode-setting conversion). There's also a fix for eDP that makes the driver cope with firmware that already initialized the display (such as the firmware on the Tegra-based Chromebooks). * tag 'drm/tegra/for-4.1-rc1' of git://anongit.freedesktop.org/tegra/linux: drm/tegra: sor: Reset during initialization drm/tegra: gem: Return 64-bit offset for mmap(2) drm/tegra: hdmi: Name register fields consistently drm/tegra: hdmi: Resets are synchronous drm/tegra: dc: Document tegra_dc_state_setup_clock() drm/tegra: dc: Remove unused callbacks drm/tegra: dc: Remove unused function drm/tegra: dc: Use base atomic state helpers drm/atomic: Add helpers for state-subclassing drivers drm/tegra: dc: Implement hardware VBLANK counter gpu: host1x: Export host1x_syncpt_read() drm/tegra: sor: Dump registers via debugfs drm/tegra: sor: Registers are 32-bit drm/tegra: Provide debugfs file for the IOVA space drm/tegra: dc: Check for valid parent clock
2015-04-02drm/tegra: dc: Implement hardware VBLANK counterThierry Reding1-2/+6
The display controller on Tegra can use syncpoints to count VBLANK events. syncpoints are 32-bit unsigned integers, so well suited as VBLANK counters. Signed-off-by: Thierry Reding <[email protected]>
2015-04-02drm/tegra: Provide debugfs file for the IOVA spaceThierry Reding1-0/+10
The Tegra DRM driver uses a single IO virtual address space for buffer mappings. Provide a table of the address space usage in debugfs. Signed-off-by: Thierry Reding <[email protected]>
2015-02-24drm/atomic-helper: Rename commmit_post/pre_planesDaniel Vetter1-2/+2
These names only make sense because of backwards compatability with the order used by the crtc helper library. There's not really any real requirement in the ordering here. So rename them to something more descriptive and update the kerneldoc a bit. Motivated in a discussion with Laurent about how to restore plane state for dpms for drivers with runtime pm. v2: Squash in fixup from Stephen Rothwell to fix a conflict with tegra. Cc: Laurent Pinchart <[email protected]> Reviewed-by: Rob Clark <[email protected]> Acked-by: Laurent Pinchart <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
2015-01-27drm/tegra: Use correct relocation target offsetsDavid Ung1-1/+1
When copying a relocation from userspace, copy the correct target offset. Signed-off-by: David Ung <[email protected]> Fixes: 961e3beae3b2 ("drm/tegra: Make job submission 64-bit safe") Cc: [email protected] [[email protected]: provide a better commit message] Signed-off-by: Thierry Reding <[email protected]>
2015-01-27drm/tegra: Add minimal power managementThierry Reding1-0/+25
For now only disable the KMS hotplug polling helper logic upon suspend and re-enable it on resume. Reviewed-by: Sean Paul <[email protected]> Reviewed-by: Mark Zhang <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2015-01-27drm/tegra: Atomic conversion, phase 3, step 3Thierry Reding1-1/+83
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 <[email protected]>
2015-01-27drm/tegra: Atomic conversion, phase 3, step 1Thierry Reding1-0/+4
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 <[email protected]>
2015-01-27drm/tegra: Atomic conversion, phase 2Thierry Reding1-0/+2
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 <[email protected]>
2015-01-27drm/tegra: Atomic conversion, phase 1Thierry Reding1-1/+1
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 <[email protected]>
2015-01-27drm/tegra: Move tegra_drm_mode_funcs to the coreThierry Reding1-0/+15
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 <[email protected]>
2015-01-27drm/tegra: Check for NULL pointer instead of IS_ERR()Dan Carpenter1-2/+2
iommu_domain_alloc() returns NULL on error, it never returns error pointers. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2015-01-27gpu: host1x: Provide a proper struct bus_typeThierry Reding1-1/+3
Previously the struct bus_type exported by the host1x infrastructure was only a very basic skeleton. Turn that implementation into a more full- fledged bus to support proper probe ordering and power management. Note that the bus infrastructure needs to be available before any of the drivers can be registered. This is automatically ensured if all drivers are built as loadable modules (via symbol dependencies). If all drivers are built-in there are no such guarantees and the link order determines the initcall ordering. Adjust drivers/gpu/Makefile to make sure that the host1x bus infrastructure is initialized prior to any of its users (only drm/tegra currently). v2: Fix building host1x and tegra-drm as modules Reported-by: Dave Airlie <[email protected]> Reviewed-by: Sean Paul <[email protected]> Reviewed-by: Mark Zhang <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2014-12-17drm/tegra: dc: Consistently use the same pipeThierry Reding1-6/+10
The hardware pipe numbers don't always match the DRM CRTC indices. This can happen for example if the first display controller defers probe, causing it to be registered with DRM after the second display controller. When that happens the hardware pipe numbers and DRM CRTC indices become different. Make sure that the CRTC index is always used when accessing per-CRTC VBLANK data. This can be ensured by using the drm_crtc_vblank_*() API, which will do the right thing automatically given a struct drm_crtc *. Signed-off-by: Thierry Reding <[email protected]>
2014-11-13drm/tegra: Plug memory leakThierry Reding1-0/+2
Free the DRM device-private memory upon driver unload to make sure the memory doesn't leak. Signed-off-by: Thierry Reding <[email protected]>
2014-11-13drm/tegra: Add IOMMU supportThierry Reding1-0/+24
When an IOMMU device is available on the platform bus, allocate an IOMMU domain and attach the display controllers to it. The display controllers can then scan out non-contiguous buffers by mapping them through the IOMMU. Signed-off-by: Thierry Reding <[email protected]>
2014-11-13drm/tegra: Fix error handling cleanupThierry Reding1-4/+16
The DRM driver's ->load() implementation didn't do a good job (no job at all really) cleaning up on failure. Fix that by undoing any prior setup when an error occurs. This requires a bit of rework to make it possible to clean up fbdev midway. This was tested by injecting errors at various points during the initialization sequence and verifying that error cleanup didn't crash and no memory leaked (using kmemleak). Reported-by: Stéphane Marchesin <[email protected]> Reported-by: Sean Paul <[email protected]> Reviewed-by: Sean Paul <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2014-08-04drm/tegra: Make job submission 64-bit safeThierry Reding1-18/+44
Job submission currently relies on the fact that struct drm_tegra_reloc and struct host1x_reloc are the same size and uses a simple call to the copy_from_user() function to copy them to kernel space. This causes the handle to be stored in the buffer object field, which then needs a cast to a 32 bit integer to resolve it to a proper buffer object pointer and store it back in the buffer object field. On 64-bit architectures that will no longer work, since pointers are 64 bits wide whereas handles will remain 32 bits. This causes the sizes of both structures to because different and copying will no longer work. Fix this by adding a new function, host1x_reloc_get_user(), that copies the structures field by field. While at it, use substructures for the command and target buffers in struct host1x_reloc for better readability. Also use unsized types to make it more obvious that this isn't part of userspace ABI. Signed-off-by: Thierry Reding <[email protected]>
2014-08-04drm/tegra: Allow non-authenticated processes to create buffer objectsThierry Reding1-1/+1
This matches what other drivers do for equivalent IOCTLs. Reviewed-by: Stéphane Marchesin <[email protected]> Tested-by: Alexandre Courbot <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2014-08-04drm/tegra: Add SET/GET_FLAGS IOCTLsThierry Reding1-0/+49
The DRM_TEGRA_GEM_SET_FLAGS IOCTL can be used to set the flags of a buffer object after it has been allocated or imported. Flags associated with a buffer object can be queried using the DRM_TEGRA_GEM_GET_FLAGS IOCTL. Reviewed-by: Stéphane Marchesin <[email protected]> Tested-by: Alexandre Courbot <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2014-08-04drm/tegra: Add SET/GET_TILING IOCTLsThierry Reding1-0/+95
Currently the tiling parameters of buffer objects can only be set at allocation time, and only a single tiled mode is supported. This new DRM_TEGRA_GEM_SET_TILING IOCTL allows more modes to be set and also allows the tiling mode to be changed after the allocation. This will enable the Tegra DRM driver to import buffers from a GPU and directly scan them out by configuring the display controller appropriately. To complement this, the DRM_TEGRA_GEM_GET_TILING IOCTL can query the current tiling mode of a buffer object. This is necessary when importing buffers via handle (as is done in Mesa for example) so that userspace can determine the proper parameters for the 2D or 3D engines. Reviewed-by: Stéphane Marchesin <[email protected]> Tested-by: Alexandre Courbot <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2014-07-08drm/tegra: Implement race-free hotplug detectionThierry Reding1-2/+6
A race condition currently exists on Tegra, where it can happen that a monitor attached via HDMI isn't detected during the initial FB helper setup, but the hotplug event happens too early to be processed by the poll helpers because they haven't been initialized yet. This happens because on some boards the HDMI driver can control the regulator that supplies the +5V pin on the HDMI connector. Therefore depending on the timing between the initialization of the HDMI driver and the rest of DRM, it's possible that the monitor returns the hotplug signal right within the window where we would miss it. Unfortunately, drm_kms_helper_poll_init() will wreak havoc when called before at least some parts of the FB helpers have been set up. This commit fixes this by splitting out the minimum of initialization required to make drm_kms_helper_poll_init() work into a separate function that can be called early. It is then safe to move all of the poll helper initialization to an earlier point in time (before the HDMI output driver has a chance to enable the +5V supply). That way if the hotplug signal is returned before the initial FB helper setup, the monitor will be forcefully detected at that point, and if the hotplug signal is returned after that it will be properly handled by the poll helpers. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2014-06-05drm/tegra: Remove host1x drm_bus implementationThierry Reding1-5/+30
The DRM core can now cope with drivers that don't have an associated struct drm_bus, so the host1x implementation is no longer useful. Signed-off-by: Thierry Reding <[email protected]>
2014-06-05drm/tegra: hdmi - Add Tegra124 supportThierry Reding1-0/+1
Tegra124 is mostly backwards-compatible with Tegra114. However, Tegra124 supports a few more features (e.g. interlacing, ...). Introduce a new compatible string and TMDS tables to cope with these differences. Signed-off-by: Thierry Reding <[email protected]>
2014-04-05Merge tag 'drm/tegra/for-3.15-rc1' of ↵Dave Airlie1-2/+17
git://anongit.freedesktop.org/tegra/linux into drm-next drm/tegra: Changes for v3.15-rc1 Implement eDP support for Tegra124 and support the PRIME vmap()/vunmap() operations. A symbol that is required for upcoming V4L2 support is now exported by the host1x driver. Relicense drivers under the GPL v2 for consistency. One exception is the public header file, which is relicensed under MIT to abide by the common rule. * tag 'drm/tegra/for-3.15-rc1' of git://anongit.freedesktop.org/tegra/linux: drm/tegra: Use standard GPL v2 license text drm/tegra: Relicense under GPL v2 drm/tegra: Relicense public header under MIT drm/tegra: Add eDP support gpu: host1x: export host1x_syncpt_incr_max() function drm/tegra: prime: Add vmap support
2014-04-04drm/tegra: Add eDP supportThierry Reding1-2/+17
Add support for eDP functionality found on Tegra124 and later SoCs. Only fast link training is currently supported. Signed-off-by: Thierry Reding <[email protected]>
2014-02-12drm/tegra: fix typo 'CONFIG_TEGRA_DRM_FBDEV'Paul Bolle1-1/+1
Signed-off-by: Paul Bolle <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-12-20drm/tegra: Add PRIME supportThierry Reding1-1/+7
Implement very basic PRIME support. This currently only works with buffers that are contiguous in memory and will refuse to import any physically non-contiguous buffers. Signed-off-by: Thierry Reding <[email protected]>
2013-12-20drm/tegra: Add Tegra124 DC supportThierry Reding1-0/+1
Tegra124 and later support interlacing, but the driver doesn't support it yet. Make sure interlacing stays disabled on hardware that supports it. Signed-off-by: Thierry Reding <[email protected]>
2013-12-20drm/tegra: Make legacy fbdev support optionalThierry Reding1-0/+2
A lot of the modern userspace is capable of working without the legacy fbdev support. kmscon can be used as a replacement for the framebuffer console, and KMS X drivers create their own framebuffers. Most people don't have a system where all of this works yet, though, so leave support enabled by default. Signed-off-by: Thierry Reding <[email protected]>
2013-12-20drm/tegra: Add DSI supportThierry Reding1-1/+9
This commit adds support for both DSI outputs found on Tegra. Only very minimal functionality is implemented, so advanced features like ganged mode won't work. Due to the lack of other test hardware, some sections of the driver are hardcoded to work with Dalmore. Signed-off-by: Thierry Reding <[email protected]>
2013-12-03drm/tegra: return -EFAULT if copy_from_user() failsDan Carpenter1-11/+15
copy_from_user() returns the number of bytes remaining if it fails, but we want to return -EFAULT here. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-12-03drm/tegra: Make tegra_drm_driver staticThierry Reding1-1/+1
There is no need to access it from other files now that the driver has been decoupled from host1x. Signed-off-by: Thierry Reding <[email protected]>
2013-12-03drm/tegra: Fix address space mismatchesThierry Reding1-4/+4
sparse complains because __user annotations aren't placed consistently. Signed-off-by: Thierry Reding <[email protected]>
2013-10-31drm/tegra: Deliver syncpoint base to user spaceArto Merilainen1-0/+29
This patch adds a separate ioctl for delivering syncpoint base number to user space. If the syncpoint does not have an associated base, the function returns -ENXIO. Signed-off-by: Arto Merilainen <[email protected]> Reviewed-by: Terje Bergstrom <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-10-31drm/tegra: Add support for tiled buffer objectsThierry Reding1-1/+1
The gr2d and gr3d engines work more efficiently on buffers with a tiled memory layout. Allow created buffers to be marked as tiled so that the display controller can scan them out properly. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-10-31drm/tegra: Add 3D supportThierry Reding1-0/+10
Initialize and power the 3D unit on Tegra20, Tegra30 and Tegra114 and register a channel with the Tegra DRM driver so that the unit can be used from userspace. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-10-31drm/tegra: Introduce tegra_drm_submit()Thierry Reding1-0/+129
Command stream submissions are the same across all devices that expose a channel to userspace, so move the code into a generic function. Signed-off-by: Thierry Reding <[email protected]>
2013-10-31drm/tegra: Add Tegra114 HDMI supportMikko Perttunen1-0/+1
Tegra114 TMDS configuration requires a new peak_current field and the driver current override bit has changed position. Signed-off-by: Mikko Perttunen <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-10-31drm/tegra: Properly cleanup and zero out resourcesThierry Reding1-2/+2
When the DRM driver is unloaded, all the associated resources must be cleaned up and zeroed out. This is necessary because of the architecture of the Tegra DRM driver, where not all subdrivers are unloaded along with the DRM driver. Therefore device-managed managed won't be freed and memory cannot be assumed to have been cleared (because it hasn't been reallocated using kzalloc()) by the time the DRM driver is reloaded. It is therefore necessary to zero out the structures to prevent strange errors (such as slab corruptions) from occurring. Signed-off-by: Thierry Reding <[email protected]>
2013-10-31drm/tegra: Move driver to DRM treeThierry Reding1-0/+545
In order to make subsystem-wide changes easier, move the Tegra DRM driver back into the DRM tree. Signed-off-by: Thierry Reding <[email protected]>