2b4d34e3fe0109cc6cebeccac35c5a722fffa8ec
[oweals/openwrt.git] /
1 From 7e891cb1f9f57c87706b1292f186d65e1640e0e7 Mon Sep 17 00:00:00 2001
2 From: Chunming Zhou <david1.zhou@amd.com>
3 Date: Thu, 30 Aug 2018 14:48:29 +0800
4 Subject: [PATCH] drm: expand drm_syncobj_find_fence to support
5  timeline point v2
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 we can fetch timeline point fence after expanded.
11 v2: The parameter fence is the result of the function and should come last.
12
13 Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
14 Reviewed-by: Christian König <christian.koenig@amd.com>
15 Signed-off-by: Christian König <christian.koenig@amd.com>
16 Link: https://patchwork.freedesktop.org/patch/246541/
17 (cherry picked from commit 0a6730ea27b68c7ac4171c29a816c29d26a9637a)
18 Signed-off-by: Eric Anholt <eric@anholt.net>
19 ---
20  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
21  drivers/gpu/drm/drm_syncobj.c          | 5 +++--
22  drivers/gpu/drm/v3d/v3d_gem.c          | 4 ++--
23  drivers/gpu/drm/vc4/vc4_gem.c          | 2 +-
24  include/drm/drm_syncobj.h              | 2 +-
25  5 files changed, 8 insertions(+), 7 deletions(-)
26
27 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
28 +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
29 @@ -1105,7 +1105,7 @@ static int amdgpu_syncobj_lookup_and_add
30  {
31         int r;
32         struct dma_fence *fence;
33 -       r = drm_syncobj_find_fence(p->filp, handle, &fence);
34 +       r = drm_syncobj_find_fence(p->filp, handle, 0, &fence);
35         if (r)
36                 return r;
37  
38 --- a/drivers/gpu/drm/drm_syncobj.c
39 +++ b/drivers/gpu/drm/drm_syncobj.c
40 @@ -235,6 +235,7 @@ static int drm_syncobj_assign_null_handl
41   * drm_syncobj_find_fence - lookup and reference the fence in a sync object
42   * @file_private: drm file private pointer
43   * @handle: sync object handle to lookup.
44 + * @point: timeline point
45   * @fence: out parameter for the fence
46   *
47   * This is just a convenience function that combines drm_syncobj_find() and
48 @@ -245,7 +246,7 @@ static int drm_syncobj_assign_null_handl
49   * dma_fence_put().
50   */
51  int drm_syncobj_find_fence(struct drm_file *file_private,
52 -                          u32 handle,
53 +                          u32 handle, u64 point,
54                            struct dma_fence **fence)
55  {
56         struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
57 @@ -516,7 +517,7 @@ static int drm_syncobj_export_sync_file(
58         if (fd < 0)
59                 return fd;
60  
61 -       ret = drm_syncobj_find_fence(file_private, handle, &fence);
62 +       ret = drm_syncobj_find_fence(file_private, handle, 0, &fence);
63         if (ret)
64                 goto err_put_fd;
65  
66 --- a/drivers/gpu/drm/v3d/v3d_gem.c
67 +++ b/drivers/gpu/drm/v3d/v3d_gem.c
68 @@ -521,12 +521,12 @@ v3d_submit_cl_ioctl(struct drm_device *d
69         kref_init(&exec->refcount);
70  
71         ret = drm_syncobj_find_fence(file_priv, args->in_sync_bcl,
72 -                                    &exec->bin.in_fence);
73 +                                    0, &exec->bin.in_fence);
74         if (ret == -EINVAL)
75                 goto fail;
76  
77         ret = drm_syncobj_find_fence(file_priv, args->in_sync_rcl,
78 -                                    &exec->render.in_fence);
79 +                                    0, &exec->render.in_fence);
80         if (ret == -EINVAL)
81                 goto fail;
82  
83 --- a/drivers/gpu/drm/vc4/vc4_gem.c
84 +++ b/drivers/gpu/drm/vc4/vc4_gem.c
85 @@ -1173,7 +1173,7 @@ vc4_submit_cl_ioctl(struct drm_device *d
86  
87         if (args->in_sync) {
88                 ret = drm_syncobj_find_fence(file_priv, args->in_sync,
89 -                                            &in_fence);
90 +                                            0, &in_fence);
91                 if (ret)
92                         goto fail;
93  
94 --- a/include/drm/drm_syncobj.h
95 +++ b/include/drm/drm_syncobj.h
96 @@ -139,7 +139,7 @@ void drm_syncobj_remove_callback(struct
97  void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
98                                struct dma_fence *fence);
99  int drm_syncobj_find_fence(struct drm_file *file_private,
100 -                          u32 handle,
101 +                          u32 handle, u64 point,
102                            struct dma_fence **fence);
103  void drm_syncobj_free(struct kref *kref);
104  int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags,