Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / gpu / drm / v3d / v3d_fence.c
blob89840ed212c06036e5b9ecef91852a490538ba89
1 // SPDX-License-Identifier: GPL-2.0+
2 /* Copyright (C) 2017-2018 Broadcom */
4 #include "v3d_drv.h"
6 struct dma_fence *v3d_fence_create(struct v3d_dev *v3d, enum v3d_queue queue)
8 struct v3d_fence *fence;
10 fence = kzalloc(sizeof(*fence), GFP_KERNEL);
11 if (!fence)
12 return ERR_PTR(-ENOMEM);
14 fence->dev = &v3d->drm;
15 fence->queue = queue;
16 fence->seqno = ++v3d->queue[queue].emit_seqno;
17 dma_fence_init(&fence->base, &v3d_fence_ops, &v3d->job_lock,
18 v3d->queue[queue].fence_context, fence->seqno);
20 return &fence->base;
23 static const char *v3d_fence_get_driver_name(struct dma_fence *fence)
25 return "v3d";
28 static const char *v3d_fence_get_timeline_name(struct dma_fence *fence)
30 struct v3d_fence *f = to_v3d_fence(fence);
32 switch (f->queue) {
33 case V3D_BIN:
34 return "v3d-bin";
35 case V3D_RENDER:
36 return "v3d-render";
37 case V3D_TFU:
38 return "v3d-tfu";
39 case V3D_CSD:
40 return "v3d-csd";
41 default:
42 return NULL;
46 const struct dma_fence_ops v3d_fence_ops = {
47 .get_driver_name = v3d_fence_get_driver_name,
48 .get_timeline_name = v3d_fence_get_timeline_name,