From d0fcf82da23d86b1e6008a2499aab1d951b588a8 Mon Sep 17 00:00:00 2001 From: Jérôme Glisse Date: Fri, 11 Aug 2017 16:19:19 -0400 Subject: drm/nouveau/compote: create a compute object to force graphic context creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Graphic context is not created until there is an object that reference the engine. Creating a compute class object as no other side effect than pgrah context creation. Signed-off-by: Jérôme Glisse --- drivers/gpu/drm/nouveau/compote/compote-channel.c | 11 +++++++++++ drivers/gpu/drm/nouveau/compote/compote.h | 1 + 2 files changed, 12 insertions(+) (limited to 'drivers/gpu/drm') diff --git a/drivers/gpu/drm/nouveau/compote/compote-channel.c b/drivers/gpu/drm/nouveau/compote/compote-channel.c index b5a490acf051..3bb7333f41a0 100644 --- a/drivers/gpu/drm/nouveau/compote/compote-channel.c +++ b/drivers/gpu/drm/nouveau/compote/compote-channel.c @@ -61,9 +61,18 @@ int compote_channel_new(struct compote_channel **channelp, if (ret) goto error; + ret = nvif_object_init(&channel->nvchan->user, 0, PASCAL_COMPUTE_B, + NULL, 0, &channel->nvcompute); + if (ret) + goto error_compute; + nvif_object_map(&channel->nvcompute); + *channelp = channel; return 0; +error_compute: + nouveau_channel_idle(channel->nvchan); + nouveau_channel_del(&channel->nvchan); error: kfree(channel); return ret; @@ -77,6 +86,8 @@ static void compote_channel_kref_put(struct kref *kref) channel = container_of(kref, struct compote_channel, kref); cfile = channel->cfile; + nvif_object_fini(&channel->nvcompute); + /* * Wait for all activity to stop before releasing notify object, which * may be still in use. diff --git a/drivers/gpu/drm/nouveau/compote/compote.h b/drivers/gpu/drm/nouveau/compote/compote.h index ef8ea114db42..6e04c56c2613 100644 --- a/drivers/gpu/drm/nouveau/compote/compote.h +++ b/drivers/gpu/drm/nouveau/compote/compote.h @@ -65,6 +65,7 @@ struct compote_channel { struct compote_file *cfile; struct nouveau_channel *nvchan; struct kref kref; + struct nvif_object nvcompute; }; long compote_ioctl_mem_alloc(struct compote_file *cfile, void __user *uarg); -- cgit v1.2.3