Commit 80e60973 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: create userspace clients as subclients

This will allow the DRM to share memory objects between clients later
down the track.

For the moment, the only immediate benefit is less logic required to
handle suspend/resume.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 20d8a88e
...@@ -131,8 +131,13 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname, ...@@ -131,8 +131,13 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
mutex_init(&cli->mutex); mutex_init(&cli->mutex);
usif_client_init(cli); usif_client_init(cli);
if (cli == &drm->client) {
ret = nvif_driver_init(NULL, nouveau_config, nouveau_debug, ret = nvif_driver_init(NULL, nouveau_config, nouveau_debug,
cli->name, device, &cli->base); cli->name, device, &cli->base);
} else {
ret = nvif_client_init(&drm->client.base, cli->name, device,
&cli->base);
}
if (ret) { if (ret) {
NV_ERROR(drm, "Client allocation failed: %d\n", ret); NV_ERROR(drm, "Client allocation failed: %d\n", ret);
goto done; goto done;
...@@ -569,7 +574,6 @@ static int ...@@ -569,7 +574,6 @@ static int
nouveau_do_suspend(struct drm_device *dev, bool runtime) nouveau_do_suspend(struct drm_device *dev, bool runtime)
{ {
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_cli *cli;
int ret; int ret;
nouveau_led_suspend(dev); nouveau_led_suspend(dev);
...@@ -599,7 +603,7 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime) ...@@ -599,7 +603,7 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime)
goto fail_display; goto fail_display;
} }
NV_INFO(drm, "suspending client object trees...\n"); NV_INFO(drm, "suspending fence...\n");
if (drm->fence && nouveau_fence(drm)->suspend) { if (drm->fence && nouveau_fence(drm)->suspend) {
if (!nouveau_fence(drm)->suspend(drm)) { if (!nouveau_fence(drm)->suspend(drm)) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -607,13 +611,7 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime) ...@@ -607,13 +611,7 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime)
} }
} }
list_for_each_entry(cli, &drm->clients, head) { NV_INFO(drm, "suspending object tree...\n");
ret = nvif_client_suspend(&cli->base);
if (ret)
goto fail_client;
}
NV_INFO(drm, "suspending kernel object tree...\n");
ret = nvif_client_suspend(&drm->client.base); ret = nvif_client_suspend(&drm->client.base);
if (ret) if (ret)
goto fail_client; goto fail_client;
...@@ -621,10 +619,6 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime) ...@@ -621,10 +619,6 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime)
return 0; return 0;
fail_client: fail_client:
list_for_each_entry_continue_reverse(cli, &drm->clients, head) {
nvif_client_resume(&cli->base);
}
if (drm->fence && nouveau_fence(drm)->resume) if (drm->fence && nouveau_fence(drm)->resume)
nouveau_fence(drm)->resume(drm); nouveau_fence(drm)->resume(drm);
...@@ -640,19 +634,14 @@ static int ...@@ -640,19 +634,14 @@ static int
nouveau_do_resume(struct drm_device *dev, bool runtime) nouveau_do_resume(struct drm_device *dev, bool runtime)
{ {
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_cli *cli;
NV_INFO(drm, "resuming kernel object tree...\n"); NV_INFO(drm, "resuming object tree...\n");
nvif_client_resume(&drm->client.base); nvif_client_resume(&drm->client.base);
NV_INFO(drm, "resuming client object trees...\n"); NV_INFO(drm, "resuming fence...\n");
if (drm->fence && nouveau_fence(drm)->resume) if (drm->fence && nouveau_fence(drm)->resume)
nouveau_fence(drm)->resume(drm); nouveau_fence(drm)->resume(drm);
list_for_each_entry(cli, &drm->clients, head) {
nvif_client_resume(&cli->base);
}
nouveau_run_vbios_init(dev); nouveau_run_vbios_init(dev);
if (dev->mode_config.num_crtc) { if (dev->mode_config.num_crtc) {
......
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