<div dir="ltr">Hi Kieran,<div><br></div><div>Glad to know.</div><div>Thanks. :-)</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Best Regards,<div>Show Liu</div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 14, 2020 at 7:02 AM Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com">kieran.bingham@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Show,<br>
<br>
Thank you,<br>
<br>
This is now pushed to master.<br>
--<br>
Regards<br>
<br>
Kieran<br>
<br>
<br>
<br>
On 10/01/2020 01:12, Show Liu wrote:<br>
> Hi Kieran,<br>
> <br>
> <br>
> <br>
> On Thu, Jan 9, 2020 at 7:40 PM Kieran Bingham<br>
> <<a href="mailto:kieran.bingham@ideasonboard.com" target="_blank">kieran.bingham@ideasonboard.com</a><br>
> <mailto:<a href="mailto:kieran.bingham@ideasonboard.com" target="_blank">kieran.bingham@ideasonboard.com</a>>> wrote:<br>
> <br>
>     Hi Show,<br>
> <br>
>     On 08/01/2020 08:30, Show Liu wrote:<br>
> <br>
>     The commit log has been lost from the previous version.<br>
>     I will add the following (slightly modified) back in when applying:<br>
> <br>
>     Add an initial simple test tool for the rkisp1 pipeline based upon the<br>
>     IPU3 pipeline test.<br>
> <br>
> OK. Thanks. <br>
> <br>
> <br>
>     Otherwise, I believe this looks good<br>
> <br>
>     Reviewed-by: Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com" target="_blank">kieran.bingham@ideasonboard.com</a><br>
>     <mailto:<a href="mailto:kieran.bingham@ideasonboard.com" target="_blank">kieran.bingham@ideasonboard.com</a>>><br>
> <br>
> <br>
>     Some time in the future I hope we can have a generic PipelineHandler<br>
>     validation which can re-use a lot of code<br>
> <br>
> Agree.  I am also thinking about it since Laurent mentioned previously.<br>
>  <br>
> <br>
>     - but for now I think this is<br>
>     fine, and will get things started.<br>
> <br>
> <br>
>     When we know what code is duplicated, we can refactor accordingly.<br>
> <br>
>     > Signed-off-by: Show Liu <<a href="mailto:show.liu@linaro.org" target="_blank">show.liu@linaro.org</a><br>
>     <mailto:<a href="mailto:show.liu@linaro.org" target="_blank">show.liu@linaro.org</a>>><br>
>     > ---<br>
>     >  test/pipeline/meson.build                     |   1 +<br>
>     >  test/pipeline/rkisp1/meson.build              |  12 ++<br>
>     >  test/pipeline/rkisp1/rkisp1_pipeline_test.cpp | 114<br>
>     ++++++++++++++++++<br>
>     >  3 files changed, 127 insertions(+)<br>
>     >  create mode 100644 test/pipeline/rkisp1/meson.build<br>
>     >  create mode 100644 test/pipeline/rkisp1/rkisp1_pipeline_test.cpp<br>
>     ><br>
>     > diff --git a/test/pipeline/meson.build b/test/pipeline/meson.build<br>
>     > index f434c79..157f789 100644<br>
>     > --- a/test/pipeline/meson.build<br>
>     > +++ b/test/pipeline/meson.build<br>
>     > @@ -1 +1,2 @@<br>
>     >  subdir('ipu3')<br>
>     > +subdir('rkisp1')<br>
>     > diff --git a/test/pipeline/rkisp1/meson.build<br>
>     b/test/pipeline/rkisp1/meson.build<br>
>     > new file mode 100644<br>
>     > index 0000000..d3f9749<br>
>     > --- /dev/null<br>
>     > +++ b/test/pipeline/rkisp1/meson.build<br>
>     > @@ -0,0 +1,12 @@<br>
>     > +rkisp1_test = [<br>
>     > +    ['rkisp1_pipeline_test',            'rkisp1_pipeline_test.cpp'],<br>
>     > +]<br>
>     > +<br>
>     > +foreach t : rkisp1_test<br>
>     > +    exe = executable(t[0], t[1],<br>
>     > +                     dependencies : libcamera_dep,<br>
>     > +                     link_with : test_libraries,<br>
>     > +                     include_directories : test_includes_internal)<br>
>     > +<br>
>     > +    test(t[0], exe, suite : 'rkisp1', is_parallel : false)<br>
>     > +endforeach<br>
>     > diff --git a/test/pipeline/rkisp1/rkisp1_pipeline_test.cpp<br>
>     b/test/pipeline/rkisp1/rkisp1_pipeline_test.cpp<br>
>     > new file mode 100644<br>
>     > index 0000000..91a4772<br>
>     > --- /dev/null<br>
>     > +++ b/test/pipeline/rkisp1/rkisp1_pipeline_test.cpp<br>
>     > @@ -0,0 +1,114 @@<br>
>     > +/* SPDX-License-Identifier: GPL-2.0-or-later */<br>
>     > +/*<br>
>     > + * Copyright (C) 2020, Linaro<br>
>     > + *<br>
>     > + * Based on test/pipeline/ipu3/ipu3_pipeline_test.cpp<br>
>     > + *<br>
>     > + * rkisp1_pipeline_test.cpp - Rockchip RK3399 rkisp1 pipeline test<br>
>     > + */<br>
>     > +<br>
>     > +#include <iostream><br>
>     > +<br>
>     > +#include <sys/stat.h><br>
>     > +#include <sys/types.h><br>
>     > +#include <unistd.h><br>
>     > +<br>
>     > +#include <libcamera/camera.h><br>
>     > +#include <libcamera/camera_manager.h><br>
>     > +<br>
>     > +#include "device_enumerator.h"<br>
>     > +#include "media_device.h"<br>
>     > +#include "media_object.h"<br>
>     > +#include "test.h"<br>
>     > +<br>
>     > +using namespace std;<br>
>     > +using namespace libcamera;<br>
>     > +<br>
>     > +/*<br>
>     > + * Verify that the RK3399 pipeline handler gets matched and cameras<br>
>     > + * are enumerated correctly.<br>
>     > + *<br>
>     > + * The test is supposed to be run on rockchip platform.<br>
>     > + *<br>
>     > + * The test lists all cameras registered in the system, if any<br>
>     camera is<br>
>     > + * available at all.<br>
>     > + */<br>
>     > +class RKISP1PipelineTest : public Test<br>
>     > +{<br>
>     > +protected:<br>
>     > +     int init();<br>
>     > +     int run();<br>
>     > +     void cleanup();<br>
>     > +<br>
>     > +private:<br>
>     > +     CameraManager *cameraManager_;<br>
>     > +     unsigned int sensors_;<br>
>     > +};<br>
>     > +<br>
>     > +int RKISP1PipelineTest::init()<br>
>     > +{<br>
>     > +     unique_ptr<DeviceEnumerator> enumerator =<br>
>     DeviceEnumerator::create();<br>
>     > +     if (!enumerator) {<br>
>     > +             cerr << "Failed to create device enumerator" << endl;<br>
>     > +             return TestFail;<br>
>     > +     }<br>
>     > +<br>
>     > +     if (enumerator->enumerate()) {<br>
>     > +             cerr << "Failed to enumerate media devices" << endl;<br>
>     > +             return TestFail;<br>
>     > +     }<br>
>     > +<br>
>     > +     DeviceMatch dm("rkisp1");<br>
>     > +<br>
>     > +     std::shared_ptr<MediaDevice> rkisp1 = enumerator->search(dm);<br>
>     > +     if (!rkisp1) {<br>
>     > +             cerr << "Failed to find rkisp1: test skip" << endl;<br>
>     > +             return TestSkip;<br>
>     > +     }<br>
>     > +<br>
>     > +     int ret = rkisp1->populate();<br>
>     > +     if (ret) {<br>
>     > +             cerr << "Failed to populate media device "<br>
>     > +                     << rkisp1->deviceNode() << endl;<br>
>     > +             return TestFail;<br>
>     > +     }<br>
>     > +<br>
>     > +     sensors_ = 0;<br>
>     > +     const vector<MediaEntity *> &entities = rkisp1->entities();<br>
>     > +     for (MediaEntity *entity : entities) {<br>
>     > +             if (entity->function() == MEDIA_ENT_F_CAM_SENSOR)<br>
>     > +                     sensors_++;<br>
>     > +     }<br>
>     > +<br>
>     > +     cameraManager_ = new CameraManager();<br>
>     > +     ret = cameraManager_->start();<br>
>     > +     if (ret) {<br>
>     > +             cerr << "Failed to start the CameraManager" << endl;<br>
>     > +             return TestFail;<br>
>     > +     }<br>
>     > +<br>
>     > +     return 0;<br>
>     > +}<br>
>     > +<br>
>     > +int RKISP1PipelineTest::run()<br>
>     > +{<br>
>     > +     auto cameras = cameraManager_->cameras();<br>
>     > +     for (const std::shared_ptr<Camera> &cam : cameras)<br>
>     > +             cout << "Found camera '" << cam->name() << "'" << endl;<br>
>     > +<br>
>     > +     if (cameras.size() != sensors_) {<br>
>     > +             cerr << cameras.size() << " cameras registered, but<br>
>     " << sensors_<br>
>     > +                  << " were expected" << endl;<br>
>     > +             return TestFail;<br>
>     > +     }<br>
>     > +<br>
>     > +     return TestPass;<br>
>     > +}<br>
>     > +<br>
>     > +void RKISP1PipelineTest::cleanup()<br>
>     > +{<br>
>     > +     cameraManager_->stop();<br>
>     > +     delete cameraManager_;<br>
>     > +}<br>
>     > +<br>
>     > +TEST_REGISTER(RKISP1PipelineTest)<br>
<br>
-- <br>
Regards<br>
--<br>
Kieran<br>
</blockquote></div>