mbox series

[00/12] media: allegro: Add support for firmware 2019.2

Message ID 20200617114550.3235-1-m.tretter@pengutronix.de (mailing list archive)
Headers show
Series media: allegro: Add support for firmware 2019.2 | expand

Message

Michael Tretter June 17, 2020, 11:45 a.m. UTC
This series adds support for the firmware version 2019.2 to the allegro
driver.

The updated firmware contains updates and bugfixes. For example, VBR encoding
works much more reliable than with the firmware 2018.2. Unfortunately, I was
not able to find an actual changelog that lists the firmware changes. Even
more unfortunately, the firmware ABI is not stable across firmware versions.

Therefore, this series changes how messages for the mailbox are created.
Previously, the driver defined a struct mcu_msg_* for each message that can be
written directly into the mailbox. This approach is incompatible with support
for more than one firmware version. Now the driver converts the struct
mcu_msg_* into the binary format that is expected by the firmware. The struct
mcu_msg_* are still the same to reduce changes to the code that is used to
prepare the messages.

This separation allows to change the struct mcu_msg_* more freely, because it
is not bound to the firmware ABI anymore and allows to get rid of ugly hacks
like using the message size to determine the number of elements in the
PUSH_BUFFER_INTERMEDIATE and PUSH_BUFFER_REFERENCE message.

Patch 1 and 2 rework how the mails are handled and how the interface to the
mailbox works to simplify adding the conversion step.

Patch 3 adds the conversion of the struct mcu_msg_* to mailbox binary format.

Patches 4 to 11 update the now independent struct mcu_msg_* to prepare the
conversion into the binary format expected by the firmware 2019.2.

Patch 12 finally adds support for firmware 2019.2 by adding the conversion
step for the new message format.

Support for the firmware 2020.1 can be added by a patch similar to Patch 13,
but I did not properly test firmware 2020.1, yet.

Based on this series, I am also preparing a series to add H.265 support.
Further, another series will cleanup the messages in allegro-mail.h by removing
reserved fields and clarifying existing field names.

The v4l2-compliance result is as follows. I decided to not fix the warning
regarding S_PARM in this series, because I want to fix it in yet another
series that adds framerate handling with different framerates on OUTPUT and
CAPTURE.

v4l2-compliance SHA: de91e870c2355e0fe754176563660b92b8ee040b, 64 bits, 64-bit time_t

Compliance test for allegro device /dev/video0:

Driver Info:
	Driver name      : allegro
	Card type        : Allegro DVT Video Encoder
	Bus info         : platform:a0009000.video-codec
	Driver version   : 5.8.0
	Capabilities     : 0x84208000
		Video Memory-to-Memory
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x04208000
		Video Memory-to-Memory
		Streaming
		Extended Pix Format
	Detected Stateful Encoder

Required ioctls:
	test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
	test second /dev/video0 open: OK
	test VIDIOC_QUERYCAP: OK
	test VIDIOC_G/S_PRIORITY: OK
	test for unlimited opens: OK

	test invalid ioctls: OK
Debug ioctls:
	test VIDIOC_DBG_G/S_REGISTER: OK
	test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
	test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
	test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
	test VIDIOC_ENUMAUDIO: OK (Not Supported)
	test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
	test VIDIOC_G/S_AUDIO: OK (Not Supported)
	Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
	test VIDIOC_G/S_MODULATOR: OK (Not Supported)
	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
	test VIDIOC_ENUMAUDOUT: OK (Not Supported)
	test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
	test VIDIOC_G/S_AUDOUT: OK (Not Supported)
	Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
	test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
	test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
	test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
	test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls:
	test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
	test VIDIOC_QUERYCTRL: OK
	test VIDIOC_G/S_CTRL: OK
	test VIDIOC_G/S/TRY_EXT_CTRLS: OK
	test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
	test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
	Standard Controls: 16 Private Controls: 0

Format ioctls:
	test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
		warn: v4l2-test-formats.cpp(1332): S_PARM is supported for buftype 2, but not for ENUM_FRAMEINTERVALS
	test VIDIOC_G/S_PARM: OK
	test VIDIOC_G_FBUF: OK (Not Supported)
	test VIDIOC_G_FMT: OK
	test VIDIOC_TRY_FMT: OK
	test VIDIOC_S_FMT: OK
	test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
	test Cropping: OK (Not Supported)
	test Composing: OK (Not Supported)
	test Scaling: OK (Not Supported)

Codec ioctls:
	test VIDIOC_(TRY_)ENCODER_CMD: OK
	test VIDIOC_G_ENC_INDEX: OK (Not Supported)
	test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
	test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
	test VIDIOC_EXPBUF: OK
	test Requests: OK (Not Supported)

Test input 0:

Streaming ioctls:
	test read/write: OK (Not Supported)
	test blocking wait: OK
	Video Capture: Captured 60 buffers
	test MMAP (select): OK
	Video Capture: Captured 60 buffers
	test MMAP (epoll): OK
	test USERPTR (select): OK (Not Supported)
	test DMABUF: Cannot test, specify --expbuf-device

Total for allegro device /dev/video0: 50, Succeeded: 50, Failed: 0, Warnings: 1

Michael

Michael Tretter (12):
  media: allegro: rework mbox handling
  media: allegro: rework read/write to mailbox
  media: allegro: add explicit mail encoding and decoding
  media: allegro: add field for number of buffers
  media: allegro: don't pack MCU messages
  media: allegro: support handling firmware dependent values
  media: allegro: encode bit fields separately
  media: allegro: add config blob for channel
  media: allegro: set num_ref_idx using response of configured channels
  media: allegro: drop length field from message header
  media: allegro: add a version field to mcu messages
  media: allegro: add support for allegro firmware 2019.2

 .../staging/media/allegro-dvt/allegro-core.c  | 387 ++++++++------
 .../staging/media/allegro-dvt/allegro-mail.c  | 506 ++++++++++++++++++
 .../staging/media/allegro-dvt/allegro-mail.h  | 111 ++--
 3 files changed, 803 insertions(+), 201 deletions(-)