History

drm/vc4: Export fence through syncobj

Allow specifying a syncobj on render job submission where we store the fence for the job. This gives userland flexible access to the fence. v2: Use 0 as invalid syncobj to drop flag (Eric) Don't reintroduce the padding (Eric)

Stefan Schake committed 8 years ago

Commit e84fcb91 parent 818f5c82 files · +34 −2Browse files

Unified · Split

2 files
  1. drivers/gpu/drm/vc4/vc4_gem.c +28 −2
  2. include/uapi/drm/vc4_drm.h +6 −0
drivers/gpu/drm/vc4/vc4_gem.c+28−2
@@ -656,7 +656,8 @@ retry: · 655 unmodified lines
656 */656 */
657static int657static int
658vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec,658vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec,
659 struct ww_acquire_ctx *acquire_ctx)659 struct ww_acquire_ctx *acquire_ctx,
660 struct drm_syncobj *out_sync)
660{661{
661 struct vc4_dev *vc4 = to_vc4_dev(dev);662 struct vc4_dev *vc4 = to_vc4_dev(dev);
662 struct vc4_exec_info *renderjob;663 struct vc4_exec_info *renderjob;
@@ -679,6 +680,9 @@ vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec, · 16 unmodified lines
679 fence->seqno = exec->seqno;680 fence->seqno = exec->seqno;
680 exec->fence = &fence->base;681 exec->fence = &fence->base;
681 682
683 if (out_sync)
684 drm_syncobj_replace_fence(out_sync, exec->fence);
685
682 vc4_update_bo_seqnos(exec, seqno);686 vc4_update_bo_seqnos(exec, seqno);
683 687
684 vc4_unlock_bo_reservations(dev, exec, acquire_ctx);688 vc4_unlock_bo_reservations(dev, exec, acquire_ctx);
@@ -1114,6 +1118,7 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, · 429 unmodified lines
1114 struct vc4_dev *vc4 = to_vc4_dev(dev);1118 struct vc4_dev *vc4 = to_vc4_dev(dev);
1115 struct vc4_file *vc4file = file_priv->driver_priv;1119 struct vc4_file *vc4file = file_priv->driver_priv;
1116 struct drm_vc4_submit_cl *args = data;1120 struct drm_vc4_submit_cl *args = data;
1121 struct drm_syncobj *out_sync = NULL;
1117 struct vc4_exec_info *exec;1122 struct vc4_exec_info *exec;
1118 struct ww_acquire_ctx acquire_ctx;1123 struct ww_acquire_ctx acquire_ctx;
1119 struct dma_fence *in_fence;1124 struct dma_fence *in_fence;
@@ -1201,12 +1206,33 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, · 81 unmodified lines
1201 if (ret)1206 if (ret)
1202 goto fail;1207 goto fail;
1203 1208
1209 if (args->out_sync) {
1210 out_sync = drm_syncobj_find(file_priv, args->out_sync);
1211 if (!out_sync) {
1212 ret = -EINVAL;
1213 goto fail;
1214 }
1215
1216 /* We replace the fence in out_sync in vc4_queue_submit since
1217 * the render job could execute immediately after that call.
1218 * If it finishes before our ioctl processing resumes the
1219 * render job fence could already have been freed.
1220 */
1221 }
1222
1204 /* Clear this out of the struct we'll be putting in the queue,1223 /* Clear this out of the struct we'll be putting in the queue,
1205 * since it's part of our stack.1224 * since it's part of our stack.
1206 */1225 */
1207 exec->args = NULL;1226 exec->args = NULL;
1208 1227
1209 ret = vc4_queue_submit(dev, exec, &acquire_ctx);1228 ret = vc4_queue_submit(dev, exec, &acquire_ctx, out_sync);
1229
1230 /* The syncobj isn't part of the exec data and we need to free our
1231 * reference even if job submission failed.
1232 */
1233 if (out_sync)
1234 drm_syncobj_put(out_sync);
1235
1210 if (ret)1236 if (ret)
1211 goto fail;1237 goto fail;
1212 1238
include/uapi/drm/vc4_drm.h+6−0
@@ -187,6 +187,12 @@ struct drm_vc4_submit_cl { · 186 unmodified lines
187 * will not start until the syncobj is signaled. 0 means ignore.187 * will not start until the syncobj is signaled. 0 means ignore.
188 */188 */
189 __u32 in_sync;189 __u32 in_sync;
190
191 /* Syncobj handle to export fence to. If set, the fence in the syncobj
192 * will be replaced with a fence that signals upon completion of this
193 * render job. 0 means ignore.
194 */
195 __u32 out_sync;
190};196};
191 197
192/**198/**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t