aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/tegra/plane.c
AgeCommit message (Collapse)AuthorFilesLines
2023-04-04drm/tegra: plane: Improve use of dev_err_probe()Cai Huoqing1-10/+6
Return dev_err_probe() directly, because the return value of dev_err_probe() is the appropriate error code, and it can reduce code size, simplify the code. Signed-off-by: Cai Huoqing <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2022-07-26drm: Remove unnecessary include statements of drm_plane_helper.hThomas Zimmermann1-1/+0
Remove the include statement for drm_plane_helper.h from all the files that don't need it. Althogh the header file is almost empty, many drivers include it somewhere. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2022-07-12Merge tag 'drm/tegra/for-5.20-rc1' of ↵Dave Airlie1-0/+1
https://gitlab.freedesktop.org/drm/tegra into drm-next drm/tegra: Changes for v5.20-rc1 The bulk of these changes adds support for context isolation for the various supported host1x engines, as well as support for the hardware found on the new Tegra234 SoC generation. There's also a couple of fixes and cleanups. To round things off, the device tree bindings are converted to the new json-schema format that allows DTBs to be validated. Signed-off-by: Dave Airlie <[email protected]> From: Thierry Reding <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2022-07-08drm/tegra: Include DMA API header where usedRobin Murphy1-0/+1
Even though the IOVA API never actually needed it, iova.h is still carrying an include of dma-mapping.h, now solely for the sake of not breaking tegra-drm. Fix that properly. Signed-off-by: Robin Murphy <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2022-06-20drm: Drop drm_framebuffer.h from drm_crtc.hVille Syrjälä1-0/+1
drm_crtc.h has no need for drm_frambuffer.h, so don't include it. Avoids useless rebuilds of the entire universe when touching drm_framebuffer.h. Quite a few placs do currently depend on drm_framebuffer.h without actually including it directly. All of those need to be fixed up. v2: Fix up msm some more v2: Deal with ingenic and shmobile as well Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Acked-by: Sam Ravnborg <[email protected]> Acked-by: Jani Nikula <[email protected]>
2022-03-01drm/tegra: Support YVYU, VYUY and YU24 formatsThierry Reding1-0/+21
Signed-off-by: Thierry Reding <[email protected]>
2022-03-01drm/tegra: Support semi-planar formats on Tegra114+Thierry Reding1-7/+45
The NV12, NV21, NV16, NV61, NV24 and NV42 formats are supported by Tegra114 and later display hardware. Add the necessary programming to allow them to be used. Note that this does not work for Tegra186 and later yet because those generations have a different display architecture that doesn't support the same formats. Signed-off-by: Thierry Reding <[email protected]>
2021-12-16drm/tegra: Propagate errors from drm_gem_plane_helper_prepare_fb()Thierry Reding1-1/+4
Currently this function doesn't return an error, but that may change in the future, so make sure to propagate any error codes that it might return. Signed-off-by: Thierry Reding <[email protected]>
2021-12-16drm/tegra: Implement buffer object cacheThierry Reding1-1/+1
This cache is used to avoid mapping and unmapping buffer objects unnecessarily. Mappings are cached per client and stay hot until the buffer object is destroyed. Signed-off-by: Thierry Reding <[email protected]>
2021-12-16drm/tegra: Implement correct DMA-BUF semanticsThierry Reding1-45/+15
DMA-BUF requires that each device that accesses a DMA-BUF attaches to it separately. To do so the host1x_bo_pin() and host1x_bo_unpin() functions need to be reimplemented so that they can return a mapping, which either represents an attachment or a map of the driver's own GEM object. Signed-off-by: Thierry Reding <[email protected]>
2021-09-14Merge drm/drm-next into drm-misc-nextMaxime Ripard1-0/+117
Kickstart new drm-misc-next cycle. Signed-off-by: Maxime Ripard <[email protected]>
2021-08-16drm/tegra: Use fourcc_mod_is_vendor() helperThierry Reding1-1/+1
Rather than open-coding the vendor extraction operation, use the newly introduced helper macro. Reviewed-by: Daniel Vetter <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2021-08-13drm/tegra: dc: Support memory bandwidth managementDmitry Osipenko1-0/+117
Display controller (DC) performs isochronous memory transfers, and thus, has a requirement for a minimum memory bandwidth that shall be fulfilled, otherwise framebuffer data can't be fetched fast enough and this results in a DC's data-FIFO underflow that follows by a visual corruption. The Memory Controller drivers provide facility for memory bandwidth management via interconnect API. Let's wire up the interconnect API support to the DC driver in order to fix the distorted display output on T30 Ouya, T124 TK1 and other Tegra devices. Tested-by: Peter Geis <[email protected]> # Ouya T30 Tested-by: Matt Merhar <[email protected]> # Ouya T30 Tested-by: Nicolas Chauvet <[email protected]> # PAZ00 T20 and TK1 T124 Signed-off-by: Dmitry Osipenko <[email protected]> [[email protected]: unbreak Tegra186+ display support] Signed-off-by: Thierry Reding <[email protected]>
2021-05-31drm/tegra: hub: Fix YUV supportThierry Reding1-2/+21
The driver currently exposes several YUV formats but fails to properly program all the registers needed to display such formats. Add the right programming sequences so that overlay windows can be used to accelerate color format conversions in multimedia playback use-cases. Signed-off-by: Thierry Reding <[email protected]>
2021-03-31drm/tegra: Support sector layout on Tegra194Thierry Reding1-0/+24
Tegra194 has a special physical address bit that enables some memory swizzling logic to support different sector layouts. Support the bit that selects the sector layout which is passed in the framebuffer modifier. Signed-off-by: Thierry Reding <[email protected]>
2021-03-31drm/tegra: gem: Add a clarifying commentThierry Reding1-0/+8
Clarify when a fixed IOV address can be used and when a buffer has to be mapped before the IOVA can be used. Signed-off-by: Thierry Reding <[email protected]>
2021-02-23drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpersThomas Zimmermann1-2/+2
The function drm_gem_fb_prepare_fb() is a helper for atomic modesetting, but currently located next to framebuffer helpers. Move it to GEM atomic helpers, rename it slightly and adopt the drivers. Same for the rsp simple-pipe helper. Compile-tested with x86-64, aarch64 and arm. The patch is fairly large, but there are no functional changes. v3: * remove out-comented line in drm_gem_framebuffer_helper.h (Maxime) v2: * rename to drm_gem_plane_helper_prepare_fb() (Daniel) * add tutorial-style documentation Signed-off-by: Thomas Zimmermann <[email protected]> Acked-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-09-10drm: tegra: fix common struct sg_table related issuesMarek Szyprowski1-10/+5
The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function returns the number of the created entries in the DMA address space. However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and dma_unmap_sg must be called with the original number of the entries passed to the dma_map_sg(). struct sg_table is a common structure used for describing a non-contiguous memory buffer, used commonly in the DRM and graphics subsystems. It consists of a scatterlist with memory pages and DMA addresses (sgl entry), as well as the number of scatterlist entries: CPU pages (orig_nents entry) and DMA mapped pages (nents entry). It turned out that it was a common mistake to misuse nents and orig_nents entries, calling DMA-mapping functions with a wrong number of entries or ignoring the number of mapped entries returned by the dma_map_sg() function. To avoid such issues, lets use a common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski <[email protected]> Reviewed-by: Robin Murphy <[email protected]>
2020-07-17drm/tegra: plane: Support horizontal reflectionDmitry Osipenko1-0/+1
Support horizontal reflection mode which will allow to support 180° rotation mode when combined with the vertical reflection. Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2020-07-17drm/tegra: plane: Rename bottom_up to reflect_yDmitry Osipenko1-1/+1
This makes the naming consistent with the DRM core. Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2020-02-06drm/tegra: Reuse IOVA mapping where possibleThierry Reding1-19/+25
This partially reverts the DMA API support that was recently merged because it was causing performance regressions on older Tegra devices. Unfortunately, the cache maintenance performed by dma_map_sg() and dma_unmap_sg() causes performance to drop by a factor of 10. The right solution for this would be to cache mappings for buffers per consumer device, but that's a bit involved. Instead, we simply revert to the old behaviour of sharing IOVA mappings when we know that devices can do so (i.e. they share the same IOMMU domain). Cc: <[email protected]> # v5.5 Reported-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Tested-by: Dmitry Osipenko <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]>
2019-12-04drm/tegra: gem: Remove premature import restrictionsThierry Reding1-0/+11
All the display related blocks on Tegra require contiguous memory. Using the DMA API, there is no knowing at import time which device will end up using the buffer, so it's not known whether or not an IOMMU will be used to map the buffer. Move the check for non-contiguous buffers/mappings to the tegra_dc_pin() function which is now the earliest point where it is known if a DMA BUF can be used by the given device or not. v2: add check for contiguous buffer/mapping in tegra_dc_pin() Reviewed-by: Daniel Vetter <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2019-10-29drm/tegra: Support DMA API for display controllersThierry Reding1-0/+104
If a display controller is not attached to an explicit IOMMU domain, which usually means that it's connected to an IOMMU domain controlled by the DMA API, make sure to map the framebuffer to the display controller address space. This allows us to transparently handle setups where the display controller is attached to an IOMMU or setups where it isn't. It also allows the driver to work with a DMA API that is backed by an IOMMU. Signed-off-by: Thierry Reding <[email protected]>
2019-08-14drm/tegra: drop use of drmP.hSam Ravnborg1-0/+1
Drop use of the deprecated drmP.h header file. For all touched files divide include files into blocks, and sort them within the blocks. Fix fallout. Signed-off-by: Sam Ravnborg <[email protected]> Reviewed-by: Thierry Reding <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Jonathan Hunter <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner1-4/+1
Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Enrico Weigelt <[email protected]> Reviewed-by: Kate Stewart <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-05-18drm/tegra: dc: Support rotation propertyThierry Reding1-0/+1
Currently only the DRM_MODE_REFLECT_Y rotation is supported. The driver already supports reflection on the Y axis via a custom flag which is not very useful because it requires custom userspace. Add the standard rotation property that supports 0 degree rotation and Y axis reflection for primary and overlay planes to provide a better interface than the custom flag. v2: keep custom flag for ABI compatibility (Dmitry) Reviewed-by: Dmitry Osipenko <[email protected]> Tested-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2018-05-17drm/tegra: plane: Implement zpos plane property for older TegrasDmitry Osipenko1-54/+139
Older Tegra's do not support plane's Z position handling in hardware, but the hardware provides knobs to implement it in software. Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2018-03-28Backmerge tag 'v4.16-rc7' into drm-nextDave Airlie1-3/+6
Linux 4.16-rc7 This was requested by Daniel, and things were getting a bit hard to reconcile, most of the conflicts were trivial though.
2018-03-21Merge tag 'drm/tegra/for-4.17-rc1' of ↵Dave Airlie1-2/+18
git://anongit.freedesktop.org/tegra/linux into drm-next drm/tegra: Changes for v4.17-rc1 This fixes mmap() for fbdev devices by providing a custom implementation based on the KMS variant. This is a fairly exotic case these days, hence why it is not flagged for stable. There is also support for dedicating one of the overlay planes to serve as a hardware cursor on older Tegra that did support hardware cursors but not RGBA formats for it. Planes will now also export the IN_FORMATS property by supporting the various block-linear tiling modifiers for RGBA pixel formats. Other than that, there's a bit of cleanup of DMA API abuse, use of the private object infrastructure for global state (rather than subclassing atomic state objects) and an implementation of ->{begin,end}_cpu_access callbacks for PRIME exported buffers, which allow users to perform cache maintenance on these buffers. * tag 'drm/tegra/for-4.17-rc1' of git://anongit.freedesktop.org/tegra/linux: drm/tegra: prime: Implement ->{begin,end}_cpu_access() drm/tegra: gem: Map pages via the DMA API drm/tegra: hub: Use private object for global state drm/tegra: fb: Properly support linear modifier drm/tegra: plane: Support format modifiers drm/tegra: dc: Dedicate overlay plane to cursor on older Tegra's drm/tegra: plane: Make tegra_plane_get_overlap_index() static drm/tegra: fb: Implement ->fb_mmap() callback drm/tegra: gem: Make __tegra_gem_mmap() available more widely drm/tegra: gem: Reshuffle declarations
2018-03-15drm/tegra: plane: Support format modifiersThierry Reding1-0/+16
Pass the list of valid format modifiers to planes upon initialization and implement the ->format_mod_supported() callback so that userspace can query for the valid combinations of formats and modifiers. Signed-off-by: Thierry Reding <[email protected]>
2018-03-15drm/tegra: plane: Correct legacy blendingDmitry Osipenko1-3/+2
Keep old 'dependent' state of unaffected planes, this way new state takes into account current state of unaffected planes. Fixes: ebae8d07435a ("drm/tegra: dc: Implement legacy blending") Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2018-03-15drm/tegra: plane: Make tegra_plane_get_overlap_index() staticDmitry Osipenko1-2/+2
This function is not used outside of the file and can be static. Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2018-03-15drm/tegra: plane: Fix RGB565 format on older TegraThierry Reding1-0/+4
The opaque/alpha format conversion code is currently only looking at XRGB formats because they have an equivalent ARGB format. The opaque format for RGB565 is RGB565 itself, much like the YUV formats map to themselves. Reported-by: Dmitry Osipenko <[email protected]> Fixes: ebae8d07435a ("drm/tegra: dc: Implement legacy blending") Signed-off-by: Thierry Reding <[email protected]>
2018-03-05drm: Don't pass clip to drm_atomic_helper_check_plane_state()Ville Syrjälä1-6/+1
Move the plane clip rectangle handling into drm_atomic_helper_check_plane_state(). Drivers no longer have to worry about such mundane details. v2: Convert armada, rcar, and sun4i as well v3: Resolve simple_kms_helper conflict Cc: Liviu Dudau <[email protected]> Cc: Brian Starkey <[email protected]> Cc: Mali DP Maintainers <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Gustavo Padovan <[email protected]> Cc: Sean Paul <[email protected]> Cc: Philipp Zabel <[email protected]> Cc: CK Hu <[email protected]> Cc: Neil Armstrong <[email protected]> Cc: Rob Clark <[email protected]> Cc: Ben Skeggs <[email protected]> Cc: Laurent Pinchart <[email protected]> Cc: Sandy Huang <[email protected]> Cc: "Heiko Stübner" <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: Thierry Reding <[email protected]> Cc: VMware Graphics <[email protected]> Cc: Sinclair Yeh <[email protected]> Cc: Thomas Hellstrom <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Archit Taneja <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: Russell King <[email protected]> Suggested-by: Daniel Vetter <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Reviewed-by: Thierry Reding <[email protected]> Reviewed-by: Archit Taneja <[email protected]> #msm Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Acked-by: Liviu Dudau <[email protected]> #hdlcd,malidp Acked-by: Philipp Zabel <[email protected]> #imx,mtk Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]> #vmwgfx Acked-by: Neil Armstrong <[email protected]> #meson Acked-by: Shawn Guo <[email protected]> #zte
2018-01-23drm/tegra/dc: Use drm_mode_get_hv_timing() to populate plane clip rectangleVille Syrjälä1-5/+4
Use drm_mode_get_hv_timing() to fill out the plane clip rectangle. No functional changes as the code already uses crtc_state->mode to populate the clip, which is also what drm_mode_get_hv_timing() uses. Once everyone agrees on this we can move the clip handling into drm_atomic_helper_check_plane_state(). v2: Rebase due to tegra_plane_state_add() relocating to plane.c Cc: Laurent Pinchart <[email protected]> Cc: Thierry Reding <[email protected]> Cc: [email protected] Signed-off-by: Ville Syrjälä <[email protected]> Acked-by: Thierry Reding <[email protected]> Reviewed-by: Thierry Reding <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-01-08drm/tegra: dc: Restore YUV overlay supportThierry Reding1-0/+5
Commit ebae8d07435a ("drm/tegra: dc: Implement legacy blending") broke support for YUV overlays by accident. The reason is that YUV formats are considered opaque because they have no alpha component, but on the other hand no corresponding format with an alpha component can be returned. In the case of YUV formats, the opaque format is the same as the alpha format, so add the special case to restore YUV overlay support. Reported-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2017-12-21drm/tegra: dc: Implement legacy blendingThierry Reding1-0/+138
This implements alpha blending on legacy display controllers (Tegra20, Tegra30 and Tegra114). While it's theoretically possible to support the zpos property to enable userspace to specify the Z-order of each plane individually, this is not currently supported and the same fixed Z- order as previously defined is used. Reverts commit 71835caa00e8 ("drm/tegra: fb: Force alpha formats") since the opaque formats are now supported. Reported-by: Dmitry Osipenko <[email protected]> Fixes: 7772fdaef939 ("drm/tegra: Support ARGB and ABGR formats") Signed-off-by: Thierry Reding <[email protected]>
2017-12-21drm/tegra: dc: Support more formatsThierry Reding1-8/+60
Also, split up formats into per-SoC lists because not all generations support all of them. Note that the list is now exhaustive for all RGB formats, but not for YUV and indexed formats. Signed-off-by: Thierry Reding <[email protected]>
2017-12-13drm/tegra: Support ARGB and ABGR formatsThierry Reding1-0/+8
These formats can easily be supported on all generations of Tegra. Note that the XRGB and XBGR formats that we supported were in fact using the ARGB and ABGR Tegra formats. This happened to work in cases where no alpha was being considered. This change is also a fix for those formats. Signed-off-by: Thierry Reding <[email protected]>
2017-12-13drm/tegra: Move common plane code to separate fileThierry Reding1-0/+180
Subsequent patches will add support for Tegra186 which has a different architecture and needs different plane code but which can share a lot of code with earlier Tegra support. Signed-off-by: Thierry Reding <[email protected]>