G-API: VPL Source turn on Linux CPU version#21883
Conversation
92d56f3 to
80184b2
Compare
dmatveev
left a comment
There was a problem hiding this comment.
I see only two new files were added, assuming extending tests for new backend I'd expect 2-3 more files modified, why it is 35 files long then? :)
modules/gapi/CMakeLists.txt
Outdated
| src/backends/fluid/gfluidimgproc_func.dispatch.cpp | ||
| src/backends/fluid/gfluidcore.cpp | ||
| src/backends/fluid/gfluidcore_func.dispatch.cpp | ||
| src/backends/fluid/gfluidcore_func.dispatch.cpp |
| if(UNIX) | ||
| find_package(PkgConfig) | ||
| if(PkgConfig_FOUND) | ||
| pkg_check_modules(PKG_LIBVA libva>=1.2 libva-drm>=1.2) | ||
| if(PKG_LIBVA_FOUND) | ||
| set(CMAKE_THREAD_PREFER_PTHREAD TRUE) | ||
| set(THREADS_PREFER_PTHREAD_FLAG TRUE) | ||
| find_package(Threads REQUIRED) | ||
| else() | ||
| message(FATAL_ERROR "libva not found: building HAVE_GAPI_ONEVPL without libVA support is impossible on UNIX systems") | ||
| endif() | ||
| else() | ||
| message(FATAL_ERROR "PkgConfig not found: building HAVE_GAPI_ONEVPL without libVA support is impossible on UNIX systems") | ||
| endif() | ||
| ocv_target_link_libraries(${the_module} PRIVATE ${PKG_LIBVA_LIBRARIES} ${PKG_THREAD_LIBRARIES}) | ||
| endif() | ||
| endif() |
There was a problem hiding this comment.
Probably this whole thing should be done one-two levels above. Maybe make VA lookup OpenCV-global? cc: @alalek
There was a problem hiding this comment.
it activates in composition with -DWITH_GAPI_ONEVPL and should be removed (or changed) when plugin-based atrchitecture applied. That's because I did not spend much time for working this out. But any other suggestions are appreciated
| #include <opencv2/gapi/util/optional.hpp> | ||
| #include <opencv2/gapi/garg.hpp> | ||
| #include <opencv2/gapi/streaming/source.hpp> | ||
| #include <opencv2/gapi/gcommon.hpp> |
There was a problem hiding this comment.
Is this really required by this particular header?
There was a problem hiding this comment.
i'll try to check it
| enum class AccelType: uint8_t { | ||
| HOST, | ||
| DX11, | ||
| VA_API, |
There was a problem hiding this comment.
or VAAPI? That's how it's called at 01.org - https://01.org/linuxmedia/vaapi
There was a problem hiding this comment.
you right, i'll rename it
| @@ -155,8 +156,12 @@ VPLCPUAccelerationPolicy::create_surface_pool(size_t pool_size, size_t surface_s | |||
| GAPI_LOG_DEBUG(nullptr, "page size: " << page_size_bytes << ", preallocated_raw_bytes: " << preallocated_raw_bytes); | |||
| preallocated_pool_memory_ptr = _aligned_malloc(preallocated_raw_bytes, page_size_bytes); | |||
There was a problem hiding this comment.
Just wondering why it wasn't RAII-d
There was a problem hiding this comment.
it "semi" RAII-d because it is being wrapped into std::shared_ptr with custom deleter (free/aligned_free) in 174 line below
| #else | ||
| GAPI_Assert(false && "Not implemented for systems differ than \"_WIN32\". " | ||
| "Please feel free to set it up under OPENCV contribution policy"); | ||
| free(ptr); |
There was a problem hiding this comment.
..at least this could have been automated then
There was a problem hiding this comment.
it's deleter definition for RAII-d shared_ptr, which constructed from raw memory pointer
So, RAII was applied in result :)
| device_fd(-1) { | ||
| #if defined(HAVE_VA) || defined(HAVE_VA_INTEL) | ||
| // TODO Move it out in device selector | ||
| device_fd = open("/dev/dri/renderD128", O_RDWR); |
There was a problem hiding this comment.
it will be moved into device selector in next PRs
at current step RAII for device_fd is VPLVAAPIAcceleration policy by itself
It seems |
|
|
||
| cv::MediaFrame::AdapterPtr VPLVAAPIAccelerationPolicy::create_frame_adapter(pool_key_t, | ||
| const FrameConstructorArgs &) { | ||
| GAPI_Assert(false && "VPLVAAPIAccelerationPolicy unavailable in current configuration"); |
There was a problem hiding this comment.
Not sure if it's a good idea, but given the amount of code here, maybe it's worth to put this unsupported asserts in the default implementation of these methods in the base class?
There was a problem hiding this comment.
Maybe...
But current version gives additional hint about descendant name whithout additional method name() exposing.
Also i do not want to pollute pure interface
| // It is subject to the license terms in the LICENSE file found in the top-level directory | ||
| // of this distribution and at http://opencv.org/license.html. | ||
| // | ||
| // Copyright (C) 2021 Intel Corporation |
There was a problem hiding this comment.
I'm not sure about whole comments because it implemented as free-initiative
|
@alalek Could you merge it please? It seems only minor commets are elapsed |
|
@alalek @asmorkalov should we merge it? |
63b7f49 to
ffe3297
Compare
|
@alalek License headers inserted in newly added files, please take a look |
G-API: VPL Source turn on Linux CPU version * Turn on linux compilation * Apply comments * Change new files headline * Add license header
Fix compilation VPL Streaming Source for Linux
Add stub for VAAPI acceleration which uses accel for decode but produces MediaFrame in CPU memory
Fix UT of existing functionalities
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.
Build Configuration