diff --git a/include/dlstreamer/openvino/context.h b/include/dlstreamer/openvino/context.h index fffb6f42..2ab4ff4a 100644 --- a/include/dlstreamer/openvino/context.h +++ b/include/dlstreamer/openvino/context.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (C) 2022-2025 Intel Corporation + * Copyright (C) 2022-2026 Intel Corporation * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -15,6 +15,7 @@ #else #include #endif +#include namespace dlstreamer { @@ -108,7 +109,11 @@ using OpenVINOContextPtr = std::shared_ptr; #include "dlstreamer/openvino/mappers/cpu_to_openvino.h" #include "dlstreamer/openvino/mappers/opencl_to_openvino.h" #include "dlstreamer/openvino/mappers/openvino_to_cpu.h" +#ifndef _WIN32 #include "dlstreamer/openvino/mappers/vaapi_to_openvino.h" +#else +#include "dlstreamer/openvino/mappers/d3d11_to_openvino.h" +#endif namespace dlstreamer { @@ -121,8 +126,13 @@ MemoryMapperPtr OpenVINOContext::get_mapper(const ContextPtr &input_context, con auto output_type = output_context ? output_context->memory_type() : MemoryType::CPU; if (input_type == MemoryType::CPU && output_type == MemoryType::OpenVINO) return std::make_shared(input_context, output_context); +#ifndef _WIN32 if (input_type == MemoryType::VAAPI && output_type == MemoryType::OpenVINO) return std::make_shared(input_context, output_context); +#else + if (input_type == MemoryType::D3D11 && output_type == MemoryType::OpenVINO) + return std::make_shared(input_context, output_context); +#endif if (input_type == MemoryType::OpenCL && output_type == MemoryType::OpenVINO) return std::make_shared(input_context, output_context); if (input_type == MemoryType::OpenVINO && output_type == MemoryType::CPU) diff --git a/include/dlstreamer/openvino/mappers/d3d11_to_openvino.h b/include/dlstreamer/openvino/mappers/d3d11_to_openvino.h new file mode 100644 index 00000000..f42ae6fd --- /dev/null +++ b/include/dlstreamer/openvino/mappers/d3d11_to_openvino.h @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (C) 2026 Intel Corporation + * + * SPDX-License-Identifier: MIT + ******************************************************************************/ + +#pragma once + +#include "dlstreamer/base/memory_mapper.h" +#include "dlstreamer/d3d11/tensor.h" +#include "dlstreamer/openvino/context.h" +#include "dlstreamer/openvino/tensor.h" + +#include + +namespace dlstreamer { + +class MemoryMapperD3D11ToOpenVINO : public BaseMemoryMapper { + public: + MemoryMapperD3D11ToOpenVINO(const ContextPtr &input_context, const ContextPtr &output_context) + : BaseMemoryMapper(input_context, output_context) { + _ov_context = *ptr_cast(output_context); + } + + FramePtr map(FramePtr src, AccessMode /*mode*/) override { + // Only NV12 supported currently + DLS_CHECK(static_cast(src->format()) == ImageFormat::NV12); + + ov::TensorVector y_ov_tensors, uv_ov_tensors; + y_ov_tensors.reserve(src->num_tensors()); + uv_ov_tensors.reserve(src->num_tensors()); + + // Convert DLS tensors w/D3D11 texture to OV remote tensors + for (auto dls_tensor : src) { + auto d3d11_tensor = ptr_cast(dls_tensor); + // Skip planes other than y - we don't need them for creating OV tensors. + if (d3d11_tensor->plane_index() != 0) + continue; + auto [yt, uvt] = convert_to_ov_tensors(*d3d11_tensor); + y_ov_tensors.push_back(yt); + uv_ov_tensors.push_back(uvt); + } + + TensorPtr res_y_tensor, res_uv_tensor; + if (y_ov_tensors.size() > 1) { + res_y_tensor = std::make_shared(std::move(y_ov_tensors), _output_context); + res_uv_tensor = std::make_shared(std::move(uv_ov_tensors), _output_context); + } else { + res_y_tensor = std::make_shared(y_ov_tensors.front(), _output_context); + res_uv_tensor = std::make_shared(uv_ov_tensors.front(), _output_context); + } + + auto res_frame = + std::make_shared(src->media_type(), src->format(), TensorVector{res_y_tensor, res_uv_tensor}); + res_frame->set_parent(src); + return res_frame; + } + + private: + std::pair convert_to_ov_tensors(D3D11Tensor &d3d11_tensor) { + auto d3d11_texture = d3d11_tensor.d3d11_texture(); + auto &info = d3d11_tensor.info(); + dlstreamer::ImageInfo image_info(info); + auto width = image_info.width(); + auto height = image_info.height(); + + ov::AnyMap tensor_params = {{ov::intel_gpu::shared_mem_type.name(), "VA_SURFACE"}, + {ov::intel_gpu::dev_object_handle.name(), static_cast(d3d11_texture)}, + {ov::intel_gpu::va_plane.name(), uint32_t(0)}}; + auto y_tensor = _ov_context.create_tensor(ov::element::u8, {1, 1, height, width}, tensor_params); + + // FIXME: should we get width/height from second tensor ? + tensor_params[ov::intel_gpu::va_plane.name()] = uint32_t(1); + auto uv_tensor = _ov_context.create_tensor(ov::element::u8, {1, 2, height / 2, width / 2}, tensor_params); + + return {y_tensor, uv_tensor}; + } + + private: + ov::RemoteContext _ov_context; +}; + +} // namespace dlstreamer diff --git a/src/monolithic/gst/common/gva_caps.h b/src/monolithic/gst/common/gva_caps.h index 94f3c769..59fa3bd2 100644 --- a/src/monolithic/gst/common/gva_caps.h +++ b/src/monolithic/gst/common/gva_caps.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (C) 2018-2025 Intel Corporation + * Copyright (C) 2018-2026 Intel Corporation * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -18,21 +18,18 @@ #define SYSTEM_MEM_CAPS GST_VIDEO_CAPS_MAKE("{ BGRx, BGRA, BGR, NV12, I420 }") "; " -#ifdef ENABLE_VAAPI +#if defined(ENABLE_VAAPI) && !defined(_WIN32) #define VASURFACE_CAPS GST_VIDEO_CAPS_MAKE_WITH_FEATURES(VASURFACE_FEATURE_STR, "{ NV12 }") "; " #define VAMEMORY_CAPS GST_VIDEO_CAPS_MAKE_WITH_FEATURES(VAMEMORY_FEATURE_STR, "{ NV12 }") "; " -#else -#define VASURFACE_CAPS -#endif - -#ifdef ENABLE_VAAPI #define DMA_BUFFER_CAPS GST_VIDEO_CAPS_MAKE_WITH_FEATURES(DMABUF_FEATURE_STR, "{ DMA_DRM }") "; " #else +#define VASURFACE_CAPS +#define VAMEMORY_CAPS #define DMA_BUFFER_CAPS #endif -#ifdef _MSC_VER -#define D3D11MEMORY_CAPS GST_VIDEO_CAPS_MAKE_WITH_FEATURES(D3D11MEMORY_FEATURE_STR, "{ NV12 }") "; " +#ifdef _WIN32 +#define D3D11MEMORY_CAPS GST_VIDEO_CAPS_MAKE_WITH_FEATURES(D3D11MEMORY_FEATURE_STR, "{ NV12,BGRA }") "; " #else #define D3D11MEMORY_CAPS #endif diff --git a/src/monolithic/gst/elements/CMakeLists.txt b/src/monolithic/gst/elements/CMakeLists.txt index b8abc503..74eb6ff6 100644 --- a/src/monolithic/gst/elements/CMakeLists.txt +++ b/src/monolithic/gst/elements/CMakeLists.txt @@ -11,7 +11,6 @@ find_package(PkgConfig REQUIRED) pkg_check_modules(GSTREAMER gstreamer-1.0>=1.16 REQUIRED) pkg_check_modules(GSTVIDEO gstreamer-video-1.0>=1.16 REQUIRED) pkg_check_modules(GSTALLOC gstreamer-allocators-1.0 REQUIRED) -pkg_search_module(VA va libva REQUIRED) if(NOT MSVC) pkg_check_modules(GSTVA REQUIRED IMPORTED_TARGET gstreamer-va-1.0) endif() @@ -118,14 +117,6 @@ if(${ENABLE_AUDIO_INFERENCE_ELEMENTS}) target_link_libraries(${TARGET_NAME} PRIVATE ${GSTAUDIO_LIBRARIES}) endif() -if(${ENABLE_VAAPI}) - target_link_libraries(${TARGET_NAME} PRIVATE image_inference_async) -endif() - -if(WIN32) - target_link_libraries(${TARGET_NAME} PRIVATE d3d11_wrapper image_inference_async_d3d11) -endif() - add_subdirectory(gvaattachroi) add_subdirectory(gvametapublish) add_subdirectory(gvapython) diff --git a/src/monolithic/gst/elements/gvaattachroi/CMakeLists.txt b/src/monolithic/gst/elements/gvaattachroi/CMakeLists.txt index 099e9bc3..7144b6c5 100644 --- a/src/monolithic/gst/elements/gvaattachroi/CMakeLists.txt +++ b/src/monolithic/gst/elements/gvaattachroi/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================== -# Copyright (C) 2021-2025 Intel Corporation +# Copyright (C) 2021-2026 Intel Corporation # # SPDX-License-Identifier: MIT # ============================================================================== @@ -7,7 +7,6 @@ set (TARGET_NAME "gvaattachroi") find_package(PkgConfig REQUIRED) -pkg_search_module(VA va libva REQUIRED) pkg_check_modules(GSTREAMER gstreamer-1.0>=1.14 REQUIRED) pkg_check_modules(GSTVIDEO gstreamer-video-1.0>=1.14 REQUIRED) pkg_check_modules(GSTALLOC gstreamer-allocators-1.0 REQUIRED) @@ -35,8 +34,6 @@ target_include_directories(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR} ) -target_link_directories(${TARGET_NAME} PUBLIC ${VA_LIBRARY_DIRS}) - target_link_libraries(${TARGET_NAME} PRIVATE ${GSTREAMER_LIBRARIES} diff --git a/src/monolithic/gst/elements/gvametapublish/CMakeLists.txt b/src/monolithic/gst/elements/gvametapublish/CMakeLists.txt index 953f342a..59c60e13 100644 --- a/src/monolithic/gst/elements/gvametapublish/CMakeLists.txt +++ b/src/monolithic/gst/elements/gvametapublish/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================== -# Copyright (C) 2021-2025 Intel Corporation +# Copyright (C) 2021-2026 Intel Corporation # # SPDX-License-Identifier: MIT # ============================================================================== @@ -7,7 +7,6 @@ set (TARGET_NAME "gvametapublish") find_package(PkgConfig REQUIRED) -pkg_search_module(VA va libva REQUIRED) pkg_check_modules(GSTREAMER gstreamer-1.0>=1.16 REQUIRED) @@ -40,8 +39,6 @@ PRIVATE ${GSTREAMER_INCLUDE_DIRS} ) -target_link_directories(${TARGET_NAME} PUBLIC ${VA_LIBRARY_DIRS}) - target_link_libraries(${TARGET_NAME} PRIVATE gstvideoanalyticsmeta diff --git a/src/monolithic/gst/elements/gvapython/CMakeLists.txt b/src/monolithic/gst/elements/gvapython/CMakeLists.txt index 9d0e369c..3411ff20 100644 --- a/src/monolithic/gst/elements/gvapython/CMakeLists.txt +++ b/src/monolithic/gst/elements/gvapython/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================== -# Copyright (C) 2020-2025 Intel Corporation +# Copyright (C) 2020-2026 Intel Corporation # # SPDX-License-Identifier: MIT # ============================================================================== @@ -7,7 +7,6 @@ set (TARGET_NAME "gvapython") find_package(PkgConfig REQUIRED) -pkg_search_module(VA va libva REQUIRED) pkg_check_modules(GLIB2 glib-2.0 REQUIRED) pkg_check_modules(GSTREAMER gstreamer-1.0>=1.16 REQUIRED) pkg_check_modules(PYGOBJECT pygobject-3.0) @@ -38,8 +37,6 @@ PRIVATE ${PYGOBJECT_INCLUDE_DIRS} ) -target_link_directories(${TARGET_NAME} PUBLIC ${VA_LIBRARY_DIRS}) - target_link_libraries(${TARGET_NAME} PRIVATE ${GSTREAMER_LIBRARIES} diff --git a/src/monolithic/gst/elements/gvarealsense/CMakeLists.txt b/src/monolithic/gst/elements/gvarealsense/CMakeLists.txt index 5462dcc2..9318107e 100644 --- a/src/monolithic/gst/elements/gvarealsense/CMakeLists.txt +++ b/src/monolithic/gst/elements/gvarealsense/CMakeLists.txt @@ -6,7 +6,6 @@ set(TARGET_NAME "gvarealsense") -pkg_search_module(VA va libva REQUIRED) find_package(OpenCV REQUIRED core imgproc) find_package(realsense2) @@ -35,8 +34,6 @@ target_include_directories(${TARGET_NAME} ${GSTALLOC_INCLUDE_DIRS} ) -target_link_directories(${TARGET_NAME} PUBLIC ${VA_LIBRARY_DIRS}) - target_link_libraries(${TARGET_NAME} PRIVATE ${GSTREAMER_LIBRARIES} diff --git a/src/monolithic/gst/elements/gvatrack/CMakeLists.txt b/src/monolithic/gst/elements/gvatrack/CMakeLists.txt index 20c8e3a9..6d9318fe 100644 --- a/src/monolithic/gst/elements/gvatrack/CMakeLists.txt +++ b/src/monolithic/gst/elements/gvatrack/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================== -# Copyright (C) 2020-2025 Intel Corporation +# Copyright (C) 2020-2026 Intel Corporation # # SPDX-License-Identifier: MIT # ============================================================================== @@ -9,7 +9,6 @@ set (TARGET_NAME "gvatrack") find_package(OpenCV REQUIRED core imgproc) find_package(OpenVINO REQUIRED) find_package(PkgConfig REQUIRED) -pkg_search_module(VA va libva REQUIRED) pkg_check_modules(GSTREAMER gstreamer-1.0>=1.16 REQUIRED) file (GLOB_RECURSE MAIN_SRC @@ -37,7 +36,6 @@ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vas/modules/platform/inc ${CMAKE_CURRENT_SOURCE_DIR}/vas/modules/kernels/kalman_filter/inc ${CMAKE_CURRENT_SOURCE_DIR}/vas/modules/components/ot/inc - ${VA_INCLUDE_DIRS} ) target_link_libraries(${TARGET_NAME} diff --git a/src/monolithic/gst/elements/gvatrack/gstgvatrack.cpp b/src/monolithic/gst/elements/gvatrack/gstgvatrack.cpp index a1816265..e8c7bfe0 100644 --- a/src/monolithic/gst/elements/gvatrack/gstgvatrack.cpp +++ b/src/monolithic/gst/elements/gvatrack/gstgvatrack.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (C) 2018-2025 Intel Corporation + * Copyright (C) 2018-2026 Intel Corporation * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -15,7 +15,7 @@ #include #include -#ifdef ENABLE_VAAPI +#if !defined(_WIN32) && defined(ENABLE_VAAPI) #include #endif @@ -66,7 +66,7 @@ static dlstreamer::MemoryMapperPtr create_mapper(GstGvaTrack *gva_track, dlstrea if (!gpu_device) return BufferMapperFactory::createMapper(InferenceBackend::MemoryType::SYSTEM); -#ifdef ENABLE_VAAPI +#if !defined(_WIN32) && defined(ENABLE_VAAPI) // GPU tracker expects VASurface or VAMemory as input. if (gva_track->caps_feature == VA_SURFACE_CAPS_FEATURE || gva_track->caps_feature == VA_MEMORY_CAPS_FEATURE) return BufferMapperFactory::createMapper(InferenceBackend::MemoryType::VAAPI, context); diff --git a/src/monolithic/gst/elements/gvawatermark/gstgvawatermarkimpl.cpp b/src/monolithic/gst/elements/gvawatermark/gstgvawatermarkimpl.cpp index cfa2a912..bf6d0149 100644 --- a/src/monolithic/gst/elements/gvawatermark/gstgvawatermarkimpl.cpp +++ b/src/monolithic/gst/elements/gvawatermark/gstgvawatermarkimpl.cpp @@ -7,17 +7,9 @@ #include "gstgvawatermarkimpl.h" #include "gvawatermarkcaps.h" -#ifndef _MSC_VER +#ifndef _WIN32 #include #include -#else -// On Windows try to include libva headers if available; otherwise fall back to minimal constants. -#if __has_include() -#include -#endif -#ifndef VA_INVALID_SURFACE -#define VA_INVALID_SURFACE (-1) -#endif #endif #include @@ -35,9 +27,15 @@ #include "utils.h" #include "video_frame.h" +#ifndef _WIN32 #ifdef ENABLE_VAAPI #include #endif +#else +#include +#define GST_USE_UNSTABLE_API +#include +#endif #include "renderer/color_converter.h" #include "renderer/cpu/create_renderer.h" @@ -45,7 +43,7 @@ #include #include #include -#ifndef ENABLE_VAAPI +#if !defined(ENABLE_VAAPI) || defined(_WIN32) // VAAPI disabled: provide minimal stub types/constants to satisfy signatures without libva. #ifndef VA_INVALID_SURFACE #define VA_INVALID_SURFACE (-1) diff --git a/src/monolithic/gst/elements/gvawatermark/gstgvawatermarkimpl.h b/src/monolithic/gst/elements/gvawatermark/gstgvawatermarkimpl.h index 0a2db5d0..25bf0b59 100644 --- a/src/monolithic/gst/elements/gvawatermark/gstgvawatermarkimpl.h +++ b/src/monolithic/gst/elements/gvawatermark/gstgvawatermarkimpl.h @@ -15,12 +15,11 @@ #ifndef _MSC_VER #include #include -#include +#include #endif #include #include -#include #include G_BEGIN_DECLS diff --git a/src/monolithic/gst/inference_elements/CMakeLists.txt b/src/monolithic/gst/inference_elements/CMakeLists.txt index 34952025..1c19fe48 100644 --- a/src/monolithic/gst/inference_elements/CMakeLists.txt +++ b/src/monolithic/gst/inference_elements/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================== -# Copyright (C) 2018-2025 Intel Corporation +# Copyright (C) 2018-2026 Intel Corporation # # SPDX-License-Identifier: MIT # ============================================================================== @@ -93,7 +93,7 @@ PUBLIC model_proc ) -if(${ENABLE_VAAPI}) +if(${ENABLE_VAAPI} AND NOT(WIN32)) target_link_libraries(${TARGET_NAME} PRIVATE va_api_wrapper image_inference_async) endif() diff --git a/src/monolithic/gst/inference_elements/base/inference_impl.cpp b/src/monolithic/gst/inference_elements/base/inference_impl.cpp index 9b030b10..23009450 100644 --- a/src/monolithic/gst/inference_elements/base/inference_impl.cpp +++ b/src/monolithic/gst/inference_elements/base/inference_impl.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (C) 2018-2025 Intel Corporation + * Copyright (C) 2018-2026 Intel Corporation * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -40,7 +40,7 @@ #include #include -#ifdef ENABLE_VAAPI +#if defined(ENABLE_VAAPI) && !defined(_WIN32) #include "vaapi_utils.h" #endif @@ -693,7 +693,7 @@ dlstreamer::ContextPtr createVaDisplay(GvaBaseInference *gva_base_inference) { const std::string device(gva_base_inference->device); dlstreamer::ContextPtr display = nullptr; - +#ifndef _WIN32 if ((gva_base_inference->priv->va_display) && (canReuseSharedVADispCtx(gva_base_inference, MAX_STREAMS_SHARING_VADISPLAY))) { // Reuse existing VADisplay context (i.e. priv->va_display) if it fits @@ -715,7 +715,7 @@ dlstreamer::ContextPtr createVaDisplay(GvaBaseInference *gva_base_inference) { "No shared VADisplay found for device '%s', failed to create or retrieve a VADisplay context.", device.c_str()); } - +#endif return display; } diff --git a/src/monolithic/gst/registrator/CMakeLists.txt b/src/monolithic/gst/registrator/CMakeLists.txt index bf683abb..2b0ec616 100644 --- a/src/monolithic/gst/registrator/CMakeLists.txt +++ b/src/monolithic/gst/registrator/CMakeLists.txt @@ -7,7 +7,6 @@ set (TARGET_NAME "gstvideoanalytics") find_package(PkgConfig REQUIRED) -pkg_search_module(VA va libva REQUIRED) pkg_check_modules(GSTREAMER gstreamer-1.0>=1.16 REQUIRED) add_library(${TARGET_NAME} SHARED register_elements.cpp) @@ -35,8 +34,6 @@ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../elements/gvadeskew/ ) -target_link_directories(${TARGET_NAME} PUBLIC ${VA_LIBRARY_DIRS}) - target_link_libraries(${TARGET_NAME} PRIVATE ${GSTREAMER_LIBRARIES} diff --git a/src/monolithic/inference_backend/image_inference/CMakeLists.txt b/src/monolithic/inference_backend/image_inference/CMakeLists.txt index 8064f75b..dbba03a0 100644 --- a/src/monolithic/inference_backend/image_inference/CMakeLists.txt +++ b/src/monolithic/inference_backend/image_inference/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================== -# Copyright (C) 2018-2025 Intel Corporation +# Copyright (C) 2018-2026 Intel Corporation # # SPDX-License-Identifier: MIT # ============================================================================== @@ -8,7 +8,7 @@ set (TARGET_NAME "image_inference") add_subdirectory(openvino) -if(${ENABLE_VAAPI}) +if(${ENABLE_VAAPI} AND NOT(WIN32)) add_subdirectory(async_with_va_api) endif() diff --git a/src/monolithic/inference_backend/image_inference/async_with_d3d11/d3d11_wrapper/CMakeLists.txt b/src/monolithic/inference_backend/image_inference/async_with_d3d11/d3d11_wrapper/CMakeLists.txt index c05b3149..d6f52c44 100644 --- a/src/monolithic/inference_backend/image_inference/async_with_d3d11/d3d11_wrapper/CMakeLists.txt +++ b/src/monolithic/inference_backend/image_inference/async_with_d3d11/d3d11_wrapper/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================== -# Copyright (C) 2025 Intel Corporation +# Copyright (C) 2025-2026 Intel Corporation # # SPDX-License-Identifier: MIT # ============================================================================== @@ -26,22 +26,15 @@ if(WIN32) target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} - ${VA_INCLUDE_DIRS} ${GSTD3D11_INCLUDE_DIRS} - PRIVATE - ${VADRM_INCLUDE_DIRS} ) target_link_libraries(${TARGET_NAME} PUBLIC logger - pre_proc - opencv_pre_proc utils d3d11 dxgi ${GSTD3D11_LIBRARIES} - PRIVATE - utils ) endif() diff --git a/src/monolithic/inference_backend/image_inference/async_with_d3d11/image_inference_async_d3d11/CmakeLists.txt b/src/monolithic/inference_backend/image_inference/async_with_d3d11/image_inference_async_d3d11/CMakeLists.txt similarity index 88% rename from src/monolithic/inference_backend/image_inference/async_with_d3d11/image_inference_async_d3d11/CmakeLists.txt rename to src/monolithic/inference_backend/image_inference/async_with_d3d11/image_inference_async_d3d11/CMakeLists.txt index c5b6756b..4959f225 100644 --- a/src/monolithic/inference_backend/image_inference/async_with_d3d11/image_inference_async_d3d11/CmakeLists.txt +++ b/src/monolithic/inference_backend/image_inference/async_with_d3d11/image_inference_async_d3d11/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================== -# Copyright (C) 2025 Intel Corporation +# Copyright (C) 2025-2026 Intel Corporation # # SPDX-License-Identifier: MIT # ============================================================================== @@ -7,8 +7,6 @@ if(WIN32) set (TARGET_NAME "image_inference_async_d3d11") - find_package(PkgConfig REQUIRED) - file (GLOB MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/*.c @@ -30,7 +28,6 @@ if(WIN32) PRIVATE logger d3d11_wrapper - ${CMAKE_THREAD_LIBS_INIT} ) if(${ENABLE_ITT}) diff --git a/src/monolithic/inference_backend/image_inference/async_with_va_api/va_api_wrapper/vaapi_converter.cpp b/src/monolithic/inference_backend/image_inference/async_with_va_api/va_api_wrapper/vaapi_converter.cpp index 82ce94c4..0791c9b7 100644 --- a/src/monolithic/inference_backend/image_inference/async_with_va_api/va_api_wrapper/vaapi_converter.cpp +++ b/src/monolithic/inference_backend/image_inference/async_with_va_api/va_api_wrapper/vaapi_converter.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (C) 2018-2025 Intel Corporation + * Copyright (C) 2018-2026 Intel Corporation * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -10,9 +10,7 @@ #include "safe_arithmetic.hpp" #include "utils.h" -#if !(_MSC_VER) #include -#endif #include @@ -20,11 +18,6 @@ #include #include -#if _MSC_VER -#include -#define close _close -#endif - using namespace InferenceBackend; namespace { @@ -81,11 +74,7 @@ VASurfaceID ConvertVASurfaceFromDifferentDriverContext(VaDpyWrapper src_display, drm_fd_out = drm_fd; external.buffers = &drm_fd; external.data_size = object.size; -#if !(_MSC_VER) external.flags = object.drm_format_modifier == DRM_FORMAT_MOD_LINEAR ? 0 : VA_SURFACE_EXTBUF_DESC_ENABLE_TILING; -#else - external.flags = 0; -#endif uint32_t k = 0; for (uint32_t i = 0; i < drm_descriptor.num_layers; i++) { for (uint32_t j = 0; j < drm_descriptor.layers[i].num_planes; j++) { diff --git a/src/monolithic/inference_backend/image_inference/async_with_va_api/va_api_wrapper/vaapi_utils.cpp b/src/monolithic/inference_backend/image_inference/async_with_va_api/va_api_wrapper/vaapi_utils.cpp index 74b70456..37debddd 100644 --- a/src/monolithic/inference_backend/image_inference/async_with_va_api/va_api_wrapper/vaapi_utils.cpp +++ b/src/monolithic/inference_backend/image_inference/async_with_va_api/va_api_wrapper/vaapi_utils.cpp @@ -1,14 +1,12 @@ /******************************************************************************* - * Copyright (C) 2022-2025 Intel Corporation + * Copyright (C) 2022-2026 Intel Corporation * * SPDX-License-Identifier: MIT ******************************************************************************/ #include #include -#if !(_MSC_VER) #include -#endif #include #include @@ -17,10 +15,8 @@ namespace internal { VaApiLibBinderImpl::VaApiLibBinderImpl() { -#if !(_MSC_VER) _libva_so = SharedObject::getLibrary("libva.so.2"); _libva_drm_so = SharedObject::getLibrary("libva-drm.so.2"); -#endif } VADisplay VaApiLibBinderImpl::GetDisplayDRM(int file_descriptor) { @@ -40,11 +36,7 @@ VAStatus VaApiLibBinderImpl::Terminate(VADisplay dpy) { } std::function VaApiLibBinderImpl::StatusToStrFunc() { -#if !(_MSC_VER) return _libva_so->getFunction("vaErrorStr"); -#else - return nullptr; -#endif } } /* namespace internal */ @@ -86,7 +78,6 @@ void initializeVaDisplay(VaDpyWrapper display) { // this function supports only CPU rendering for now in WIN32 environment dlstreamer::VAAPIContextPtr vaApiCreateVaDisplay(uint32_t relative_device_index) { -#if !(_MSC_VER) static const char *DEV_DRI_RENDER_PATTERN = "/dev/dri/renderD*"; glob_t globbuf; @@ -127,9 +118,6 @@ dlstreamer::VAAPIContextPtr vaApiCreateVaDisplay(uint32_t relative_device_index) }; return {new dlstreamer::VAAPIContext(display), deleter}; -#else - return nullptr; -#endif } internal::VaApiLibBinderImpl &VaApiLibBinder::get() { diff --git a/src/monolithic/inference_backend/image_inference/image_inference.cpp b/src/monolithic/inference_backend/image_inference/image_inference.cpp index 57f05b0d..0984cc56 100644 --- a/src/monolithic/inference_backend/image_inference/image_inference.cpp +++ b/src/monolithic/inference_backend/image_inference/image_inference.cpp @@ -1,14 +1,15 @@ /******************************************************************************* - * Copyright (C) 2018-2025 Intel Corporation + * Copyright (C) 2018-2026 Intel Corporation * * SPDX-License-Identifier: MIT ******************************************************************************/ -#include "image_inference_async/image_inference_async.h" #include "openvino_image_inference.h" #include "utils.h" -#ifdef _MSC_VER +#ifdef _WIN32 #include "image_inference_async_d3d11/image_inference_async_d3d11.h" +#else +#include "image_inference_async/image_inference_async.h" #endif using namespace InferenceBackend; @@ -105,13 +106,10 @@ ImageInference::Ptr ImageInference::createImageInferenceInstance(MemoryType inpu ImageInference::Ptr result_inference; if (async_mode) { -#ifdef ENABLE_VAAPI -#ifndef _MSC_VER +#ifndef _WIN32 // Wrap the inference in an asynchronous handler if async mode is enabled result_inference = std::make_shared(config, context, std::move(ov_inference)); -#endif -#endif -#ifdef _MSC_VER +#else result_inference = std::make_shared(config, context, std::move(ov_inference)); #endif } else { diff --git a/src/monolithic/inference_backend/image_inference/openvino/CMakeLists.txt b/src/monolithic/inference_backend/image_inference/openvino/CMakeLists.txt index ff1e7dca..dc036703 100644 --- a/src/monolithic/inference_backend/image_inference/openvino/CMakeLists.txt +++ b/src/monolithic/inference_backend/image_inference/openvino/CMakeLists.txt @@ -1,21 +1,15 @@ # ============================================================================== -# Copyright (C) 2018-2025 Intel Corporation +# Copyright (C) 2018-2026 Intel Corporation # # SPDX-License-Identifier: MIT # ============================================================================== set (TARGET_NAME "image_inference_openvino") -# FIXME: update macro below find_package(PkgConfig REQUIRED) find_package(OpenVINO REQUIRED Runtime) find_package(OpenCL REQUIRED) -set(OpenVINO_MIN_VERSION "2024.0.0") -if(${OpenVINO_VERSION} VERSION_LESS ${OpenVINO_MIN_VERSION}) - message(FATAL_ERROR "OpenVINO version should be >= ${OpenVINO_MIN_VERSION}. Found: ${OpenVINO_VERSION}") -endif() - file (GLOB MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/*.c @@ -52,7 +46,7 @@ if(WIN32) target_link_libraries(${TARGET_NAME} PUBLIC d3d11) endif() -if (${ENABLE_VAAPI} AND ${OpenVINO_VERSION} VERSION_GREATER_EQUAL "2023.3") +if (${ENABLE_VAAPI} AND NOT(WIN32)) add_definitions(-DENABLE_GPU_TILE_AFFINITY) target_link_libraries(${TARGET_NAME} PUBLIC va_api_wrapper) endif() diff --git a/src/monolithic/inference_backend/image_inference/openvino/openvino_image_inference.cpp b/src/monolithic/inference_backend/image_inference/openvino/openvino_image_inference.cpp index cd69497d..ce39bfc0 100644 --- a/src/monolithic/inference_backend/image_inference/openvino/openvino_image_inference.cpp +++ b/src/monolithic/inference_backend/image_inference/openvino/openvino_image_inference.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (C) 2018-2025 Intel Corporation + * Copyright (C) 2018-2026 Intel Corporation * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -27,14 +27,14 @@ #include "safe_arithmetic.hpp" #include "utils.h" +#ifndef _WIN32 #ifdef ENABLE_VAAPI #include -#include -#include #ifdef ENABLE_GPU_TILE_AFFINITY #include "vaapi_utils.h" #endif #endif +#endif #include #include diff --git a/src/monolithic/inference_backend/include/inference_backend/buffer_mapper.h b/src/monolithic/inference_backend/include/inference_backend/buffer_mapper.h index 2a8f2367..d1ff7f64 100644 --- a/src/monolithic/inference_backend/include/inference_backend/buffer_mapper.h +++ b/src/monolithic/inference_backend/include/inference_backend/buffer_mapper.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (C) 2022-2025 Intel Corporation + * Copyright (C) 2022-2026 Intel Corporation * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -7,9 +7,10 @@ #pragma once #include "dlstreamer/gst/mappers/gst_to_cpu.h" +#ifndef _WIN32 #include "dlstreamer/gst/mappers/gst_to_dma.h" #include "dlstreamer/gst/mappers/gst_to_vaapi.h" -#ifdef _MSC_VER +#else #include "dlstreamer/gst/mappers/gst_to_d3d11.h" #endif #include "inference_backend/image.h" @@ -74,11 +75,14 @@ class BufferToImageMapper final { image->height = image_info0.height(); image->size = size; image->type = _memory_type; +#ifndef _WIN32 if (_memory_type == MemoryType::VAAPI) { image->va_surface_id = dlstreamer::ptr_cast(tensor0)->va_surface(); image->va_display = tensor0->context()->handle(dlstreamer::VAAPIContext::key::va_display); }; -#ifdef _MSC_VER + image->dma_fd = tensor0->handle(dlstreamer::tensor::key::dma_fd, 0); + image->drm_format_modifier = tensor0->handle(dlstreamer::tensor::key::drm_modifier, 0); +#else if (_memory_type == MemoryType::D3D11) { image->d3d11_texture = dlstreamer::ptr_cast(tensor0)->d3d11_texture(); auto gst_d3d_device = @@ -86,9 +90,6 @@ class BufferToImageMapper final { image->d3d11_device = reinterpret_cast(gst_d3d11_device_get_device_handle(gst_d3d_device)); } #endif - image->dma_fd = tensor0->handle(dlstreamer::tensor::key::dma_fd, 0); - image->drm_format_modifier = tensor0->handle(dlstreamer::tensor::key::drm_modifier, 0); - return image; } @@ -107,13 +108,14 @@ class BufferMapperFactory { switch (memory_type) { case InferenceBackend::MemoryType::SYSTEM: return std::make_shared(nullptr, output_context); +#ifndef _WIN32 case InferenceBackend::MemoryType::DMA_BUFFER: return std::make_shared(nullptr, output_context); case InferenceBackend::MemoryType::VAAPI: return std::make_shared(nullptr, output_context); case InferenceBackend::MemoryType::USM_DEVICE_POINTER: throw std::runtime_error("Not impemented"); -#ifdef _MSC_VER +#else case InferenceBackend::MemoryType::D3D11: return std::make_shared(nullptr, output_context); #endif