[libcamera-devel] [PATCH] libcamera: Move DRM headers to include/drm

Kieran Bingham kieran.bingham at ideasonboard.com
Tue May 19 14:12:19 CEST 2020


Hi Kieran,

On 19/05/2020 13:01, Kieran Bingham wrote:
> The local copy of the DRM headers are stored under include/linux/drm*.
> 
> When installed on a host system, they are instead installed to
> /usr/include/drm/*, and as such building a userspace application against
> the libcamera headers currently fails to find linux/drm_fourcc.h.
> 
> Fix up the file locations, and references throughout the project.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
>  include/{linux => drm}/drm.h                       | 0
>  include/{linux => drm}/drm_fourcc.h                | 0
>  include/{linux => drm}/drm_mode.h                  | 0
>  include/libcamera/pixelformats.h                   | 2 +-
>  src/gstreamer/gstlibcamera-utils.cpp               | 2 +-
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +-
>  src/libcamera/v4l2_pixelformat.cpp                 | 2 +-
>  7 files changed, 4 insertions(+), 4 deletions(-)
>  rename include/{linux => drm}/drm.h (100%)
>  rename include/{linux => drm}/drm_fourcc.h (100%)
>  rename include/{linux => drm}/drm_mode.h (100%)
> 
> diff --git a/include/linux/drm.h b/include/drm/drm.h
> similarity index 100%
> rename from include/linux/drm.h
> rename to include/drm/drm.h
> diff --git a/include/linux/drm_fourcc.h b/include/drm/drm_fourcc.h
> similarity index 100%
> rename from include/linux/drm_fourcc.h
> rename to include/drm/drm_fourcc.h
> diff --git a/include/linux/drm_mode.h b/include/drm/drm_mode.h
> similarity index 100%
> rename from include/linux/drm_mode.h
> rename to include/drm/drm_mode.h
> diff --git a/include/libcamera/pixelformats.h b/include/libcamera/pixelformats.h
> index 89966e5e664c..e3cdb711b828 100644
> --- a/include/libcamera/pixelformats.h
> +++ b/include/libcamera/pixelformats.h
> @@ -11,7 +11,7 @@
>  #include <stdint.h>
>  #include <string>
>  
> -#include <linux/drm_fourcc.h>
> +#include <drm/drm_fourcc.h>
>  
>  namespace libcamera {
>  
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index a3cb0746e012..41ca2b90867d 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -8,7 +8,7 @@
>  
>  #include "gstlibcamera-utils.h"

This header includes libcamera/stream.h, which includes
libcamera/pixelformats.h, which includes drm/drm_fourcc.h... so we can
drop the drm include below - unless we want to put it there to
explicitly show we need it.

>  
> -#include <linux/drm_fourcc.h>
> +#include <drm/drm_fourcc.h>
>  
>  using namespace libcamera;
>  
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 07ca9f5d7f53..198ec295a840 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -18,7 +18,7 @@
>  #include <libcamera/request.h>
>  #include <libcamera/stream.h>
>  
> -#include <linux/drm_fourcc.h>
> +#include <drm/drm_fourcc.h>

And here, I think we should better include libcamera/pixelformats.h over
the drm/drm_fourcc.h anyway.

And in fact, libcamera/stream.h already includes
libcamera/pixelformats.h as well.

Should we include libcamera/pixelformats.h explicitly ?

>  #include <linux/videodev2.h>
>  
>  #include "libcamera/internal/camera_sensor.h"
> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
> index 36776be99e59..1c4a05b37e23 100644
> --- a/src/libcamera/v4l2_pixelformat.cpp
> +++ b/src/libcamera/v4l2_pixelformat.cpp
> @@ -12,7 +12,7 @@
>  #include <map>
>  #include <string.h>
>  
> -#include <linux/drm_fourcc.h>
> +#include <drm/drm_fourcc.h>

This is included in libcamera/pixelformats.h below so isn't needed.

>  
>  #include <libcamera/pixelformats.h>
>  
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list