Lines Matching refs:vscaler
136 vimc_scaler_pad_format(struct vimc_scaler_device *vscaler, in vimc_scaler_pad_format() argument
141 return v4l2_subdev_get_try_format(&vscaler->sd, sd_state, pad); in vimc_scaler_pad_format()
143 return &vscaler->fmt[pad]; in vimc_scaler_pad_format()
147 vimc_scaler_pad_crop(struct vimc_scaler_device *vscaler, in vimc_scaler_pad_crop() argument
152 return v4l2_subdev_get_try_crop(&vscaler->sd, sd_state, in vimc_scaler_pad_crop()
155 return &vscaler->crop_rect; in vimc_scaler_pad_crop()
162 struct vimc_scaler_device *vscaler = v4l2_get_subdevdata(sd); in vimc_scaler_get_fmt() local
164 format->format = *vimc_scaler_pad_format(vscaler, sd_state, format->pad, in vimc_scaler_get_fmt()
173 struct vimc_scaler_device *vscaler = v4l2_get_subdevdata(sd); in vimc_scaler_set_fmt() local
177 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE && vscaler->src_frame) in vimc_scaler_set_fmt()
180 fmt = vimc_scaler_pad_format(vscaler, sd_state, format->pad, format->which); in vimc_scaler_set_fmt()
218 crop = vimc_scaler_pad_crop(vscaler, sd_state, format->which); in vimc_scaler_set_fmt()
224 src_fmt = vimc_scaler_pad_format(vscaler, sd_state, VIMC_SCALER_SRC, in vimc_scaler_set_fmt()
238 struct vimc_scaler_device *vscaler = v4l2_get_subdevdata(sd); in vimc_scaler_get_selection() local
246 sel->r = *vimc_scaler_pad_crop(vscaler, sd_state, sel->which); in vimc_scaler_get_selection()
249 sink_fmt = vimc_scaler_pad_format(vscaler, sd_state, VIMC_SCALER_SINK, in vimc_scaler_get_selection()
275 struct vimc_scaler_device *vscaler = v4l2_get_subdevdata(sd); in vimc_scaler_set_selection() local
283 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE && vscaler->src_frame) in vimc_scaler_set_selection()
286 crop_rect = vimc_scaler_pad_crop(vscaler, sd_state, sel->which); in vimc_scaler_set_selection()
287 sink_fmt = vimc_scaler_pad_format(vscaler, sd_state, VIMC_SCALER_SINK, in vimc_scaler_set_selection()
307 struct vimc_scaler_device *vscaler = v4l2_get_subdevdata(sd); in vimc_scaler_s_stream() local
313 if (vscaler->src_frame) in vimc_scaler_s_stream()
317 vpix = vimc_pix_map_by_code(vscaler->fmt[VIMC_SCALER_SINK].code); in vimc_scaler_s_stream()
318 vscaler->bpp = vpix->bpp; in vimc_scaler_s_stream()
321 frame_size = vscaler->fmt[VIMC_SCALER_SRC].width in vimc_scaler_s_stream()
322 * vscaler->fmt[VIMC_SCALER_SRC].height * vscaler->bpp; in vimc_scaler_s_stream()
327 vscaler->src_frame = vmalloc(frame_size); in vimc_scaler_s_stream()
328 if (!vscaler->src_frame) in vimc_scaler_s_stream()
332 if (!vscaler->src_frame) in vimc_scaler_s_stream()
335 vfree(vscaler->src_frame); in vimc_scaler_s_stream()
336 vscaler->src_frame = NULL; in vimc_scaler_s_stream()
351 static void vimc_scaler_fill_src_frame(const struct vimc_scaler_device *const vscaler, in vimc_scaler_fill_src_frame() argument
354 const struct v4l2_mbus_framefmt *src_fmt = &vscaler->fmt[VIMC_SCALER_SRC]; in vimc_scaler_fill_src_frame()
355 const struct v4l2_rect *r = &vscaler->crop_rect; in vimc_scaler_fill_src_frame()
356 unsigned int snk_width = vscaler->fmt[VIMC_SCALER_SINK].width; in vimc_scaler_fill_src_frame()
358 u8 *walker = vscaler->src_frame; in vimc_scaler_fill_src_frame()
365 y_offset = snk_y * snk_width * vscaler->bpp; in vimc_scaler_fill_src_frame()
371 x_offset = snk_x * vscaler->bpp; in vimc_scaler_fill_src_frame()
373 memcpy(walker, &sink_frame[index], vscaler->bpp); in vimc_scaler_fill_src_frame()
374 walker += vscaler->bpp; in vimc_scaler_fill_src_frame()
382 struct vimc_scaler_device *vscaler = container_of(ved, struct vimc_scaler_device, in vimc_scaler_process_frame() local
386 if (!vscaler->src_frame) in vimc_scaler_process_frame()
389 vimc_scaler_fill_src_frame(vscaler, sink_frame); in vimc_scaler_process_frame()
391 return vscaler->src_frame; in vimc_scaler_process_frame()
396 struct vimc_scaler_device *vscaler = in vimc_scaler_release() local
399 media_entity_cleanup(vscaler->ved.ent); in vimc_scaler_release()
400 kfree(vscaler); in vimc_scaler_release()
407 struct vimc_scaler_device *vscaler; in vimc_scaler_add() local
411 vscaler = kzalloc(sizeof(*vscaler), GFP_KERNEL); in vimc_scaler_add()
412 if (!vscaler) in vimc_scaler_add()
416 vscaler->pads[VIMC_SCALER_SINK].flags = MEDIA_PAD_FL_SINK; in vimc_scaler_add()
417 vscaler->pads[VIMC_SCALER_SRC].flags = MEDIA_PAD_FL_SOURCE; in vimc_scaler_add()
419 ret = vimc_ent_sd_register(&vscaler->ved, &vscaler->sd, v4l2_dev, in vimc_scaler_add()
422 vscaler->pads, &vimc_scaler_ops); in vimc_scaler_add()
424 kfree(vscaler); in vimc_scaler_add()
428 vscaler->ved.process_frame = vimc_scaler_process_frame; in vimc_scaler_add()
429 vscaler->ved.dev = vimc->mdev.dev; in vimc_scaler_add()
432 vscaler->fmt[VIMC_SCALER_SINK] = fmt_default; in vimc_scaler_add()
433 vscaler->fmt[VIMC_SCALER_SRC] = fmt_default; in vimc_scaler_add()
436 vscaler->crop_rect = crop_rect_default; in vimc_scaler_add()
438 return &vscaler->ved; in vimc_scaler_add()