Skip to content

Commit

Permalink
Revert "msm: implement f4l2_try_fmt"
Browse files Browse the repository at this point in the history
This reverts commit 4f95f70.
  • Loading branch information
lance.zhou committed Sep 1, 2023
1 parent 54eb7b8 commit 8d60b36
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 145 deletions.
12 changes: 4 additions & 8 deletions arch/arm64/configs/sagit_user_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,10 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
# CONFIG_CPU_BOOST is not set
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
# CONFIG_CPU_INPUT_BOOST is not set
CONFIG_INPUT_BOOST_DURATION_MS=40
CONFIG_WAKE_BOOST_DURATION_MS=1000
CONFIG_INPUT_BOOST_FREQ_LP=960000
CONFIG_INPUT_BOOST_FREQ_PERF=300000

#
# CPU frequency scaling drivers
Expand Down Expand Up @@ -4630,16 +4634,8 @@ CONFIG_RPCSEC_GSS_KRB5=y
CONFIG_SUNRPC_DEBUG=y
# CONFIG_CEPH_FS is not set
CONFIG_CIFS=y
# CONFIG_CIFS_STATS is not set
# CONFIG_CIFS_WEAK_PW_HASH is not set
# CONFIG_CIFS_UPCALL is not set
# CONFIG_CIFS_XATTR is not set
CONFIG_CIFS_DEBUG=y
# CONFIG_CIFS_DEBUG2 is not set
# CONFIG_CIFS_DFS_UPCALL is not set
CONFIG_CIFS_SMB2=y
CONFIG_CIFS_SMB311=y
# CONFIG_CIFS_FSCACHE is not set
# CONFIG_NCP_FS is not set
# CONFIG_CODA_FS is not set
# CONFIG_AFS_FS is not set
Expand Down
9 changes: 0 additions & 9 deletions drivers/media/platform/msm/vidc/msm_v4l2_vidc.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,6 @@ static int msm_v4l2_querycap(struct file *filp, void *fh,
return msm_vidc_querycap((void *)vidc_inst, cap);
}

static int msm_v4l2_try_fmt(struct file *filp, void *fh,
struct v4l2_format *f)
{
struct msm_vidc_inst *vidc_inst = get_vidc_inst(filp, fh);
return msm_vidc_try_fmt((void *)vidc_inst, f);
}

int msm_v4l2_enum_fmt(struct file *file, void *fh,
struct v4l2_fmtdesc *f)
{
Expand Down Expand Up @@ -253,8 +246,6 @@ static const struct v4l2_ioctl_ops msm_v4l2_ioctl_ops = {
.vidioc_s_fmt_vid_out_mplane = msm_v4l2_s_fmt,
.vidioc_g_fmt_vid_cap_mplane = msm_v4l2_g_fmt,
.vidioc_g_fmt_vid_out_mplane = msm_v4l2_g_fmt,
.vidioc_try_fmt_vid_cap_mplane = msm_v4l2_try_fmt,
.vidioc_try_fmt_vid_out_mplane = msm_v4l2_try_fmt,
.vidioc_reqbufs = msm_v4l2_reqbufs,
.vidioc_prepare_buf = msm_v4l2_prepare_buf,
.vidioc_qbuf = msm_v4l2_qbuf,
Expand Down
55 changes: 0 additions & 55 deletions drivers/media/platform/msm/vidc/msm_vdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1225,61 +1225,6 @@ static int set_default_properties(struct msm_vidc_inst *inst)
return rc;
}

static const struct msm_vidc_format *
vdec_try_fmt_common(struct msm_vidc_inst *inst, struct v4l2_format *f)
{
struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp;
struct v4l2_plane_pix_format *pfmt = pixmp->plane_fmt;
const struct msm_vidc_format *fmt;
u32 szimage;

memset(pfmt[0].reserved, 0, sizeof(pfmt[0].reserved));
memset(pixmp->reserved, 0, sizeof(pixmp->reserved));

fmt = msm_comm_get_pixel_fmt_fourcc(vdec_formats, ARRAY_SIZE(vdec_formats), pixmp->pixelformat, f->type);
if (!fmt) {
if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
pixmp->pixelformat = V4L2_PIX_FMT_NV12;
else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
pixmp->pixelformat = V4L2_PIX_FMT_H264;
else
return NULL;
fmt = msm_comm_get_pixel_fmt_fourcc(vdec_formats, ARRAY_SIZE(vdec_formats), pixmp->pixelformat, f->type);
if (!fmt)
return NULL;
}

if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
pixmp->height = ALIGN(pixmp->height, 32);

if (pixmp->field == V4L2_FIELD_ANY)
pixmp->field = V4L2_FIELD_NONE;
pixmp->num_planes = 1;
pixmp->flags = 0;

szimage = fmt->get_frame_size(0,
pixmp->height, pixmp->width);

if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
unsigned int stride = pixmp->width;

pfmt[0].sizeimage = szimage;
pfmt[0].bytesperline = ALIGN(stride, 128);
} else {
pfmt[0].sizeimage = clamp_t(u32, pfmt[0].sizeimage, 0, SZ_8M);
pfmt[0].sizeimage = max(pfmt[0].sizeimage, szimage);
pfmt[0].bytesperline = 0;
}

return fmt;
}

int msm_vdec_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
{
vdec_try_fmt_common(inst, f);
return 0;
}

int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
{
struct msm_vidc_format *fmt = NULL;
Expand Down
1 change: 0 additions & 1 deletion drivers/media/platform/msm/vidc/msm_vdec.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ int msm_vdec_streamon(struct msm_vidc_inst *inst, enum v4l2_buf_type i);
int msm_vdec_streamoff(struct msm_vidc_inst *inst, enum v4l2_buf_type i);
int msm_vdec_cmd(struct msm_vidc_inst *inst, struct v4l2_decoder_cmd *dec);
int msm_vdec_s_parm(struct msm_vidc_inst *inst, struct v4l2_streamparm *a);
int msm_vdec_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f);
const struct vb2_ops *msm_vdec_get_vb2q_ops(void);
void msm_vdec_g_ctrl(struct msm_vidc_ctrl **ctrls, int *num_ctrls);
void msm_vdec_ctrl_sort(void);
Expand Down
55 changes: 0 additions & 55 deletions drivers/media/platform/msm/vidc/msm_venc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1541,61 +1541,6 @@ static struct msm_vidc_format venc_formats[] = {
},
};

static const struct msm_vidc_format *
venc_try_fmt_common(struct msm_vidc_inst *inst, struct v4l2_format *f)
{
struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp;
struct v4l2_plane_pix_format *pfmt = pixmp->plane_fmt;
const struct msm_vidc_format *fmt;
u32 sizeimage;

memset(pfmt[0].reserved, 0, sizeof(pfmt[0].reserved));
memset(pixmp->reserved, 0, sizeof(pixmp->reserved));

fmt = msm_comm_get_pixel_fmt_fourcc(venc_formats, ARRAY_SIZE(venc_formats), pixmp->pixelformat, f->type);
if (!fmt) {
if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
pixmp->pixelformat = V4L2_PIX_FMT_H264;
else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
pixmp->pixelformat = V4L2_PIX_FMT_NV12;
else
return NULL;
fmt = msm_comm_get_pixel_fmt_fourcc(venc_formats, ARRAY_SIZE(venc_formats), pixmp->pixelformat, f->type);
if (!fmt)
return NULL;
}

pixmp->width = ALIGN(pixmp->width, 128);
pixmp->height = ALIGN(pixmp->height, 32);

pixmp->width = ALIGN(pixmp->width, 2);
pixmp->height = ALIGN(pixmp->height, 2);

if (pixmp->field == V4L2_FIELD_ANY)
pixmp->field = V4L2_FIELD_NONE;
pixmp->num_planes = 1;
pixmp->flags = 0;

sizeimage = fmt->get_frame_size(0,
pixmp->height, pixmp->width);

pfmt[0].sizeimage = max(ALIGN(pfmt[0].sizeimage, SZ_4K), sizeimage);

if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
pfmt[0].bytesperline = ALIGN(pixmp->width, 128);
else
pfmt[0].bytesperline = 0;

return fmt;
}

int msm_venc_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
{
venc_try_fmt_common(inst, f);

return 0;
}

static int msm_venc_set_csc(struct msm_vidc_inst *inst)
{
int rc = 0;
Expand Down
1 change: 0 additions & 1 deletion drivers/media/platform/msm/vidc/msm_venc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ int msm_venc_streamon(struct msm_vidc_inst *inst, enum v4l2_buf_type i);
int msm_venc_streamoff(struct msm_vidc_inst *inst, enum v4l2_buf_type i);
int msm_venc_cmd(struct msm_vidc_inst *inst, struct v4l2_encoder_cmd *enc);
int msm_venc_s_parm(struct msm_vidc_inst *inst, struct v4l2_streamparm *a);
int msm_venc_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f);
struct vb2_ops *msm_venc_get_vb2q_ops(void);

#endif
15 changes: 0 additions & 15 deletions drivers/media/platform/msm/vidc/msm_vidc.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,6 @@ int msm_vidc_querycap(void *instance, struct v4l2_capability *cap)
}
EXPORT_SYMBOL(msm_vidc_querycap);

int msm_vidc_try_fmt(void *instance, struct v4l2_format *f)
{
struct msm_vidc_inst *inst = instance;

if (!inst)
return -EINVAL;

if (inst->session_type == MSM_VIDC_DECODER)
return msm_vdec_try_fmt(inst, f);
else if (inst->session_type == MSM_VIDC_ENCODER)
return msm_venc_try_fmt(instance, f);
return -EINVAL;
}
EXPORT_SYMBOL(msm_vidc_try_fmt);

int msm_vidc_enum_fmt(void *instance, struct v4l2_fmtdesc *f)
{
struct msm_vidc_inst *inst = instance;
Expand Down
3 changes: 3 additions & 0 deletions drivers/media/v4l2-core/v4l2-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,9 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops,
* Drivers MUST fill in device_caps, so check for this and
* warn if it was forgotten.
*/
WARN(!(cap->capabilities & V4L2_CAP_DEVICE_CAPS) ||
!cap->device_caps, "Bad caps for driver %s, %x %x",
cap->driver, cap->capabilities, cap->device_caps);
cap->device_caps |= V4L2_CAP_EXT_PIX_FORMAT;

return ret;
Expand Down
Binary file modified drivers/platform/msm/ipa/ipa_common
Binary file not shown.
1 change: 0 additions & 1 deletion include/media/msm_vidc.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,4 @@ int msm_vidc_unsubscribe_event(void *instance,
const struct v4l2_event_subscription *sub);
int msm_vidc_dqevent(void *instance, struct v4l2_event *event);
int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize);
int msm_vidc_try_fmt(void *instance, struct v4l2_format *f);
#endif

0 comments on commit 8d60b36

Please sign in to comment.