From patchwork Thu Mar 5 20:38:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2964 Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8541160427 for ; Thu, 5 Mar 2020 21:38:20 +0100 (CET) X-Halon-ID: 3cc6dc84-5f21-11ea-9f85-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2392.dip0.t-ipconnect.de [79.202.35.146]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 3cc6dc84-5f21-11ea-9f85-005056917a89; Thu, 05 Mar 2020 21:38:19 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Thu, 5 Mar 2020 21:38:01 +0100 Message-Id: <20200305203808.536050-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 0/7] libcamera: V4L2BufferCache: Improve cache eviction strategy X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2020 20:38:20 -0000 Hello, This series improves the function of the V4L2BufferCache and how it selects which cache entries to evict. This solves a real issue where if the cache is not pre-allocated the cache can perform suboptimally and not utilise all the entries in the cache. Patch 1/7 fix an error in the test class BufferSource found as code in v1 of this series was based on it. 2/7 Extracts the BufferSource from the camera buffer import test so it can be used in the new test for the V4L2BufferCache. Patch 3/7, 4/7 and 5/7 fix small issues with the V4L2BufferCache pointed out in review of v2. Patch 6/7 add tests which breaks without the improved cache eviction strategy introduced in 7/7. Niklas Söderlund (7): test: camera: buffer_import: Fix error messages test: Extract BufferSource class out of camera tests to libtest libcamera: V4L2BufferCache: Mark Entry::operator==() as const libcamera: V4L2BufferCache: Use the entry reference libcamera: V4L2BufferCache: Check for hot hit first test: v4l2_videodevice: Add test for V4L2BufferCache libcamera: V4L2BufferCache: Improve cache eviction strategy src/libcamera/include/v4l2_videodevice.h | 9 +- src/libcamera/v4l2_videodevice.cpp | 31 ++-- test/camera/buffer_import.cpp | 92 +--------- test/libtest/buffer_source.cpp | 98 +++++++++++ test/libtest/buffer_source.h | 32 ++++ test/libtest/meson.build | 11 +- test/v4l2_videodevice/buffer_cache.cpp | 215 +++++++++++++++++++++++ test/v4l2_videodevice/meson.build | 1 + 8 files changed, 379 insertions(+), 110 deletions(-) create mode 100644 test/libtest/buffer_source.cpp create mode 100644 test/libtest/buffer_source.h create mode 100644 test/v4l2_videodevice/buffer_cache.cpp