mbox series

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

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

Message

Michael Tretter July 13, 2020, 2:42 p.m. UTC
This is v2 of the series to add support for the firmware version 2019.2 to the
allegro driver.

The changes compared to v1:

- Change the return type of allegro_mbox_notify() to void. The return
  value was neither checked, nor is there anything we can do, if an error
  occurs, thus there is no need to return an error.

- Add the string.h to allegro-mail.c, which is necessary for memcpy().

Motivation of the patch series in the cover letter of v1:

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.

Updated v4l2-compliance result:

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

Compliance test for allegro device /dev/video3:

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/video3 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
	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/video3: 50, Succeeded: 50, Failed: 0, Warnings: 0

Michael

Changelog:

v1 -> v2:

- change allegro_mbox_notify() to void
- add missing string.h header

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  | 383 +++++++------
 .../staging/media/allegro-dvt/allegro-mail.c  | 507 ++++++++++++++++++
 .../staging/media/allegro-dvt/allegro-mail.h  | 111 ++--
 3 files changed, 800 insertions(+), 201 deletions(-)