Commit f5ba33fb authored by Mikko Perttunen's avatar Mikko Perttunen Committed by Thierry Reding

gpu: host1x: Reserve VBLANK syncpoints at initialization

On T20-T148 chips, the bootloader can set up a boot splash
screen with DC configured to increment syncpoint 26/27
at VBLANK. Because of this we shouldn't allow these syncpoints
to be allocated until DC has been reset and will no longer
increment them in the background.

As such, on these chips, reserve those two syncpoints at
initialization, and only mark them free once the DC
driver has indicated it's safe to do so.
Signed-off-by: default avatarMikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent aded42ad
...@@ -2045,6 +2045,12 @@ static int tegra_dc_init(struct host1x_client *client) ...@@ -2045,6 +2045,12 @@ static int tegra_dc_init(struct host1x_client *client)
struct drm_plane *cursor = NULL; struct drm_plane *cursor = NULL;
int err; int err;
/*
* DC has been reset by now, so VBLANK syncpoint can be released
* for general use.
*/
host1x_syncpt_release_vblank_reservation(client, 26 + dc->pipe);
/* /*
* XXX do not register DCs with no window groups because we cannot * XXX do not register DCs with no window groups because we cannot
* 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
......
...@@ -77,6 +77,7 @@ static const struct host1x_info host1x01_info = { ...@@ -77,6 +77,7 @@ static const struct host1x_info host1x01_info = {
.has_hypervisor = false, .has_hypervisor = false,
.num_sid_entries = 0, .num_sid_entries = 0,
.sid_table = NULL, .sid_table = NULL,
.reserve_vblank_syncpts = true,
}; };
static const struct host1x_info host1x02_info = { static const struct host1x_info host1x02_info = {
...@@ -91,6 +92,7 @@ static const struct host1x_info host1x02_info = { ...@@ -91,6 +92,7 @@ static const struct host1x_info host1x02_info = {
.has_hypervisor = false, .has_hypervisor = false,
.num_sid_entries = 0, .num_sid_entries = 0,
.sid_table = NULL, .sid_table = NULL,
.reserve_vblank_syncpts = true,
}; };
static const struct host1x_info host1x04_info = { static const struct host1x_info host1x04_info = {
...@@ -105,6 +107,7 @@ static const struct host1x_info host1x04_info = { ...@@ -105,6 +107,7 @@ static const struct host1x_info host1x04_info = {
.has_hypervisor = false, .has_hypervisor = false,
.num_sid_entries = 0, .num_sid_entries = 0,
.sid_table = NULL, .sid_table = NULL,
.reserve_vblank_syncpts = false,
}; };
static const struct host1x_info host1x05_info = { static const struct host1x_info host1x05_info = {
...@@ -119,6 +122,7 @@ static const struct host1x_info host1x05_info = { ...@@ -119,6 +122,7 @@ static const struct host1x_info host1x05_info = {
.has_hypervisor = false, .has_hypervisor = false,
.num_sid_entries = 0, .num_sid_entries = 0,
.sid_table = NULL, .sid_table = NULL,
.reserve_vblank_syncpts = false,
}; };
static const struct host1x_sid_entry tegra186_sid_table[] = { static const struct host1x_sid_entry tegra186_sid_table[] = {
...@@ -142,6 +146,7 @@ static const struct host1x_info host1x06_info = { ...@@ -142,6 +146,7 @@ static const struct host1x_info host1x06_info = {
.has_hypervisor = true, .has_hypervisor = true,
.num_sid_entries = ARRAY_SIZE(tegra186_sid_table), .num_sid_entries = ARRAY_SIZE(tegra186_sid_table),
.sid_table = tegra186_sid_table, .sid_table = tegra186_sid_table,
.reserve_vblank_syncpts = false,
}; };
static const struct host1x_sid_entry tegra194_sid_table[] = { static const struct host1x_sid_entry tegra194_sid_table[] = {
...@@ -165,6 +170,7 @@ static const struct host1x_info host1x07_info = { ...@@ -165,6 +170,7 @@ static const struct host1x_info host1x07_info = {
.has_hypervisor = true, .has_hypervisor = true,
.num_sid_entries = ARRAY_SIZE(tegra194_sid_table), .num_sid_entries = ARRAY_SIZE(tegra194_sid_table),
.sid_table = tegra194_sid_table, .sid_table = tegra194_sid_table,
.reserve_vblank_syncpts = false,
}; };
static const struct of_device_id host1x_of_match[] = { static const struct of_device_id host1x_of_match[] = {
......
...@@ -101,6 +101,12 @@ struct host1x_info { ...@@ -101,6 +101,12 @@ struct host1x_info {
bool has_hypervisor; /* has hypervisor registers */ bool has_hypervisor; /* has hypervisor registers */
unsigned int num_sid_entries; unsigned int num_sid_entries;
const struct host1x_sid_entry *sid_table; const struct host1x_sid_entry *sid_table;
/*
* On T20-T148, the boot chain may setup DC to increment syncpoints
* 26/27 on VBLANK. As such we cannot use these syncpoints until
* the display driver disables VBLANK increments.
*/
bool reserve_vblank_syncpts;
}; };
struct host1x { struct host1x {
......
...@@ -67,7 +67,7 @@ struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host, ...@@ -67,7 +67,7 @@ struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host,
mutex_lock(&host->syncpt_mutex); mutex_lock(&host->syncpt_mutex);
for (i = 0; i < host->info->nb_pts && sp->name; i++, sp++) for (i = 0; i < host->info->nb_pts && kref_read(&sp->ref); i++, sp++)
; ;
if (i >= host->info->nb_pts) if (i >= host->info->nb_pts)
...@@ -374,6 +374,11 @@ int host1x_syncpt_init(struct host1x *host) ...@@ -374,6 +374,11 @@ int host1x_syncpt_init(struct host1x *host)
if (!host->nop_sp) if (!host->nop_sp)
return -ENOMEM; return -ENOMEM;
if (host->info->reserve_vblank_syncpts) {
kref_init(&host->syncpt[26].ref);
kref_init(&host->syncpt[27].ref);
}
return 0; return 0;
} }
...@@ -559,3 +564,31 @@ u32 host1x_syncpt_base_id(struct host1x_syncpt_base *base) ...@@ -559,3 +564,31 @@ u32 host1x_syncpt_base_id(struct host1x_syncpt_base *base)
return base->id; return base->id;
} }
EXPORT_SYMBOL(host1x_syncpt_base_id); EXPORT_SYMBOL(host1x_syncpt_base_id);
static void do_nothing(struct kref *ref)
{
}
/**
* host1x_syncpt_release_vblank_reservation() - Make VBLANK syncpoint
* available for allocation
*
* @client: host1x bus client
* @syncpt_id: syncpoint ID to make available
*
* Makes VBLANK<i> syncpoint available for allocatation if it was
* reserved at initialization time. This should be called by the display
* driver after it has ensured that any VBLANK increment programming configured
* by the boot chain has been disabled.
*/
void host1x_syncpt_release_vblank_reservation(struct host1x_client *client,
u32 syncpt_id)
{
struct host1x *host = dev_get_drvdata(client->host->parent);
if (!host->info->reserve_vblank_syncpts)
return;
kref_put(&host->syncpt[syncpt_id].ref, do_nothing);
}
EXPORT_SYMBOL(host1x_syncpt_release_vblank_reservation);
...@@ -163,6 +163,9 @@ struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host, ...@@ -163,6 +163,9 @@ struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host,
struct host1x_syncpt_base *host1x_syncpt_get_base(struct host1x_syncpt *sp); struct host1x_syncpt_base *host1x_syncpt_get_base(struct host1x_syncpt *sp);
u32 host1x_syncpt_base_id(struct host1x_syncpt_base *base); u32 host1x_syncpt_base_id(struct host1x_syncpt_base *base);
void host1x_syncpt_release_vblank_reservation(struct host1x_client *client,
u32 syncpt_id);
/* /*
* host1x channel * host1x channel
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment