Skip to content

Commit 20854b5

Browse files
6by9pelwell
authored andcommitted
vc04_services: bcm2835-codec: Set port format from s_selection
s_selection allows the crop region of an uncompressed pixel format to be specified, but it wasn't passing the setting on to the firmware. Depending on call order this would potentially mean that the crop wasn't actioned. Set the port format on s_selection if we have a component created. Signed-off-by: Dave Stevenson <[email protected]>
1 parent de20105 commit 20854b5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,6 +1901,8 @@ static int vidioc_s_selection(struct file *file, void *priv,
19011901
{
19021902
struct bcm2835_codec_ctx *ctx = file2ctx(file);
19031903
struct bcm2835_codec_q_data *q_data = NULL;
1904+
struct vchiq_mmal_port *port = NULL;
1905+
int ret;
19041906

19051907
/*
19061908
* The selection API takes V4L2_BUF_TYPE_VIDEO_CAPTURE and
@@ -1916,12 +1918,16 @@ static int vidioc_s_selection(struct file *file, void *priv,
19161918
if (ctx->dev->role == ENCODE || ctx->dev->role == ENCODE_IMAGE)
19171919
return -EINVAL;
19181920
q_data = &ctx->q_data[V4L2_M2M_DST];
1921+
if (ctx->component)
1922+
port = &ctx->component->output[0];
19191923
break;
19201924
case V4L2_BUF_TYPE_VIDEO_OUTPUT:
19211925
/* OUTPUT on deoder is not valid. */
19221926
if (ctx->dev->role == DECODE)
19231927
return -EINVAL;
19241928
q_data = &ctx->q_data[V4L2_M2M_SRC];
1929+
if (ctx->component)
1930+
port = &ctx->component->input[0];
19251931
break;
19261932
default:
19271933
return -EINVAL;
@@ -2006,6 +2012,17 @@ static int vidioc_s_selection(struct file *file, void *priv,
20062012
break;
20072013
}
20082014

2015+
if (!port)
2016+
return 0;
2017+
2018+
setup_mmal_port_format(ctx, q_data, port);
2019+
ret = vchiq_mmal_port_set_format(ctx->dev->instance, port);
2020+
if (ret) {
2021+
v4l2_err(&ctx->dev->v4l2_dev, "%s: Failed vchiq_mmal_port_set_format on port, ret %d\n",
2022+
__func__, ret);
2023+
return -EINVAL;
2024+
}
2025+
20092026
return 0;
20102027
}
20112028

0 commit comments

Comments
 (0)