[libcamera-devel] [PATCH 1/1] linux: install missing drm includes

Kieran Bingham kieran.bingham at ideasonboard.com
Tue Jun 9 17:00:24 CEST 2020


Hi Stéphane,

On 09/06/2020 15:36, Stéphane Cerveau wrote:
> When using libcamera in a third party, the build needs
> 3 missing drm includes such as:
> - drm_fourcc.h
> - drm.h
> - drm_mode.h
> 
> install those in libcamera/include/linux

Installing the headers could be one option, but the location isn't quite
correct.

The linux headers should normally be installed in in include/drm, as I
suggested in my patch to move them.

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

That in it's own right should then fix the issue for distributions which
provide the header correctly (ubuntu seems to, but debian/arch doesn't).

This is certainly an annoying issue we have currently, particularly as
it blocks building external applications.

The issue is that we shouldn't install these headers, as they are
external really - and we shouldn't be installing a copy that would take
an incorrect precedence over an application intending to use the
'correct' ones.

But - it got more complicated, because various distributions have either
chosen not to provide these headers from the kernel packages (I'd call
that a distribution bug personally).

It would be incorrect to depend on libdrm for these headers too.

Fortunately, Laurent has been working on an alternative solution which
provides a libcamera namespaced set of format descriptions.

That might be verging towards https://xkcd.com/927/, but it keeps the
DRM fourcc and modifiers underneath, and the naming of the formats, but
brings definitions into the libcamera namespace so we can reference them
globally without conflicts occurring, while remaining compatible with
other DRM fourcc users.

--
Regards

Kieran


> Signed-off-by: Stéphane Cerveau <scerveau at collabora.com>
> ---
>  include/linux/meson.build | 12 ++++++++++++
>  include/meson.build       |  1 +
>  2 files changed, 13 insertions(+)
>  create mode 100644 include/linux/meson.build
> 
> diff --git a/include/linux/meson.build b/include/linux/meson.build
> new file mode 100644
> index 0000000..a39faab
> --- /dev/null
> +++ b/include/linux/meson.build
> @@ -0,0 +1,12 @@
> +# SPDX-License-Identifier: CC0-1.0
> +
> +linux_public_headers = files([
> +    'drm_fourcc.h',
> +    'drm.h',
> +    'drm_mode.h',
> +])
> +
> +linux_include_dir = join_paths(libcamera_include_dir, 'linux')
> +
> +install_headers(linux_public_headers,
> +                subdir : linux_include_dir)
> diff --git a/include/meson.build b/include/meson.build
> index 2ac9a3a..90339a7 100644
> --- a/include/meson.build
> +++ b/include/meson.build
> @@ -4,3 +4,4 @@ libcamera_include_dir = 'libcamera'
>  
>  subdir('android')
>  subdir('libcamera')
> +subdir('linux')
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list