[v5,4/5] libcamera: converter: Add DW100 converter class
diff mbox series

Message ID 20240709202151.152289-5-umang.jain@ideasonboard.com
State Superseded
Headers show
Series
  • libcamera: rkisp1: Plumb the ConverterDW100 converter
Related show

Commit Message

Umang Jain July 9, 2024, 8:21 p.m. UTC
DW100 Dewarp engine is present on i.MX8MP SoC. This patch
provides a converter class (inherited from V4L2M2MConverter).

The DW100 dewarp engine has scaling capabilites and can be used
to set crop rectangles in the rkisp1 pipeline handler. Plumbing
in the RkISP1 pipeline-handler is done in the subsequent patch.

The ConverterDW100 class can be extended later (as additional
development) to support the dewarping by setting a dewarp vertex
map as well.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 .../internal/converter/converter_dw100.h      | 24 ++++++++++++
 .../libcamera/internal/converter/meson.build  |  1 +
 src/libcamera/converter/converter_dw100.cpp   | 37 +++++++++++++++++++
 src/libcamera/converter/meson.build           |  1 +
 4 files changed, 63 insertions(+)
 create mode 100644 include/libcamera/internal/converter/converter_dw100.h
 create mode 100644 src/libcamera/converter/converter_dw100.cpp

Comments

Jacopo Mondi July 17, 2024, 10:05 a.m. UTC | #1
Hi Umang

On Wed, Jul 10, 2024 at 01:51:50AM GMT, Umang Jain wrote:
> DW100 Dewarp engine is present on i.MX8MP SoC. This patch
> provides a converter class (inherited from V4L2M2MConverter).
>
> The DW100 dewarp engine has scaling capabilites and can be used
> to set crop rectangles in the rkisp1 pipeline handler. Plumbing
> in the RkISP1 pipeline-handler is done in the subsequent patch.
>
> The ConverterDW100 class can be extended later (as additional
> development) to support the dewarping by setting a dewarp vertex
> map as well.
>
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>  .../internal/converter/converter_dw100.h      | 24 ++++++++++++
>  .../libcamera/internal/converter/meson.build  |  1 +
>  src/libcamera/converter/converter_dw100.cpp   | 37 +++++++++++++++++++
>  src/libcamera/converter/meson.build           |  1 +
>  4 files changed, 63 insertions(+)
>  create mode 100644 include/libcamera/internal/converter/converter_dw100.h
>  create mode 100644 src/libcamera/converter/converter_dw100.cpp
>
> diff --git a/include/libcamera/internal/converter/converter_dw100.h b/include/libcamera/internal/converter/converter_dw100.h
> new file mode 100644
> index 00000000..dc41f365
> --- /dev/null
> +++ b/include/libcamera/internal/converter/converter_dw100.h
> @@ -0,0 +1,24 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * Copyright (C) 2024, Ideas On Board Oy
> + *
> + * i.MX8MP Dewarp Engine integration
> + */
> +
> +#pragma once
> +
> +#include "libcamera/internal/converter/converter_v4l2_m2m.h"
> +
> +namespace libcamera {
> +
> +class MediaDevice;
> +class Rectangle;
> +class Stream;
> +
> +class ConverterDW100 : public V4L2M2MConverter
> +{
> +public:
> +	ConverterDW100(std::shared_ptr<MediaDevice> media);
> +};
> +
> +} /* namespace libcamera */
> diff --git a/include/libcamera/internal/converter/meson.build b/include/libcamera/internal/converter/meson.build
> index 891e79e7..85007a4b 100644
> --- a/include/libcamera/internal/converter/meson.build
> +++ b/include/libcamera/internal/converter/meson.build
> @@ -1,5 +1,6 @@
>  # SPDX-License-Identifier: CC0-1.0
>
>  libcamera_internal_headers += files([
> +    'converter_dw100.h',
>      'converter_v4l2_m2m.h',
>  ])
> diff --git a/src/libcamera/converter/converter_dw100.cpp b/src/libcamera/converter/converter_dw100.cpp
> new file mode 100644
> index 00000000..3061fc71
> --- /dev/null
> +++ b/src/libcamera/converter/converter_dw100.cpp
> @@ -0,0 +1,37 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * Copyright (C) 2024, Ideas On Board Oy
> + *
> + * i.MX8MP Dewarp Engine integration
> + */
> +
> +#include "libcamera/internal/converter/converter_dw100.h"
> +
> +#include <libcamera/base/log.h>
> +
> +#include <libcamera/geometry.h>
> +
> +#include "libcamera/internal/media_device.h"
> +#include "libcamera/internal/v4l2_videodevice.h"
> +
> +namespace libcamera {
> +
> +LOG_DECLARE_CATEGORY(Converter)
> +
> +/**
> + * \class libcamera::ConverterDW100
> + * \brief The i.MX8MP dewarp converter implements the converter interface based
> + * on V4L2 M2M device.
> +*/
> +
> +/**
> + * \fn ConverterDW100::ConverterDW100
> + * \brief Construct a ConverterDW100 instance
> + * \param[in] media The media device implementing the converter
> + */
> +ConverterDW100::ConverterDW100(std::shared_ptr<MediaDevice> media)
> +	: V4L2M2MConverter(media.get(), Feature::Crop)
> +{
> +}
> +

I might have missed where the matching compatible is added.

> +} /* namespace libcamera */
> diff --git a/src/libcamera/converter/meson.build b/src/libcamera/converter/meson.build
> index 2aa72fe4..175581b8 100644
> --- a/src/libcamera/converter/meson.build
> +++ b/src/libcamera/converter/meson.build
> @@ -1,5 +1,6 @@
>  # SPDX-License-Identifier: CC0-1.0
>
>  libcamera_sources += files([
> +        'converter_dw100.cpp',
>          'converter_v4l2_m2m.cpp'
>  ])
> --
> 2.45.2
>
Umang Jain July 17, 2024, 11:07 a.m. UTC | #2
On 17/07/24 3:35 pm, Jacopo Mondi wrote:
> Hi Umang
>
> On Wed, Jul 10, 2024 at 01:51:50AM GMT, Umang Jain wrote:
>> DW100 Dewarp engine is present on i.MX8MP SoC. This patch
>> provides a converter class (inherited from V4L2M2MConverter).
>>
>> The DW100 dewarp engine has scaling capabilites and can be used
>> to set crop rectangles in the rkisp1 pipeline handler. Plumbing
>> in the RkISP1 pipeline-handler is done in the subsequent patch.
>>
>> The ConverterDW100 class can be extended later (as additional
>> development) to support the dewarping by setting a dewarp vertex
>> map as well.
>>
>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
>> ---
>>   .../internal/converter/converter_dw100.h      | 24 ++++++++++++
>>   .../libcamera/internal/converter/meson.build  |  1 +
>>   src/libcamera/converter/converter_dw100.cpp   | 37 +++++++++++++++++++
>>   src/libcamera/converter/meson.build           |  1 +
>>   4 files changed, 63 insertions(+)
>>   create mode 100644 include/libcamera/internal/converter/converter_dw100.h
>>   create mode 100644 src/libcamera/converter/converter_dw100.cpp
>>
>> diff --git a/include/libcamera/internal/converter/converter_dw100.h b/include/libcamera/internal/converter/converter_dw100.h
>> new file mode 100644
>> index 00000000..dc41f365
>> --- /dev/null
>> +++ b/include/libcamera/internal/converter/converter_dw100.h
>> @@ -0,0 +1,24 @@
>> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>> +/*
>> + * Copyright (C) 2024, Ideas On Board Oy
>> + *
>> + * i.MX8MP Dewarp Engine integration
>> + */
>> +
>> +#pragma once
>> +
>> +#include "libcamera/internal/converter/converter_v4l2_m2m.h"
>> +
>> +namespace libcamera {
>> +
>> +class MediaDevice;
>> +class Rectangle;
>> +class Stream;
>> +
>> +class ConverterDW100 : public V4L2M2MConverter
>> +{
>> +public:
>> +	ConverterDW100(std::shared_ptr<MediaDevice> media);
>> +};
>> +
>> +} /* namespace libcamera */
>> diff --git a/include/libcamera/internal/converter/meson.build b/include/libcamera/internal/converter/meson.build
>> index 891e79e7..85007a4b 100644
>> --- a/include/libcamera/internal/converter/meson.build
>> +++ b/include/libcamera/internal/converter/meson.build
>> @@ -1,5 +1,6 @@
>>   # SPDX-License-Identifier: CC0-1.0
>>
>>   libcamera_internal_headers += files([
>> +    'converter_dw100.h',
>>       'converter_v4l2_m2m.h',
>>   ])
>> diff --git a/src/libcamera/converter/converter_dw100.cpp b/src/libcamera/converter/converter_dw100.cpp
>> new file mode 100644
>> index 00000000..3061fc71
>> --- /dev/null
>> +++ b/src/libcamera/converter/converter_dw100.cpp
>> @@ -0,0 +1,37 @@
>> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>> +/*
>> + * Copyright (C) 2024, Ideas On Board Oy
>> + *
>> + * i.MX8MP Dewarp Engine integration
>> + */
>> +
>> +#include "libcamera/internal/converter/converter_dw100.h"
>> +
>> +#include <libcamera/base/log.h>
>> +
>> +#include <libcamera/geometry.h>
>> +
>> +#include "libcamera/internal/media_device.h"
>> +#include "libcamera/internal/v4l2_videodevice.h"
>> +
>> +namespace libcamera {
>> +
>> +LOG_DECLARE_CATEGORY(Converter)
>> +
>> +/**
>> + * \class libcamera::ConverterDW100
>> + * \brief The i.MX8MP dewarp converter implements the converter interface based
>> + * on V4L2 M2M device.
>> +*/
>> +
>> +/**
>> + * \fn ConverterDW100::ConverterDW100
>> + * \brief Construct a ConverterDW100 instance
>> + * \param[in] media The media device implementing the converter
>> + */
>> +ConverterDW100::ConverterDW100(std::shared_ptr<MediaDevice> media)
>> +	: V4L2M2MConverter(media.get(), Feature::Crop)
>> +{
>> +}
>> +
> I might have missed where the matching compatible is added.

Currently I have not, since compatible string is only for simple 
pipeline handlers

ConverterDW100 present on I.MX8MP can be tested with ISI and simple 
pipeline handler (with YUV sensor).

I don't have a YUV sensor to test this particular use-case. Hence, I 
added a \todo to extend compatibles and REGISTER_CONVERTER macro to be 
adjusted at a later stage.

>
>> +} /* namespace libcamera */
>> diff --git a/src/libcamera/converter/meson.build b/src/libcamera/converter/meson.build
>> index 2aa72fe4..175581b8 100644
>> --- a/src/libcamera/converter/meson.build
>> +++ b/src/libcamera/converter/meson.build
>> @@ -1,5 +1,6 @@
>>   # SPDX-License-Identifier: CC0-1.0
>>
>>   libcamera_sources += files([
>> +        'converter_dw100.cpp',
>>           'converter_v4l2_m2m.cpp'
>>   ])
>> --
>> 2.45.2
>>
Paul Elder July 19, 2024, 7:06 a.m. UTC | #3
On Wed, Jul 10, 2024 at 01:51:50AM +0530, Umang Jain wrote:
> DW100 Dewarp engine is present on i.MX8MP SoC. This patch
> provides a converter class (inherited from V4L2M2MConverter).
> 
> The DW100 dewarp engine has scaling capabilites and can be used
> to set crop rectangles in the rkisp1 pipeline handler. Plumbing
> in the RkISP1 pipeline-handler is done in the subsequent patch.
> 
> The ConverterDW100 class can be extended later (as additional
> development) to support the dewarping by setting a dewarp vertex
> map as well.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  .../internal/converter/converter_dw100.h      | 24 ++++++++++++
>  .../libcamera/internal/converter/meson.build  |  1 +
>  src/libcamera/converter/converter_dw100.cpp   | 37 +++++++++++++++++++
>  src/libcamera/converter/meson.build           |  1 +
>  4 files changed, 63 insertions(+)
>  create mode 100644 include/libcamera/internal/converter/converter_dw100.h
>  create mode 100644 src/libcamera/converter/converter_dw100.cpp
> 
> diff --git a/include/libcamera/internal/converter/converter_dw100.h b/include/libcamera/internal/converter/converter_dw100.h
> new file mode 100644
> index 00000000..dc41f365
> --- /dev/null
> +++ b/include/libcamera/internal/converter/converter_dw100.h
> @@ -0,0 +1,24 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * Copyright (C) 2024, Ideas On Board Oy
> + *
> + * i.MX8MP Dewarp Engine integration
> + */
> +
> +#pragma once
> +
> +#include "libcamera/internal/converter/converter_v4l2_m2m.h"
> +
> +namespace libcamera {
> +
> +class MediaDevice;
> +class Rectangle;
> +class Stream;
> +
> +class ConverterDW100 : public V4L2M2MConverter
> +{
> +public:
> +	ConverterDW100(std::shared_ptr<MediaDevice> media);
> +};
> +
> +} /* namespace libcamera */
> diff --git a/include/libcamera/internal/converter/meson.build b/include/libcamera/internal/converter/meson.build
> index 891e79e7..85007a4b 100644
> --- a/include/libcamera/internal/converter/meson.build
> +++ b/include/libcamera/internal/converter/meson.build
> @@ -1,5 +1,6 @@
>  # SPDX-License-Identifier: CC0-1.0
>  
>  libcamera_internal_headers += files([
> +    'converter_dw100.h',
>      'converter_v4l2_m2m.h',
>  ])
> diff --git a/src/libcamera/converter/converter_dw100.cpp b/src/libcamera/converter/converter_dw100.cpp
> new file mode 100644
> index 00000000..3061fc71
> --- /dev/null
> +++ b/src/libcamera/converter/converter_dw100.cpp
> @@ -0,0 +1,37 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * Copyright (C) 2024, Ideas On Board Oy
> + *
> + * i.MX8MP Dewarp Engine integration
> + */
> +
> +#include "libcamera/internal/converter/converter_dw100.h"
> +
> +#include <libcamera/base/log.h>
> +
> +#include <libcamera/geometry.h>
> +
> +#include "libcamera/internal/media_device.h"
> +#include "libcamera/internal/v4l2_videodevice.h"
> +
> +namespace libcamera {
> +
> +LOG_DECLARE_CATEGORY(Converter)
> +
> +/**
> + * \class libcamera::ConverterDW100
> + * \brief The i.MX8MP dewarp converter implements the converter interface based
> + * on V4L2 M2M device.
> +*/
> +
> +/**
> + * \fn ConverterDW100::ConverterDW100
> + * \brief Construct a ConverterDW100 instance
> + * \param[in] media The media device implementing the converter
> + */
> +ConverterDW100::ConverterDW100(std::shared_ptr<MediaDevice> media)
> +	: V4L2M2MConverter(media.get(), Feature::Crop)
> +{
> +}
> +
> +} /* namespace libcamera */
> diff --git a/src/libcamera/converter/meson.build b/src/libcamera/converter/meson.build
> index 2aa72fe4..175581b8 100644
> --- a/src/libcamera/converter/meson.build
> +++ b/src/libcamera/converter/meson.build
> @@ -1,5 +1,6 @@
>  # SPDX-License-Identifier: CC0-1.0
>  
>  libcamera_sources += files([
> +        'converter_dw100.cpp',
>          'converter_v4l2_m2m.cpp'
>  ])
> -- 
> 2.45.2
>

Patch
diff mbox series

diff --git a/include/libcamera/internal/converter/converter_dw100.h b/include/libcamera/internal/converter/converter_dw100.h
new file mode 100644
index 00000000..dc41f365
--- /dev/null
+++ b/include/libcamera/internal/converter/converter_dw100.h
@@ -0,0 +1,24 @@ 
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2024, Ideas On Board Oy
+ *
+ * i.MX8MP Dewarp Engine integration
+ */
+
+#pragma once
+
+#include "libcamera/internal/converter/converter_v4l2_m2m.h"
+
+namespace libcamera {
+
+class MediaDevice;
+class Rectangle;
+class Stream;
+
+class ConverterDW100 : public V4L2M2MConverter
+{
+public:
+	ConverterDW100(std::shared_ptr<MediaDevice> media);
+};
+
+} /* namespace libcamera */
diff --git a/include/libcamera/internal/converter/meson.build b/include/libcamera/internal/converter/meson.build
index 891e79e7..85007a4b 100644
--- a/include/libcamera/internal/converter/meson.build
+++ b/include/libcamera/internal/converter/meson.build
@@ -1,5 +1,6 @@ 
 # SPDX-License-Identifier: CC0-1.0
 
 libcamera_internal_headers += files([
+    'converter_dw100.h',
     'converter_v4l2_m2m.h',
 ])
diff --git a/src/libcamera/converter/converter_dw100.cpp b/src/libcamera/converter/converter_dw100.cpp
new file mode 100644
index 00000000..3061fc71
--- /dev/null
+++ b/src/libcamera/converter/converter_dw100.cpp
@@ -0,0 +1,37 @@ 
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2024, Ideas On Board Oy
+ *
+ * i.MX8MP Dewarp Engine integration
+ */
+
+#include "libcamera/internal/converter/converter_dw100.h"
+
+#include <libcamera/base/log.h>
+
+#include <libcamera/geometry.h>
+
+#include "libcamera/internal/media_device.h"
+#include "libcamera/internal/v4l2_videodevice.h"
+
+namespace libcamera {
+
+LOG_DECLARE_CATEGORY(Converter)
+
+/**
+ * \class libcamera::ConverterDW100
+ * \brief The i.MX8MP dewarp converter implements the converter interface based
+ * on V4L2 M2M device.
+*/
+
+/**
+ * \fn ConverterDW100::ConverterDW100
+ * \brief Construct a ConverterDW100 instance
+ * \param[in] media The media device implementing the converter
+ */
+ConverterDW100::ConverterDW100(std::shared_ptr<MediaDevice> media)
+	: V4L2M2MConverter(media.get(), Feature::Crop)
+{
+}
+
+} /* namespace libcamera */
diff --git a/src/libcamera/converter/meson.build b/src/libcamera/converter/meson.build
index 2aa72fe4..175581b8 100644
--- a/src/libcamera/converter/meson.build
+++ b/src/libcamera/converter/meson.build
@@ -1,5 +1,6 @@ 
 # SPDX-License-Identifier: CC0-1.0
 
 libcamera_sources += files([
+        'converter_dw100.cpp',
         'converter_v4l2_m2m.cpp'
 ])