From 69f98f4a5f29f42acb698408960c236715cbb370 Mon Sep 17 00:00:00 2001 From: Kartik Nema Date: Tue, 4 Aug 2026 15:23:31 +0530 Subject: [PATCH] Add URM Support Signed-off-by: Kartik Nema --- gst-plugin-qmmfsrc/CMakeLists.txt | 6 +++ gst-plugin-qmmfsrc/camera_source_utils.cc | 46 +++++++++++------------ gst-plugin-qmmfsrc/camera_source_utils.h | 2 +- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/gst-plugin-qmmfsrc/CMakeLists.txt b/gst-plugin-qmmfsrc/CMakeLists.txt index 0528d738..1af01577 100644 --- a/gst-plugin-qmmfsrc/CMakeLists.txt +++ b/gst-plugin-qmmfsrc/CMakeLists.txt @@ -32,6 +32,11 @@ else() endif() pkg_check_modules(QMMF_CAMERA_METADATA qmmf_camera_metadata) +find_library(URM_CLIENT_LIBRARY NAMES UrmClient) +if(NOT URM_CLIENT_LIBRARY) + message(FATAL_ERROR "UrmClient library is required by gstqticamsrc but was not found in the target sysroot") +endif() + # Generate configuration header file with plugin describing definitions configure_file(config.h.in config.h @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR}) @@ -123,6 +128,7 @@ target_link_libraries(${GST_CAMSRC_PLUGIN} PRIVATE ${GST_QCOM_UTILS_LIBRARIES} ${GST_QCOM_VIDEO_LIBRARIES} gstqticamerabase + ${URM_CLIENT_LIBRARY} ) install( diff --git a/gst-plugin-qmmfsrc/camera_source_utils.cc b/gst-plugin-qmmfsrc/camera_source_utils.cc index ba0ed2b0..d66556ab 100644 --- a/gst-plugin-qmmfsrc/camera_source_utils.cc +++ b/gst-plugin-qmmfsrc/camera_source_utils.cc @@ -39,6 +39,8 @@ #include #include +#include + #include // Declare Qmmf buffer pool @@ -1397,42 +1399,36 @@ gboolean gst_qmmf_boost_with_perflock(const gint duration_ms) { gint ret; - void* hLibrary; - PerfHintFunc perf_hint; - if (duration_ms <= 0) - { - GST_WARNING("Invalid perflock duration: %d ms", duration_ms); - return FALSE; + if(duration_ms == 0) { + duration_ms = -1; } - hLibrary = dlopen("libqti-perfd-client.so", RTLD_NOW | RTLD_LOCAL); - if (hLibrary == NULL) + if (duration_ms == 0 || duration_ms < -1) { - GST_INFO("Failed to load perflock library: %s", dlerror()); + GST_WARNING("Invalid lock duration: %d ms", duration_ms); return FALSE; } - perf_hint = (PerfHintFunc)dlsym(hLibrary, "perf_hint"); - if (perf_hint == NULL) + ret = tuneSignal( + POWER_HINT_ID_GST_BOOST, + DEFAULT_SIGNAL_TYPE, + duration_ms, + RequestPriority::REQ_PRIORITY_HIGH, + "", + "", + 0, + NULL + ); + + if (ret <= 0) { - GST_WARNING("Failed to find perf_hint symbol: %s", dlerror()); - - dlclose(hLibrary); - return FALSE; - } - - ret = perf_hint(POWER_HINT_ID_GST_BOOST, NULL, duration_ms, PERF_HINT_NO_TYPE); - if (ret < 0) - { - GST_WARNING("Perflock perf_hint failed with ret: %d", ret); + GST_WARNING("URM tuneSignal failed with ret: %d", ret); } else { - GST_INFO("Perflock perf_hint success with ret: %d", ret); + GST_INFO("URM tuneSignal success, handle returned: %d", ret); } - dlclose(hLibrary); - - return ret >= 0; + return ret > 0; } diff --git a/gst-plugin-qmmfsrc/camera_source_utils.h b/gst-plugin-qmmfsrc/camera_source_utils.h index 3f7d5ce7..9ae4563f 100644 --- a/gst-plugin-qmmfsrc/camera_source_utils.h +++ b/gst-plugin-qmmfsrc/camera_source_utils.h @@ -137,7 +137,7 @@ typedef struct GstQmmfSrcResolutionRange { typedef gint(*PerfHintFunc)(gint hint, const char* pkg, gint duration, gint type); #define PERF_HINT_NO_TYPE -1 -#define POWER_HINT_ID_GST_BOOST 0x00001400 +#define POWER_HINT_ID_GST_BOOST 0x008c0001 gboolean gst_qmmf_boost_with_perflock(const gint duration_ms);