[PATCH 2/2] drm/lima: driver for ARM Mali4xx GPUs
Eric Anholt
eric at anholt.net
Thu Feb 7 19:38:47 UTC 2019
Qiang Yu <yuq825 at gmail.com> writes:
> On Thu, Feb 7, 2019 at 3:17 AM Eric Anholt <eric at anholt.net> wrote:
>>
>> Qiang Yu <yuq825 at gmail.com> 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!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190207/a19092e1/attachment.sig>
More information about the dri-devel
mailing list