diff options
author | José Fonseca <[email protected]> | 2008-09-02 02:51:06 +0900 |
---|---|---|
committer | José Fonseca <[email protected]> | 2008-09-02 02:51:06 +0900 |
commit | 038d53cbdb9e504388141c25859bce12f7e8f87e (patch) | |
tree | 4dc3b0ba72ef9216ee087352d553dff52cdda44a | |
parent | 5c198f660a1812d9b3970408695d04bdd74a5d1e (diff) |
pipebuffer: Add missing break statement to cache lookup logic.
Second loop was never run. Spotted by Keith.
-rw-r--r-- | src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c index e2b8fe0f98c..1ec422fb19e 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c @@ -249,17 +249,25 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr, buf = curr_buf; else if(util_time_timeout(&curr_buf->start, &curr_buf->end, &now)) _pb_cache_buffer_destroy(curr_buf); + else + /* This buffer (and all hereafter) are still hot in cache */ + break; curr = next; next = curr->next; } /* keep searching in the hot buffers */ - while(!buf && curr != &mgr->delayed) { - curr_buf = LIST_ENTRY(struct pb_cache_buffer, curr, head); - if(pb_cache_is_buffer_compat(curr_buf, size, desc)) - buf = curr_buf; - curr = next; - next = curr->next; + if(!buf) { + while(curr != &mgr->delayed) { + curr_buf = LIST_ENTRY(struct pb_cache_buffer, curr, head); + if(pb_cache_is_buffer_compat(curr_buf, size, desc)) { + buf = curr_buf; + break; + } + /* no need to check the timeout here */ + curr = next; + next = curr->next; + } } if(buf) { |