Skip to contentSkip to conversation

drm/msm: for array in-fences, check if all backing fences are from our own context before waiting

PATCH In review Philipp Zabel 3 participants 3 messages Mar 17, 2017 – Mar 20, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm: for array in-fences, check if all backing fences are from our own context before waiting

Use the dma_fence_match_context helper to check if all backing fences are from our own context, in which case we don't have to wait.

Cc Rob Clark <[email protected]>
Cc Gustavo Padovan <[email protected]>

---
Not sure if this can be handled exactly the same as for etnaviv. This depends on d5b72a2123df ("dma-fence: add dma_fence_match_context helper").

---
 drivers/gpu/drm/msm/msm_gem_submit.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/msm_gem_submit.c +4 -6
index 1172fe7a9252c..507a6f5b911f0 100644
@@ -439,17 +439,15 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
 			goto out;
 		}
 
-		/* TODO if we get an array-fence due to userspace merging multiple
-		 * fences, we need a way to determine if all the backing fences
-		 * are from our own context..
+		/*
+		 * Wait if the fence is from a foreign context, or if the fence
+		 * array contains any fence from a foreign context.
 		 */
-
-		if (in_fence->context != gpu->fctx->context) {
+		if (!dma_fence_match_context(in_fence, gpu->fctx->context)) {
 			ret = dma_fence_wait(in_fence, true);
 			if (ret)
 				goto out;
 		}
-
 	}
 
 	if (!(args->fence & MSM_SUBMIT_NO_IMPLICIT)) {
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 20170317183840.7491-1-p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org

#2 lore raw
Quoted 9 lines · Philipp Zabel

Use the dma_fence_match_context helper to check if all backing fences are from our own context, in which case we don't have to wait.

Cc Rob Clark <[email protected]>
Cc Gustavo Padovan <[email protected]>

---
Not sure if this can be handled exactly the same as for etnaviv. This depends on d5b72a2123df ("dma-fence: add dma_fence_match_context helper").

Thanks, the helper is a nice improvement. I'll pull this in when the dma-fence patch lands (seems not to be in drm-next yet).. and also maybe shorten up the subject line a bit ;-)

BR,
-R

Quoted 31 lines
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/msm_gem_submit.c +4 -7
index 1172fe7a9252c..507a6f5b911f0 100644
@@ -439,17 +439,15 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
                        goto out;
                }
 
-               /* TODO if we get an array-fence due to userspace merging multiple
-                * fences, we need a way to determine if all the backing fences
-                * are from our own context..
+               /*
+                * Wait if the fence is from a foreign context, or if the fence
+                * array contains any fence from a foreign context.
                 */
-
-               if (in_fence->context != gpu->fctx->context) {
+               if (!dma_fence_match_context(in_fence, gpu->fctx->context)) {
                        ret = dma_fence_wait(in_fence, true);
                        if (ret)
                                goto out;
                }
-
        }
 
        if (!(args->fence & MSM_SUBMIT_NO_IMPLICIT)) {
--
Quoted 2 lines

2.11.0

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): CAF6AEGtSb5VaPM_RZM8naX_eUuU4DpF6ReBUwzr4u-AM8mVNBA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 11 lines · Rob Clark
Quoted 9 lines · Philipp Zabel

Use the dma_fence_match_context helper to check if all backing fences are from our own context, in which case we don't have to wait.

Cc Rob Clark <[email protected]>
Cc Gustavo Padovan <[email protected]>

---
Not sure if this can be handled exactly the same as for etnaviv. This depends on d5b72a2123df ("dma-fence: add dma_fence_match_context helper").

Quoted 3 lines

Thanks, the helper is a nice improvement. I'll pull this in when the dma-fence patch lands (seems not to be in drm-next yet).. and also maybe shorten up the subject line a bit ;-)

Yes, thank you :)

regards
Philipp

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno