Commit Graph

294 Commits

Author SHA1 Message Date
Mikko Perttunen
e906f87373 drm/tegra: nvdec: Support multiple clocks
NVDEC on Tegra234 requires multiple clocks. Add support for that.

Bug 3778105

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I7c6ac2a2567e03a148deb86c5328e709a6b164bb
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2771765
(cherry picked from commit 91ab71267a2ecc7be9fea64118836264bfe5071f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2768896
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
437bb539be drm/tegra: Update to Linux v6.0-rc5
Update the Tegra-DRM driver to align with the latest upstream driver
from Linux v6.0-rc5.

Bug 3767126

Change-Id: Iaadc3b6a616b327fea5dab9acfba9c1d174557d3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2776688
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 09:18:59 +00:00
Mikko Perttunen
429e344bea drm/tegra: vic: Add Tegra234 support
Add Tegra234 support for VIC. It is backwards compatible with
Tegra194.

Bug 3724727

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I4421906847f7097bfbde1d3cb1191ab6c2fd58e0
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2745965
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Brad Griffis <bgriffis@nvidia.com>
2023-04-03 09:18:59 +00:00
Mikko Perttunen
88c0b67c1d drm/tegra: Implement stream ID related callbacks on engines
Implement the get_streamid_offset and can_use_memory_ctx callbacks
required for supporting context isolation. Since old firmware on VIC
cannot support context isolation without hacks that we don't want to
implement, check the firmware binary to see if context isolation
should be enabled.

Bug 3724727

Change-Id: Ie4c952987f2a5ae660257194b43c18829ac707c4
2023-04-03 09:18:59 +00:00
Mikko Perttunen
f3b009a8e6 drm/tegra: Support context isolation
For engines that support context isolation, allocate a context when
opening a channel, and set up stream ID offset and context fields
when submitting a job.

As of this commit, the stream ID offset and fallback stream ID
are not used when context isolation is disabled. However, with
upcoming patches that enable a full featured job opcode sequence,
these will be necessary.

Bug 3724727

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Ic57b04d8240ef19a1b82361e5ca8d07119f08652
2023-04-03 09:18:59 +00:00
Mikko Perttunen
250d164381 drm/tegra: nvdec: Fix TRANSCFG register offset
NVDEC's TRANSCFG register is at a different offset than VIC.
This becomes a problem now when context isolation is enabled and
the reset value of the register is no longer sufficient.

Bug 3724727

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Ic83043dcc49a3739fe310cfb5b143b42d9aa259b
2023-04-03 09:18:59 +00:00
Mikko Perttunen
abbdd9c844 drm/tegra: falcon: Set DMACTX field on DMA transactions
The DMACTX field determines which context, as specified in the
TRANSCFG register, is used. While during boot it doesn't matter
which is used, later on it matters and this value is reused by
the firmware.

Bug 3724727

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I79da5107399e39a1a175e8dd1c026cab75ba44f3
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2745947
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Brad Griffis <bgriffis@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
57b7756289 drm/tegra: Update to Linux v5.19-rc1
Update the Tegra DRM driver to align with the latest upstream Tegra DRM
driver from Linux v5.19-rc1.

Bug 3724727

Change-Id: I5dc54eee6cd2c5c62832e1844cd3df59fcabe976
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2739541
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
38c4f3bbd5 drm/tegra: Add trace support
Add trace support for the Tegra DRM driver by pulling in the relevant
changes from the upstream Tegra DRM driver.

Bug 3724727

Change-Id: Id34df005df76a27120282790a53c09c71361cec2
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2739540
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
1980c277ea drm/tegra: Drop support for pre-Linux v5.14 kernels
Drop support for Linux kernel earlier than v5.14 for the Tegra DRM
driver.

Bug 3724727

Change-Id: Id6467ed9abdfae8e134ea2e6f38540b1b6be88a8
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2739539
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2023-04-03 09:18:59 +00:00
Thierry Reding
c8eb0cd6b2 drm/tegra: gem: Do not try to dereference ERR_PTR()
When mapping the DMA-BUF attachment fails, map->sgt will be an ERR_PTR-
encoded error code and the cleanup code would try to free that memory,
which obviously would fail.

Zero out that pointer after extracting the error code when this happens
so that kfree() can do the right thing.

Bug 3706991

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I6870559061cb91fb6ff01bc458a816f56ce8b978
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2744243
(cherry picked from commit 9d625d7f7fa2f1769c6f7f856b4ca7562ccba1e6)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2744600
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Mikko Perttunen
381919e9c3 drm/tegra: Add support for secondary syncpoint
Add support for secondary (non-job tracking) syncpoint used for
NVENC slice encoding.

Bug 3589873

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I80204c23486dd476c6b67a3897934f301833c7f5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2729281
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
9734cc0d92 drm/tegra: Fix build for Linux v5.19
Upstream Linux commits da68386d9edb ("drm: Rename dp/ to display/") and
644edf52b630 ("drm/display: Move SCDC helpers into display-helper
library") moved some of the DRM headers and this is causing the out of
tree Tegra DRM driver build to fail with Linux v5.19. Fix this by
correcting the include paths for Linux v5.19.

Bug 3680147

Change-Id: Ic9b7a9d16da11e487ace4d09ffbff6ae4466e002
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2728509
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
c88d7b49ed drm/tegra: Fix build for Linux v5.18
Building the Tegra DRM out-of-tree module with Linux v5.18-rc1 is
currently failing because of two changes which are ...

1. Upstream commit 5b529e8d9c38 ("drm/dp: Move public DisplayPort
   headers into dp/") moves the location of the header drm_dp_helper.h.
   Fix this by updating the location for Linux v5.18 onwards.

2. Upstream commit 7938f4218168 ("dma-buf-map: Rename to iosys-map")
   renames 'struct dma_buf_map' to 'struct iosys_map' and so fix this
   by using the appropriate structure name depending on kernel version.

Bug 3598986

Change-Id: Ib6c3326d42fb5e6c74bc74f4d16b136b903ff1b2
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2693912
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Kees Cook
c51668e457 UPSTREAM: drm/dp: Fix OOB read when handling Post Cursor2 register
The link_status array was not large enough to read the Adjust Request
Post Cursor2 register, so remove the common helper function to avoid
an OOB read, found with a -Warray-bounds build:

drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_get_adjust_request_post_cursor':
drivers/gpu/drm/drm_dp_helper.c:59:27: error: array subscript 10 is outside array bounds of 'const u8[6]' {aka 'const unsigned char[6]'} [-Werror=array-bounds]
   59 |         return link_status[r - DP_LANE0_1_STATUS];
      |                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/drm_dp_helper.c:147:51: note: while referencing 'link_status'
  147 | u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
      |                                          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Replace the only user of the helper with an open-coded fetch and decode,
similar to drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c.

Change-Id: Ifd759369437783a9aa0cc2da5748d2235196b434
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Fixes: 79465e0ffeb9 ("drm/dp: Add helper to get post-cursor adjustments")
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://lore.kernel.org/r/20220105173507.2420910-1-keescook@chromium.org
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2693871
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
aec071d698 drm/tegra: Revert workaround for freeing BOs
Commit 72c23bd789f4 ("drm/tegra: Ensure BOs are not freed before
display is updated") added a workaround to fix a race condition when
freeing BOs. A proper fix has been created for the BO caching for
host1x that has been submitted upstream and so revert commit
72c23bd789f4.

Bug 3556250

Change-Id: Ie47e734393770a1390acff20ee133576a335f38f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2693868
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
43cafba95d drm/tegra: Fix support for Linux v5.10
When compiling the Tegra DRM driver for Linux v5.10 it is currently
failing and the following errors are seen ...

 tegra/dc.c: In function 'tegra_crtc_atomic_begin':
 tegra/dc.c:2278:43: error: 'state' undeclared (first use in this function)
  tegra_crtc_update_memory_bandwidth(crtc, state, true);
                                             ^~~~~
 tegra/dc.c:2524:18: error: initialization from incompatible pointer type
 [-Werror=incompatible-pointer-types]
  .atomic_check = tegra_crtc_atomic_check,
                  ^~~~~~~~~~~~~~~~~~~~~~~

Upstream commit 04d5d5df9df7 ("drm/tegra: dc: Support memory bandwidth
management") added support for memory bandwidth and so disable this for
Linux kernel prior to v5.11 due to incompatibilty with these earlier
versions.

JIRA LS-410

Change-Id: Ic130a6e37cef597772b62be192f154a2681fe157
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2668675
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
881ea5294c drm/tegra: Ensure BOs are not freed before display is updated
Occasionally, there are cases where the BO is being freed before the
display has been updated to use the next BO. If the SMMU is enabled this
causes SMMU faults to occur.

This problem occurs when the vertical blanking interrupt occurs at the
same time the BO used by the display is updated. In this case, the
interrupt handler, tegra_dc_irq(), is called to handle the vertial
blanking interrupt, which in turn calls drm_crtc_handle_vblank() to
discard the previous BO. However, the programming of the display
controller did not actually complete before the vertical blanking
and the display is still using the previous BO. Hence, the display
continues to use the prevoius BO which is then freed.

Fix this by disabling the vertical blanking interrupt during the time
where the display is updated and then in the Tegra interrupt handler
ensure that we only handle interrupts that are currently enabled.
Finally, before calling drm_crtc_handle_vblank() in the interrupt
handler, check that the programming of the display controller has
completed and it is safe to release the BO.

JIRA LS-128

Change-Id: I1c9523f2b0a3ea406d651c2d1988e452d412e204
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2660852
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Mikko Perttunen
02b028d02a drm/tegra: Merge upstream changes
Merge upstream changes from linux-next, including merged version
of new UAPI.

Change-Id: I4f591d39e51ac6ab6877a0bd428adf166eca3c55
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2653095
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
a6ff2bcf9e drm/tegra: Fix build for Linux-v5.16-rc1
Building the Tegra DRM out-of-tree module against the current upstream
mainline kernel is failing and errors such as the following are seen.

ERROR: modpost: module tegra-drm-next uses symbol dma_buf_detach from
	namespace DMA_BUF, but does not import it.
ERROR: modpost: module tegra-drm-next uses symbol dma_buf_vunmap from
	namespace DMA_BUF, but does not import it.
ERROR: modpost: module tegra-drm-next uses symbol dma_buf_put from
	namespace DMA_BUF, but does not import it.

Following upstream commit 16b0314aa746 ("dma-buf: move dma-buf symbols
into the DMA_BUF module namespace"), it is now necessary to import the
DMA_BUF module namespace into the Tegra DRM driver to fix this.

Change-Id: I9dbd0e3c97b3ccf09982fdb72ef8a9a715d873de
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2621643
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
96b2a8c5ea drm/tegra: Add support for NVENC and NVJPG
Add support for the Host1x NVENC and NVJPG engines.

JIRA LS-411

Change-Id: Ied1c64c17d337e571512c053ef9552642faa430c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2490297
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 09:18:59 +00:00
Thierry Reding
cc4ccb187b drm/tegra: Support asynchronous commits for cursor
This adds support for asynchronously updating the cursor plane, which
enables support for the legacy cursor IOCTLs.

Bug 200768479

Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: Iaf77883db8de83d36251c686db523ea3d6f0bee1
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2596400
(cherry picked from commit b8211942c65092e4d28caf8cf63036dce3ed3501)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620153
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
1da27ee38f drm/tegra: Implement buffer object cache
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.

Bug 200768479

Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: Ia2efe2b77b5043b665bae403d9eba4698e6a5228
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2596399
(cherry picked from commit d23156d94fa9499256e8082250e3bc02559f9c8d)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620152
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
756aa327f1 drm/tegra: Implement correct DMA-BUF semantics
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.

Bug 200768479

Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: Ia380b7dcc371ce47f5f35d44a60fbd6b4ab9d636
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2596398
(cherry picked from commit 28960586000fca025689edfd45645ab28e497bca)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620137
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
65450ce220 drm/tegra: Fix standalone build
To facilitate building the module standalone, set the srctree.host1x
variable to a default value.

Bug 200768479

Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: I7658a7f493d3b9791e68300cfc0ba864381671e0
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2596397
(cherry picked from commit e2a7e1400416480939e47b85e2353409ca7f7097)`
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620151
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
19d4c20727 drm/tegra: Fix build for Linux v5.15 with CONFIG_DRM_LEGACY disabled
Upstream commit c1736b9008cb ("drm: IRQ midlayer is now legacy") moved
the 'irq_enabled' member of struct drm_device under CONFIG_DRM_LEGACY.
When compiling Linux v5.15 without CONFIG_DRM_LEGACY enabled, compiling
the Tegra DRM driver now fails because the 'irq_enabled' member is not
defined.

Upstream commit 14746211570b ("drm/tegra: Don't set struct
drm_device.irq_enabled") has now removed the setting of the
'irq_enabled' variable from the Tegra DRM driver and so fix this by
only setting this variable for kernels prior to Linux v5.15.

Change-Id: I27907494e6ca0c5c7f8bedc80eca4395428d4e1a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2613510
(cherry picked from commit 1e4600fca6b4027e6f1dc6b8dcc28fc1c8c8767e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620155
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Mikko Perttunen
3f528cb16c UPSTREAM: drm/tegra: Bump VIC clock rate to Fmax
To get full performance out of this engine, bump their clock rate
to maximum. In the future we may want something smarter but this
should be fine for now.

Change-Id: I2b05bec99dc63f670b0d54cb71715dec2b8f57ee
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2599710
(cherry picked from commit d9fc58e4a1e776993f039c7298a4cc3150704dc5)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620154
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
abbda4e63b drm/tegra: uapi: Allocate gather data using DMA API
This needs to be DMA-able data because it's eventually passed to the
host1x CDMA.

Bug 200768479

Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: Ia209c9fac79e3edf3590288fc0739bc803609bc2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2596396
(cherry picked from commit 4e064281d0bc8371e228b03386c128661a1a52a9)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620150
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
f1ec6fabaf drm/tegra: Update device-tree property for NVDEC
The device-tree property for identifying the NVDEC instance has been
updated and so update the NVDEC driver to align with upstream.

JIRA LS-96

Change-Id: I7bcb074601049a3ac81c0069a865c467008a7846
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2602720
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
(cherry picked from commit 81fcabc1c77c79a345a443e99aadf279d1fb6586)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2615189
Reviewed-by: David Ung <davidu@nvidia.com>
Tested-by: David Ung <davidu@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
254980dab4 UPSTREAM: drm/tegra: Update NVDEC driver to latest upstream version
Update the NVDEC driver to the latest version that is being upstreamed.
Main notable updates are ...

1. Remove reset handling, done by power domain code
2. Add pm-runtime autosuspend support to improve performance
3. Update device-tree property name for the NVDEC instance

JIRA LS-96

Change-Id: Ibe980fe0c71408fd7754b2c75d979bce12b10602
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2584498
(cherry picked from commit 6c04abe593cfbd7c2a07b07ecb4a38fd1cfdcf60)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2587388
Reviewed-by: David Ung <davidu@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: David Ung <davidu@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 09:18:59 +00:00
Mikko Perttunen
a2489aa01a UPSTREAM: drm/tegra: vic: Use autosuspend
When going idle, it's not unlikely that more work will follow.
As such, use autosuspend with a 500ms suspend delay.

JIRA LS-95

Change-Id: I4a12fa358da2b81eb46ef3d7c44ab854068eed1b
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2584497
(cherry picked from commit a7836a45f4b6eb36c573bf75da745c12d173fa52)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2587387
Reviewed-by: David Ung <davidu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: David Ung <davidu@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
b7661d82c8 drm/tegra: Fix support for Linux v5.14
Upstream commit be4306ad928f ("drm/tegra: Don't set allow_fb_modifiers
explicitly") removed the setting of drm->mode_config.allow_fb_modifiers
from the Tegra DRM driver because this is now set by the core. However,
because this is still being set in the Tegra DRM out-of-tree module it
generates a WARNING on boot. Fix this by not setting
drm->mode_config.allow_fb_modifiers for Linux kernels v5.14 and greater.

Upstream commit 6cba3fe43341 ("drm/dp: Add backpointer to drm_device in
drm_dp_aux") added a backpointer that if missing generates another
WARNING on boot so fix this by ensuring the backpointer is populated for
Linux v5.14 kernels and greater.

Bug 200780535

Change-Id: I6092f09cf35f636c4cde0801526fdeab7a26daed
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2602684
(cherry picked from commit e3910b7d43971d7c72ab71b24fab3a234473f8d0)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2604802
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
4b104ab7c5 drm/tegra: Fix compilation for Linux v5.15
Commit 97c9bfe3f660 ("drm/aperture: Pass DRM driver structure instead
of driver name") updated the function drm_aperture_remove_framebuffers()
so that callers need to pass a DRM driver structure instead of a name.
This is causing the compilation of out-of-tree Tegra DRM driver to fail
for Linux v5.15 kernels. Update the out-of-tree Tegra DRM driver as
necessary to support v5.15 kernels.

Change-Id: I3cf5ce75032651a64115452b4ac1fd1e54d83f11
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2588211
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
6875b1f69e drm/tegra: Fix compilation for Linux v5.14
Commit 6848c291a54f ("drm/aperture: Convert drivers to aperture
interfaces") converted various drm_fb_helper_xxx functions to
drm_aperture_xxx functions for Linux v5.14. This breaks the compilation
of the out-of-tree Tegra DRM module and so fix this by updating the
out-of-tree module as necessary.

JIRA LS-115

Change-Id: Ice68b5f9ac6aded268ea4bb6db273d505db29af4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2554714
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
6eb90145f1 drm/tegra: Fix support for Linux v5.9+
The out-of-tree Tegra DRM module that is being maintained for Sidecar
supports Linux v5.9+. Recent upstream changes pulled into the
out-of-tree Tegra DRM broke support for some earlier kernels. Fix
support for all v5.9+ kernel by adding the necessary backwards
compatibility.

JIRA LS-80

Change-Id: I7fb31d979fb0bba35569cbde99815645929b1a49
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2548377
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
dce2bcb225 UPSTREAM: drm/tegra: hub: Implement basic scaling support
Parameterize code in several places to allow scaling of windows. Note
that this currently still relies on static programming of the various
metering and memory pool allocation registers. This seems to work for
the common cases, but may eventually need to be updated to support
use-cases with multiple windows and higher bandwidth and latency
requirements.

Change-Id: Ia64ca5ef66e0afcbb80db0c11e5e88af0017411d
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545954
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
fbce3f1d95 UPSTREAM: drm/tegra: hub: Fix YUV support
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.

Change-Id: I0c508936e022557e02670d114933ba3865048b85
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545953
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Dmitry Osipenko
99b2dfcad0 UPSTREAM: drm/tegra: Correct DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT
The format modifier is 64bit, while DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT
uses BIT() macro that is 32bit on ARM32.

The (modifier &= ~DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT) doesn't work as
expected on ARM32 and tegra_fb_get_tiling() fails for the tiled formats
on 32bit Tegra because modifier mask isn't applied properly. Use the
BIT_ULL() macro to fix this trouble.

Change-Id: Idb0ccf13f0aac5c98d62a629e4b90a222e869779
Fixes: 7b6f846785f4 ("drm/tegra: Support sector layout on Tegra194")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545952
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
6e8e2ead9c UPSTREAM: drm/tegra: sor: Fix AUX device reference leak
In the case where the AUX provides an I2C-over-AUX DDC channel, a
reference is taken on the AUX parent device of the DDC channel rather
than the DDC channel like it would be for regular I2C controllers. To
make sure the correct reference is dropped, move the unreferencing code
into the SOR driver and make sure not to drop the I2C adapter reference
in that case.

Change-Id: I8821ffa49629f808714dae30463d7bf4a3466415
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545951
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Lyude Paul
7cd5671ce4 UPSTREAM: drm/tegra: Get ref for DP AUX channel, not its ddc adapter
While we're taking a reference of the DDC adapter for a DP AUX channel in
tegra_sor_probe() because we're going to be using that adapter with the
SOR, now that we've moved where AUX registration happens the actual device
structure for the DDC adapter isn't initialized yet. Which means that we
can't really take a reference from it to try to keep it around anymore.

This should be fine though, because we can just take a reference of its
parent instead.

v2:
* Avoid calling i2c_put_adapter() in tegra_output_remove() for eDP/DP cases

Change-Id: I2a992474c16db294ecfb4ab5ce5da7419bad6851
Signed-off-by: Lyude Paul <lyude@redhat.com>
Fixes: 39c17ae60ea9 ("drm/tegra: Don't register DP AUX channels before connectors")
Cc: Lyude Paul <lyude@redhat.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545950
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Nathan Chancellor
f0231b05dc UPSTREAM: drm/tegra: Fix shift overflow in tegra_shared_plane_atomic_update
Clang warns:

drivers/gpu/drm/tegra/hub.c:513:11: warning: shift count >= width of
type [-Wshift-count-overflow]
                base |= BIT(39);
                        ^~~~~~~

BIT is unsigned long, which is 32-bit on ARCH=arm, hence the overflow
warning. Switch to BIT_ULL, which is 64-bit and will not overflow.

Change-Id: I0cb7bf0f6899b8dc6fb2a4ff2001daf89aa9b432
Fixes: 7b6f846785f4 ("drm/tegra: Support sector layout on Tegra194")
Link: https://github.com/ClangBuiltLinux/linux/issues/1351
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545949
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
816dfcb103 UPSTREAM: drm/tegra: sor: Fully initialize SOR before registration
Before registering the SOR host1x client, make sure that it is fully
initialized. This avoids a potential race condition between the SOR's
probe and the host1x device initialization in cases where the SOR is
the final sub-device to register to a host1x instance.

Change-Id: If1a1e9aa66cef1e2aedd2099b01a86caf4b789dc
Reported-by: Jonathan Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545948
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Pavel Machek (CIP)
a2c744d2a2 UPSTREAM: drm/tegra: sor: Do not leak runtime PM reference
It's theoretically possible for the runtime PM reference to leak if the
code fails anywhere between the pm_runtime_resume_and_get() and
pm_runtime_put() calls, so make sure to release the runtime PM reference
in that case.

Practically this will never happen because none of the functions will
fail on Tegra, but it's better for the code to be pedantic in case these
assumptions will ever become wrong.

Change-Id: I04d11da45f88ccbae5b007e73344232914480f77
Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
[treding@nvidia.com: add commit message]
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545947
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Lyude Paul
b66f51710d UPSTREAM: drm/tegra: Don't register DP AUX channels before connectors
As pointed out by the documentation for drm_dp_aux_register(),
drm_dp_aux_init() should be used in situations where the AUX channel for a
display driver can potentially be registered before it's respective DRM
driver. This is the case with Tegra, since the DP aux channel exists as a
platform device instead of being a grandchild of the DRM device.

Since we're about to add a backpointer to a DP AUX channel's respective DRM
device, let's fix this so that we don't potentially allow userspace to use
the AUX channel before we've associated it with it's DRM connector.

Change-Id: I499992ec3a45b3813ee3e0dbca7882154dd97ccd
Signed-off-by: Lyude Paul <lyude@redhat.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210326203807.105754-3-lyude@redhat.com
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545946
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
d885fa7b15 UPSTREAM: drm/tegra: Support sector layout on Tegra194
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.

Change-Id: I253c94e44b0ec1a4718e21927a5b8bfe604bc8b4
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545945
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
9ca27f1245 UPSTREAM: drm/tegra: Count number of display controllers at runtime
In order to be able to attach planes to all possible display controllers
the exact number of CRTCs must be known. Keep track of the number of the
display controllers that register during initialization.

Change-Id: I06d2afdbe23bb3865f5ca4c8e7d1dbbc9f09ac43
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545944
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
ad745d3283 UPSTREAM: drm/tegra: fb: Add diagnostics for framebuffer modifiers
Add a debug message to let the user know when a framebuffer modifier is
not supported.

Change-Id: Iac3ea90b3c1f2a7674ff7ff0bc7f8af3214bdfed
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545943
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
7983dd9e4c UPSTREAM: drm/tegra: dc: Implement hardware cursor on Tegra186 and later
The hardware cursor on Tegra186 differs slightly from the implementation
on older SoC generations. In particular the new implementation relies on
software for clipping the cursor against the screen. Fortunately, atomic
KMS already computes clipped coordinates for (cursor) planes, so this is
trivial to implement.

The format supported by the hardware cursor is also slightly different.

v2: use more drm_rect helpers (Dmitry)

Change-Id: I677aca7680f27b99f29c747f28e43fe4b0bd7c09
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545942
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
98a160c54a UPSTREAM: drm/tegra: dc: Parameterize maximum resolution
Tegra186 and later support a higher maximum resolution than earlier
chips, so make sure to reflect that in the mode configuration.

Change-Id: I76e948f301c366f9e86f77ecadc545dbe81bd3fe
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545941
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
efed2371e4 UPSTREAM: drm/tegra: dc: Inherit DMA mask
Inherit the DMA mask from host1x (on Tegra210 and earlier) or the
display hub (on Tegra186 and later). This is necessary in order to
properly map buffers without SMMU support and use the maximum IOVA
space available with SMMU support.

Change-Id: Id1be7d4e05b611ee29581b5ea61f0f40c1d296b1
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545940
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00