summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/etnaviv
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2017-05-18 18:36:14 +0200
committerLucas Stach <l.stach@pengutronix.de>2017-06-03 13:25:41 +0200
commit46a269da7e8a1ab6510ea5c88b2732925e5efc79 (patch)
treed7097629b56c6a05fc753cd41631661b0c4c86b7 /drivers/gpu/drm/etnaviv
parentd79fd1ccf2cd76adba2121a62bae996bc4beccfe (diff)
drm/etnaviv: restore ETNA_PREP_NOSYNC behaviour
This reverts commit cd34db4a526c (drm/etnaviv: Remove manual call to reservation_object_test_signaled_rcu before wait), as the patch to turn reservation_object_wait_timeout_rcu() into reservation_object_test_signaled_rcu() with a 0 timeout has been reverted. This causes the driver to call into the fence wait, even with a timeout of 0 The etnaviv BO cache depends on ETNA_PREP_NOSYNC to be wait-free, even if the BO has attached fences, so restore the behaviour for this flag. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Diffstat (limited to 'drivers/gpu/drm/etnaviv')
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gem.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index fd56f92f3469..f0efc5db793f 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -411,16 +411,20 @@ int etnaviv_gem_cpu_prep(struct drm_gem_object *obj, u32 op,
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
struct drm_device *dev = obj->dev;
bool write = !!(op & ETNA_PREP_WRITE);
- unsigned long remain =
- op & ETNA_PREP_NOSYNC ? 0 : etnaviv_timeout_to_jiffies(timeout);
- long lret;
-
- lret = reservation_object_wait_timeout_rcu(etnaviv_obj->resv,
- write, true, remain);
- if (lret < 0)
- return lret;
- else if (lret == 0)
- return remain == 0 ? -EBUSY : -ETIMEDOUT;
+ int ret;
+
+ if (op & ETNA_PREP_NOSYNC) {
+ if (!reservation_object_test_signaled_rcu(etnaviv_obj->resv,
+ write))
+ return -EBUSY;
+ } else {
+ unsigned long remain = etnaviv_timeout_to_jiffies(timeout);
+
+ ret = reservation_object_wait_timeout_rcu(etnaviv_obj->resv,
+ write, true, remain);
+ if (ret <= 0)
+ return ret == 0 ? -ETIMEDOUT : ret;
+ }
if (etnaviv_obj->flags & ETNA_BO_CACHED) {
if (!etnaviv_obj->sgt) {