Skip to content

Commit

Permalink
media: allegro: add field for number of buffers
Browse files Browse the repository at this point in the history
When pushing the buffers for the intermediate and reference frames to
the MCU, the driver relied on the message size to calculate the number
of buffers. As it is not necessary anymore to keep the messages binary
compatible to the firmware, we can just explicitly write the number of
buffers into the message.

Signed-off-by: Michael Tretter <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
tretter authored and sigmaris committed Aug 8, 2020
1 parent 9763f54 commit 64ea4fe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/staging/media/allegro-dvt/allegro-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,7 @@ static int allegro_mcu_push_buffer_internal(struct allegro_channel *channel,
msg->header.length = size - sizeof(msg->header);
msg->header.type = type;
msg->channel_id = channel->mcu_channel_id;
msg->num_buffers = num_buffers;

buffer = msg->buffer;
list_for_each_entry(al_buffer, list, head) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/media/allegro-dvt/allegro-mail.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ allegro_enc_push_buffers(u32 *dst, struct mcu_msg_push_buffers_internal *msg)
{
unsigned int i = 0;
struct mcu_msg_push_buffers_internal_buffer *buffer;
unsigned int num_buffers = (msg->header.length - 4) / sizeof(*buffer);
unsigned int num_buffers = msg->num_buffers;
unsigned int j;

dst[i++] = msg->channel_id;
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/media/allegro-dvt/allegro-mail.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ struct mcu_msg_push_buffers_internal_buffer {
struct mcu_msg_push_buffers_internal {
struct mcu_msg_header header;
u32 channel_id;
size_t num_buffers;
struct mcu_msg_push_buffers_internal_buffer buffer[];
} __attribute__ ((__packed__));

Expand Down

0 comments on commit 64ea4fe

Please sign in to comment.