b35d3fea | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: write vui parameters for HEVC
The vui parameters are optional. However, the vui data allows to specify the color space of the encoded video. Write the vui parameters to make sure tha
media: allegro: write vui parameters for HEVC
The vui parameters are optional. However, the vui data allows to specify the color space of the encoded video. Write the vui parameters to make sure that decoders are able to pick up the correct color space.
Also implement the necessary lookup functions to convert the values from the V4L2 controls to the values specified in the hevc standard.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
42fd2806 | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: nal-hevc: implement generator for vui
The NAL unit generator for HEVC does not support the generation of vui parameters. Implement it to allow drivers to set the vui parameters in th
media: allegro: nal-hevc: implement generator for vui
The NAL unit generator for HEVC does not support the generation of vui parameters. Implement it to allow drivers to set the vui parameters in the coded video stream.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
0317c05f | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: write correct colorspace into SPS
Currently, the driver always writes PAL as video format into the SPS of the encoded stream.
Set the video format to the default value 5 (unspecifie
media: allegro: write correct colorspace into SPS
Currently, the driver always writes PAL as video format into the SPS of the encoded stream.
Set the video format to the default value 5 (unspecified) and use the color description that is already configured on the channel as color space. This fixes the color space definition in the coded data to reflect the configured color space of the video data that is encoded.
Add lookup functions to convert the color primaries, transfer function and matrix coefficients from the V4L2 control values to the values specified in the h.264 standard.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
e5c28f21 | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: extract nal value lookup functions to header
The lookup of the h.264 or hevc values for the respective V4L2 controls is done by the driver that uses the sps/pps generator and not in
media: allegro: extract nal value lookup functions to header
The lookup of the h.264 or hevc values for the respective V4L2 controls is done by the driver that uses the sps/pps generator and not in the generator. Therefore, it is more intuitive to define these functions directly in the header and not in the module.
Extract the functions to the headers as static inline functions.
Also simplify the function name and add kernel-doc for the hevc functions.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
89091e12 | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: correctly scale the bit rate in SPS
The bit rate in the SPS can be scaled by an exponent, which allows to reduce the number of bits in the SPS in case of high bit rates.
The driver
media: allegro: correctly scale the bit rate in SPS
The bit rate in the SPS can be scaled by an exponent, which allows to reduce the number of bits in the SPS in case of high bit rates.
The driver did not scale the bitrate, but used a scaling exponent of 0. Fix this by properly calculating the scaling factor and writing the bit rate as value and scaling factor into the SPS.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
c0a3753c | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: remove external QP table
The VCU allows to specify the QP per frame and coding unit. A buffer that specifies the QP is passed via the ep2 field in the ENCODE_FRAME message.
The driv
media: allegro: remove external QP table
The VCU allows to specify the QP per frame and coding unit. A buffer that specifies the QP is passed via the ep2 field in the ENCODE_FRAME message.
The driver currently does not support the external QP table. Simplify the driver by not setting the ep2 fields at all.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
436ee4b5 | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: fix row and column in response message
The fields for the number of rows and columns in the encode frame response message are switched. This causes broken PPS, if the encoder uses ti
media: allegro: fix row and column in response message
The fields for the number of rows and columns in the encode frame response message are switched. This causes broken PPS, if the encoder uses tiles for encoding and the number of rows and columns differ.
Write the fields of the response message into the correct fields of the the internal data structure when parsing the response message.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
7aea2c0b | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: add control to disable encoder buffer
The encoder buffer can have a negative impact on the quality of the encoded video.
Add a control to allow user space to disable the encoder buf
media: allegro: add control to disable encoder buffer
The encoder buffer can have a negative impact on the quality of the encoded video.
Add a control to allow user space to disable the encoder buffer per channel if the VCU supports the encoder buffer but the quality is not sufficient.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
98f1cbf6 | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: add encoder buffer support
The encoder buffer serves as a cache for reference frames during the encoding process. The encoder buffer significantly reduces the bandwidth requirement f
media: allegro: add encoder buffer support
The encoder buffer serves as a cache for reference frames during the encoding process. The encoder buffer significantly reduces the bandwidth requirement for read accesses on the AXI ports of the VCU, but slightly reduces the quality of the encoded video.
The encoder buffer must be configured as a whole during the firmware initialization and later explicitly enabled for every channel that shall use the encoder buffer.
Prior to firmware version 2019.2, it was necessary to explicitly set the size of the encoder buffer for every channel. Since 2019.2 it is sufficient to enable the encoder buffer and leave the rest to the firmware. Therefore, only support the encoder buffer for firmware 2019.2 and later.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
83cc5fd9 | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: add pm_runtime support
The allegro driver must ensure that the mcu and core clocks are enabled and set to the expected clock rate before trying to load the firmware and to reset the
media: allegro: add pm_runtime support
The allegro driver must ensure that the mcu and core clocks are enabled and set to the expected clock rate before trying to load the firmware and to reset the MCU.
Up until now, the driver assumed that the clocks are always enabled in the PL (programming logic), because the xlnx_vcu driver did not export the clocks to other drivers. This has changed and by explicitly enabling the clocks in the driver, this assumption can be dropped.
It might even be possible to disable the clocks for the encoder if the encoder is not used. However, the behavior is not documented and it might be necessary to reinitialize the encoder after deactivating the clocks. Play it safe by sticking to the current behavior.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
b6707e77 | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: lookup VCU settings
The VCU provides information about its configuration in a dedicated register space. These settings include, for example, the expected clock rates and the configur
media: allegro: lookup VCU settings
The VCU provides information about its configuration in a dedicated register space. These settings include, for example, the expected clock rates and the configuration of the encoder buffer. In the device tree, the settings are described by the "xlnx,vcu-settings" compatible.
The settings are needed to correctly configure the clocks and the encoder buffer.
Lookup the VCU settings in the device tree and make it accessible to the driver via a regmap.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
dacc21d6 | 08-Sep-2021 |
Michael Tretter <m.tretter@pengutronix.de> |
media: allegro: fix module removal if initialization failed
If the module probe finished, but the firmware initialization failed, removing the module must not revert the firmware initialization.
Ad
media: allegro: fix module removal if initialization failed
If the module probe finished, but the firmware initialization failed, removing the module must not revert the firmware initialization.
Add a field to track the status of the firmware initialization and only roll it back, if the firmware was successfully initialized.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|