Qiang Yu <yuq825@xxxxxxxxx> writes: > On Thu, Feb 7, 2019 at 3:17 AM Eric Anholt <eric@xxxxxxxxxx> wrote: >> >> Qiang Yu <yuq825@xxxxxxxxx> writes: >> > +int lima_gem_wait(struct drm_file *file, u32 handle, u32 op, u64 timeout_ns) >> > +{ >> > + bool write = op & LIMA_GEM_WAIT_WRITE; >> > + struct drm_gem_object *obj; >> > + struct lima_bo *bo; >> > + signed long ret; >> > + unsigned long timeout; >> > + >> > + obj = drm_gem_object_lookup(file, handle); >> > + if (!obj) >> > + return -ENOENT; >> > + >> > + bo = to_lima_bo(obj); >> > + >> > + timeout = timeout_ns ? lima_timeout_to_jiffies(timeout_ns) : 0; >> > + >> > + ret = lima_bo_reserve(bo, true); >> > + if (ret) >> > + goto out; >> > + >> > + /* must use long for result check because in 64bit arch int >> > + * will overflow if timeout is too large and get <0 result >> > + */ >> > + ret = reservation_object_wait_timeout_rcu(bo->tbo.resv, write, true, timeout); >> > + if (ret == 0) >> > + ret = timeout ? -ETIMEDOUT : -EBUSY; >> > + else if (ret > 0) >> > + ret = 0; >> > + >> > + lima_bo_unreserve(bo); >> > +out: >> > + drm_gem_object_put_unlocked(obj); >> > + return ret; >> > +} >> >> From Documentation/botching-up-ioctls.txt: >> >> * For timeouts, use absolute times. If you're a good fellow and made your >> ioctl restartable relative timeouts tend to be too coarse and can >> indefinitely extend your wait time due to rounding on each restart. >> Especially if your reference clock is something really slow like the display >> frame counter. With a spec lawyer hat on this isn't a bug since timeouts can >> always be extended - but users will surely hate you if their neat animations >> starts to stutter due to this. >> >> (I made v3d's timeouts relative, but decrement the timeout value the >> user passed by how much I waited so that the timeout probably gets >> reduced after a restartable signal. I should have done absolute.) > timeout_ns in lima is already an absolute one which will be converted to > relative one in lima_timeout_to_jiffies, is this what you want or I miss > understand? Yeah, not sure how I missed the lima function, wich is clearly doing absolute. Sorry!
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel