mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
CHROMIUM: [media] rk3288-vpu: Implement VIDIOC_ENUM_FRAMESIZES
This patch adds implementations of VIDIOC_ENUM_FRAMESIZES for rk3288-vpu encoder and decoder devices. This IOCTL lets the userspace learn about frame size limits of the hardware. BUG=chromium:485409 TEST=vda/veatests, Chrome with crrev.com/1097913002. Signed-off-by: Tomasz Figa <tfiga@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/269867 Reviewed-by: Heng-ruey Hsu <henryhsu@google.com> Change-Id: Ia23a89c2f380b16cc7ef8338d33946d62f8a68fe Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Signed-off-by: Yakir Yang <ykk@rock-chips.com>
This commit is contained in:
@@ -178,6 +178,37 @@ static int vidioc_querycap(struct file *file, void *priv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_enum_framesizes(struct file *file, void *prov,
|
||||
struct v4l2_frmsizeenum *fsize)
|
||||
{
|
||||
struct v4l2_frmsize_stepwise *s = &fsize->stepwise;
|
||||
struct rk3288_vpu_fmt *fmt;
|
||||
|
||||
if (fsize->index != 0) {
|
||||
vpu_debug(0, "invalid frame size index (expected 0, got %d)\n",
|
||||
fsize->index);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
fmt = find_format(fsize->pixel_format, true);
|
||||
if (!fmt) {
|
||||
vpu_debug(0, "unsupported bitstream format (%08x)\n",
|
||||
fsize->pixel_format);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
|
||||
|
||||
s->min_width = RK3288_DEC_MIN_WIDTH;
|
||||
s->max_width = RK3288_DEC_MAX_WIDTH;
|
||||
s->step_width = MB_DIM;
|
||||
s->min_height = RK3288_DEC_MIN_HEIGHT;
|
||||
s->max_height = RK3288_DEC_MAX_HEIGHT;
|
||||
s->step_height = MB_DIM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_enum_fmt(struct v4l2_fmtdesc *f, bool out)
|
||||
{
|
||||
struct rk3288_vpu_fmt *fmt;
|
||||
@@ -767,6 +798,7 @@ static const struct v4l2_ctrl_ops rk3288_vpu_dec_ctrl_ops = {
|
||||
|
||||
static const struct v4l2_ioctl_ops rk3288_vpu_dec_ioctl_ops = {
|
||||
.vidioc_querycap = vidioc_querycap,
|
||||
.vidioc_enum_framesizes = vidioc_enum_framesizes,
|
||||
.vidioc_enum_fmt_vid_cap_mplane = vidioc_enum_fmt_vid_cap_mplane,
|
||||
.vidioc_enum_fmt_vid_out_mplane = vidioc_enum_fmt_vid_out_mplane,
|
||||
.vidioc_g_fmt_vid_cap_mplane = vidioc_g_fmt,
|
||||
|
||||
@@ -370,6 +370,37 @@ static int vidioc_querycap(struct file *file, void *priv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_enum_framesizes(struct file *file, void *prov,
|
||||
struct v4l2_frmsizeenum *fsize)
|
||||
{
|
||||
struct v4l2_frmsize_stepwise *s = &fsize->stepwise;
|
||||
struct rk3288_vpu_fmt *fmt;
|
||||
|
||||
if (fsize->index != 0) {
|
||||
vpu_debug(0, "invalid frame size index (expected 0, got %d)\n",
|
||||
fsize->index);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
fmt = find_format(fsize->pixel_format, true);
|
||||
if (!fmt) {
|
||||
vpu_debug(0, "unsupported bitstream format (%08x)\n",
|
||||
fsize->pixel_format);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
|
||||
|
||||
s->min_width = RK3288_ENC_MIN_WIDTH;
|
||||
s->max_width = RK3288_ENC_MAX_WIDTH;
|
||||
s->step_width = MB_DIM;
|
||||
s->min_height = RK3288_ENC_MIN_HEIGHT;
|
||||
s->max_height = RK3288_ENC_MAX_HEIGHT;
|
||||
s->step_height = MB_DIM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_enum_fmt(struct v4l2_fmtdesc *f, bool out)
|
||||
{
|
||||
struct rk3288_vpu_fmt *fmt;
|
||||
@@ -999,6 +1030,7 @@ out:
|
||||
|
||||
static const struct v4l2_ioctl_ops rk3288_vpu_enc_ioctl_ops = {
|
||||
.vidioc_querycap = vidioc_querycap,
|
||||
.vidioc_enum_framesizes = vidioc_enum_framesizes,
|
||||
.vidioc_enum_fmt_vid_cap_mplane = vidioc_enum_fmt_vid_cap_mplane,
|
||||
.vidioc_enum_fmt_vid_out_mplane = vidioc_enum_fmt_vid_out_mplane,
|
||||
.vidioc_g_fmt_vid_cap_mplane = vidioc_g_fmt,
|
||||
|
||||
Reference in New Issue
Block a user