Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gst-plugin-qmmfsrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -123,6 +128,7 @@ target_link_libraries(${GST_CAMSRC_PLUGIN} PRIVATE
${GST_QCOM_UTILS_LIBRARIES}
${GST_QCOM_VIDEO_LIBRARIES}
gstqticamerabase
${URM_CLIENT_LIBRARY}
)

install(
Expand Down
46 changes: 21 additions & 25 deletions gst-plugin-qmmfsrc/camera_source_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#include <qmmf-sdk/qmmf_recorder_params.h>
#include <camera_source_context.h>

#include <Urm/UrmAPIs.h>

#include <dlfcn.h>

// Declare Qmmf buffer pool
Expand Down Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion gst-plugin-qmmfsrc/camera_source_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading