summaryrefslogtreecommitdiff
path: root/utils/ipc/generators/mojom_libcamera_generator.py
AgeCommit message (Collapse)Author
2021-12-04libcamera: base: Rename FileDescriptor to SharedFDLaurent Pinchart
Now that we have a UniqueFD class, the name FileDescriptor is ambiguous. Rename it to SharedFD. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-06-01utils: ipc: mojo: Error if ControlInfoMap/List doesn't prefix libcameraPaul Elder
The mojo parser is fine if there are types that are used in array/map members that it does not know about. These are usually caught by the C++ compiler, because the generated code refers to unknown types. This feature is necessary for us for supporting FrameBuffer::Plane as an array/map member, since as long as the type has an IPADataSerializer and the struct defined in C++, the generated code will run fine (FrameBuffer::Plane is not defined anywhere in mojom but is used as an array member in IPABuffer). The types that are defined in controls.h (or any header included in ipa_interface.h) will all be compiled by the C++ compiler fine, since the generated files all include controls.h. The types that are there that are not ControlInfoMap or ControlList (like ControlValue) will still fail at the linker stage. For example: struct A { array<ControlValue> a; }; will compile fine, but will fail to link, since IPADataSerializer<ControlValue> doesn't exist. This behavior, although not the best, is acceptable. The issue is that if ControlInfoMap or ControlList are used as array/map members without the libcamera prefix, the compiler will not complain, as the types are valid, and the linker will also not complain, as IPADataSerializer<ControlList> and IPADataSerializer<ControlInfoMap> both exist. However, the code generator will not recognize them as types that require a ControlSerializer (since mojo doesn't recognize them, so they are different from the ones that it does recognize with the libcamera namespace), and so the ControlSerializer will not be passed to the serializer in the generated code. This is the cause of the FATAL breakage: FATAL IPADataSerializer ipa_data_serializer.cpp:437 ControlSerializer not provided for serialization of ControlInfoMap Since ControlInfoMap and ControlList are the only types that will run into this issue, we solve this by simply detecting if they are used without the prefix, and produce an error at that point in the code generator. As the code generator stage no longer has information on the source code file and line, we output the struct name in which the error was found (ninja will output the file name). Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-27utils: ipc: Use the proper namespace for mojom structsPaul Elder
Structs defined in mojom previously used the namespace of the mojom file that was being used as the source. This is obviously not the correct namespace for structs that are defined in core.mojom. Fix the jinja function for getting the element type including namespace, and use it. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-09utils: ipc: Make first output parameter direct return if int32Paul Elder
To make it more convenient for synchronous IPA calls to return a status, convert the first output into a direct return if it is an int32. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Naushir Patuck <naush@raspberrypi.com>
2021-03-09utils: ipc: Support custom parameters to init()Paul Elder
Add support to the mojom-based code generator for custom parameters to init(). Remove the parameter type and count validation as well. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-16utils: ipc: add templates for code generation for IPC mechanismPaul Elder
Add templates to mojo to generate code for the IPC mechanism. These templates generate: - module header - module serializer - IPA proxy cpp, header, and worker Given an input data definition mojom file for a pipeline. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>