sna: Use a single definition for the inactive cache timeout
And share it between the timer and the expiration function, just to simplify the code. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
eb3e04d960
commit
22d9bc0bc1
|
|
@ -1159,7 +1159,7 @@ bool kgem_expire_cache(struct kgem *kgem)
|
|||
list_for_each_entry(bo, &kgem->inactive[i], list) {
|
||||
assert(bo->purged);
|
||||
if (bo->delta) {
|
||||
expire = now - 5;
|
||||
expire = now - MAX_INACTIVE_TIME;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -347,6 +347,7 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
|
|||
void kgem_buffer_read_sync(struct kgem *kgem, struct kgem_bo *bo);
|
||||
|
||||
void kgem_throttle(struct kgem *kgem);
|
||||
#define MAX_INACTIVE_TIME 10
|
||||
bool kgem_expire_cache(struct kgem *kgem);
|
||||
void kgem_cleanup_cache(struct kgem *kgem);
|
||||
|
||||
|
|
|
|||
|
|
@ -8474,13 +8474,9 @@ static Bool sna_accel_do_expire(struct sna *sna)
|
|||
if (sna->timer[EXPIRE_TIMER] == -1)
|
||||
return TRUE;
|
||||
|
||||
/* Initial expiration after 5s. */
|
||||
to.it_value.tv_sec = 5;
|
||||
to.it_value.tv_nsec = 0;
|
||||
|
||||
/* Then periodic update every 10s.*/
|
||||
to.it_interval.tv_sec = 10;
|
||||
to.it_interval.tv_sec = MAX_INACTIVE_TIME;
|
||||
to.it_interval.tv_nsec = 0;
|
||||
to.it_value = to.it_interval;
|
||||
timerfd_settime(sna->timer[EXPIRE_TIMER], 0, &to, NULL);
|
||||
|
||||
sna->timer_active |= 1 << EXPIRE_TIMER;
|
||||
|
|
|
|||
Loading…
Reference in New Issue