From 007517618c8440d09cfd39db5dbf451e87ef703a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>
Date: Mon, 25 Nov 2019 22:14:40 +0100
Subject: ipa: Switch to FrameBuffer interface
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Switch the IPA interfaces and implementations to use the Framebuffer
interface.

- The IPA interface is switched to use the simpler FrameBuffer::Plane
  container when carrying dmabuf descriptions (fd and length) over the
  pipeline/IPA boundary.

- The RkISP1 IPA implementation takes advantage of the new simpler and
  safer (better control over file descriptors) FrameBuffer interface.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/ipa/ipa_wrappers_test.cpp | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

(limited to 'test/ipa')

diff --git a/test/ipa/ipa_wrappers_test.cpp b/test/ipa/ipa_wrappers_test.cpp
index a1e34ad5..e711e4fe 100644
--- a/test/ipa/ipa_wrappers_test.cpp
+++ b/test/ipa/ipa_wrappers_test.cpp
@@ -115,28 +115,28 @@ public:
 			return report(Op_mapBuffers, TestFail);
 		}
 
-		if (buffers[0].memory.planes().size() != 3 ||
-		    buffers[1].memory.planes().size() != 3) {
+		if (buffers[0].planes.size() != 3 ||
+		    buffers[1].planes.size() != 3) {
 			cerr << "mapBuffers(): Invalid number of planes" << endl;
 			return report(Op_mapBuffers, TestFail);
 		}
 
-		if (buffers[0].memory.planes()[0].length() != 4096 ||
-		    buffers[0].memory.planes()[1].length() != 0 ||
-		    buffers[0].memory.planes()[2].length() != 0 ||
-		    buffers[0].memory.planes()[0].length() != 4096 ||
-		    buffers[1].memory.planes()[1].length() != 4096 ||
-		    buffers[1].memory.planes()[2].length() != 0) {
+		if (buffers[0].planes[0].length != 4096 ||
+		    buffers[0].planes[1].length != 0 ||
+		    buffers[0].planes[2].length != 0 ||
+		    buffers[0].planes[0].length != 4096 ||
+		    buffers[1].planes[1].length != 4096 ||
+		    buffers[1].planes[2].length != 0) {
 			cerr << "mapBuffers(): Invalid length" << endl;
 			return report(Op_mapBuffers, TestFail);
 		}
 
-		if (buffers[0].memory.planes()[0].dmabuf() == -1 ||
-		    buffers[0].memory.planes()[1].dmabuf() != -1 ||
-		    buffers[0].memory.planes()[2].dmabuf() != -1 ||
-		    buffers[0].memory.planes()[0].dmabuf() == -1 ||
-		    buffers[1].memory.planes()[1].dmabuf() == -1 ||
-		    buffers[1].memory.planes()[2].dmabuf() != -1) {
+		if (buffers[0].planes[0].fd.fd() == -1 ||
+		    buffers[0].planes[1].fd.fd() != -1 ||
+		    buffers[0].planes[2].fd.fd() != -1 ||
+		    buffers[0].planes[0].fd.fd() == -1 ||
+		    buffers[1].planes[1].fd.fd() == -1 ||
+		    buffers[1].planes[2].fd.fd() != -1) {
 			cerr << "mapBuffers(): Invalid dmabuf" << endl;
 			return report(Op_mapBuffers, TestFail);
 		}
@@ -287,13 +287,16 @@ protected:
 
 		/* Test mapBuffers(). */
 		std::vector<IPABuffer> buffers(2);
-		buffers[0].memory.planes().resize(3);
+		buffers[0].planes.resize(3);
 		buffers[0].id = 10;
-		buffers[0].memory.planes()[0].setDmabuf(fd_, 4096);
+		buffers[0].planes[0].fd = FileDescriptor(fd_);
+		buffers[0].planes[0].length = 4096;
 		buffers[1].id = 11;
-		buffers[1].memory.planes().resize(3);
-		buffers[1].memory.planes()[0].setDmabuf(fd_, 4096);
-		buffers[1].memory.planes()[1].setDmabuf(fd_, 4096);
+		buffers[1].planes.resize(3);
+		buffers[1].planes[0].fd = FileDescriptor(fd_);
+		buffers[1].planes[0].length = 4096;
+		buffers[1].planes[1].fd = FileDescriptor(fd_);
+		buffers[1].planes[1].length = 4096;
 
 		ret = INVOKE(mapBuffers, buffers);
 		if (ret == TestFail)
-- 
cgit v1.2.1