[libcamera-devel,v2,07/11,WIP] utils: libtuning: parsers: Add yaml parser
diff mbox series

Message ID 20221022062310.2545463-8-paul.elder@ideasonboard.com
State Accepted
Headers show
Series
  • utils: tuning: Add a new tuning infrastructure
Related show

Commit Message

Paul Elder Oct. 22, 2022, 6:23 a.m. UTC
Add a parser to libtuning for parsing configuration files in yaml
format.

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

---
Obviously this doesn't work. Technically it's fine because the only user
of the yaml parser at the moment works fine with no input configuration
file.
---
 utils/tuning/libtuning/parsers/__init__.py    |  1 +
 utils/tuning/libtuning/parsers/yaml_parser.py | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 utils/tuning/libtuning/parsers/yaml_parser.py

Comments

Laurent Pinchart Nov. 9, 2022, 10:38 a.m. UTC | #1
Hi Paul,

Thank you for the patch.

On Sat, Oct 22, 2022 at 03:23:06PM +0900, Paul Elder via libcamera-devel wrote:
> Add a parser to libtuning for parsing configuration files in yaml
> format.
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> 
> ---
> Obviously this doesn't work. Technically it's fine because the only user
> of the yaml parser at the moment works fine with no input configuration
> file.

Do we need to merge this, or can it be left out for now ? I'm fine
either way, so

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  utils/tuning/libtuning/parsers/__init__.py    |  1 +
>  utils/tuning/libtuning/parsers/yaml_parser.py | 15 +++++++++++++++
>  2 files changed, 16 insertions(+)
>  create mode 100644 utils/tuning/libtuning/parsers/yaml_parser.py
> 
> diff --git a/utils/tuning/libtuning/parsers/__init__.py b/utils/tuning/libtuning/parsers/__init__.py
> index 9d20d2fc..022c1e5d 100644
> --- a/utils/tuning/libtuning/parsers/__init__.py
> +++ b/utils/tuning/libtuning/parsers/__init__.py
> @@ -3,3 +3,4 @@
>  # Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>
>  
>  from libtuning.parsers.raspberrypi_parser import RaspberryPiParser
> +from libtuning.parsers.yaml_parser import YamlParser
> diff --git a/utils/tuning/libtuning/parsers/yaml_parser.py b/utils/tuning/libtuning/parsers/yaml_parser.py
> new file mode 100644
> index 00000000..e2ce6e20
> --- /dev/null
> +++ b/utils/tuning/libtuning/parsers/yaml_parser.py
> @@ -0,0 +1,15 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +#
> +# Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>
> +
> +from .parser import Parser
> +
> +
> +class YamlParser(Parser):
> +    def __init__(self):
> +        super().__init__()
> +
> +    # todo Implement this (it's fine for now as we don't need a config for
> +    # rkisp1 LSC)
> +    def _parse(self, config_file, modules):
> +        return {}, []
Paul Elder Nov. 10, 2022, 7:16 a.m. UTC | #2
On Wed, Nov 09, 2022 at 12:38:20PM +0200, Laurent Pinchart wrote:
> Hi Paul,
> 
> Thank you for the patch.
> 
> On Sat, Oct 22, 2022 at 03:23:06PM +0900, Paul Elder via libcamera-devel wrote:
> > Add a parser to libtuning for parsing configuration files in yaml
> > format.
> > 
> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> > 
> > ---
> > Obviously this doesn't work. Technically it's fine because the only user
> > of the yaml parser at the moment works fine with no input configuration
> > file.
> 
> Do we need to merge this, or can it be left out for now ? I'm fine
> either way, so

We actually don't, but I think it's better to keep it in otherwise I'm
certain we'll forget about it later.

Should I return empty or raise NotImplementedError?

> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


Thanks,

Paul

> 
> > ---
> >  utils/tuning/libtuning/parsers/__init__.py    |  1 +
> >  utils/tuning/libtuning/parsers/yaml_parser.py | 15 +++++++++++++++
> >  2 files changed, 16 insertions(+)
> >  create mode 100644 utils/tuning/libtuning/parsers/yaml_parser.py
> > 
> > diff --git a/utils/tuning/libtuning/parsers/__init__.py b/utils/tuning/libtuning/parsers/__init__.py
> > index 9d20d2fc..022c1e5d 100644
> > --- a/utils/tuning/libtuning/parsers/__init__.py
> > +++ b/utils/tuning/libtuning/parsers/__init__.py
> > @@ -3,3 +3,4 @@
> >  # Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>
> >  
> >  from libtuning.parsers.raspberrypi_parser import RaspberryPiParser
> > +from libtuning.parsers.yaml_parser import YamlParser
> > diff --git a/utils/tuning/libtuning/parsers/yaml_parser.py b/utils/tuning/libtuning/parsers/yaml_parser.py
> > new file mode 100644
> > index 00000000..e2ce6e20
> > --- /dev/null
> > +++ b/utils/tuning/libtuning/parsers/yaml_parser.py
> > @@ -0,0 +1,15 @@
> > +# SPDX-License-Identifier: GPL-2.0-or-later
> > +#
> > +# Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>
> > +
> > +from .parser import Parser
> > +
> > +
> > +class YamlParser(Parser):
> > +    def __init__(self):
> > +        super().__init__()
> > +
> > +    # todo Implement this (it's fine for now as we don't need a config for
> > +    # rkisp1 LSC)
> > +    def _parse(self, config_file, modules):
> > +        return {}, []
Paul Elder Nov. 10, 2022, 7:35 a.m. UTC | #3
On Thu, Nov 10, 2022 at 04:16:20PM +0900, Paul Elder via libcamera-devel wrote:
> On Wed, Nov 09, 2022 at 12:38:20PM +0200, Laurent Pinchart wrote:
> > Hi Paul,
> > 
> > Thank you for the patch.
> > 
> > On Sat, Oct 22, 2022 at 03:23:06PM +0900, Paul Elder via libcamera-devel wrote:
> > > Add a parser to libtuning for parsing configuration files in yaml
> > > format.
> > > 
> > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> > > 
> > > ---
> > > Obviously this doesn't work. Technically it's fine because the only user
> > > of the yaml parser at the moment works fine with no input configuration
> > > file.
> > 
> > Do we need to merge this, or can it be left out for now ? I'm fine
> > either way, so
> 
> We actually don't, but I think it's better to keep it in otherwise I'm
> certain we'll forget about it later.
> 
> Should I return empty or raise NotImplementedError?

I should return empty, because this is the parser that the rkisp1 tuning
script uses, and it needs to return *something*.

Basically I'll leave this as-is, until we have some config options. Then
I'll implement this :)


Paul

> 
> > 
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> 
> > 
> > > ---
> > >  utils/tuning/libtuning/parsers/__init__.py    |  1 +
> > >  utils/tuning/libtuning/parsers/yaml_parser.py | 15 +++++++++++++++
> > >  2 files changed, 16 insertions(+)
> > >  create mode 100644 utils/tuning/libtuning/parsers/yaml_parser.py
> > > 
> > > diff --git a/utils/tuning/libtuning/parsers/__init__.py b/utils/tuning/libtuning/parsers/__init__.py
> > > index 9d20d2fc..022c1e5d 100644
> > > --- a/utils/tuning/libtuning/parsers/__init__.py
> > > +++ b/utils/tuning/libtuning/parsers/__init__.py
> > > @@ -3,3 +3,4 @@
> > >  # Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>
> > >  
> > >  from libtuning.parsers.raspberrypi_parser import RaspberryPiParser
> > > +from libtuning.parsers.yaml_parser import YamlParser
> > > diff --git a/utils/tuning/libtuning/parsers/yaml_parser.py b/utils/tuning/libtuning/parsers/yaml_parser.py
> > > new file mode 100644
> > > index 00000000..e2ce6e20
> > > --- /dev/null
> > > +++ b/utils/tuning/libtuning/parsers/yaml_parser.py
> > > @@ -0,0 +1,15 @@
> > > +# SPDX-License-Identifier: GPL-2.0-or-later
> > > +#
> > > +# Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>
> > > +
> > > +from .parser import Parser
> > > +
> > > +
> > > +class YamlParser(Parser):
> > > +    def __init__(self):
> > > +        super().__init__()
> > > +
> > > +    # todo Implement this (it's fine for now as we don't need a config for
> > > +    # rkisp1 LSC)
> > > +    def _parse(self, config_file, modules):
> > > +        return {}, []

Patch
diff mbox series

diff --git a/utils/tuning/libtuning/parsers/__init__.py b/utils/tuning/libtuning/parsers/__init__.py
index 9d20d2fc..022c1e5d 100644
--- a/utils/tuning/libtuning/parsers/__init__.py
+++ b/utils/tuning/libtuning/parsers/__init__.py
@@ -3,3 +3,4 @@ 
 # Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>
 
 from libtuning.parsers.raspberrypi_parser import RaspberryPiParser
+from libtuning.parsers.yaml_parser import YamlParser
diff --git a/utils/tuning/libtuning/parsers/yaml_parser.py b/utils/tuning/libtuning/parsers/yaml_parser.py
new file mode 100644
index 00000000..e2ce6e20
--- /dev/null
+++ b/utils/tuning/libtuning/parsers/yaml_parser.py
@@ -0,0 +1,15 @@ 
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>
+
+from .parser import Parser
+
+
+class YamlParser(Parser):
+    def __init__(self):
+        super().__init__()
+
+    # todo Implement this (it's fine for now as we don't need a config for
+    # rkisp1 LSC)
+    def _parse(self, config_file, modules):
+        return {}, []