summaryrefslogtreecommitdiff
path: root/utils/update-mojo.sh
blob: fcbc81e70529e008ebf6a43011ab6a2fc53eba37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh

# SPDX-License-Identifier: GPL-2.0-or-later
# Update mojo copy from a chromium source tree

if [ $# != 1 ] ; then
	echo "Usage: $0 <chromium dir>"
	exit 1
fi

ipc_dir="$(dirname "$(realpath "$0")")/ipc"
chromium_dir="$1"

if [ ! -d "${chromium_dir}/mojo" ] ; then
	echo "Directory ${chromium_dir} doesn't contain mojo"
	exit 1
fi

if [ ! -d "${chromium_dir}/.git" ] ; then
	echo "Directory ${chromium_dir} doesn't contain a git tree"
	exit 1
fi

# Get the chromium commit id
version=$(git -C "${chromium_dir}" rev-parse --short HEAD)

# Reject dirty trees
if [ -n "$(git -C "${chromium_dir}" status --porcelain)" ] ; then
	echo "Chromium tree in ${chromium_dir} is dirty"
	exit 1
fi

# Copy the diagnosis file
cp "${chromium_dir}/tools/diagnosis/crbug_1001171.py" "${ipc_dir}/tools/diagnosis"

# Copy the rest of mojo
cp "${chromium_dir}/mojo/public/LICENSE" "${ipc_dir}/mojo/public"

rm -rf "${ipc_dir}/mojo/public/tools/*"

(
	cd "${chromium_dir}" || exit
	find ./mojo/public/tools -type f \
	     -not -path "*/generators/*" \
	     -not -path "*/fuzzers/*" \
	     -exec cp --parents "{}" "${ipc_dir}" ";"
)

# Update the README files
readme=$(cat <<EOF
# SPDX-License-Identifier: CC0-1.0

Files in this directory are imported from ${version} of Chromium. Do not
modify them manually.
EOF
)

echo "$readme" > "${ipc_dir}/mojo/README"
echo "$readme" > "${ipc_dir}/tools/README"

cat <<EOF
------------------------------------------------------------
mojo updated. Please review and up-port local changes before
committing.
------------------------------------------------------------
EOF
This can be used to embed nested structures. The C++ double colon is * replaced with a dot (e.g. FrameBuffer::Plane -> FrameBuffer.Plane) * - The struct must still be defined in a header in C++ and a (de)serializer * implemented in ipa_data_serializer.h, as it cannot be defined in mojom * - [skipHeader] and [skipSerdes] only work here in core.mojom. * - If a struct definition has [skipHeader], then the header where the * struct is defined must be #included in ipa_interface.h * - If a field in a struct has a FileDescriptor, but is not explicitly * defined so in mojom, then the field must be marked with the [hasFd] * attribute. * * \todo Generate documentation from Doxygen comments in .mojom files * \todo Figure out how to keep the skipHeader structs in sync with their * C++ definitions, and the skipSerdes structs in sync with their * (de)serializers */ [skipSerdes, skipHeader] struct ControlInfoMap {}; [skipSerdes, skipHeader] struct ControlList {}; [skipSerdes, skipHeader] struct FileDescriptor {}; [skipHeader] struct Point { int32 x; int32 y; }; [skipHeader] struct Size { uint32 width; uint32 height; }; [skipHeader] struct SizeRange { Size min; Size max; uint32 hStep; uint32 vStep; }; [skipHeader] struct Rectangle { int32 x; int32 y; uint32 width; uint32 height; }; [skipHeader] struct CameraSensorInfo { string model; uint32 bitsPerPixel; Size activeAreaSize; Rectangle analogCrop; Size outputSize; uint64 pixelRate; uint32 lineLength; uint32 minFrameLength; uint32 maxFrameLength; }; /** * \struct IPABuffer * \brief Buffer information for the IPA interface * * The IPABuffer structure associates buffer memory with a unique ID. It is * used to map buffers to the IPA with IPAInterface::mapBuffers(), after which * buffers will be identified by their ID in the IPA interface. */ /** * \var IPABuffer::id * \brief The buffer unique ID * * Buffers mapped to the IPA are identified by numerical unique IDs. The IDs * are chosen by the pipeline handler to fulfil the following constraints: * * - IDs shall be positive integers different than zero * - IDs shall be unique among all mapped buffers * * When buffers are unmapped with IPAInterface::unmapBuffers() their IDs are * freed and may be reused for new buffer mappings. */ /** * \var IPABuffer::planes * \brief The buffer planes description * * Stores the dmabuf handle and length for each plane of the buffer. */ struct IPABuffer { uint32 id; [hasFd] array<FrameBuffer.Plane> planes; }; /** * \struct IPASettings * \brief IPA interface initialization settings * * The IPASettings structure stores data passed to the IPAInterface::init() * function. The data contains settings that don't depend on a particular camera * or pipeline configuration and are valid for the whole life time of the IPA * interface. */ /** * \var IPASettings::configurationFile * \brief The name of the IPA configuration file * * This field may be an empty string if the IPA doesn't require a configuration * file. */ /** * \var IPASettings::sensorModel * \brief The sensor model name * * Provides the sensor model name to the IPA. */ struct IPASettings { string configurationFile; string sensorModel; }; /** * \struct IPAStream * \brief Stream configuration for the IPA interface * * The IPAStream structure stores stream configuration parameters needed by the * IPAInterface::configure() method. It mirrors the StreamConfiguration class * that is not suitable for this purpose due to not being serializable. */ /** * \var IPAStream::pixelFormat * \brief The stream pixel format */ /** * \var IPAStream::size * \brief The stream size in pixels */ struct IPAStream { uint32 pixelFormat; Size size; }; /** * \fn IPAInterface::init() * \brief Initialise the IPAInterface * \param[in] settings The IPA initialization settings * * This function initializes the IPA interface. It shall be called before any * other function of the IPAInterface. The \a settings carry initialization * parameters that are valid for the whole life time of the IPA interface. */ /** * \fn IPAInterface::stop() * \brief Stop the IPA * * This method informs the IPA module that the camera is stopped. The IPA module * shall release resources prepared in start(). */