diff options
| author | Stefan Schake <stschake@gmail.com> | 2018-04-24 18:03:45 -0400 |
|---|---|---|
| committer | Eric Anholt <eric@anholt.net> | 2018-04-30 19:04:14 -0400 |
| commit | 818f5c8f4cd27747e8218e8a5fb230c322e02d1e (patch) | |
| tree | 6e7fb9ceae3ff664104b17a56ff8a1bb19351e7a /drivers/gpu/drm/vc4/vc4_gem.c | |
| parent | 3481fe768faeae3f1d2a929e401748893460d82e (diff) | |
drm/vc4: Syncobj import support
Allow userland to specify a syncobj that is waited on before a render job
starts processing.
v2: Use 0 as invalid syncobj to drop flag (Eric)
Drop extra newline (Eric)
Signed-off-by: Stefan Schake <stschake@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/1524607427-12876-2-git-send-email-stschake@gmail.com
Diffstat (limited to 'drivers/gpu/drm/vc4/vc4_gem.c')
| -rw-r--r-- | drivers/gpu/drm/vc4/vc4_gem.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index 2107b0daf8ef..e305ccdedf47 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/device.h> | 27 | #include <linux/device.h> |
| 28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
| 29 | #include <linux/sched/signal.h> | 29 | #include <linux/sched/signal.h> |
| 30 | #include <linux/dma-fence-array.h> | ||
| 30 | 31 | ||
| 31 | #include "uapi/drm/vc4_drm.h" | 32 | #include "uapi/drm/vc4_drm.h" |
| 32 | #include "vc4_drv.h" | 33 | #include "vc4_drv.h" |
| @@ -1115,6 +1116,7 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, | |||
| 1115 | struct drm_vc4_submit_cl *args = data; | 1116 | struct drm_vc4_submit_cl *args = data; |
| 1116 | struct vc4_exec_info *exec; | 1117 | struct vc4_exec_info *exec; |
| 1117 | struct ww_acquire_ctx acquire_ctx; | 1118 | struct ww_acquire_ctx acquire_ctx; |
| 1119 | struct dma_fence *in_fence; | ||
| 1118 | int ret = 0; | 1120 | int ret = 0; |
| 1119 | 1121 | ||
| 1120 | if ((args->flags & ~(VC4_SUBMIT_CL_USE_CLEAR_COLOR | | 1122 | if ((args->flags & ~(VC4_SUBMIT_CL_USE_CLEAR_COLOR | |
| @@ -1125,11 +1127,6 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, | |||
| 1125 | return -EINVAL; | 1127 | return -EINVAL; |
| 1126 | } | 1128 | } |
| 1127 | 1129 | ||
| 1128 | if (args->pad2 != 0) { | ||
| 1129 | DRM_DEBUG("->pad2 must be set to zero\n"); | ||
| 1130 | return -EINVAL; | ||
| 1131 | } | ||
| 1132 | |||
| 1133 | exec = kcalloc(1, sizeof(*exec), GFP_KERNEL); | 1130 | exec = kcalloc(1, sizeof(*exec), GFP_KERNEL); |
| 1134 | if (!exec) { | 1131 | if (!exec) { |
| 1135 | DRM_ERROR("malloc failure on exec struct\n"); | 1132 | DRM_ERROR("malloc failure on exec struct\n"); |
| @@ -1164,6 +1161,29 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, | |||
| 1164 | } | 1161 | } |
| 1165 | } | 1162 | } |
| 1166 | 1163 | ||
| 1164 | if (args->in_sync) { | ||
| 1165 | ret = drm_syncobj_find_fence(file_priv, args->in_sync, | ||
| 1166 | &in_fence); | ||
| 1167 | if (ret) | ||
| 1168 | goto fail; | ||
| 1169 | |||
| 1170 | /* When the fence (or fence array) is exclusively from our | ||
| 1171 | * context we can skip the wait since jobs are executed in | ||
| 1172 | * order of their submission through this ioctl and this can | ||
| 1173 | * only have fences from a prior job. | ||
| 1174 | */ | ||
| 1175 | if (!dma_fence_match_context(in_fence, | ||
| 1176 | vc4->dma_fence_context)) { | ||
| 1177 | ret = dma_fence_wait(in_fence, true); | ||
| 1178 | if (ret) { | ||
| 1179 | dma_fence_put(in_fence); | ||
| 1180 | goto fail; | ||
| 1181 | } | ||
| 1182 | } | ||
| 1183 | |||
| 1184 | dma_fence_put(in_fence); | ||
| 1185 | } | ||
| 1186 | |||
| 1167 | if (exec->args->bin_cl_size != 0) { | 1187 | if (exec->args->bin_cl_size != 0) { |
| 1168 | ret = vc4_get_bcl(dev, exec); | 1188 | ret = vc4_get_bcl(dev, exec); |
| 1169 | if (ret) | 1189 | if (ret) |
