drm/tegra: dc: Don't clean up unused display controller

Display controllers that don't own any windows and which therefore
aren't currently being assigned a primary plane are not registered
as a CRTC with the DRM framework. They request neither a syncpoint
nor an interrupt because they don't use them, so avoid cleaning up
those resources.

Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
Thierry Reding 2018-11-29 17:24:35 +01:00
parent 0cffbde2e3
commit e75d04771a
1 changed files with 22 additions and 16 deletions

View File

@ -1978,6 +1978,23 @@ static irqreturn_t tegra_dc_irq(int irq, void *data)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static bool tegra_dc_has_window_groups(struct tegra_dc *dc)
{
unsigned int i;
if (!dc->soc->wgrps)
return true;
for (i = 0; i < dc->soc->num_wgrps; i++) {
const struct tegra_windowgroup_soc *wgrp = &dc->soc->wgrps[i];
if (wgrp->dc == dc->pipe && wgrp->num_windows > 0)
return true;
}
return false;
}
static int tegra_dc_init(struct host1x_client *client) static int tegra_dc_init(struct host1x_client *client)
{ {
struct drm_device *drm = dev_get_drvdata(client->parent); struct drm_device *drm = dev_get_drvdata(client->parent);
@ -1993,22 +2010,8 @@ static int tegra_dc_init(struct host1x_client *client)
* assign a primary plane to them, which in turn will cause KMS to * assign a primary plane to them, which in turn will cause KMS to
* crash. * crash.
*/ */
if (dc->soc->wgrps) { if (!tegra_dc_has_window_groups(dc))
bool has_wgrps = false; return 0;
unsigned int i;
for (i = 0; i < dc->soc->num_wgrps; i++) {
const struct tegra_windowgroup_soc *wgrp = &dc->soc->wgrps[i];
if (wgrp->dc == dc->pipe && wgrp->num_windows > 0) {
has_wgrps = true;
break;
}
}
if (!has_wgrps)
return 0;
}
dc->syncpt = host1x_syncpt_request(client, flags); dc->syncpt = host1x_syncpt_request(client, flags);
if (!dc->syncpt) if (!dc->syncpt)
@ -2094,6 +2097,9 @@ static int tegra_dc_exit(struct host1x_client *client)
struct tegra_dc *dc = host1x_client_to_dc(client); struct tegra_dc *dc = host1x_client_to_dc(client);
int err; int err;
if (!tegra_dc_has_window_groups(dc))
return 0;
devm_free_irq(dc->dev, dc->irq, dc); devm_free_irq(dc->dev, dc->irq, dc);
err = tegra_dc_rgb_exit(dc); err = tegra_dc_rgb_exit(dc);