Loading...
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2013-2016 Red Hat
4 * Author: Rob Clark <robdclark@gmail.com>
5 */
6
7#ifndef __MSM_FENCE_H__
8#define __MSM_FENCE_H__
9
10#include "msm_drv.h"
11
12struct msm_fence_context {
13 struct drm_device *dev;
14 char name[32];
15 unsigned context;
16 /* last_fence == completed_fence --> no pending work */
17 uint32_t last_fence; /* last assigned fence */
18 uint32_t completed_fence; /* last completed fence */
19 wait_queue_head_t event;
20 spinlock_t spinlock;
21};
22
23struct msm_fence_context * msm_fence_context_alloc(struct drm_device *dev,
24 const char *name);
25void msm_fence_context_free(struct msm_fence_context *fctx);
26
27int msm_wait_fence(struct msm_fence_context *fctx, uint32_t fence,
28 ktime_t *timeout, bool interruptible);
29void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence);
30
31struct dma_fence * msm_fence_alloc(struct msm_fence_context *fctx);
32
33#endif
1/*
2 * Copyright (C) 2013-2016 Red Hat
3 * Author: Rob Clark <robdclark@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __MSM_FENCE_H__
19#define __MSM_FENCE_H__
20
21#include "msm_drv.h"
22
23struct msm_fence_context {
24 struct drm_device *dev;
25 const char *name;
26 unsigned context;
27 /* last_fence == completed_fence --> no pending work */
28 uint32_t last_fence; /* last assigned fence */
29 uint32_t completed_fence; /* last completed fence */
30 wait_queue_head_t event;
31 spinlock_t spinlock;
32};
33
34struct msm_fence_context * msm_fence_context_alloc(struct drm_device *dev,
35 const char *name);
36void msm_fence_context_free(struct msm_fence_context *fctx);
37
38int msm_wait_fence(struct msm_fence_context *fctx, uint32_t fence,
39 ktime_t *timeout, bool interruptible);
40int msm_queue_fence_cb(struct msm_fence_context *fctx,
41 struct msm_fence_cb *cb, uint32_t fence);
42void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence);
43
44struct dma_fence * msm_fence_alloc(struct msm_fence_context *fctx);
45
46#endif