Commit 6e2b98cf authored by Lucas Stach's avatar Lucas Stach

drm/etnaviv: return GPU fence through the submit structure

The next patch will need the complete dma_fence, instead of just the seqno,
to create the sync_file in etnaviv_ioctl_gem_submit, in case an
out_fence_fd is requested.

The submit needs to hold a reference to the dma_fence, to avoid raceing
with the GPU completing the fence.
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Tested-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
---
New patch in v3.
parent 9ad59fea
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/reservation.h> #include <linux/reservation.h>
#include "etnaviv_drv.h" #include "etnaviv_drv.h"
struct dma_fence;
struct etnaviv_gem_ops; struct etnaviv_gem_ops;
struct etnaviv_gem_object; struct etnaviv_gem_object;
...@@ -104,7 +105,7 @@ struct etnaviv_gem_submit { ...@@ -104,7 +105,7 @@ struct etnaviv_gem_submit {
struct drm_device *dev; struct drm_device *dev;
struct etnaviv_gpu *gpu; struct etnaviv_gpu *gpu;
struct ww_acquire_ctx ticket; struct ww_acquire_ctx ticket;
u32 fence; struct dma_fence *fence;
unsigned int nr_bos; unsigned int nr_bos;
struct etnaviv_gem_submit_bo bos[0]; struct etnaviv_gem_submit_bo bos[0];
u32 flags; u32 flags;
......
...@@ -294,6 +294,7 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit) ...@@ -294,6 +294,7 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit)
} }
ww_acquire_fini(&submit->ticket); ww_acquire_fini(&submit->ticket);
dma_fence_put(submit->fence);
kfree(submit); kfree(submit);
} }
...@@ -435,7 +436,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, ...@@ -435,7 +436,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
if (ret == 0) if (ret == 0)
cmdbuf = NULL; cmdbuf = NULL;
args->fence = submit->fence; args->fence = submit->fence->seqno;
out: out:
submit_unpin_objects(submit); submit_unpin_objects(submit);
......
...@@ -1337,8 +1337,8 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu, ...@@ -1337,8 +1337,8 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu,
mutex_lock(&gpu->lock); mutex_lock(&gpu->lock);
gpu->event[event].fence = fence; gpu->event[event].fence = fence;
submit->fence = fence->seqno; submit->fence = dma_fence_get(fence);
gpu->active_fence = submit->fence; gpu->active_fence = submit->fence->seqno;
if (gpu->lastctx != cmdbuf->ctx) { if (gpu->lastctx != cmdbuf->ctx) {
gpu->mmu->need_flush = true; gpu->mmu->need_flush = true;
......
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