[PATCH v16 0/2] Add memory bandwidth management to NVIDIA Tegra DRM driver

From: Dmitry Osipenko
Date: Wed Mar 17 2021 - 15:00:59 EST

This series adds memory bandwidth management to the NVIDIA Tegra DRM driver,
which is done using interconnect framework. It fixes display corruption that
happens due to insufficient memory bandwidth.


v16: - Implemented suggestions that were given by Michał Mirosław to v15.

- Added r-b from Michał Mirosław to the debug-stats patch.

- Rebased on top of a recent linux-next.

- Removed bandwidth scaling based on width difference of src/dst
windows since it's not actual anymore. Apparently the recent memory
driver changes fixed problems that I witnessed before.

- Average bandwidth calculation now won't overflow for 4k resolutions.

- Average bandwidth calculation now uses the size of the visible
area instead of the src area since debug stats of the memory
controller clearly show that downscaled window takes less bandwidth,
proportionally to the scaled size.

- Bandwidth calculation now uses "adjusted mode" of the CRTC, which
is what used for h/w programming, instead of the mode that was
requested by userspace, although the two usually match in practice.

v15: - Corrected tegra_plane_icc_names[] NULL-check that was partially lost
by accident in v14 after unsuccessful rebase.

v14: - Made improvements that were suggested by Michał Mirosław to v13:

- Changed 'unsigned int' to 'bool'.
- Renamed functions which calculate bandwidth state.
- Reworked comment in the code that explains why downscaled plane
require higher bandwidth.
- Added round-up to bandwidth calculation.
- Added sanity checks of the plane index and fixed out-of-bounds
access which happened on T124 due to the cursor plane index.

v13: - No code changes. Patches missed v5.12, re-sending them for v5.13.

Dmitry Osipenko (2):
drm/tegra: dc: Support memory bandwidth management
drm/tegra: dc: Extend debug stats with total number of events

drivers/gpu/drm/tegra/Kconfig | 1 +
drivers/gpu/drm/tegra/dc.c | 362 ++++++++++++++++++++++++++++++++++
drivers/gpu/drm/tegra/dc.h | 19 ++
drivers/gpu/drm/tegra/drm.c | 14 ++
drivers/gpu/drm/tegra/hub.c | 3 +
drivers/gpu/drm/tegra/plane.c | 116 +++++++++++
drivers/gpu/drm/tegra/plane.h | 15 ++
7 files changed, 530 insertions(+)