summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/fence_gk20a.h
diff options
context:
space:
mode:
authorLauri Peltonen <lpeltonen@nvidia.com>2014-07-17 19:21:34 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:10:40 -0400
commitbcf60a22c3e8671468517d34aa37548272455c1f (patch)
treec3544f6714c291e611e33a8d0e39c5cb2c795821 /drivers/gpu/nvgpu/gk20a/fence_gk20a.h
parent55295c6087ed975be12e92f9be799269aef94678 (diff)
gpu: nvgpu: Add gk20a_fence type
When moving compression state tracking and compbit management ops to kernel, we need to attach a fence to dma-buf metadata, along with the compbit state. To make in-kernel fence management easier, introduce a new gk20a_fence abstraction. A gk20a_fence may be backed by a semaphore or a syncpoint (id, value) pair. If the kernel is configured with CONFIG_SYNC, it will also contain a sync_fence. The gk20a_fence can easily be converted back to a syncpoint (id, value) parir or sync FD when we need to return it to user space. Change gk20a_submit_channel_gpfifo to return a gk20a_fence instead of nvhost_fence. This is to facilitate work submission initiated from kernel. Bug 1509620 Change-Id: I6154764a279dba83f5e91ba9e0cb5e227ca08e1b Signed-off-by: Lauri Peltonen <lpeltonen@nvidia.com> Reviewed-on: http://git-master/r/439846 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fence_gk20a.h')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fence_gk20a.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.h b/drivers/gpu/nvgpu/gk20a/fence_gk20a.h
new file mode 100644
index 00000000..629dc694
--- /dev/null
+++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.h
@@ -0,0 +1,68 @@
1/*
2 * drivers/video/tegra/host/gk20a/fence_gk20a.h
3 *
4 * GK20A Fences
5 *
6 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 */
17#ifndef _GK20A_FENCE_H_
18#define _GK20A_FENCE_H_
19
20#include <linux/types.h>
21#include <linux/kref.h>
22#include <linux/wait.h>
23
24struct platform_device;
25struct sync_timeline;
26struct sync_fence;
27struct gk20a_semaphore;
28struct channel_gk20a;
29
30struct gk20a_fence_ops;
31
32struct gk20a_fence {
33 /* Valid for all fence types: */
34 struct kref ref;
35 bool wfi;
36 struct sync_fence *sync_fence;
37 const struct gk20a_fence_ops *ops;
38
39 /* Valid for fences created from semaphores: */
40 struct gk20a_semaphore *semaphore;
41 wait_queue_head_t *semaphore_wq;
42
43 /* Valid for fences created from syncpoints: */
44 struct platform_device *host1x_pdev;
45 u32 syncpt_id;
46 u32 syncpt_value;
47};
48
49/* Fences can be created from semaphores or syncpoint (id, value) pairs */
50struct gk20a_fence *gk20a_fence_from_semaphore(
51 struct sync_timeline *timeline,
52 struct gk20a_semaphore *semaphore,
53 wait_queue_head_t *semaphore_wq,
54 struct sync_fence *dependency,
55 bool wfi);
56
57struct gk20a_fence *gk20a_fence_from_syncpt(
58 struct platform_device *host1x_pdev,
59 u32 id, u32 value, bool wfi);
60
61/* Fence operations */
62void gk20a_fence_put(struct gk20a_fence *f);
63struct gk20a_fence *gk20a_fence_get(struct gk20a_fence *f);
64int gk20a_fence_wait(struct gk20a_fence *f, int timeout);
65bool gk20a_fence_is_expired(struct gk20a_fence *f);
66int gk20a_fence_install_fd(struct gk20a_fence *f);
67
68#endif