From: "Xiong, Jianxin" <jianxin.xiong@intel.com> To: Jason Gunthorpe <jgg@nvidia.com> Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>, "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>, "Doug Ledford" <dledford@redhat.com>, Leon Romanovsky <leon@kernel.org>, "Sumit Semwal" <sumit.semwal@linaro.org>, Christian Koenig <christian.koenig@amd.com>, "Vetter, Daniel" <daniel.vetter@intel.com>, Edward Srouji <edwards@nvidia.com>, Yishai Hadas <yishaih@nvidia.com>, "John Hubbard" <jhubbard@nvidia.com>, Ali Alnubani <alialnu@nvidia.com>, "Gal Pressman" <galpress@amazon.com>, Emil Velikov <emil.l.velikov@gmail.com> Subject: RE: [PATCH rdma-core 3/3] configure: Add check for the presence of DRM headers Date: Thu, 4 Feb 2021 22:11:45 +0000 [thread overview] Message-ID: <MW3PR11MB45557821DAFD15937DEF488CE5B39@MW3PR11MB4555.namprd11.prod.outlook.com> (raw) In-Reply-To: <20210204211210.GQ4247@nvidia.com> > -----Original Message----- > From: Jason Gunthorpe <jgg@nvidia.com> > Sent: Thursday, February 04, 2021 1:12 PM > To: Xiong, Jianxin <jianxin.xiong@intel.com> > Cc: linux-rdma@vger.kernel.org; dri-devel@lists.freedesktop.org; Doug Ledford <dledford@redhat.com>; Leon Romanovsky > <leon@kernel.org>; Sumit Semwal <sumit.semwal@linaro.org>; Christian Koenig <christian.koenig@amd.com>; Vetter, Daniel > <daniel.vetter@intel.com>; Edward Srouji <edwards@nvidia.com>; Yishai Hadas <yishaih@nvidia.com>; John Hubbard > <jhubbard@nvidia.com>; Ali Alnubani <alialnu@nvidia.com>; Gal Pressman <galpress@amazon.com>; Emil Velikov > <emil.l.velikov@gmail.com> > Subject: Re: [PATCH rdma-core 3/3] configure: Add check for the presence of DRM headers > > On Thu, Feb 04, 2021 at 10:50:51AM -0800, Jianxin Xiong wrote: > > Compilation of pyverbs/dmabuf_alloc.c depends on a few DRM headers > > that are installed by either the kernel-header or the libdrm package. > > The installation is optional and the location is not unique. > > > > The standard locations (such as /usr/include/drm, /usr/include/libdrm) > > are checked first. If failed, pkg-config is tried to find the include > > path of custom libdrm installation. The dmabuf allocation routines now > > return suitable error when the headers are not available. The related > > tests will recognize this error code and skip. > > > > Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com> > > CMakeLists.txt | 7 +++++++ > > buildlib/Finddrm.cmake | 19 +++++++++++++++++++ > > buildlib/config.h.in | 2 ++ > > pyverbs/dmabuf_alloc.c | 47 > > ++++++++++++++++++++++++++++++++++++++++++----- > > 4 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 > > buildlib/Finddrm.cmake > > > > diff --git a/CMakeLists.txt b/CMakeLists.txt index 4113423..feaba3a > > 100644 > > +++ b/CMakeLists.txt > > @@ -515,6 +515,13 @@ find_package(Systemd) > > include_directories(${SYSTEMD_INCLUDE_DIRS}) > > RDMA_DoFixup("${SYSTEMD_FOUND}" "systemd/sd-daemon.h") > > > > +# drm headers > > +find_package(drm) > > +if (DRM_INCLUDE_DIRS) > > + include_directories(${DRM_INCLUDE_DIRS}) > > + set(HAVE_DRM_H 1) > > +endif() > > + > > #------------------------- > > # Apply fixups > > > > diff --git a/buildlib/Finddrm.cmake b/buildlib/Finddrm.cmake new file > > mode 100644 index 0000000..6f8e5f2 > > +++ b/buildlib/Finddrm.cmake > > @@ -0,0 +1,19 @@ > > +# COPYRIGHT (c) 2021 Intel Corporation. > > +# Licensed under BSD (MIT variant) or GPLv2. See COPYING. > > + > > +# Check standard locations first > > +find_path(DRM_INCLUDE_DIRS "drm.h" PATH_SUFFIXES "drm" "libdrm") > > + > > +# Check custom libdrm installation, if any if (NOT DRM_INCLUDE_DIRS) > > + execute_process(COMMAND pkg-config --cflags-only-I libdrm > > + OUTPUT_VARIABLE _LIBDRM > > + RESULT_VARIABLE _LIBDRM_RESULT > > + ERROR_QUIET) > > + > > + if (NOT _LIBDRM_RESULT) > > + string(REGEX REPLACE "^-I" "" DRM_INCLUDE_DIRS "${_LIBDRM}") > > + endif() > > + unset(_LIBDRM) > > + unset(_LIBDRM_RESULT) > > +endif() > > I think this should be using pkg_check_modules() ?? > > Look at the NL stuff: > > pkg_check_modules(NL libnl-3.0 libnl-route-3.0 REQUIRED) > include_directories(${NL_INCLUDE_DIRS}) > link_directories(${NL_LIBRARY_DIRS}) > Yes, this is much simpler than the pkg-config method. > > +#if HAVE_DRM_H > > + > > Would rather you use cmake to conditionally compile a dmabuf_alloc.c or a dmabuf_alloc_stub.c than ifdef the entire file Sure, will try that. > > Jaason
WARNING: multiple messages have this Message-ID (diff)
From: "Xiong, Jianxin" <jianxin.xiong@intel.com> To: Jason Gunthorpe <jgg@nvidia.com> Cc: Yishai Hadas <yishaih@nvidia.com>, Leon Romanovsky <leon@kernel.org>, "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>, John Hubbard <jhubbard@nvidia.com>, Edward Srouji <edwards@nvidia.com>, Emil Velikov <emil.l.velikov@gmail.com>, Gal Pressman <galpress@amazon.com>, "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>, Doug Ledford <dledford@redhat.com>, Ali Alnubani <alialnu@nvidia.com>, "Vetter, Daniel" <daniel.vetter@intel.com>, Christian Koenig <christian.koenig@amd.com> Subject: RE: [PATCH rdma-core 3/3] configure: Add check for the presence of DRM headers Date: Thu, 4 Feb 2021 22:11:45 +0000 [thread overview] Message-ID: <MW3PR11MB45557821DAFD15937DEF488CE5B39@MW3PR11MB4555.namprd11.prod.outlook.com> (raw) In-Reply-To: <20210204211210.GQ4247@nvidia.com> > -----Original Message----- > From: Jason Gunthorpe <jgg@nvidia.com> > Sent: Thursday, February 04, 2021 1:12 PM > To: Xiong, Jianxin <jianxin.xiong@intel.com> > Cc: linux-rdma@vger.kernel.org; dri-devel@lists.freedesktop.org; Doug Ledford <dledford@redhat.com>; Leon Romanovsky > <leon@kernel.org>; Sumit Semwal <sumit.semwal@linaro.org>; Christian Koenig <christian.koenig@amd.com>; Vetter, Daniel > <daniel.vetter@intel.com>; Edward Srouji <edwards@nvidia.com>; Yishai Hadas <yishaih@nvidia.com>; John Hubbard > <jhubbard@nvidia.com>; Ali Alnubani <alialnu@nvidia.com>; Gal Pressman <galpress@amazon.com>; Emil Velikov > <emil.l.velikov@gmail.com> > Subject: Re: [PATCH rdma-core 3/3] configure: Add check for the presence of DRM headers > > On Thu, Feb 04, 2021 at 10:50:51AM -0800, Jianxin Xiong wrote: > > Compilation of pyverbs/dmabuf_alloc.c depends on a few DRM headers > > that are installed by either the kernel-header or the libdrm package. > > The installation is optional and the location is not unique. > > > > The standard locations (such as /usr/include/drm, /usr/include/libdrm) > > are checked first. If failed, pkg-config is tried to find the include > > path of custom libdrm installation. The dmabuf allocation routines now > > return suitable error when the headers are not available. The related > > tests will recognize this error code and skip. > > > > Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com> > > CMakeLists.txt | 7 +++++++ > > buildlib/Finddrm.cmake | 19 +++++++++++++++++++ > > buildlib/config.h.in | 2 ++ > > pyverbs/dmabuf_alloc.c | 47 > > ++++++++++++++++++++++++++++++++++++++++++----- > > 4 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 > > buildlib/Finddrm.cmake > > > > diff --git a/CMakeLists.txt b/CMakeLists.txt index 4113423..feaba3a > > 100644 > > +++ b/CMakeLists.txt > > @@ -515,6 +515,13 @@ find_package(Systemd) > > include_directories(${SYSTEMD_INCLUDE_DIRS}) > > RDMA_DoFixup("${SYSTEMD_FOUND}" "systemd/sd-daemon.h") > > > > +# drm headers > > +find_package(drm) > > +if (DRM_INCLUDE_DIRS) > > + include_directories(${DRM_INCLUDE_DIRS}) > > + set(HAVE_DRM_H 1) > > +endif() > > + > > #------------------------- > > # Apply fixups > > > > diff --git a/buildlib/Finddrm.cmake b/buildlib/Finddrm.cmake new file > > mode 100644 index 0000000..6f8e5f2 > > +++ b/buildlib/Finddrm.cmake > > @@ -0,0 +1,19 @@ > > +# COPYRIGHT (c) 2021 Intel Corporation. > > +# Licensed under BSD (MIT variant) or GPLv2. See COPYING. > > + > > +# Check standard locations first > > +find_path(DRM_INCLUDE_DIRS "drm.h" PATH_SUFFIXES "drm" "libdrm") > > + > > +# Check custom libdrm installation, if any if (NOT DRM_INCLUDE_DIRS) > > + execute_process(COMMAND pkg-config --cflags-only-I libdrm > > + OUTPUT_VARIABLE _LIBDRM > > + RESULT_VARIABLE _LIBDRM_RESULT > > + ERROR_QUIET) > > + > > + if (NOT _LIBDRM_RESULT) > > + string(REGEX REPLACE "^-I" "" DRM_INCLUDE_DIRS "${_LIBDRM}") > > + endif() > > + unset(_LIBDRM) > > + unset(_LIBDRM_RESULT) > > +endif() > > I think this should be using pkg_check_modules() ?? > > Look at the NL stuff: > > pkg_check_modules(NL libnl-3.0 libnl-route-3.0 REQUIRED) > include_directories(${NL_INCLUDE_DIRS}) > link_directories(${NL_LIBRARY_DIRS}) > Yes, this is much simpler than the pkg-config method. > > +#if HAVE_DRM_H > > + > > Would rather you use cmake to conditionally compile a dmabuf_alloc.c or a dmabuf_alloc_stub.c than ifdef the entire file Sure, will try that. > > Jaason _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2021-02-04 22:12 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-04 18:50 [PATCH rdma-core 0/3] Dma-buf related fixes Jianxin Xiong 2021-02-04 18:50 ` Jianxin Xiong 2021-02-04 18:50 ` [PATCH rdma-core 1/3] verbs: Fix gcc warnings when building for 32bit systems Jianxin Xiong 2021-02-04 18:50 ` Jianxin Xiong 2021-02-04 18:50 ` [PATCH rdma-core 2/3] pyverbs,tests: Cosmetic improvements for dma-buf allocation routines Jianxin Xiong 2021-02-04 18:50 ` [PATCH rdma-core 2/3] pyverbs, tests: " Jianxin Xiong 2021-02-04 23:04 ` [PATCH rdma-core 2/3] pyverbs,tests: " John Hubbard 2021-02-04 23:04 ` John Hubbard 2021-02-04 18:50 ` [PATCH rdma-core 3/3] configure: Add check for the presence of DRM headers Jianxin Xiong 2021-02-04 18:50 ` Jianxin Xiong 2021-02-04 21:12 ` Jason Gunthorpe 2021-02-04 21:12 ` Jason Gunthorpe 2021-02-04 22:11 ` Xiong, Jianxin [this message] 2021-02-04 22:11 ` Xiong, Jianxin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=MW3PR11MB45557821DAFD15937DEF488CE5B39@MW3PR11MB4555.namprd11.prod.outlook.com \ --to=jianxin.xiong@intel.com \ --cc=alialnu@nvidia.com \ --cc=christian.koenig@amd.com \ --cc=daniel.vetter@intel.com \ --cc=dledford@redhat.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=edwards@nvidia.com \ --cc=emil.l.velikov@gmail.com \ --cc=galpress@amazon.com \ --cc=jgg@nvidia.com \ --cc=jhubbard@nvidia.com \ --cc=leon@kernel.org \ --cc=linux-rdma@vger.kernel.org \ --cc=sumit.semwal@linaro.org \ --cc=yishaih@nvidia.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.