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, u32 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()
487 struct omap_vout_device *vout = (struct omap_vout_device *)arg; in omap_vout_isr() local
489 ovid = &vout->vid_info; in omap_vout_isr()
500 spin_lock(&vout->vbq_lock); in omap_vout_isr()
518 fid = omapvid_handle_interlace_display(vout, irqstatus, in omap_vout_isr()
531 if (!vout->first_int && (vout->cur_frm != vout->next_frm)) { in omap_vout_isr()
532 vout->cur_frm->vbuf.vb2_buf.timestamp = ts; in omap_vout_isr()
533 vout->cur_frm->vbuf.sequence = vout->sequence++; in omap_vout_isr()
534 vb2_buffer_done(&vout->cur_frm->vbuf.vb2_buf, VB2_BUF_STATE_DONE); in omap_vout_isr()
535 vout->cur_frm = vout->next_frm; in omap_vout_isr()
538 vout->first_int = 0; in omap_vout_isr()
539 if (list_empty(&vout->dma_queue)) in omap_vout_isr()
542 vout->next_frm = list_entry(vout->dma_queue.next, in omap_vout_isr()
544 list_del(&vout->next_frm->queue); in omap_vout_isr()
546 addr = (unsigned long)vout->queued_buf_addr[vout->next_frm->vbuf.vb2_buf.index] in omap_vout_isr()
547 + vout->cropped_offset; in omap_vout_isr()
550 ret = omapvid_init(vout, addr); in omap_vout_isr()
558 ret = omapvid_apply_changes(vout); in omap_vout_isr()
563 spin_unlock(&vout->vbq_lock); in omap_vout_isr()
573 struct omap_vout_device *vout = video_drvdata(file); in vidioc_querycap() local
576 strscpy(cap->card, vout->vfd->name, sizeof(cap->card)); in vidioc_querycap()
578 "platform:%s.%d", VOUT_NAME, vout->vid); in vidioc_querycap()
599 struct omap_vout_device *vout = video_drvdata(file); in vidioc_g_fmt_vid_out() local
601 f->fmt.pix = vout->pix; in vidioc_g_fmt_vid_out()
612 struct omap_vout_device *vout = video_drvdata(file); in vidioc_try_fmt_vid_out() local
615 ovid = &vout->vid_info; in vidioc_try_fmt_vid_out()
625 vout->fbuf.fmt.height = timing->y_res; in vidioc_try_fmt_vid_out()
626 vout->fbuf.fmt.width = timing->x_res; in vidioc_try_fmt_vid_out()
639 struct omap_vout_device *vout = video_drvdata(file); in vidioc_s_fmt_vid_out() local
642 if (vb2_is_busy(&vout->vq)) in vidioc_s_fmt_vid_out()
645 ovid = &vout->vid_info; in vidioc_s_fmt_vid_out()
658 if ((is_rotation_enabled(vout)) && in vidioc_s_fmt_vid_out()
666 if (is_rotation_90_or_270(vout)) { in vidioc_s_fmt_vid_out()
667 vout->fbuf.fmt.height = timing->x_res; in vidioc_s_fmt_vid_out()
668 vout->fbuf.fmt.width = timing->y_res; in vidioc_s_fmt_vid_out()
670 vout->fbuf.fmt.height = timing->y_res; in vidioc_s_fmt_vid_out()
671 vout->fbuf.fmt.width = timing->x_res; in vidioc_s_fmt_vid_out()
680 vout->bpp = bpp; in vidioc_s_fmt_vid_out()
681 vout->pix = f->fmt.pix; in vidioc_s_fmt_vid_out()
682 vout->vrfb_bpp = 1; in vidioc_s_fmt_vid_out()
685 if (V4L2_PIX_FMT_YUYV == vout->pix.pixelformat || in vidioc_s_fmt_vid_out()
686 V4L2_PIX_FMT_UYVY == vout->pix.pixelformat) in vidioc_s_fmt_vid_out()
687 vout->vrfb_bpp = 2; in vidioc_s_fmt_vid_out()
690 omap_vout_new_format(&vout->pix, &vout->fbuf, &vout->crop, &vout->win); in vidioc_s_fmt_vid_out()
702 struct omap_vout_device *vout = video_drvdata(file); in vidioc_try_fmt_vid_overlay() local
707 ovid = &vout->vid_info; in vidioc_try_fmt_vid_overlay()
710 ret = omap_vout_try_window(&vout->fbuf, win); in vidioc_try_fmt_vid_overlay()
724 struct omap_vout_device *vout = video_drvdata(file); in vidioc_s_fmt_vid_overlay() local
727 ovid = &vout->vid_info; in vidioc_s_fmt_vid_overlay()
730 ret = omap_vout_new_window(&vout->crop, &vout->win, &vout->fbuf, win); in vidioc_s_fmt_vid_overlay()
738 vout->win.global_alpha = win->global_alpha; in vidioc_s_fmt_vid_overlay()
741 if (vout->fbuf.flags & (V4L2_FBUF_FLAG_CHROMAKEY | in vidioc_s_fmt_vid_overlay()
746 if (vout->fbuf.flags & V4L2_FBUF_FLAG_SRC_CHROMAKEY) in vidioc_s_fmt_vid_overlay()
756 info.trans_key = vout->win.chromakey; in vidioc_s_fmt_vid_overlay()
770 struct omap_vout_device *vout = video_drvdata(file); in vidioc_g_fmt_vid_overlay() local
773 ovid = &vout->vid_info; in vidioc_g_fmt_vid_overlay()
776 win->w = vout->win.w; in vidioc_g_fmt_vid_overlay()
777 win->field = vout->win.field; in vidioc_g_fmt_vid_overlay()
778 win->chromakey = vout->win.chromakey; in vidioc_g_fmt_vid_overlay()
780 win->global_alpha = vout->win.global_alpha; in vidioc_g_fmt_vid_overlay()
791 struct omap_vout_device *vout = video_drvdata(file); in vidioc_g_selection() local
792 struct v4l2_pix_format *pix = &vout->pix; in vidioc_g_selection()
799 sel->r = vout->crop; in vidioc_g_selection()
802 omap_vout_default_crop(&vout->pix, &vout->fbuf, &sel->r); in vidioc_g_selection()
818 struct omap_vout_device *vout = video_drvdata(file); in vidioc_s_selection() local
830 if (vb2_is_busy(&vout->vq)) in vidioc_s_selection()
833 ovid = &vout->vid_info; in vidioc_s_selection()
845 if (is_rotation_90_or_270(vout)) { in vidioc_s_selection()
846 vout->fbuf.fmt.height = timing->x_res; in vidioc_s_selection()
847 vout->fbuf.fmt.width = timing->y_res; in vidioc_s_selection()
849 vout->fbuf.fmt.height = timing->y_res; in vidioc_s_selection()
850 vout->fbuf.fmt.width = timing->x_res; in vidioc_s_selection()
853 ret = omap_vout_new_crop(&vout->pix, &vout->crop, &vout->win, in vidioc_s_selection()
854 &vout->fbuf, &sel->r); in vidioc_s_selection()
862 struct omap_vout_device *vout = in omap_vout_s_ctrl() local
871 ovid = &vout->vid_info; in omap_vout_s_ctrl()
878 if (rotation && vout->pix.pixelformat == V4L2_PIX_FMT_RGB24) { in omap_vout_s_ctrl()
883 if (v4l2_rot_to_dss_rot(rotation, &vout->rotation, in omap_vout_s_ctrl()
884 vout->mirror)) { in omap_vout_s_ctrl()
896 ovl = vout->vid_info.overlays[0]; in omap_vout_s_ctrl()
916 ovid = &vout->vid_info; in omap_vout_s_ctrl()
923 if (mirror && vout->pix.pixelformat == V4L2_PIX_FMT_RGB24) { in omap_vout_s_ctrl()
927 vout->mirror = mirror; in omap_vout_s_ctrl()
945 struct omap_vout_device *vout = vb2_get_drv_priv(vq); in omap_vout_vb2_queue_setup() local
946 int size = vout->pix.sizeimage; in omap_vout_vb2_queue_setup()
948 if (is_rotation_enabled(vout) && vq->num_buffers + *nbufs > VRFB_NUM_BUFS) { in omap_vout_vb2_queue_setup()
964 struct omap_vout_device *vout = vb2_get_drv_priv(vb->vb2_queue); in omap_vout_vb2_prepare() local
965 struct omapvideo_info *ovid = &vout->vid_info; in omap_vout_vb2_prepare()
969 if (vb2_plane_size(vb, 0) < vout->pix.sizeimage) { in omap_vout_vb2_prepare()
970 v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, in omap_vout_vb2_prepare()
972 __func__, vb2_plane_size(vb, 0), vout->pix.sizeimage); in omap_vout_vb2_prepare()
976 vb2_set_plane_payload(vb, 0, vout->pix.sizeimage); in omap_vout_vb2_prepare()
979 vout->queued_buf_addr[vb->index] = (u8 *)buf_phy_addr; in omap_vout_vb2_prepare()
981 return omap_vout_prepare_vrfb(vout, vb); in omap_vout_vb2_prepare()
987 struct omap_vout_device *vout = vb2_get_drv_priv(vb->vb2_queue); in omap_vout_vb2_queue() local
990 list_add_tail(&voutbuf->queue, &vout->dma_queue); in omap_vout_vb2_queue()
995 struct omap_vout_device *vout = vb2_get_drv_priv(vq); in omap_vout_vb2_start_streaming() local
996 struct omapvideo_info *ovid = &vout->vid_info; in omap_vout_vb2_start_streaming()
1002 vout->next_frm = vout->cur_frm = list_entry(vout->dma_queue.next, in omap_vout_vb2_start_streaming()
1005 list_del(&vout->cur_frm->queue); in omap_vout_vb2_start_streaming()
1007 vout->field_id = 0; in omap_vout_vb2_start_streaming()
1008 vout->first_int = 1; in omap_vout_vb2_start_streaming()
1009 vout->sequence = 0; in omap_vout_vb2_start_streaming()
1011 if (omap_vout_calculate_offset(vout)) { in omap_vout_vb2_start_streaming()
1016 if (omap_vout_vrfb_buffer_setup(vout, &count, 0)) { in omap_vout_vb2_start_streaming()
1021 addr = (unsigned long)vout->queued_buf_addr[vout->cur_frm->vbuf.vb2_buf.index] in omap_vout_vb2_start_streaming()
1022 + vout->cropped_offset; in omap_vout_vb2_start_streaming()
1028 ret = omapvid_init(vout, addr); in omap_vout_vb2_start_streaming()
1030 v4l2_err(&vout->vid_dev->v4l2_dev, in omap_vout_vb2_start_streaming()
1035 omap_dispc_register_isr(omap_vout_isr, vout, mask); in omap_vout_vb2_start_streaming()
1038 ret = omapvid_apply_changes(vout); in omap_vout_vb2_start_streaming()
1040 v4l2_err(&vout->vid_dev->v4l2_dev, "failed to change mode\n"); in omap_vout_vb2_start_streaming()
1058 omap_dispc_unregister_isr(omap_vout_isr, vout, mask); in omap_vout_vb2_start_streaming()
1068 if (omapvid_apply_changes(vout)) in omap_vout_vb2_start_streaming()
1069 v4l2_err(&vout->vid_dev->v4l2_dev, in omap_vout_vb2_start_streaming()
1073 vb2_buffer_done(&vout->cur_frm->vbuf.vb2_buf, VB2_BUF_STATE_QUEUED); in omap_vout_vb2_start_streaming()
1074 list_for_each_entry_safe(buf, tmp, &vout->dma_queue, queue) { in omap_vout_vb2_start_streaming()
1083 struct omap_vout_device *vout = vb2_get_drv_priv(vq); in omap_vout_vb2_stop_streaming() local
1084 struct omapvideo_info *ovid = &vout->vid_info; in omap_vout_vb2_stop_streaming()
1092 omap_dispc_unregister_isr(omap_vout_isr, vout, mask); in omap_vout_vb2_stop_streaming()
1102 if (omapvid_apply_changes(vout)) in omap_vout_vb2_stop_streaming()
1103 v4l2_err(&vout->vid_dev->v4l2_dev, in omap_vout_vb2_stop_streaming()
1106 if (vout->next_frm != vout->cur_frm) in omap_vout_vb2_stop_streaming()
1107 vb2_buffer_done(&vout->next_frm->vbuf.vb2_buf, VB2_BUF_STATE_ERROR); in omap_vout_vb2_stop_streaming()
1108 vb2_buffer_done(&vout->cur_frm->vbuf.vb2_buf, VB2_BUF_STATE_ERROR); in omap_vout_vb2_stop_streaming()
1109 list_for_each_entry_safe(buf, tmp, &vout->dma_queue, queue) { in omap_vout_vb2_stop_streaming()
1121 struct omap_vout_device *vout = video_drvdata(file); in vidioc_s_fbuf() local
1125 ovid = &vout->vid_info; in vidioc_s_fbuf()
1140 vout->fbuf.flags |= V4L2_FBUF_FLAG_SRC_CHROMAKEY; in vidioc_s_fbuf()
1143 vout->fbuf.flags &= ~V4L2_FBUF_FLAG_SRC_CHROMAKEY; in vidioc_s_fbuf()
1146 vout->fbuf.flags |= V4L2_FBUF_FLAG_CHROMAKEY; in vidioc_s_fbuf()
1149 vout->fbuf.flags &= ~V4L2_FBUF_FLAG_CHROMAKEY; in vidioc_s_fbuf()
1162 info.trans_key = vout->win.chromakey; in vidioc_s_fbuf()
1168 vout->fbuf.flags |= V4L2_FBUF_FLAG_LOCAL_ALPHA; in vidioc_s_fbuf()
1171 vout->fbuf.flags &= ~V4L2_FBUF_FLAG_LOCAL_ALPHA; in vidioc_s_fbuf()
1192 struct omap_vout_device *vout = video_drvdata(file); in vidioc_g_fbuf() local
1197 ovid = &vout->vid_info; in vidioc_g_fbuf()
1207 vout->fbuf.fmt.height = timing->y_res; in vidioc_g_fbuf()
1208 vout->fbuf.fmt.width = timing->x_res; in vidioc_g_fbuf()
1212 a->fmt.height = vout->fbuf.fmt.height; in vidioc_g_fbuf()
1213 a->fmt.width = vout->fbuf.fmt.width; in vidioc_g_fbuf()
1214 a->fmt.bytesperline = vout->fbuf.fmt.width * 4; in vidioc_g_fbuf()
1216 a->base = vout->fbuf.base; in vidioc_g_fbuf()
1218 a->flags = vout->fbuf.flags; in vidioc_g_fbuf()
1219 a->capability = vout->fbuf.capability; in vidioc_g_fbuf()
1306 static int __init omap_vout_setup_video_data(struct omap_vout_device *vout) in omap_vout_setup_video_data() argument
1310 struct omap_overlay *ovl = vout->vid_info.overlays[0]; in omap_vout_setup_video_data()
1317 pix = &vout->pix; in omap_vout_setup_video_data()
1330 vout->bpp = RGB565_BPP; in omap_vout_setup_video_data()
1331 vout->fbuf.fmt.width = display->panel.timings.x_res; in omap_vout_setup_video_data()
1332 vout->fbuf.fmt.height = display->panel.timings.y_res; in omap_vout_setup_video_data()
1333 vout->cropped_offset = 0; in omap_vout_setup_video_data()
1336 vout->fbuf.flags = V4L2_FBUF_FLAG_OVERLAY; in omap_vout_setup_video_data()
1337 vout->fbuf.capability = V4L2_FBUF_CAP_LOCAL_ALPHA | in omap_vout_setup_video_data()
1341 vout->win.global_alpha = 255; in omap_vout_setup_video_data()
1342 vout->fbuf.capability |= V4L2_FBUF_CAP_GLOBAL_ALPHA; in omap_vout_setup_video_data()
1343 vout->fbuf.flags |= V4L2_FBUF_FLAG_GLOBAL_ALPHA; in omap_vout_setup_video_data()
1345 vout->win.global_alpha = 0; in omap_vout_setup_video_data()
1347 vout->win.field = V4L2_FIELD_NONE; in omap_vout_setup_video_data()
1349 omap_vout_new_format(pix, &vout->fbuf, &vout->crop, &vout->win); in omap_vout_setup_video_data()
1351 hdl = &vout->ctrl_handler; in omap_vout_setup_video_data()
1353 if (vout->vid_info.rotation_type == VOUT_ROT_VRFB) { in omap_vout_setup_video_data()
1364 vout->rotation = 0; in omap_vout_setup_video_data()
1365 vout->mirror = false; in omap_vout_setup_video_data()
1366 INIT_LIST_HEAD(&vout->dma_queue); in omap_vout_setup_video_data()
1367 if (vout->vid_info.rotation_type == VOUT_ROT_VRFB) in omap_vout_setup_video_data()
1368 vout->vrfb_bpp = 2; in omap_vout_setup_video_data()
1371 vfd = vout->vfd = video_device_alloc(); in omap_vout_setup_video_data()
1386 vfd->v4l2_dev = &vout->vid_dev->v4l2_dev; in omap_vout_setup_video_data()
1391 mutex_init(&vout->lock); in omap_vout_setup_video_data()
1393 vq = &vout->vq; in omap_vout_setup_video_data()
1396 vq->drv_priv = vout; in omap_vout_setup_video_data()
1403 vq->lock = &vout->lock; in omap_vout_setup_video_data()
1420 struct omap_vout_device *vout; in omap_vout_setup_video_bufs() local
1426 vout = vid_dev->vouts[vid_num]; in omap_vout_setup_video_bufs()
1427 ovid = &vout->vid_info; in omap_vout_setup_video_bufs()
1442 struct omap_vout_device *vout; in omap_vout_create_video_devices() local
1454 vout = kzalloc(sizeof(struct omap_vout_device), GFP_KERNEL); in omap_vout_create_video_devices()
1455 if (!vout) { in omap_vout_create_video_devices()
1460 vout->vid = k; in omap_vout_create_video_devices()
1461 vid_dev->vouts[k] = vout; in omap_vout_create_video_devices()
1462 vout->vid_dev = vid_dev; in omap_vout_create_video_devices()
1465 vout->vid_info.overlays[0] = vid_dev->overlays[k + 2]; in omap_vout_create_video_devices()
1468 vout->vid_info.overlays[0] = vid_dev->overlays[k + 1]; in omap_vout_create_video_devices()
1469 vout->vid_info.num_overlays = 1; in omap_vout_create_video_devices()
1470 vout->vid_info.id = k + 1; in omap_vout_create_video_devices()
1471 spin_lock_init(&vout->vbq_lock); in omap_vout_create_video_devices()
1479 vout->fbuf.base = (void *)info.paddr; in omap_vout_create_video_devices()
1483 vout->vid_info.rotation_type = VOUT_ROT_VRFB; in omap_vout_create_video_devices()
1487 if (omap_vout_setup_video_data(vout) != 0) { in omap_vout_create_video_devices()
1502 vfd = vout->vfd; in omap_vout_create_video_devices()
1510 video_set_drvdata(vfd, vout); in omap_vout_create_video_devices()
1520 if (vout->vid_info.rotation_type == VOUT_ROT_VRFB) in omap_vout_create_video_devices()
1521 omap_vout_release_vrfb(vout); in omap_vout_create_video_devices()
1525 kfree(vout); in omap_vout_create_video_devices()
1532 static void omap_vout_cleanup_device(struct omap_vout_device *vout) in omap_vout_cleanup_device() argument
1537 if (!vout) in omap_vout_cleanup_device()
1540 vfd = vout->vfd; in omap_vout_cleanup_device()
1541 ovid = &vout->vid_info; in omap_vout_cleanup_device()
1557 v4l2_ctrl_handler_free(&vout->ctrl_handler); in omap_vout_cleanup_device()
1559 omap_vout_release_vrfb(vout); in omap_vout_cleanup_device()
1563 if (vout->vrfb_static_allocation) in omap_vout_cleanup_device()
1564 omap_vout_free_vrfb_buffers(vout); in omap_vout_cleanup_device()
1567 kfree(vout); in omap_vout_cleanup_device()