Skip to content

Commit

Permalink
drm/etnaviv: return GPU fence through the submit structure
Browse files Browse the repository at this point in the history
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: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
---
New patch in v3.
  • Loading branch information
Lucas Stach committed Mar 29, 2017
1 parent 9ad59fe commit 6e2b98c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/etnaviv/etnaviv_gem.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/reservation.h>
#include "etnaviv_drv.h"

struct dma_fence;
struct etnaviv_gem_ops;
struct etnaviv_gem_object;

Expand Down Expand Up @@ -104,7 +105,7 @@ struct etnaviv_gem_submit {
struct drm_device *dev;
struct etnaviv_gpu *gpu;
struct ww_acquire_ctx ticket;
u32 fence;
struct dma_fence *fence;
unsigned int nr_bos;
struct etnaviv_gem_submit_bo bos[0];
u32 flags;
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit)
}

ww_acquire_fini(&submit->ticket);
dma_fence_put(submit->fence);
kfree(submit);
}

Expand Down Expand Up @@ -435,7 +436,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
if (ret == 0)
cmdbuf = NULL;

args->fence = submit->fence;
args->fence = submit->fence->seqno;

out:
submit_unpin_objects(submit);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/etnaviv/etnaviv_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1337,8 +1337,8 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu,
mutex_lock(&gpu->lock);

gpu->event[event].fence = fence;
submit->fence = fence->seqno;
gpu->active_fence = submit->fence;
submit->fence = dma_fence_get(fence);
gpu->active_fence = submit->fence->seqno;

if (gpu->lastctx != cmdbuf->ctx) {
gpu->mmu->need_flush = true;
Expand Down

0 comments on commit 6e2b98c

Please sign in to comment.