summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2017-11-24 11:36:03 +0100
committerLucas Stach <l.stach@pengutronix.de>2018-01-02 17:31:31 +0100
commite0329e6cfa6274ceb54d175b5e6ac19c00024c33 (patch)
tree61f286acee5eb8fb92c6b48f31159c3d1e994d03 /drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
parentdrm/etnaviv: move ww_acquire_ctx out of submit object (diff)
downloadlinux-e0329e6cfa6274ceb54d175b5e6ac19c00024c33.tar.xz
linux-e0329e6cfa6274ceb54d175b5e6ac19c00024c33.zip
drm/etnaviv: refcount the submit object
The submit object lifetime will get extended to the actual GPU execution. As multiple users will depend on this, add a kref to properly control destruction of the object. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c')
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
index 3090a46979af..9b4436c380ea 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
@@ -43,6 +43,7 @@ static struct etnaviv_gem_submit *submit_create(struct drm_device *dev,
return NULL;
submit->gpu = gpu;
+ kref_init(&submit->refcount);
return submit;
}
@@ -341,8 +342,10 @@ static int submit_perfmon_validate(struct etnaviv_gem_submit *submit,
return 0;
}
-static void submit_cleanup(struct etnaviv_gem_submit *submit)
+static void submit_cleanup(struct kref *kref)
{
+ struct etnaviv_gem_submit *submit =
+ container_of(kref, struct etnaviv_gem_submit, refcount);
unsigned i;
for (i = 0; i < submit->nr_bos; i++) {
@@ -367,6 +370,11 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit)
kfree(submit);
}
+void etnaviv_submit_put(struct etnaviv_gem_submit *submit)
+{
+ kref_put(&submit->refcount, submit_cleanup);
+}
+
int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
struct drm_file *file)
{
@@ -544,7 +552,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
args->fence = submit->out_fence->seqno;
err_submit_objects:
- submit_cleanup(submit);
+ etnaviv_submit_put(submit);
err_submit_ww_acquire:
ww_acquire_fini(&ticket);