Skip to content

Commit cf64a1d

Browse files
jc-kynesimpelwell
authored andcommitted
media/rpivid: Make SPS / PPS optional in a request
SPS & PPS are optional in requests. Fix. The framework keeps the last value so this is mostly a matter of changing .required to false when requesting the controls. Check that SPS has ever been set on frame start, PPS is valid if all zeros so is at best tricky to check. Signed-off-by: John Cox <[email protected]>
1 parent a44f17d commit cf64a1d

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

drivers/staging/media/rpivid/rpivid.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ static const struct rpivid_control rpivid_ctrls[] = {
4040
.id = V4L2_CID_STATELESS_HEVC_SPS,
4141
.ops = &rpivid_hevc_sps_ctrl_ops,
4242
},
43-
.required = true,
43+
.required = false,
4444
},
4545
{
4646
.cfg = {
4747
.id = V4L2_CID_STATELESS_HEVC_PPS,
4848
.ops = &rpivid_hevc_pps_ctrl_ops,
4949
},
50-
.required = true,
50+
.required = false,
5151
},
5252
{
5353
.cfg = {

drivers/staging/media/rpivid/rpivid_h265.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,12 @@ static void rpivid_h265_setup(struct rpivid_ctx *ctx, struct rpivid_run *run)
17261726
unsigned int ctb_size_y;
17271727
bool sps_changed = false;
17281728

1729+
if (!is_sps_set(run->h265.sps)) {
1730+
v4l2_warn(&dev->v4l2_dev, "SPS never set\n");
1731+
goto fail;
1732+
}
1733+
// Can't check for PPS easily as all 0's looks valid to me
1734+
17291735
if (memcmp(&s->sps, run->h265.sps, sizeof(s->sps)) != 0) {
17301736
/* SPS changed */
17311737
v4l2_info(&dev->v4l2_dev, "SPS changed\n");

drivers/staging/media/rpivid/rpivid_video.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,6 @@ static int rpivid_hevc_validate_sps(const struct v4l2_ctrl_hevc_sps * const sps)
257257
return 1;
258258
}
259259

260-
static inline int is_sps_set(const struct v4l2_ctrl_hevc_sps * const sps)
261-
{
262-
return sps && sps->pic_width_in_luma_samples != 0;
263-
}
264-
265260
static u32 pixelformat_from_sps(const struct v4l2_ctrl_hevc_sps * const sps,
266261
const int index)
267262
{

drivers/staging/media/rpivid/rpivid_video.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ struct rpivid_format {
2020
unsigned int capabilities;
2121
};
2222

23+
static inline int is_sps_set(const struct v4l2_ctrl_hevc_sps * const sps)
24+
{
25+
return sps && sps->pic_width_in_luma_samples != 0;
26+
}
27+
2328
extern const struct v4l2_ioctl_ops rpivid_ioctl_ops;
2429

2530
int rpivid_queue_init(void *priv, struct vb2_queue *src_vq,

0 commit comments

Comments
 (0)