2018-04-30 18:10:58 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/* Copyright (C) 2017-2018 Broadcom */
|
|
|
|
|
|
|
|
#include "v3d_drv.h"
|
|
|
|
|
|
|
|
struct dma_fence *v3d_fence_create(struct v3d_dev *v3d, enum v3d_queue queue)
|
|
|
|
{
|
|
|
|
struct v3d_fence *fence;
|
|
|
|
|
|
|
|
fence = kzalloc(sizeof(*fence), GFP_KERNEL);
|
|
|
|
if (!fence)
|
|
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
|
|
|
|
fence->dev = &v3d->drm;
|
|
|
|
fence->queue = queue;
|
|
|
|
fence->seqno = ++v3d->queue[queue].emit_seqno;
|
|
|
|
dma_fence_init(&fence->base, &v3d_fence_ops, &v3d->job_lock,
|
|
|
|
v3d->queue[queue].fence_context, fence->seqno);
|
|
|
|
|
|
|
|
return &fence->base;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *v3d_fence_get_driver_name(struct dma_fence *fence)
|
|
|
|
{
|
|
|
|
return "v3d";
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *v3d_fence_get_timeline_name(struct dma_fence *fence)
|
|
|
|
{
|
|
|
|
struct v3d_fence *f = to_v3d_fence(fence);
|
|
|
|
|
2018-12-01 00:57:59 +00:00
|
|
|
switch (f->queue) {
|
|
|
|
case V3D_BIN:
|
2018-04-30 18:10:58 +00:00
|
|
|
return "v3d-bin";
|
2018-12-01 00:57:59 +00:00
|
|
|
case V3D_RENDER:
|
2018-04-30 18:10:58 +00:00
|
|
|
return "v3d-render";
|
2018-12-01 00:57:59 +00:00
|
|
|
case V3D_TFU:
|
|
|
|
return "v3d-tfu";
|
2019-04-16 22:58:54 +00:00
|
|
|
case V3D_CSD:
|
|
|
|
return "v3d-csd";
|
2018-12-01 00:57:59 +00:00
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
2018-04-30 18:10:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const struct dma_fence_ops v3d_fence_ops = {
|
|
|
|
.get_driver_name = v3d_fence_get_driver_name,
|
|
|
|
.get_timeline_name = v3d_fence_get_timeline_name,
|
|
|
|
};
|