kumquat-buildroot/package/intel-mediadriver/0001-build-check-for-backtrace-3-via-FindBacktrace.patch
Bernd Kuhls 96b9a589ea package/intel-mediadriver: bump version to 22.6.2
Replaced patches with upstream patch which fixes both problems.

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-11-14 23:15:46 +01:00

151 lines
5.7 KiB
Diff

From 08ad0e3da9f9ab48e423d0aea2af9605190aafe7 Mon Sep 17 00:00:00 2001
From: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
Date: Mon, 31 Oct 2022 16:41:43 -0700
Subject: [PATCH] build: check for backtrace(3) via FindBacktrace
Fixes: #1533
Change-Id: I81bcdb5e65c26f94b174af9b5e6218c14601c50f
Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
Downloaded from upstream PR:
https://github.com/intel/media-driver/pull/1536
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
media_driver/media_top_cmake.cmake | 11 +++++-
.../common/os/osservice/media_srcs.cmake | 3 ++
.../linux/common/os/osservice/mos_compat.h.in | 35 +++++++++++++++++++
.../os/osservice/mos_utilities_specific.cpp | 4 ++-
4 files changed, 51 insertions(+), 2 deletions(-)
create mode 100644 media_softlet/linux/common/os/osservice/mos_compat.h.in
diff --git a/media_driver/media_top_cmake.cmake b/media_driver/media_top_cmake.cmake
index 1a8b3b242..e71c8630d 100755
--- a/media_driver/media_top_cmake.cmake
+++ b/media_driver/media_top_cmake.cmake
@@ -22,6 +22,10 @@ project( media )
find_package(PkgConfig)
find_package(X11)
+find_package(Backtrace)
+
+# to get access to generated header files
+include_directories(${CMAKE_BINARY_DIR})
bs_set_if_undefined(LIB_NAME iHD_drv_video)
@@ -381,10 +385,15 @@ set_target_properties(${LIB_NAME} PROPERTIES LINK_FLAGS ${MEDIA_LINK_FLAGS})
set_target_properties(${LIB_NAME} PROPERTIES PREFIX "")
set_target_properties(${LIB_NAME_STATIC} PROPERTIES PREFIX "")
+set(MEDIA_LINK_EXTERNAL_LIBS "${PKG_PCIACCESS_LIBRARIES} m pthread dl")
+if(Backtrace_FOUND)
+ set(MEDIA_LINK_EXTERNAL_LIBS "${MEDIA_LINK_EXTERNAL_LIBS} ${Backtrace_LIBRARY}")
+endif()
+
bs_ufo_link_libraries_noBsymbolic(
${LIB_NAME}
"${INCLUDED_LIBS}"
- "${PKG_PCIACCESS_LIBRARIES} m pthread dl"
+ "${MEDIA_LINK_EXTERNAL_LIBS}"
)
if (NOT DEFINED INCLUDED_LIBS OR "${INCLUDED_LIBS}" STREQUAL "")
diff --git a/media_softlet/linux/common/os/osservice/media_srcs.cmake b/media_softlet/linux/common/os/osservice/media_srcs.cmake
index e90c502f3..4e8aad1d8 100644
--- a/media_softlet/linux/common/os/osservice/media_srcs.cmake
+++ b/media_softlet/linux/common/os/osservice/media_srcs.cmake
@@ -18,12 +18,15 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
+configure_file(${CMAKE_CURRENT_LIST_DIR}/mos_compat.h.in ${CMAKE_BINARY_DIR}/mos_compat.h)
+
set(TMP_SOURCES_
${CMAKE_CURRENT_LIST_DIR}/mos_util_debug_specific.cpp
${CMAKE_CURRENT_LIST_DIR}/mos_utilities_specific.cpp
)
set(TMP_HEADERS_
+ ${CMAKE_BINARY_DIR}/mos_compat.h
${CMAKE_CURRENT_LIST_DIR}/mos_utilities_specific.h
${CMAKE_CURRENT_LIST_DIR}/mos_util_debug_specific.h
)
diff --git a/media_softlet/linux/common/os/osservice/mos_compat.h.in b/media_softlet/linux/common/os/osservice/mos_compat.h.in
new file mode 100644
index 000000000..4a04febe5
--- /dev/null
+++ b/media_softlet/linux/common/os/osservice/mos_compat.h.in
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2022, 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 in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef __MOS_COMPAT_H__
+#define __MOS_COMPAT_H__
+
+// clib implementations (musl, uClibc) might provide backtrace(3)
+// in different header files or not provide it all and rely on external
+// implementations. So, we need to detect which header to be used.
+#cmakedefine01 Backtrace_FOUND
+#if Backtrace_FOUND
+#include <${Backtrace_HEADER}>
+#endif
+
+#endif // __MOS_COMPAT_H__
+
diff --git a/media_softlet/linux/common/os/osservice/mos_utilities_specific.cpp b/media_softlet/linux/common/os/osservice/mos_utilities_specific.cpp
index 305a0e01c..02555837a 100644
--- a/media_softlet/linux/common/os/osservice/mos_utilities_specific.cpp
+++ b/media_softlet/linux/common/os/osservice/mos_utilities_specific.cpp
@@ -34,13 +34,13 @@
#include <signal.h>
#include <unistd.h> // fork
#include <algorithm>
-#include <execinfo.h> // backtrace
#include <sys/types.h>
#include <sys/stat.h> // fstat
#include <sys/ipc.h> // System V IPC
#include <sys/types.h>
#include <sys/sem.h>
#include <sys/mman.h>
+#include "mos_compat.h" // libc variative definitions: backtrace
#include "mos_user_setting.h"
#include "mos_utilities_specific.h"
#include "mos_utilities.h"
@@ -2492,6 +2492,7 @@ void MosUtilities::MosTraceEvent(
MOS_FreeMemory(pTraceBuf);
}
}
+#if Backtrace_FOUND
if (m_mosTraceFilter(TR_KEY_CALL_STACK))
{
// reserve space for header and stack size field.
@@ -2511,6 +2512,7 @@ void MosUtilities::MosTraceEvent(
size_t ret = write(MosUtilitiesSpecificNext::m_mosTraceFd, traceBuf, nLen);
}
}
+#endif
}
return;
}