libcamera: V4L2BufferCache: Check for hot hit first

Check for a hot cache hit before updating which buffer is best to evict
in case no hot hit is found. This doesn't change the behaviour, but
follows a more logical flow.

Suggested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund
2020-03-04 23:54:08 +01:00
parent bab5749227
commit b167158395
+3 -3
View File
@@ -212,15 +212,15 @@ int V4L2BufferCache::get(const FrameBuffer &buffer)
if (!entry.free)
continue;
if (use < 0)
use = index;
/* Try to find a cache hit by comparing the planes. */
if (entry == buffer) {
hit = true;
use = index;
break;
}
if (use < 0)
use = index;
}
if (!hit)