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

drm/tegra: Allocate per-engine channel in core code

To avoid code duplication, allocate the per-engine shared channel in
the core code instead. This is the usual channel that all jobs are
submitted to when MLOCKing is not in use. Once MLOCKs are implemented
on Host1x side, we can also update this to avoid allocating a shared
channel when MLOCKs are enabled.
Signed-off-by: default avatarMikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 99166123
...@@ -870,6 +870,14 @@ static const struct drm_driver tegra_drm_driver = { ...@@ -870,6 +870,14 @@ static const struct drm_driver tegra_drm_driver = {
int tegra_drm_register_client(struct tegra_drm *tegra, int tegra_drm_register_client(struct tegra_drm *tegra,
struct tegra_drm_client *client) struct tegra_drm_client *client)
{ {
/*
* When MLOCKs are implemented, change to allocate a shared channel
* only when MLOCKs are disabled.
*/
client->shared_channel = host1x_channel_request(&client->base);
if (!client->shared_channel)
return -EBUSY;
mutex_lock(&tegra->clients_lock); mutex_lock(&tegra->clients_lock);
list_add_tail(&client->list, &tegra->clients); list_add_tail(&client->list, &tegra->clients);
client->drm = tegra; client->drm = tegra;
...@@ -886,6 +894,9 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra, ...@@ -886,6 +894,9 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra,
client->drm = NULL; client->drm = NULL;
mutex_unlock(&tegra->clients_lock); mutex_unlock(&tegra->clients_lock);
if (client->shared_channel)
host1x_channel_put(client->shared_channel);
return 0; return 0;
} }
......
...@@ -91,7 +91,9 @@ struct tegra_drm_client { ...@@ -91,7 +91,9 @@ struct tegra_drm_client {
struct host1x_client base; struct host1x_client base;
struct list_head list; struct list_head list;
struct tegra_drm *drm; struct tegra_drm *drm;
struct host1x_channel *shared_channel;
/* Set by driver */
unsigned int version; unsigned int version;
const struct tegra_drm_client_ops *ops; const struct tegra_drm_client_ops *ops;
}; };
......
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