Lines Matching refs:ipu_plane

38 static inline struct ipu_plane *to_ipu_plane(struct drm_plane *p)  in to_ipu_plane()
40 return container_of(p, struct ipu_plane, base); in to_ipu_plane()
117 int ipu_plane_irq(struct ipu_plane *ipu_plane) in ipu_plane_irq() argument
119 return ipu_idmac_channel_irq(ipu_plane->ipu, ipu_plane->ipu_ch, in ipu_plane_irq()
178 struct ipu_plane *ipu_plane = ptr; in ipu_plane_put_resources() local
180 if (!IS_ERR_OR_NULL(ipu_plane->dp)) in ipu_plane_put_resources()
181 ipu_dp_put(ipu_plane->dp); in ipu_plane_put_resources()
182 if (!IS_ERR_OR_NULL(ipu_plane->dmfc)) in ipu_plane_put_resources()
183 ipu_dmfc_put(ipu_plane->dmfc); in ipu_plane_put_resources()
184 if (!IS_ERR_OR_NULL(ipu_plane->ipu_ch)) in ipu_plane_put_resources()
185 ipu_idmac_put(ipu_plane->ipu_ch); in ipu_plane_put_resources()
186 if (!IS_ERR_OR_NULL(ipu_plane->alpha_ch)) in ipu_plane_put_resources()
187 ipu_idmac_put(ipu_plane->alpha_ch); in ipu_plane_put_resources()
191 struct ipu_plane *ipu_plane) in ipu_plane_get_resources() argument
196 ipu_plane->ipu_ch = ipu_idmac_get(ipu_plane->ipu, ipu_plane->dma); in ipu_plane_get_resources()
197 if (IS_ERR(ipu_plane->ipu_ch)) { in ipu_plane_get_resources()
198 ret = PTR_ERR(ipu_plane->ipu_ch); in ipu_plane_get_resources()
203 ret = drmm_add_action_or_reset(dev, ipu_plane_put_resources, ipu_plane); in ipu_plane_get_resources()
207 alpha_ch = ipu_channel_alpha_channel(ipu_plane->dma); in ipu_plane_get_resources()
209 ipu_plane->alpha_ch = ipu_idmac_get(ipu_plane->ipu, alpha_ch); in ipu_plane_get_resources()
210 if (IS_ERR(ipu_plane->alpha_ch)) { in ipu_plane_get_resources()
211 ret = PTR_ERR(ipu_plane->alpha_ch); in ipu_plane_get_resources()
218 ipu_plane->dmfc = ipu_dmfc_get(ipu_plane->ipu, ipu_plane->dma); in ipu_plane_get_resources()
219 if (IS_ERR(ipu_plane->dmfc)) { in ipu_plane_get_resources()
220 ret = PTR_ERR(ipu_plane->dmfc); in ipu_plane_get_resources()
225 if (ipu_plane->dp_flow >= 0) { in ipu_plane_get_resources()
226 ipu_plane->dp = ipu_dp_get(ipu_plane->ipu, ipu_plane->dp_flow); in ipu_plane_get_resources()
227 if (IS_ERR(ipu_plane->dp)) { in ipu_plane_get_resources()
228 ret = PTR_ERR(ipu_plane->dp); in ipu_plane_get_resources()
237 static bool ipu_plane_separate_alpha(struct ipu_plane *ipu_plane) in ipu_plane_separate_alpha() argument
239 switch (ipu_plane->base.state->fb->format->format) { in ipu_plane_separate_alpha()
252 static void ipu_plane_enable(struct ipu_plane *ipu_plane) in ipu_plane_enable() argument
254 if (ipu_plane->dp) in ipu_plane_enable()
255 ipu_dp_enable(ipu_plane->ipu); in ipu_plane_enable()
256 ipu_dmfc_enable_channel(ipu_plane->dmfc); in ipu_plane_enable()
257 ipu_idmac_enable_channel(ipu_plane->ipu_ch); in ipu_plane_enable()
258 if (ipu_plane_separate_alpha(ipu_plane)) in ipu_plane_enable()
259 ipu_idmac_enable_channel(ipu_plane->alpha_ch); in ipu_plane_enable()
260 if (ipu_plane->dp) in ipu_plane_enable()
261 ipu_dp_enable_channel(ipu_plane->dp); in ipu_plane_enable()
264 void ipu_plane_disable(struct ipu_plane *ipu_plane, bool disable_dp_channel) in ipu_plane_disable() argument
270 ret = ipu_idmac_wait_busy(ipu_plane->ipu_ch, 50); in ipu_plane_disable()
273 ipu_plane->base.base.id); in ipu_plane_disable()
276 if (ipu_plane->dp && disable_dp_channel) in ipu_plane_disable()
277 ipu_dp_disable_channel(ipu_plane->dp, false); in ipu_plane_disable()
278 ipu_idmac_disable_channel(ipu_plane->ipu_ch); in ipu_plane_disable()
279 if (ipu_plane->alpha_ch) in ipu_plane_disable()
280 ipu_idmac_disable_channel(ipu_plane->alpha_ch); in ipu_plane_disable()
281 ipu_dmfc_disable_channel(ipu_plane->dmfc); in ipu_plane_disable()
282 if (ipu_plane->dp) in ipu_plane_disable()
283 ipu_dp_disable(ipu_plane->ipu); in ipu_plane_disable()
284 if (ipu_prg_present(ipu_plane->ipu)) in ipu_plane_disable()
285 ipu_prg_channel_disable(ipu_plane->ipu_ch); in ipu_plane_disable()
290 struct ipu_plane *ipu_plane = to_ipu_plane(plane); in ipu_plane_disable_deferred() local
292 if (ipu_plane->disabling) { in ipu_plane_disable_deferred()
293 ipu_plane->disabling = false; in ipu_plane_disable_deferred()
294 ipu_plane_disable(ipu_plane, false); in ipu_plane_disable_deferred()
531 struct ipu_plane *ipu_plane = to_ipu_plane(plane); in ipu_plane_atomic_disable() local
533 if (ipu_plane->dp) in ipu_plane_atomic_disable()
534 ipu_dp_disable_channel(ipu_plane->dp, true); in ipu_plane_atomic_disable()
535 ipu_plane->disabling = true; in ipu_plane_atomic_disable()
578 struct ipu_plane *ipu_plane = to_ipu_plane(plane); in ipu_plane_atomic_update() local
594 if (ipu_plane->dp_flow == IPU_DP_FLOW_SYNC_FG) in ipu_plane_atomic_update()
595 ipu_dp_set_window_pos(ipu_plane->dp, dst->x1, dst->y1); in ipu_plane_atomic_update()
597 switch (ipu_plane->dp_flow) { in ipu_plane_atomic_update()
600 ipu_dp_set_global_alpha(ipu_plane->dp, in ipu_plane_atomic_update()
604 ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true); in ipu_plane_atomic_update()
609 ipu_dp_set_global_alpha(ipu_plane->dp, in ipu_plane_atomic_update()
623 axi_id = ipu_chan_assign_axi_id(ipu_plane->dma); in ipu_plane_atomic_update()
624 ipu_prg_channel_configure(ipu_plane->ipu_ch, axi_id, in ipu_plane_atomic_update()
636 switch (ipu_plane->dp_flow) { in ipu_plane_atomic_update()
638 ipu_dp_setup_channel(ipu_plane->dp, new_state->color_encoding, in ipu_plane_atomic_update()
643 ipu_dp_setup_channel(ipu_plane->dp, new_state->color_encoding, in ipu_plane_atomic_update()
654 active = ipu_idmac_get_current_buffer(ipu_plane->ipu_ch); in ipu_plane_atomic_update()
655 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, !active, eba); in ipu_plane_atomic_update()
656 ipu_idmac_select_buffer(ipu_plane->ipu_ch, !active); in ipu_plane_atomic_update()
657 if (ipu_plane_separate_alpha(ipu_plane)) { in ipu_plane_atomic_update()
658 active = ipu_idmac_get_current_buffer(ipu_plane->alpha_ch); in ipu_plane_atomic_update()
659 ipu_cpmem_set_buffer(ipu_plane->alpha_ch, !active, in ipu_plane_atomic_update()
661 ipu_idmac_select_buffer(ipu_plane->alpha_ch, !active); in ipu_plane_atomic_update()
667 switch (ipu_plane->dp_flow) { in ipu_plane_atomic_update()
669 ipu_dp_setup_channel(ipu_plane->dp, DRM_COLOR_YCBCR_BT601, in ipu_plane_atomic_update()
674 ipu_dp_setup_channel(ipu_plane->dp, DRM_COLOR_YCBCR_BT601, in ipu_plane_atomic_update()
680 ipu_dmfc_config_wait4eot(ipu_plane->dmfc, ALIGN(drm_rect_width(dst), 8)); in ipu_plane_atomic_update()
688 ipu_cpmem_zero(ipu_plane->ipu_ch); in ipu_plane_atomic_update()
689 ipu_cpmem_set_resolution(ipu_plane->ipu_ch, width, height); in ipu_plane_atomic_update()
690 ipu_cpmem_set_fmt(ipu_plane->ipu_ch, fb->format->format); in ipu_plane_atomic_update()
691 ipu_cpmem_set_burstsize(ipu_plane->ipu_ch, burstsize); in ipu_plane_atomic_update()
692 ipu_cpmem_set_high_priority(ipu_plane->ipu_ch); in ipu_plane_atomic_update()
693 ipu_idmac_enable_watermark(ipu_plane->ipu_ch, true); in ipu_plane_atomic_update()
694 ipu_idmac_set_double_buffer(ipu_plane->ipu_ch, 1); in ipu_plane_atomic_update()
695 ipu_cpmem_set_stride(ipu_plane->ipu_ch, fb->pitches[0]); in ipu_plane_atomic_update()
696 ipu_cpmem_set_axi_id(ipu_plane->ipu_ch, axi_id); in ipu_plane_atomic_update()
712 ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch, in ipu_plane_atomic_update()
715 dev_dbg(ipu_plane->base.dev->dev, in ipu_plane_atomic_update()
723 ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch, in ipu_plane_atomic_update()
726 dev_dbg(ipu_plane->base.dev->dev, in ipu_plane_atomic_update()
739 dev_dbg(ipu_plane->base.dev->dev, "phys = %lu %lu, x = %d, y = %d", in ipu_plane_atomic_update()
743 ipu_cpmem_set_burstsize(ipu_plane->ipu_ch, 16); in ipu_plane_atomic_update()
745 ipu_cpmem_zero(ipu_plane->alpha_ch); in ipu_plane_atomic_update()
746 ipu_cpmem_set_resolution(ipu_plane->alpha_ch, in ipu_plane_atomic_update()
749 ipu_cpmem_set_format_passthrough(ipu_plane->alpha_ch, 8); in ipu_plane_atomic_update()
750 ipu_cpmem_set_high_priority(ipu_plane->alpha_ch); in ipu_plane_atomic_update()
751 ipu_idmac_set_double_buffer(ipu_plane->alpha_ch, 1); in ipu_plane_atomic_update()
752 ipu_cpmem_set_stride(ipu_plane->alpha_ch, fb->pitches[1]); in ipu_plane_atomic_update()
753 ipu_cpmem_set_burstsize(ipu_plane->alpha_ch, 16); in ipu_plane_atomic_update()
754 ipu_cpmem_set_buffer(ipu_plane->alpha_ch, 0, alpha_eba); in ipu_plane_atomic_update()
755 ipu_cpmem_set_buffer(ipu_plane->alpha_ch, 1, alpha_eba); in ipu_plane_atomic_update()
758 dev_dbg(ipu_plane->base.dev->dev, "phys = %lu, x = %d, y = %d", in ipu_plane_atomic_update()
762 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, 0, eba); in ipu_plane_atomic_update()
763 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, 1, eba); in ipu_plane_atomic_update()
764 ipu_idmac_lock_enable(ipu_plane->ipu_ch, num_bursts); in ipu_plane_atomic_update()
765 ipu_plane_enable(ipu_plane); in ipu_plane_atomic_update()
776 struct ipu_plane *ipu_plane = to_ipu_plane(plane); in ipu_plane_atomic_update_pending() local
785 return ipu_prg_channel_configure_pending(ipu_plane->ipu_ch); in ipu_plane_atomic_update_pending()
803 struct ipu_plane *ipu_plane; in ipu_planes_assign_pre() local
825 ipu_plane = to_ipu_plane(plane); in ipu_planes_assign_pre()
836 if (!ipu_prg_present(ipu_plane->ipu) || !available_pres) in ipu_planes_assign_pre()
839 if (!ipu_prg_format_supported(ipu_plane->ipu, in ipu_planes_assign_pre()
850 ipu_plane = to_ipu_plane(plane); in ipu_planes_assign_pre()
864 if (ipu_prg_present(ipu_plane->ipu) && available_pres && in ipu_planes_assign_pre()
865 ipu_prg_format_supported(ipu_plane->ipu, in ipu_planes_assign_pre()
878 struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, in ipu_plane_init()
882 struct ipu_plane *ipu_plane; in ipu_plane_init() local
903 ipu_plane = drmm_universal_plane_alloc(dev, struct ipu_plane, base, in ipu_plane_init()
907 if (IS_ERR(ipu_plane)) { in ipu_plane_init()
910 return ipu_plane; in ipu_plane_init()
913 ipu_plane->ipu = ipu; in ipu_plane_init()
914 ipu_plane->dma = dma; in ipu_plane_init()
915 ipu_plane->dp_flow = dp; in ipu_plane_init()
917 drm_plane_helper_add(&ipu_plane->base, &ipu_plane_helper_funcs); in ipu_plane_init()
920 ret = drm_plane_create_zpos_property(&ipu_plane->base, zpos, 0, in ipu_plane_init()
923 ret = drm_plane_create_zpos_immutable_property(&ipu_plane->base, in ipu_plane_init()
928 ret = drm_plane_create_color_properties(&ipu_plane->base, in ipu_plane_init()
937 ret = ipu_plane_get_resources(dev, ipu_plane); in ipu_plane_init()
944 return ipu_plane; in ipu_plane_init()