Lines Matching refs:vout

200 static int omap_vout_calculate_offset(struct omap_vout_device *vout)  in omap_vout_calculate_offset()  argument
203 struct v4l2_rect *crop = &vout->crop; in omap_vout_calculate_offset()
204 struct v4l2_pix_format *pix = &vout->pix; in omap_vout_calculate_offset()
205 int *cropped_offset = &vout->cropped_offset; in omap_vout_calculate_offset()
208 ovid = &vout->vid_info; in omap_vout_calculate_offset()
211 omap_vout_calculate_vrfb_offset(vout); in omap_vout_calculate_offset()
213 vout->line_length = line_length = pix->width; in omap_vout_calculate_offset()
223 vout->ps = ps; in omap_vout_calculate_offset()
229 v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "%s Offset:%x\n", in omap_vout_calculate_offset()
230 __func__, vout->cropped_offset); in omap_vout_calculate_offset()
238 static int video_mode_to_dss_mode(struct omap_vout_device *vout) in video_mode_to_dss_mode() argument
242 struct v4l2_pix_format *pix = &vout->pix; in video_mode_to_dss_mode()
245 ovid = &vout->vid_info; in video_mode_to_dss_mode()
278 static int omapvid_setup_overlay(struct omap_vout_device *vout, in omapvid_setup_overlay() argument
287 (outw != vout->pix.width || outh != vout->pix.height)) { in omapvid_setup_overlay()
292 vout->dss_mode = video_mode_to_dss_mode(vout); in omapvid_setup_overlay()
293 if (vout->dss_mode == -EINVAL) { in omapvid_setup_overlay()
301 if (is_rotation_90_or_270(vout)) { in omapvid_setup_overlay()
302 cropheight = vout->crop.width; in omapvid_setup_overlay()
303 cropwidth = vout->crop.height; in omapvid_setup_overlay()
304 pixwidth = vout->pix.height; in omapvid_setup_overlay()
306 cropheight = vout->crop.height; in omapvid_setup_overlay()
307 cropwidth = vout->crop.width; in omapvid_setup_overlay()
308 pixwidth = vout->pix.width; in omapvid_setup_overlay()
315 info.color_mode = vout->dss_mode; in omapvid_setup_overlay()
316 info.mirror = vout->mirror; in omapvid_setup_overlay()
321 info.global_alpha = vout->win.global_alpha; in omapvid_setup_overlay()
322 if (!is_rotation_enabled(vout)) { in omapvid_setup_overlay()
327 info.rotation = vout->rotation; in omapvid_setup_overlay()
332 v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, in omapvid_setup_overlay()
348 v4l2_warn(&vout->vid_dev->v4l2_dev, "setup_overlay failed\n"); in omapvid_setup_overlay()
355 static int omapvid_init(struct omap_vout_device *vout, dma_addr_t addr) in omapvid_init() argument
362 struct omapvideo_info *ovid = &vout->vid_info; in omapvid_init()
364 win = &vout->win; in omapvid_init()
378 switch (vout->rotation) { in omapvid_init()
405 ret = omapvid_setup_overlay(vout, ovl, posx, posy, in omapvid_init()
413 v4l2_warn(&vout->vid_dev->v4l2_dev, "apply_changes failed\n"); in omapvid_init()
420 static int omapvid_apply_changes(struct omap_vout_device *vout) in omapvid_apply_changes() argument
424 struct omapvideo_info *ovid = &vout->vid_info; in omapvid_apply_changes()
439 static int omapvid_handle_interlace_display(struct omap_vout_device *vout, in omapvid_handle_interlace_display() argument
444 if (vout->first_int) { in omapvid_handle_interlace_display()
445 vout->first_int = 0; in omapvid_handle_interlace_display()
456 vout->field_id ^= 1; in omapvid_handle_interlace_display()
457 if (fid != vout->field_id) { in omapvid_handle_interlace_display()
459 vout->field_id = fid; in omapvid_handle_interlace_display()
461 if (vout->cur_frm == vout->next_frm) in omapvid_handle_interlace_display()
464 vout->cur_frm->vbuf.vb2_buf.timestamp = ts; in omapvid_handle_interlace_display()
465 vout->cur_frm->vbuf.sequence = vout->sequence++; in omapvid_handle_interlace_display()
466 vb2_buffer_done(&vout->cur_frm->vbuf.vb2_buf, VB2_BUF_STATE_DONE); in omapvid_handle_interlace_display()
467 vout->cur_frm = vout->next_frm; in omapvid_handle_interlace_display()
469 if (list_empty(&vout->dma_queue) || in omapvid_handle_interlace_display()
470 (vout->cur_frm != vout->next_frm)) in omapvid_handle_interlace_display()
474 return vout->field_id; in omapvid_handle_interlace_display()
488 struct omap_vout_device *vout = (struct omap_vout_device *)arg; in omap_vout_isr() local
490 ovid = &vout->vid_info; in omap_vout_isr()
501 spin_lock(&vout->vbq_lock); in omap_vout_isr()
519 fid = omapvid_handle_interlace_display(vout, irqstatus, in omap_vout_isr()
532 if (!vout->first_int && (vout->cur_frm != vout->next_frm)) { in omap_vout_isr()
533 vout->cur_frm->vbuf.vb2_buf.timestamp = ts; in omap_vout_isr()
534 vout->cur_frm->vbuf.sequence = vout->sequence++; in omap_vout_isr()
535 vb2_buffer_done(&vout->cur_frm->vbuf.vb2_buf, VB2_BUF_STATE_DONE); in omap_vout_isr()
536 vout->cur_frm = vout->next_frm; in omap_vout_isr()
539 vout->first_int = 0; in omap_vout_isr()
540 if (list_empty(&vout->dma_queue)) in omap_vout_isr()
543 vout->next_frm = list_entry(vout->dma_queue.next, in omap_vout_isr()
545 list_del(&vout->next_frm->queue); in omap_vout_isr()
547 addr = vout->queued_buf_addr[vout->next_frm->vbuf.vb2_buf.index] in omap_vout_isr()
548 + vout->cropped_offset; in omap_vout_isr()
551 ret = omapvid_init(vout, addr); in omap_vout_isr()
559 ret = omapvid_apply_changes(vout); in omap_vout_isr()
564 spin_unlock(&vout->vbq_lock); in omap_vout_isr()
574 struct omap_vout_device *vout = video_drvdata(file); in vidioc_querycap() local
577 strscpy(cap->card, vout->vfd->name, sizeof(cap->card)); in vidioc_querycap()
579 "platform:%s.%d", VOUT_NAME, vout->vid); in vidioc_querycap()
600 struct omap_vout_device *vout = video_drvdata(file); in vidioc_g_fmt_vid_out() local
602 f->fmt.pix = vout->pix; in vidioc_g_fmt_vid_out()
613 struct omap_vout_device *vout = video_drvdata(file); in vidioc_try_fmt_vid_out() local
616 ovid = &vout->vid_info; in vidioc_try_fmt_vid_out()
626 vout->fbuf.fmt.height = timing->y_res; in vidioc_try_fmt_vid_out()
627 vout->fbuf.fmt.width = timing->x_res; in vidioc_try_fmt_vid_out()
640 struct omap_vout_device *vout = video_drvdata(file); in vidioc_s_fmt_vid_out() local
643 if (vb2_is_busy(&vout->vq)) in vidioc_s_fmt_vid_out()
646 ovid = &vout->vid_info; in vidioc_s_fmt_vid_out()
659 if ((is_rotation_enabled(vout)) && in vidioc_s_fmt_vid_out()
667 if (is_rotation_90_or_270(vout)) { in vidioc_s_fmt_vid_out()
668 vout->fbuf.fmt.height = timing->x_res; in vidioc_s_fmt_vid_out()
669 vout->fbuf.fmt.width = timing->y_res; in vidioc_s_fmt_vid_out()
671 vout->fbuf.fmt.height = timing->y_res; in vidioc_s_fmt_vid_out()
672 vout->fbuf.fmt.width = timing->x_res; in vidioc_s_fmt_vid_out()
681 vout->bpp = bpp; in vidioc_s_fmt_vid_out()
682 vout->pix = f->fmt.pix; in vidioc_s_fmt_vid_out()
683 vout->vrfb_bpp = 1; in vidioc_s_fmt_vid_out()
686 if (V4L2_PIX_FMT_YUYV == vout->pix.pixelformat || in vidioc_s_fmt_vid_out()
687 V4L2_PIX_FMT_UYVY == vout->pix.pixelformat) in vidioc_s_fmt_vid_out()
688 vout->vrfb_bpp = 2; in vidioc_s_fmt_vid_out()
691 omap_vout_new_format(&vout->pix, &vout->fbuf, &vout->crop, &vout->win); in vidioc_s_fmt_vid_out()
703 struct omap_vout_device *vout = video_drvdata(file); in vidioc_try_fmt_vid_overlay() local
708 ovid = &vout->vid_info; in vidioc_try_fmt_vid_overlay()
711 ret = omap_vout_try_window(&vout->fbuf, win); in vidioc_try_fmt_vid_overlay()
725 struct omap_vout_device *vout = video_drvdata(file); in vidioc_s_fmt_vid_overlay() local
728 ovid = &vout->vid_info; in vidioc_s_fmt_vid_overlay()
731 ret = omap_vout_new_window(&vout->crop, &vout->win, &vout->fbuf, win); in vidioc_s_fmt_vid_overlay()
739 vout->win.global_alpha = win->global_alpha; in vidioc_s_fmt_vid_overlay()
742 if (vout->fbuf.flags & (V4L2_FBUF_FLAG_CHROMAKEY | in vidioc_s_fmt_vid_overlay()
747 if (vout->fbuf.flags & V4L2_FBUF_FLAG_SRC_CHROMAKEY) in vidioc_s_fmt_vid_overlay()
757 info.trans_key = vout->win.chromakey; in vidioc_s_fmt_vid_overlay()
771 struct omap_vout_device *vout = video_drvdata(file); in vidioc_g_fmt_vid_overlay() local
774 ovid = &vout->vid_info; in vidioc_g_fmt_vid_overlay()
777 win->w = vout->win.w; in vidioc_g_fmt_vid_overlay()
778 win->field = vout->win.field; in vidioc_g_fmt_vid_overlay()
779 win->chromakey = vout->win.chromakey; in vidioc_g_fmt_vid_overlay()
781 win->global_alpha = vout->win.global_alpha; in vidioc_g_fmt_vid_overlay()
792 struct omap_vout_device *vout = video_drvdata(file); in vidioc_g_selection() local
793 struct v4l2_pix_format *pix = &vout->pix; in vidioc_g_selection()
800 sel->r = vout->crop; in vidioc_g_selection()
803 omap_vout_default_crop(&vout->pix, &vout->fbuf, &sel->r); in vidioc_g_selection()
819 struct omap_vout_device *vout = video_drvdata(file); in vidioc_s_selection() local
831 if (vb2_is_busy(&vout->vq)) in vidioc_s_selection()
834 ovid = &vout->vid_info; in vidioc_s_selection()
846 if (is_rotation_90_or_270(vout)) { in vidioc_s_selection()
847 vout->fbuf.fmt.height = timing->x_res; in vidioc_s_selection()
848 vout->fbuf.fmt.width = timing->y_res; in vidioc_s_selection()
850 vout->fbuf.fmt.height = timing->y_res; in vidioc_s_selection()
851 vout->fbuf.fmt.width = timing->x_res; in vidioc_s_selection()
854 ret = omap_vout_new_crop(&vout->pix, &vout->crop, &vout->win, in vidioc_s_selection()
855 &vout->fbuf, &sel->r); in vidioc_s_selection()
863 struct omap_vout_device *vout = in omap_vout_s_ctrl() local
872 ovid = &vout->vid_info; in omap_vout_s_ctrl()
879 if (rotation && vout->pix.pixelformat == V4L2_PIX_FMT_RGB24) { in omap_vout_s_ctrl()
884 if (v4l2_rot_to_dss_rot(rotation, &vout->rotation, in omap_vout_s_ctrl()
885 vout->mirror)) { in omap_vout_s_ctrl()
897 ovl = vout->vid_info.overlays[0]; in omap_vout_s_ctrl()
917 ovid = &vout->vid_info; in omap_vout_s_ctrl()
924 if (mirror && vout->pix.pixelformat == V4L2_PIX_FMT_RGB24) { in omap_vout_s_ctrl()
928 vout->mirror = mirror; in omap_vout_s_ctrl()
946 struct omap_vout_device *vout = vb2_get_drv_priv(vq); in omap_vout_vb2_queue_setup() local
947 int size = vout->pix.sizeimage; in omap_vout_vb2_queue_setup()
949 if (is_rotation_enabled(vout) && vq->num_buffers + *nbufs > VRFB_NUM_BUFS) { in omap_vout_vb2_queue_setup()
965 struct omap_vout_device *vout = vb2_get_drv_priv(vb->vb2_queue); in omap_vout_vb2_prepare() local
966 struct omapvideo_info *ovid = &vout->vid_info; in omap_vout_vb2_prepare()
970 if (vb2_plane_size(vb, 0) < vout->pix.sizeimage) { in omap_vout_vb2_prepare()
971 v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, in omap_vout_vb2_prepare()
973 __func__, vb2_plane_size(vb, 0), vout->pix.sizeimage); in omap_vout_vb2_prepare()
977 vb2_set_plane_payload(vb, 0, vout->pix.sizeimage); in omap_vout_vb2_prepare()
980 vout->queued_buf_addr[vb->index] = buf_phy_addr; in omap_vout_vb2_prepare()
982 return omap_vout_prepare_vrfb(vout, vb); in omap_vout_vb2_prepare()
988 struct omap_vout_device *vout = vb2_get_drv_priv(vb->vb2_queue); in omap_vout_vb2_queue() local
991 list_add_tail(&voutbuf->queue, &vout->dma_queue); in omap_vout_vb2_queue()
996 struct omap_vout_device *vout = vb2_get_drv_priv(vq); in omap_vout_vb2_start_streaming() local
997 struct omapvideo_info *ovid = &vout->vid_info; in omap_vout_vb2_start_streaming()
1004 vout->next_frm = vout->cur_frm = list_entry(vout->dma_queue.next, in omap_vout_vb2_start_streaming()
1007 list_del(&vout->cur_frm->queue); in omap_vout_vb2_start_streaming()
1009 vout->field_id = 0; in omap_vout_vb2_start_streaming()
1010 vout->first_int = 1; in omap_vout_vb2_start_streaming()
1011 vout->sequence = 0; in omap_vout_vb2_start_streaming()
1013 if (omap_vout_calculate_offset(vout)) { in omap_vout_vb2_start_streaming()
1018 if (omap_vout_vrfb_buffer_setup(vout, &count, 0)) { in omap_vout_vb2_start_streaming()
1023 addr = vout->queued_buf_addr[vout->cur_frm->vbuf.vb2_buf.index] in omap_vout_vb2_start_streaming()
1024 + vout->cropped_offset; in omap_vout_vb2_start_streaming()
1030 ret = omapvid_init(vout, addr); in omap_vout_vb2_start_streaming()
1032 v4l2_err(&vout->vid_dev->v4l2_dev, in omap_vout_vb2_start_streaming()
1037 omap_dispc_register_isr(omap_vout_isr, vout, mask); in omap_vout_vb2_start_streaming()
1040 ret = omapvid_apply_changes(vout); in omap_vout_vb2_start_streaming()
1042 v4l2_err(&vout->vid_dev->v4l2_dev, "failed to change mode\n"); in omap_vout_vb2_start_streaming()
1060 omap_dispc_unregister_isr(omap_vout_isr, vout, mask); in omap_vout_vb2_start_streaming()
1070 if (omapvid_apply_changes(vout)) in omap_vout_vb2_start_streaming()
1071 v4l2_err(&vout->vid_dev->v4l2_dev, in omap_vout_vb2_start_streaming()
1075 vb2_buffer_done(&vout->cur_frm->vbuf.vb2_buf, VB2_BUF_STATE_QUEUED); in omap_vout_vb2_start_streaming()
1076 list_for_each_entry_safe(buf, tmp, &vout->dma_queue, queue) { in omap_vout_vb2_start_streaming()
1085 struct omap_vout_device *vout = vb2_get_drv_priv(vq); in omap_vout_vb2_stop_streaming() local
1086 struct omapvideo_info *ovid = &vout->vid_info; in omap_vout_vb2_stop_streaming()
1094 omap_dispc_unregister_isr(omap_vout_isr, vout, mask); in omap_vout_vb2_stop_streaming()
1104 if (omapvid_apply_changes(vout)) in omap_vout_vb2_stop_streaming()
1105 v4l2_err(&vout->vid_dev->v4l2_dev, in omap_vout_vb2_stop_streaming()
1108 if (vout->next_frm != vout->cur_frm) in omap_vout_vb2_stop_streaming()
1109 vb2_buffer_done(&vout->next_frm->vbuf.vb2_buf, VB2_BUF_STATE_ERROR); in omap_vout_vb2_stop_streaming()
1110 vb2_buffer_done(&vout->cur_frm->vbuf.vb2_buf, VB2_BUF_STATE_ERROR); in omap_vout_vb2_stop_streaming()
1111 list_for_each_entry_safe(buf, tmp, &vout->dma_queue, queue) { in omap_vout_vb2_stop_streaming()
1123 struct omap_vout_device *vout = video_drvdata(file); in vidioc_s_fbuf() local
1127 ovid = &vout->vid_info; in vidioc_s_fbuf()
1142 vout->fbuf.flags |= V4L2_FBUF_FLAG_SRC_CHROMAKEY; in vidioc_s_fbuf()
1145 vout->fbuf.flags &= ~V4L2_FBUF_FLAG_SRC_CHROMAKEY; in vidioc_s_fbuf()
1148 vout->fbuf.flags |= V4L2_FBUF_FLAG_CHROMAKEY; in vidioc_s_fbuf()
1151 vout->fbuf.flags &= ~V4L2_FBUF_FLAG_CHROMAKEY; in vidioc_s_fbuf()
1164 info.trans_key = vout->win.chromakey; in vidioc_s_fbuf()
1170 vout->fbuf.flags |= V4L2_FBUF_FLAG_LOCAL_ALPHA; in vidioc_s_fbuf()
1173 vout->fbuf.flags &= ~V4L2_FBUF_FLAG_LOCAL_ALPHA; in vidioc_s_fbuf()
1194 struct omap_vout_device *vout = video_drvdata(file); in vidioc_g_fbuf() local
1199 ovid = &vout->vid_info; in vidioc_g_fbuf()
1209 vout->fbuf.fmt.height = timing->y_res; in vidioc_g_fbuf()
1210 vout->fbuf.fmt.width = timing->x_res; in vidioc_g_fbuf()
1214 a->fmt.height = vout->fbuf.fmt.height; in vidioc_g_fbuf()
1215 a->fmt.width = vout->fbuf.fmt.width; in vidioc_g_fbuf()
1216 a->fmt.bytesperline = vout->fbuf.fmt.width * 4; in vidioc_g_fbuf()
1218 a->base = vout->fbuf.base; in vidioc_g_fbuf()
1220 a->flags = vout->fbuf.flags; in vidioc_g_fbuf()
1221 a->capability = vout->fbuf.capability; in vidioc_g_fbuf()
1308 static int __init omap_vout_setup_video_data(struct omap_vout_device *vout) in omap_vout_setup_video_data() argument
1312 struct omap_overlay *ovl = vout->vid_info.overlays[0]; in omap_vout_setup_video_data()
1319 pix = &vout->pix; in omap_vout_setup_video_data()
1332 vout->bpp = RGB565_BPP; in omap_vout_setup_video_data()
1333 vout->fbuf.fmt.width = display->panel.timings.x_res; in omap_vout_setup_video_data()
1334 vout->fbuf.fmt.height = display->panel.timings.y_res; in omap_vout_setup_video_data()
1335 vout->cropped_offset = 0; in omap_vout_setup_video_data()
1338 vout->fbuf.flags = V4L2_FBUF_FLAG_OVERLAY; in omap_vout_setup_video_data()
1339 vout->fbuf.capability = V4L2_FBUF_CAP_LOCAL_ALPHA | in omap_vout_setup_video_data()
1343 vout->win.global_alpha = 255; in omap_vout_setup_video_data()
1344 vout->fbuf.capability |= V4L2_FBUF_CAP_GLOBAL_ALPHA; in omap_vout_setup_video_data()
1345 vout->fbuf.flags |= V4L2_FBUF_FLAG_GLOBAL_ALPHA; in omap_vout_setup_video_data()
1347 vout->win.global_alpha = 0; in omap_vout_setup_video_data()
1349 vout->win.field = V4L2_FIELD_NONE; in omap_vout_setup_video_data()
1351 omap_vout_new_format(pix, &vout->fbuf, &vout->crop, &vout->win); in omap_vout_setup_video_data()
1353 hdl = &vout->ctrl_handler; in omap_vout_setup_video_data()
1355 if (vout->vid_info.rotation_type == VOUT_ROT_VRFB) { in omap_vout_setup_video_data()
1366 vout->rotation = 0; in omap_vout_setup_video_data()
1367 vout->mirror = false; in omap_vout_setup_video_data()
1368 INIT_LIST_HEAD(&vout->dma_queue); in omap_vout_setup_video_data()
1369 if (vout->vid_info.rotation_type == VOUT_ROT_VRFB) in omap_vout_setup_video_data()
1370 vout->vrfb_bpp = 2; in omap_vout_setup_video_data()
1373 vfd = vout->vfd = video_device_alloc(); in omap_vout_setup_video_data()
1388 vfd->v4l2_dev = &vout->vid_dev->v4l2_dev; in omap_vout_setup_video_data()
1393 mutex_init(&vout->lock); in omap_vout_setup_video_data()
1395 vq = &vout->vq; in omap_vout_setup_video_data()
1398 vq->drv_priv = vout; in omap_vout_setup_video_data()
1405 vq->lock = &vout->lock; in omap_vout_setup_video_data()
1422 struct omap_vout_device *vout; in omap_vout_setup_video_bufs() local
1428 vout = vid_dev->vouts[vid_num]; in omap_vout_setup_video_bufs()
1429 ovid = &vout->vid_info; in omap_vout_setup_video_bufs()
1444 struct omap_vout_device *vout; in omap_vout_create_video_devices() local
1456 vout = kzalloc(sizeof(struct omap_vout_device), GFP_KERNEL); in omap_vout_create_video_devices()
1457 if (!vout) { in omap_vout_create_video_devices()
1462 vout->vid = k; in omap_vout_create_video_devices()
1463 vid_dev->vouts[k] = vout; in omap_vout_create_video_devices()
1464 vout->vid_dev = vid_dev; in omap_vout_create_video_devices()
1467 vout->vid_info.overlays[0] = vid_dev->overlays[k + 2]; in omap_vout_create_video_devices()
1470 vout->vid_info.overlays[0] = vid_dev->overlays[k + 1]; in omap_vout_create_video_devices()
1471 vout->vid_info.num_overlays = 1; in omap_vout_create_video_devices()
1472 vout->vid_info.id = k + 1; in omap_vout_create_video_devices()
1473 spin_lock_init(&vout->vbq_lock); in omap_vout_create_video_devices()
1481 vout->fbuf.base = (void *)(uintptr_t)info.paddr; in omap_vout_create_video_devices()
1485 vout->vid_info.rotation_type = VOUT_ROT_VRFB; in omap_vout_create_video_devices()
1489 if (omap_vout_setup_video_data(vout) != 0) { in omap_vout_create_video_devices()
1504 vfd = vout->vfd; in omap_vout_create_video_devices()
1512 video_set_drvdata(vfd, vout); in omap_vout_create_video_devices()
1522 if (vout->vid_info.rotation_type == VOUT_ROT_VRFB) in omap_vout_create_video_devices()
1523 omap_vout_release_vrfb(vout); in omap_vout_create_video_devices()
1527 kfree(vout); in omap_vout_create_video_devices()
1534 static void omap_vout_cleanup_device(struct omap_vout_device *vout) in omap_vout_cleanup_device() argument
1539 if (!vout) in omap_vout_cleanup_device()
1542 vfd = vout->vfd; in omap_vout_cleanup_device()
1543 ovid = &vout->vid_info; in omap_vout_cleanup_device()
1559 v4l2_ctrl_handler_free(&vout->ctrl_handler); in omap_vout_cleanup_device()
1561 omap_vout_release_vrfb(vout); in omap_vout_cleanup_device()
1565 if (vout->vrfb_static_allocation) in omap_vout_cleanup_device()
1566 omap_vout_free_vrfb_buffers(vout); in omap_vout_cleanup_device()
1569 kfree(vout); in omap_vout_cleanup_device()