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
656656 */
657657 static int
658658 vc4_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)
660661 {
661662 struct vc4_dev *vc4 = to_vc4_dev(dev);
662663 struct vc4_exec_info *renderjob;
@@ -679,6 +680,9 @@ vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec, · 16 unmodified lines
679680 fence->seqno = exec->seqno;
680681 exec->fence = &fence->base;
681682
683+ if (out_sync)
684+ drm_syncobj_replace_fence(out_sync, exec->fence);
685+
682686 vc4_update_bo_seqnos(exec, seqno);
683687
684688 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
11141118 struct vc4_dev *vc4 = to_vc4_dev(dev);
11151119 struct vc4_file *vc4file = file_priv->driver_priv;
11161120 struct drm_vc4_submit_cl *args = data;
1121+ struct drm_syncobj *out_sync = NULL;
11171122 struct vc4_exec_info *exec;
11181123 struct ww_acquire_ctx acquire_ctx;
11191124 struct dma_fence *in_fence;
@@ -1201,12 +1206,33 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, · 81 unmodified lines
12011206 if (ret)
12021207 goto fail;
12031208
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+
12041223 /* Clear this out of the struct we'll be putting in the queue,
12051224 * since it's part of our stack.
12061225 */
12071226 exec->args = NULL;
12081227
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+
12101236 if (ret)
12111237 goto fail;
12121238
include/uapi/drm/vc4_drm.h+6−0
@@ -187,6 +187,12 @@ struct drm_vc4_submit_cl { · 186 unmodified lines
187187 * will not start until the syncobj is signaled. 0 means ignore.
188188 */
189189 __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;
190196 };
191197
192198 /**

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