[libcamera-devel] [PATCH] libcamera: Give MappedFrameBuffer its own implementation

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Aug 6 15:15:34 CEST 2021


Hi Laurent,

On 06/08/2021 12:06, Laurent Pinchart wrote:
> Hi Kieran,
> 
> On Fri, Aug 06, 2021 at 11:56:40AM +0100, Kieran Bingham wrote:
>> On 06/08/2021 11:37, Laurent Pinchart wrote:
>> <snip>
>>
>>>>> +++ b/include/libcamera/internal/mapped_framebuffer.h
>>>>> @@ -0,0 +1,52 @@
>>>>> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
>>>>> +/*
>>>>> + * Copyright (C) 2021, Google Inc.
>>>>> + *
>>>>> + * mapped_framebuffer.h - Frame buffer memory mapping support
>>>>> + */
>>>>> +#ifndef __LIBCAMERA_INTERNAL_MAPPED_FRAMEBUFFER_H__
>>>>> +#define __LIBCAMERA_INTERNAL_MAPPED_FRAMEBUFFER_H__
>>>>> +
>>>>> +#include <sys/mman.h>
>>>
>>> This isn't needed anymore, but you need stdint.h instead.
>>
>> Users of MappedFrameBuffer need to specify the mapping flags.
> 
> It's not required by mapped_framebuffer.h, but it's indeed not nice to
> for all users to include it.
> 
>> We can abstract that with your new Flags class now if you prefer ?
> 
> If we want to make this class public, then I'd prefer not depending on
> sys/mman.h indeed. We can add a custom scoped enum (and use the newly
> merged Flags<> class :-)).

I've done all this on top, which I think makes more sense.
 (including picking up the stdint.h).

See the recently posted
 "libcamera: MappedFrameBuffer:: Use typed Flags<MapModes>"

--
Kieran


>>>>> diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build
>>>>> index dac1a2d36fa8..665fd6de4ed3 100644
>>>>> --- a/include/libcamera/internal/meson.build
>>>>> +++ b/include/libcamera/internal/meson.build
>>>>> @@ -28,6 +28,7 @@ libcamera_internal_headers = files([
>>>>>      'ipa_module.h',
>>>>>      'ipa_proxy.h',
>>>>>      'ipc_unixsocket.h',
>>>>> +    'mapped_framebuffer.h',
>>>>>      'media_device.h',
>>>>>      'media_object.h',
>>>>>      'pipeline_handler.h',
>>>>> diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h
>>>>> index 21373fa25bf8..e67cfa2b363e 100644
>>>>> --- a/src/android/camera_buffer.h
>>>>> +++ b/src/android/camera_buffer.h
>>>>> @@ -7,6 +7,8 @@
>>>>>  #ifndef __ANDROID_CAMERA_BUFFER_H__
>>>>>  #define __ANDROID_CAMERA_BUFFER_H__
>>>>>
>>>>> +#include <sys/mman.h>
>>>>> +
>>
>> That's also why it is added here ...
>>
>>>>>  #include <hardware/camera3.h>
>>>>>
>>>>>  #include <libcamera/base/class.h>
> 


More information about the libcamera-devel mailing list