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
This commit is contained in:
Thierry Reding
2021-03-26 15:51:38 +01:00
committed by Laxman Dewangan
parent ad745d3283
commit 9ca27f1245
3 changed files with 27 additions and 2 deletions

View File

@@ -2138,6 +2138,16 @@ static bool tegra_dc_has_window_groups(struct tegra_dc *dc)
return false;
}
static int tegra_dc_early_init(struct host1x_client *client)
{
struct drm_device *drm = dev_get_drvdata(client->host);
struct tegra_drm *tegra = drm->dev_private;
tegra->num_crtcs++;
return 0;
}
static int tegra_dc_init(struct host1x_client *client)
{
struct drm_device *drm = dev_get_drvdata(client->host);
@@ -2286,6 +2296,16 @@ static int tegra_dc_exit(struct host1x_client *client)
return 0;
}
static int tegra_dc_late_exit(struct host1x_client *client)
{
struct drm_device *drm = dev_get_drvdata(client->host);
struct tegra_drm *tegra = drm->dev_private;
tegra->num_crtcs--;
return 0;
}
static int tegra_dc_runtime_suspend(struct host1x_client *client)
{
struct tegra_dc *dc = host1x_client_to_dc(client);
@@ -2350,8 +2370,10 @@ put_rpm:
}
static const struct host1x_client_ops dc_client_ops = {
.early_init = tegra_dc_early_init,
.init = tegra_dc_init,
.exit = tegra_dc_exit,
.late_exit = tegra_dc_late_exit,
.suspend = tegra_dc_runtime_suspend,
.resume = tegra_dc_runtime_resume,
};

View File

@@ -55,6 +55,7 @@ struct tegra_drm {
unsigned int hmask, vmask;
unsigned int pitch_align;
unsigned int num_crtcs;
struct tegra_display_hub *hub;
};

View File

@@ -584,9 +584,8 @@ struct drm_plane *tegra_shared_plane_create(struct drm_device *drm,
enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY;
struct tegra_drm *tegra = drm->dev_private;
struct tegra_display_hub *hub = tegra->hub;
/* planes can be assigned to arbitrary CRTCs */
unsigned int possible_crtcs = 0x7;
struct tegra_shared_plane *plane;
unsigned int possible_crtcs;
unsigned int num_formats;
const u64 *modifiers;
struct drm_plane *p;
@@ -605,6 +604,9 @@ struct drm_plane *tegra_shared_plane_create(struct drm_device *drm,
p = &plane->base.base;
/* planes can be assigned to arbitrary CRTCs */
possible_crtcs = BIT(tegra->num_crtcs) - 1;
num_formats = ARRAY_SIZE(tegra_shared_plane_formats);
formats = tegra_shared_plane_formats;
modifiers = tegra_shared_plane_modifiers;