<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Thanks. Pushed it.</p>
<p><br>
</p>
<p>Tom</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Andres Rodriguez <andresx7@gmail.com><br>
<b>Sent:</b> Sunday, February 5, 2017 17:28<br>
<b>To:</b> Tom St Denis; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> StDenis, Tom<br>
<b>Subject:</b> Re: [PATCH] Autodetect libdrm path (v2)</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Reviewed-by: Andres Rodriguez<andresx7@gmail.com><br>
<br>
On 2/5/2017 5:24 PM, Tom St Denis wrote:<br>
> (v2): Use findLibDRM script instead of directly finding path<br>
><br>
> Signed-off-by: Tom St Denis <tom.stdenis@amd.com><br>
> ---<br>
> CMakeLists.txt | 3 +++<br>
> cmake_modules/FindLibDRM.cmake | 35 +++++++++++++++++++++++++++++++++++<br>
> src/lib/query_drm.c | 4 ++--<br>
> 3 files changed, 40 insertions(+), 2 deletions(-)<br>
> create mode 100644 cmake_modules/FindLibDRM.cmake<br>
><br>
> diff --git a/CMakeLists.txt b/CMakeLists.txt<br>
> index bef94fdba788..ef78c97ad763 100644<br>
> --- a/CMakeLists.txt<br>
> +++ b/CMakeLists.txt<br>
> @@ -25,6 +25,9 @@ include_directories(${CURSES_INCLUDE_DIRS})<br>
> find_package(PCIAccess REQUIRED)<br>
> include_directories(${PCIACCESS_INCLUDE_DIR})<br>
><br>
> +find_package(LibDRM REQUIRED)<br>
> +include_directories(${LIBDRM_INCLUDE_DIR})<br>
> +<br>
> set(REQUIRED_EXTERNAL_LIBS<br>
> ${CURSES_LIBRARIES}<br>
> ${PCIACCESS_LIBRARIES}<br>
> diff --git a/cmake_modules/FindLibDRM.cmake b/cmake_modules/FindLibDRM.cmake<br>
> new file mode 100644<br>
> index 000000000000..e840c4d1bfd0<br>
> --- /dev/null<br>
> +++ b/cmake_modules/FindLibDRM.cmake<br>
> @@ -0,0 +1,35 @@<br>
> +# Try to find libdrm<br>
> +#<br>
> +# Once done, this will define<br>
> +#<br>
> +# LIBDRM_FOUND<br>
> +# LIBDRM_INCLUDE_DIR<br>
> +# LIBDRM_LIBRARIES<br>
> +<br>
> +find_package(PkgConfig)<br>
> +<br>
> +pkg_check_modules(PC_LIBDRM QUIET libdrm)<br>
> +<br>
> +find_path(LIBDRM_INCLUDE_DIR NAMES amdgpu_drm.h<br>
> + HINTS<br>
> + ${PC_LIBDRM_INCLUDEDIR}<br>
> + ${PC_LIBDRM_INCLUDE_DIRS}<br>
> + /usr/include<br>
> +)<br>
> +<br>
> +find_library(LIBDRM_LIBRARY NAMES libdrm_amdgpu.so.1<br>
> + HINTS<br>
> + ${PC_LIBDRM_LIBDIR}<br>
> + ${PC_LIBDRM_LIBRARY_DIRS}<br>
> + /usr/lib64<br>
> + /usr/lib<br>
> +)<br>
> +<br>
> +SET(LIBDRM_LIBRARIES optimized ${LIBDRM_LIBRARY})<br>
> +<br>
> +include(FindPackageHandleStandardArgs)<br>
> +find_package_handle_standard_args(LIBDRM DEFAULT_MSG<br>
> + LIBDRM_LIBRARIES LIBDRM_INCLUDE_DIR<br>
> +)<br>
> +<br>
> +mark_as_advanced(LIBDRM_INCLUDE_DIR LIBDRM_LIBRARIES)<br>
> diff --git a/src/lib/query_drm.c b/src/lib/query_drm.c<br>
> index b9d80a8fc0c8..755c65fbc662 100644<br>
> --- a/src/lib/query_drm.c<br>
> +++ b/src/lib/query_drm.c<br>
> @@ -25,8 +25,8 @@<br>
> #include "umr.h"<br>
> #include <asm/ioctl.h><br>
> #include <sys/ioctl.h><br>
> -#include <drm/drm.h><br>
> -#include <drm/amdgpu_drm.h><br>
> +#include <drm.h><br>
> +#include <amdgpu_drm.h><br>
><br>
> #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)<br>
> #define DRM_IOC_WRITE _IOC_WRITE<br>
><br>
</div>
</span></font></div>
</div>
</body>
</html>