Skip to content

Commit

Permalink
Align with CS version
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-liu1024 authored and gfxVPLsdm committed Oct 23, 2024
1 parent 4ef6d7c commit bbd2e31
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 31 deletions.
2 changes: 2 additions & 0 deletions _studio/mfx_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@ target_include_directories(mfxcore
PUBLIC
scheduler/include
${OPENCL_INCLUDE}
${VULKAN_INCLUDE}
)

if (CMAKE_SYSTEM_NAME MATCHES Linux)
target_include_directories(mfxcore
PUBLIC
scheduler/linux/include
${VULKAN_INCLUDE}
)
endif()

Expand Down
1 change: 1 addition & 0 deletions _studio/mfx_lib/decode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ if (MFX_ENABLE_MJPEG_VIDEO_DECODE)
${MSDK_UMC_ROOT}/codec/color_space_converter/include
mjpeg/include
${OPENCL_INCLUDE}
${VULKAN_INCLUDE}
)

set(MJPEG_VIDEO_DECODE_SRC
Expand Down
1 change: 1 addition & 0 deletions _studio/mfx_lib/encode_hw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ target_include_directories(encode_hw
${MSDK_UMC_ROOT}/codec/brc/include
${MSDK_UMC_ROOT}/codec/color_space_converter/include
${OPENCL_INCLUDE}
${VULKAN_INCLUDE}
)

target_link_libraries(encode_hw
Expand Down
1 change: 1 addition & 0 deletions _studio/mfx_lib/ext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ if(MFX_ENABLE_KERNELS)
PUBLIC
${genx_include_dirs}
${mctf_include_dir}
${VULKAN_INCLUDE}
)

target_sources(mfx_ext PRIVATE
Expand Down
1 change: 1 addition & 0 deletions _studio/mfx_lib/pxp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ target_include_directories(pxp_hw
${MSDK_UMC_ROOT}/codec/h265_dec/include
${MSDK_UMC_ROOT}/codec/vvc_dec/include
${OPENCL_INCLUDE}
${VULKAN_INCLUDE}
)

target_link_libraries(pxp_hw
Expand Down
3 changes: 2 additions & 1 deletion _studio/mfx_lib/shared/src/libmfxsw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,8 @@ mfxHDL* MFX_CDECL MFXQueryImplsDescription(mfxImplCapsDeliveryFormat format, mfx
}
};

for (auto type : { MFX_SURFACE_TYPE_VAAPI })
for (auto type : { MFX_SURFACE_TYPE_VAAPI
})
{
auto& surface_type = holder->PushBack(holder->SurfaceTypes);
holder->NumSurfaceTypes++;
Expand Down
1 change: 1 addition & 0 deletions _studio/mfx_lib/vpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ target_include_directories(vpp_hw
PUBLIC
include
${OPENCL_INCLUDE}
${VULKAN_INCLUDE}
${MSDK_STUDIO_ROOT}/mfx_lib/ext/ai_vfi
)

Expand Down
1 change: 1 addition & 0 deletions _studio/shared/enctools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ target_include_directories(enctools_base
PUBLIC
include
${OPENCL_INCLUDE}
${VULKAN_INCLUDE}
)
target_link_libraries(enctools_base
PRIVATE
Expand Down
25 changes: 18 additions & 7 deletions _studio/shared/include/libmfx_allocator_vaapi.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2011-2020 Intel Corporation
// Copyright (c) 2011-2024 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -30,6 +30,7 @@
#include "mfxvideo++int.h"
#include "libmfx_allocator.h"


// VAAPI Allocator internal Mem ID
struct vaapiMemIdInt
{
Expand Down Expand Up @@ -233,23 +234,33 @@ class vaapi_surface_wrapper : public vaapi_resource_wrapper
virtual mfxStatus Lock(mfxFrameData& frame_data, mfxU32 flags) override;
virtual mfxStatus Unlock() override;

private:

virtual mfxStatus Export(const mfxSurfaceHeader& export_header, mfxSurfaceBase*& exported_surface, mfxFrameSurfaceInterfaceImpl* p_base_surface) override;
std::shared_ptr<ImportExportHelper>& GetCreateHelper()
{
std::lock_guard<std::mutex> guard(m_mutex);

if (!m_import_export_helper)
m_import_export_helper.reset(new ImportExportHelper());

return m_import_export_helper;
}

private:
std::pair<mfxStatus, bool> TryImportSurface (const mfxFrameInfo& info, mfxSurfaceHeader* import_surface);
std::pair<mfxStatus, bool> TryImportSurfaceVAAPI(const mfxFrameInfo& info, mfxSurfaceVAAPI& import_surface);


mfxStatus CopyImportSurface (const mfxFrameInfo& info, mfxSurfaceHeader* import_surface);
mfxStatus CopyImportSurfaceVAAPI(const mfxFrameInfo& info, mfxSurfaceVAAPI& import_surface);


SurfaceScopedLock m_surface_lock;
// If m_imported == true we will not delete vaapi surface in destructor
bool m_imported = false;
mfxU16 m_type;
mfxU32 m_fourcc;
bool m_imported = false;
mfxU16 m_type;
mfxU32 m_fourcc;
std::mutex m_mutex;
std::shared_ptr<ImportExportHelper> m_import_export_helper;

};

struct mfxFrameSurface1_hw_vaapi : public RWAcessSurface
Expand Down
1 change: 1 addition & 0 deletions _studio/shared/include/mfx_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
#define MFX_ENABLE_PROTECT
#endif


/*
* Traces
*/
Expand Down
13 changes: 1 addition & 12 deletions _studio/shared/src/libmfx_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,18 +746,7 @@ mfx::mfx_shared_lib_holder* ImportExportHelper::GetHelper(mfxSurfaceType shared_
lock.unlock();
mfx::mfx_shared_lib_holder* ret = nullptr;
uniq_ptr_mfx_shared_lib_holder loaded_lib;
#ifdef MFX_ENABLE_SHARING_OPENCL
switch (shared_library_type)
{
//#ifdef MFX_ENABLE_SHARING_OPENCL
case MFX_SURFACE_TYPE_OPENCL_IMG2D:
loaded_lib = LoadAndInit<MFX_SURFACE_TYPE_OPENCL_IMG2D>();
break;
//#endif
default:
break;
}
#endif


if (loaded_lib)
{
Expand Down
14 changes: 11 additions & 3 deletions _studio/shared/src/libmfx_allocator_vaapi.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2007-2023 Intel Corporation
// Copyright (c) 2007-2024 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,14 +18,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#include "mfx_common.h"

#include "mfx_common.h"

#include <algorithm>
#include <vector>

#include "ippcore.h"
#include "ipps.h"

#include "libmfx_allocator_vaapi.h"
#include "mfx_utils.h"
Expand Down Expand Up @@ -959,6 +958,7 @@ std::pair<mfxStatus, bool> vaapi_surface_wrapper::TryImportSurface(const mfxFram
case MFX_SURFACE_TYPE_VAAPI:
return TryImportSurfaceVAAPI(info, *(reinterpret_cast<mfxSurfaceVAAPI*>(import_surface)));


default:
return { MFX_STS_TRACE(MFX_ERR_UNSUPPORTED), false };
}
Expand Down Expand Up @@ -1022,6 +1022,8 @@ std::pair<mfxStatus, bool> vaapi_surface_wrapper::TryImportSurfaceVAAPI(const mf
return { MFX_ERR_NONE, true };
}



mfxStatus vaapi_surface_wrapper::CopyImportSurface(const mfxFrameInfo& info, mfxSurfaceHeader* import_surface)
{
MFX_CHECK_NULL_PTR1(import_surface);
Expand All @@ -1031,6 +1033,7 @@ mfxStatus vaapi_surface_wrapper::CopyImportSurface(const mfxFrameInfo& info, mfx
case MFX_SURFACE_TYPE_VAAPI:
MFX_RETURN(CopyImportSurfaceVAAPI(info, *(reinterpret_cast<mfxSurfaceVAAPI*>(import_surface))));


default:
MFX_RETURN(MFX_ERR_UNSUPPORTED);
}
Expand All @@ -1051,6 +1054,8 @@ mfxStatus vaapi_surface_wrapper::CopyImportSurfaceVAAPI(const mfxFrameInfo& info
return MFX_ERR_NONE;
}



vaapi_surface_wrapper::~vaapi_surface_wrapper()
{
if (!m_imported)
Expand Down Expand Up @@ -1086,11 +1091,14 @@ mfxStatus vaapi_surface_wrapper::Unlock()

mfxStatus vaapi_surface_wrapper::Export(const mfxSurfaceHeader& export_header, mfxSurfaceBase*& exported_surface, mfxFrameSurfaceInterfaceImpl* p_base_surface)
{

switch (export_header.SurfaceType)
{
case MFX_SURFACE_TYPE_VAAPI:
exported_surface = mfxSurfaceVAAPIImpl::Create(export_header, p_base_surface, m_pVADisplay, m_resource_id);
break;


default:
MFX_RETURN(MFX_ERR_UNSUPPORTED);
}
Expand Down
8 changes: 0 additions & 8 deletions builder/BuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,6 @@ if (BUILD_KERNELS)
endif()


# Supported frameworks for surface sharing
# Temporarily disable OpenCL surface sharing on Linux until code is ready
if (CMAKE_SYSTEM_NAME MATCHES Windows)
option( MFX_ENABLE_SHARING_OPENCL "Enable surface sharing between VPL and OpenCL." ON)
else()
set( MFX_ENABLE_SHARING_OPENCL OFF)
endif()

option( MFX_ENABLE_VVC_VIDEO_DECODE "Enabled VVC decoder?" ON)
option( MFX_ENABLE_AV1_VIDEO_DECODE "Enabled AV1 decoder?" ON)
option( MFX_ENABLE_VP8_VIDEO_DECODE "Enabled VP8 decoder?" ON)
Expand Down

0 comments on commit bbd2e31

Please sign in to comment.