diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2010-11-18 23:32:56 -0500 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2010-12-07 21:00:36 -0500 |
commit | 12fb9525075982bc65cfd71427dd7afdf47bafed (patch) | |
tree | 0e8b75e10ec7c5b607f14d24b857041850bc40d9 /drivers/gpu/drm/nouveau/nouveau_state.c | |
parent | ceac30999dfb00ee7b56cfea8b28ef50999a3c95 (diff) |
drm/nouveau: introduce a util function to wait on reg != val
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_state.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index e779e9320453..e0811f93243d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -1126,8 +1126,9 @@ nouveau_ioctl_setparam(struct drm_device *dev, void *data, | |||
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | /* Wait until (value(reg) & mask) == val, up until timeout has hit */ | 1128 | /* Wait until (value(reg) & mask) == val, up until timeout has hit */ |
1129 | bool nouveau_wait_until(struct drm_device *dev, uint64_t timeout, | 1129 | bool |
1130 | uint32_t reg, uint32_t mask, uint32_t val) | 1130 | nouveau_wait_eq(struct drm_device *dev, uint64_t timeout, |
1131 | uint32_t reg, uint32_t mask, uint32_t val) | ||
1131 | { | 1132 | { |
1132 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 1133 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
1133 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; | 1134 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; |
@@ -1141,6 +1142,23 @@ bool nouveau_wait_until(struct drm_device *dev, uint64_t timeout, | |||
1141 | return false; | 1142 | return false; |
1142 | } | 1143 | } |
1143 | 1144 | ||
1145 | /* Wait until (value(reg) & mask) != val, up until timeout has hit */ | ||
1146 | bool | ||
1147 | nouveau_wait_ne(struct drm_device *dev, uint64_t timeout, | ||
1148 | uint32_t reg, uint32_t mask, uint32_t val) | ||
1149 | { | ||
1150 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
1151 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; | ||
1152 | uint64_t start = ptimer->read(dev); | ||
1153 | |||
1154 | do { | ||
1155 | if ((nv_rd32(dev, reg) & mask) != val) | ||
1156 | return true; | ||
1157 | } while (ptimer->read(dev) - start < timeout); | ||
1158 | |||
1159 | return false; | ||
1160 | } | ||
1161 | |||
1144 | /* Waits for PGRAPH to go completely idle */ | 1162 | /* Waits for PGRAPH to go completely idle */ |
1145 | bool nouveau_wait_for_idle(struct drm_device *dev) | 1163 | bool nouveau_wait_for_idle(struct drm_device *dev) |
1146 | { | 1164 | { |