aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2017-09-12 14:23:05 -0400
committerRob Clark <robdclark@gmail.com>2017-10-12 14:21:22 -0400
commit06451a3d1d777141dedfa947649cbb0c594ac3af (patch)
tree5be36f7998014e55de3206d03896a8b22a28ec9f
parent6bd6ae2dfc7e091059fd8a650579bb1efc9b4b9f (diff)
drm/msm: fix _NO_IMPLICIT fencing case
We need to call reservation_object_reserve_shared() in both cases, but this wasn't happening in the _NO_IMPLICIT submit case. Fixes: f0a42bb ("drm/msm: submit support for in-fences") Reported-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r--drivers/gpu/drm/msm/msm_gem.c11
-rw-r--r--drivers/gpu/drm/msm/msm_gem_submit.c24
2 files changed, 18 insertions, 17 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 0b338fbf97ce..ea5bb0e1632c 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -610,17 +610,6 @@ int msm_gem_sync_object(struct drm_gem_object *obj,
610 struct dma_fence *fence; 610 struct dma_fence *fence;
611 int i, ret; 611 int i, ret;
612 612
613 if (!exclusive) {
614 /* NOTE: _reserve_shared() must happen before _add_shared_fence(),
615 * which makes this a slightly strange place to call it. OTOH this
616 * is a convenient can-fail point to hook it in. (And similar to
617 * how etnaviv and nouveau handle this.)
618 */
619 ret = reservation_object_reserve_shared(msm_obj->resv);
620 if (ret)
621 return ret;
622 }
623
624 fobj = reservation_object_get_list(msm_obj->resv); 613 fobj = reservation_object_get_list(msm_obj->resv);
625 if (!fobj || (fobj->shared_count == 0)) { 614 if (!fobj || (fobj->shared_count == 0)) {
626 fence = reservation_object_get_excl(msm_obj->resv); 615 fence = reservation_object_get_excl(msm_obj->resv);
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index 5d0a75d4b249..93535cac0676 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -221,7 +221,7 @@ fail:
221 return ret; 221 return ret;
222} 222}
223 223
224static int submit_fence_sync(struct msm_gem_submit *submit) 224static int submit_fence_sync(struct msm_gem_submit *submit, bool no_implicit)
225{ 225{
226 int i, ret = 0; 226 int i, ret = 0;
227 227
@@ -229,6 +229,20 @@ static int submit_fence_sync(struct msm_gem_submit *submit)
229 struct msm_gem_object *msm_obj = submit->bos[i].obj; 229 struct msm_gem_object *msm_obj = submit->bos[i].obj;
230 bool write = submit->bos[i].flags & MSM_SUBMIT_BO_WRITE; 230 bool write = submit->bos[i].flags & MSM_SUBMIT_BO_WRITE;
231 231
232 if (!write) {
233 /* NOTE: _reserve_shared() must happen before
234 * _add_shared_fence(), which makes this a slightly
235 * strange place to call it. OTOH this is a
236 * convenient can-fail point to hook it in.
237 */
238 ret = reservation_object_reserve_shared(msm_obj->resv);
239 if (ret)
240 return ret;
241 }
242
243 if (no_implicit)
244 continue;
245
232 ret = msm_gem_sync_object(&msm_obj->base, submit->gpu->fctx, write); 246 ret = msm_gem_sync_object(&msm_obj->base, submit->gpu->fctx, write);
233 if (ret) 247 if (ret)
234 break; 248 break;
@@ -451,11 +465,9 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
451 if (ret) 465 if (ret)
452 goto out; 466 goto out;
453 467
454 if (!(args->flags & MSM_SUBMIT_NO_IMPLICIT)) { 468 ret = submit_fence_sync(submit, !!(args->flags & MSM_SUBMIT_NO_IMPLICIT));
455 ret = submit_fence_sync(submit); 469 if (ret)
456 if (ret) 470 goto out;
457 goto out;
458 }
459 471
460 ret = submit_pin_objects(submit); 472 ret = submit_pin_objects(submit);
461 if (ret) 473 if (ret)