struct v4l2_streamparm *parms)
{
struct vivi_dev *dev = video_drvdata(file);
- struct v4l2_amlogic_parm *ap
- = (struct v4l2_amlogic_parm *)&parms->parm.capture;
if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
- memset(ap, 0, sizeof(struct v4l2_amlogic_parm));
- *ap = dev->am_parm;
-
+ memcpy(parms->parm.raw_data, (u8 *)&dev->am_parm,
+ sizeof(struct v4l2_amlogic_parm));
return 0;
}
{
struct vivi_dev *dev = video_drvdata(file);
struct vivi_fh *fh = NULL;
- int retval = 0;
struct videobuf_res_privdata *res = NULL;
char *bstart = NULL;
unsigned int bsize = 0;
}
res = kzalloc(sizeof(*res), GFP_KERNEL);
if ((res == NULL) || (dev->res != NULL)) {
+ kfree(res);
dev->users--;
mutex_unlock(&dev->mutex);
return -ENOMEM;
kfree(res);
dev->users--;
mutex_unlock(&dev->mutex);
- retval = -ENOMEM;
+ return -ENOMEM;
}
}
mutex_unlock(&dev->mutex);
rel_vdev: video_device_release(vfd);
unreg_dev: v4l2_device_unregister(&dev->v4l2_dev);
-free_dev: kfree(dev);
+free_dev:
dev->res = NULL;
+ kfree(dev);
return ret;
}
if (dev_id < VIDEOSYNC_S_COUNT)
dev_s = &vp_dev->video_prov[dev_id];
- if (dev_s != NULL && dev_s->mapped)
+ if (dev_s && dev_s->mapped) {
dev_s->show_first_frame_nosync = info[1];
- pr_info("show_first_frame_nosync =%d\n",
- dev_s->show_first_frame_nosync);
+ pr_info("show_first_frame_nosync =%d\n",
+ dev_s->show_first_frame_nosync);
+ }
}
}
break;
int toggled_cnt)
{
- u32 pts = next_vf->pts;
+ u32 pts;
#ifdef VIDEO_PTS_CHASE
u32 vid_pts, scr_pts;
#endif
/*u32 dur_pts = 0;*/
bool expired;
+ if (!next_vf)
+ return false;
+
+ pts = next_vf->pts;
+
if (dev_s->freerun_mode == FREERUN_NODUR)
return true;
systime,
vsync_pts_inc);
- if (expired && next_vf && next_vf->next_vf_pts_valid &&
+ if (expired && next_vf->next_vf_pts_valid &&
pts_enforce_pulldown &&
next_vf->next_vf_pts &&
(toggled_cnt > 0) &&
expired = false;
vp_print(dev_s->vf_receiver_name, PRINT_PATTERN,
"force expired false\n");
- } else if (!expired && next_vf && next_vf->next_vf_pts_valid &&
+ } else if (!expired && next_vf->next_vf_pts_valid &&
pts_enforce_pulldown &&
next_vf->next_vf_pts &&
(toggled_cnt == 0) &&
#endif
#ifdef TV_3D_FUNCTION_OPEN
/*turn off vertical scaler when 3d display */
- if ((layer->dispbuf->type & VIDTYPE_MVC) ||
+ if ((layer->dispbuf &&
+ (layer->dispbuf->type & VIDTYPE_MVC)) ||
last_mode_3d) {
layer->sc_setting.sc_v_enable = false;
config_3d_vd2_pps(
pr_info("call process_fun\n");
}
#endif
- cur_dispbuf->process_fun(
- cur_dispbuf->private_data,
- vd_layer[0].start_x_lines |
- (cur_frame_par->vscale_skip_count <<
- 24) | (frame_par_di_set << 16),
- vd_layer[0].end_x_lines,
- vd_layer[0].start_y_lines,
- vd_layer[0].end_y_lines,
- cur_dispbuf);
+ if (cur_frame_par)
+ cur_dispbuf->process_fun(
+ cur_dispbuf->private_data,
+ vd_layer[0].start_x_lines |
+ (cur_frame_par->vscale_skip_count <<
+ 24) | (frame_par_di_set << 16),
+ vd_layer[0].end_x_lines,
+ vd_layer[0].start_y_lines,
+ vd_layer[0].end_y_lines,
+ cur_dispbuf);
di_post_process_done = true;
}
exit:
struct class_attribute *attr,
const char *buf, size_t count)
{
- size_t r;
+ int r;
int value;
r = kstrtoint(buf, 0, &value);
struct class_attribute *attr,
const char *buf, size_t count)
{
- size_t r;
+ int r;
int value;
r = kstrtoint(buf, 0, &value);
VI_HIST_V_START_END, 0);
WRITE_VCBUS_REG(
VI_HIST_PIC_SIZE,
- (ginfo->width & 0xfff) |
- (ginfo->field_height << 16));
+ 1080 | 1920);
WRITE_VCBUS_REG(VI_HIST_CTRL, 0x3801);
}
}
struct vppfilter_mode_s *filter = &next_frame_par->vpp_filter;
u32 wide_mode;
s32 height_shift = 0;
- u32 height_after_ratio;
+ u32 height_after_ratio = 0;
u32 aspect_factor;
s32 ini_vphase;
u32 w_in = width_in;
sar_height = 1;
}
- if (ext_sar && sar_width && sar_height) {
+ if (ext_sar && sar_width && sar_height && width_in) {
aspect_factor =
div_u64((u64)256ULL *
(u64)sar_height *
u64 tmp = (u64)((u64)(width_out * width_in) * aspect_ratio_out);
tmp = tmp >> 2;
- height_after_ratio =
- div_u64((u64)256ULL *
- (u64)w_in *
- (u64)height_out *
- (u64)sar_height *
- (u64)height_in,
- (u32)tmp);
+ if (tmp != 0)
+ height_after_ratio =
+ div_u64((u64)256ULL *
+ (u64)w_in *
+ (u64)height_out *
+ (u64)sar_height *
+ (u64)height_in,
+ (u32)tmp);
height_after_ratio /= sar_width;
aspect_factor = (height_after_ratio << 8) / h_in;
if (super_debug)
u64 tmp = (u64)((u64)(width_out * h_in) * aspect_ratio_out);
tmp = tmp >> 2;
- aspect_factor =
- div_u64((unsigned long long)w_in * height_out *
- (aspect_factor << 8),
- (u32)tmp);
+ if (tmp != 0)
+ aspect_factor =
+ div_u64((unsigned long long)w_in * height_out *
+ (aspect_factor << 8),
+ (u32)tmp);
height_after_ratio = (h_in * aspect_factor) >> 8;
}