diff options
author | Wind Yuan <feng.yuan@intel.com> | 2017-11-16 20:01:41 +0800 |
---|---|---|
committer | windyuan <feng.yuan@intel.com> | 2017-11-17 15:45:08 +0800 |
commit | ec81fad17dfcaeeb63b1be6d30f3d44f2b4ddb2c (patch) | |
tree | 4f794482e380f3472020fc4cbdb9f02b00bc95f8 | |
parent | 48a9287dce9333490c4efb1c68970a327ba93d8f (diff) | |
download | libxcam-ec81fad17dfcaeeb63b1be6d30f3d44f2b4ddb2c.tar.gz |
framework: add worker stop and fix handler configure
Signed-off-by: Wind Yuan <feng.yuan@intel.com>
-rw-r--r-- | modules/soft/soft_handler.cpp | 10 | ||||
-rw-r--r-- | modules/soft/soft_handler.h | 3 | ||||
-rw-r--r-- | modules/soft/soft_worker.cpp | 9 | ||||
-rw-r--r-- | modules/soft/soft_worker.h | 1 | ||||
-rw-r--r-- | xcore/worker.cpp | 3 | ||||
-rw-r--r-- | xcore/worker.h | 1 |
6 files changed, 22 insertions, 5 deletions
diff --git a/modules/soft/soft_handler.cpp b/modules/soft/soft_handler.cpp index bd2c034..6a81472 100644 --- a/modules/soft/soft_handler.cpp +++ b/modules/soft/soft_handler.cpp @@ -115,9 +115,8 @@ SoftHandler::enable_allocator (bool enable) } XCamReturn -SoftHandler::configure_resource (const SmartPtr<ImageHandler::Parameters> ¶m) +SoftHandler::confirm_configured () { - XCAM_UNUSED (param); XCamReturn ret = XCAM_RETURN_NO_ERROR; XCAM_ASSERT (_need_configure); @@ -159,8 +158,13 @@ SoftHandler::execute_buffer (const SmartPtr<ImageHandler::Parameters> ¶m, bo if (_need_configure) { ret = configure_resource (param); XCAM_FAIL_RETURN ( - WARNING, ret == XCAM_RETURN_NO_ERROR, ret, + WARNING, xcam_ret_is_ok (ret), ret, "soft_hander(%s) configure resource failed", XCAM_STR (get_name ())); + + ret = confirm_configured (); + XCAM_FAIL_RETURN ( + WARNING, xcam_ret_is_ok (ret), ret, + "soft_hander(%s) confirm configure failed", XCAM_STR (get_name ())); } if (!param->out_buf.ptr () && _enable_allocator) { diff --git a/modules/soft/soft_handler.h b/modules/soft/soft_handler.h index 310cf86..33990ce 100644 --- a/modules/soft/soft_handler.h +++ b/modules/soft/soft_handler.h @@ -66,7 +66,7 @@ public: virtual XCamReturn terminate (); protected: - virtual XCamReturn configure_resource (const SmartPtr<Parameters> ¶m); + virtual XCamReturn configure_resource (const SmartPtr<Parameters> ¶m) = 0; virtual XCamReturn start_work (const SmartPtr<Parameters> ¶m) = 0; //virtual SmartPtr<Worker::Arguments> get_first_worker_args (const SmartPtr<SoftWorker> &worker, SmartPtr<Parameters> ¶ms) = 0; virtual void work_well_done (const SmartPtr<ImageHandler::Parameters> ¶m, XCamReturn err); @@ -76,6 +76,7 @@ protected: bool check_work_continue (const SmartPtr<ImageHandler::Parameters> ¶m, XCamReturn err); private: + XCamReturn confirm_configured (); void param_ended (SmartPtr<ImageHandler::Parameters> param, XCamReturn err); static bool is_param_error (const SmartPtr<ImageHandler::Parameters> ¶m); diff --git a/modules/soft/soft_worker.cpp b/modules/soft/soft_worker.cpp index 9511e1f..3cf49bc 100644 --- a/modules/soft/soft_worker.cpp +++ b/modules/soft/soft_worker.cpp @@ -163,6 +163,13 @@ SoftWorker::set_local_size (const WorkSize &size) } XCamReturn +SoftWorker::stop () +{ + _threads->stop (); + return XCAM_RETURN_NO_ERROR; +} + +XCamReturn SoftWorker::work (const SmartPtr<Worker::Arguments> &args) { XCamReturn ret = XCAM_RETURN_NO_ERROR; @@ -190,7 +197,7 @@ SoftWorker::work (const SmartPtr<Worker::Arguments> &args) if (!_threads.ptr ()) { char thr_name [XCAM_MAX_STR_SIZE]; - snprintf (thr_name, XCAM_MAX_STR_SIZE, "%s-thread-pool", XCAM_STR(get_name ())); + snprintf (thr_name, XCAM_MAX_STR_SIZE, "%s-thrs", XCAM_STR(get_name ())); _threads = new ThreadPool (thr_name); XCAM_ASSERT (_threads.ptr ()); _threads->set_threads (max_items, max_items + 1); //extra thread to process all_items_done diff --git a/modules/soft/soft_worker.h b/modules/soft/soft_worker.h index b5e3551..365d959 100644 --- a/modules/soft/soft_worker.h +++ b/modules/soft/soft_worker.h @@ -76,6 +76,7 @@ public: // derived from Worker virtual XCamReturn work (const SmartPtr<Arguments> &args); + virtual XCamReturn stop (); private: //new virtual functions diff --git a/xcore/worker.cpp b/xcore/worker.cpp index 7fc4361..6d8a7ab 100644 --- a/xcore/worker.cpp +++ b/xcore/worker.cpp @@ -108,6 +108,9 @@ public: status_check (args, XCAM_RETURN_NO_ERROR); return XCAM_RETURN_NO_ERROR; } + XCamReturn stop () { + return XCAM_RETURN_NO_ERROR; + } }; class UintTestHandler { diff --git a/xcore/worker.h b/xcore/worker.h index d61f52b..a16aabb 100644 --- a/xcore/worker.h +++ b/xcore/worker.h @@ -89,6 +89,7 @@ public: bool set_callback (const SmartPtr<Callback> &callback); virtual XCamReturn work (const SmartPtr<Arguments> &args) = 0; + virtual XCamReturn stop () = 0; protected: virtual void status_check (const SmartPtr<Arguments> &args, const XCamReturn error); |