Lines Matching refs:ipu_plane

39 static inline struct ipu_plane *to_ipu_plane(struct drm_plane *p)  in to_ipu_plane()
41 return container_of(p, struct ipu_plane, base); in to_ipu_plane()
118 int ipu_plane_irq(struct ipu_plane *ipu_plane) in ipu_plane_irq() argument
120 return ipu_idmac_channel_irq(ipu_plane->ipu, ipu_plane->ipu_ch, in ipu_plane_irq()
179 struct ipu_plane *ipu_plane = ptr; in ipu_plane_put_resources() local
181 if (!IS_ERR_OR_NULL(ipu_plane->dp)) in ipu_plane_put_resources()
182 ipu_dp_put(ipu_plane->dp); in ipu_plane_put_resources()
183 if (!IS_ERR_OR_NULL(ipu_plane->dmfc)) in ipu_plane_put_resources()
184 ipu_dmfc_put(ipu_plane->dmfc); in ipu_plane_put_resources()
185 if (!IS_ERR_OR_NULL(ipu_plane->ipu_ch)) in ipu_plane_put_resources()
186 ipu_idmac_put(ipu_plane->ipu_ch); in ipu_plane_put_resources()
187 if (!IS_ERR_OR_NULL(ipu_plane->alpha_ch)) in ipu_plane_put_resources()
188 ipu_idmac_put(ipu_plane->alpha_ch); in ipu_plane_put_resources()
192 struct ipu_plane *ipu_plane) in ipu_plane_get_resources() argument
197 ipu_plane->ipu_ch = ipu_idmac_get(ipu_plane->ipu, ipu_plane->dma); in ipu_plane_get_resources()
198 if (IS_ERR(ipu_plane->ipu_ch)) { in ipu_plane_get_resources()
199 ret = PTR_ERR(ipu_plane->ipu_ch); in ipu_plane_get_resources()
204 ret = drmm_add_action_or_reset(dev, ipu_plane_put_resources, ipu_plane); in ipu_plane_get_resources()
208 alpha_ch = ipu_channel_alpha_channel(ipu_plane->dma); in ipu_plane_get_resources()
210 ipu_plane->alpha_ch = ipu_idmac_get(ipu_plane->ipu, alpha_ch); in ipu_plane_get_resources()
211 if (IS_ERR(ipu_plane->alpha_ch)) { in ipu_plane_get_resources()
212 ret = PTR_ERR(ipu_plane->alpha_ch); in ipu_plane_get_resources()
219 ipu_plane->dmfc = ipu_dmfc_get(ipu_plane->ipu, ipu_plane->dma); in ipu_plane_get_resources()
220 if (IS_ERR(ipu_plane->dmfc)) { in ipu_plane_get_resources()
221 ret = PTR_ERR(ipu_plane->dmfc); in ipu_plane_get_resources()
226 if (ipu_plane->dp_flow >= 0) { in ipu_plane_get_resources()
227 ipu_plane->dp = ipu_dp_get(ipu_plane->ipu, ipu_plane->dp_flow); in ipu_plane_get_resources()
228 if (IS_ERR(ipu_plane->dp)) { in ipu_plane_get_resources()
229 ret = PTR_ERR(ipu_plane->dp); in ipu_plane_get_resources()
238 static bool ipu_plane_separate_alpha(struct ipu_plane *ipu_plane) in ipu_plane_separate_alpha() argument
240 switch (ipu_plane->base.state->fb->format->format) { in ipu_plane_separate_alpha()
253 static void ipu_plane_enable(struct ipu_plane *ipu_plane) in ipu_plane_enable() argument
255 if (ipu_plane->dp) in ipu_plane_enable()
256 ipu_dp_enable(ipu_plane->ipu); in ipu_plane_enable()
257 ipu_dmfc_enable_channel(ipu_plane->dmfc); in ipu_plane_enable()
258 ipu_idmac_enable_channel(ipu_plane->ipu_ch); in ipu_plane_enable()
259 if (ipu_plane_separate_alpha(ipu_plane)) in ipu_plane_enable()
260 ipu_idmac_enable_channel(ipu_plane->alpha_ch); in ipu_plane_enable()
261 if (ipu_plane->dp) in ipu_plane_enable()
262 ipu_dp_enable_channel(ipu_plane->dp); in ipu_plane_enable()
265 void ipu_plane_disable(struct ipu_plane *ipu_plane, bool disable_dp_channel) in ipu_plane_disable() argument
271 ret = ipu_idmac_wait_busy(ipu_plane->ipu_ch, 50); in ipu_plane_disable()
274 ipu_plane->base.base.id); in ipu_plane_disable()
277 if (ipu_plane->dp && disable_dp_channel) in ipu_plane_disable()
278 ipu_dp_disable_channel(ipu_plane->dp, false); in ipu_plane_disable()
279 ipu_idmac_disable_channel(ipu_plane->ipu_ch); in ipu_plane_disable()
280 if (ipu_plane->alpha_ch) in ipu_plane_disable()
281 ipu_idmac_disable_channel(ipu_plane->alpha_ch); in ipu_plane_disable()
282 ipu_dmfc_disable_channel(ipu_plane->dmfc); in ipu_plane_disable()
283 if (ipu_plane->dp) in ipu_plane_disable()
284 ipu_dp_disable(ipu_plane->ipu); in ipu_plane_disable()
285 if (ipu_prg_present(ipu_plane->ipu)) in ipu_plane_disable()
286 ipu_prg_channel_disable(ipu_plane->ipu_ch); in ipu_plane_disable()
291 struct ipu_plane *ipu_plane = to_ipu_plane(plane); in ipu_plane_disable_deferred() local
293 if (ipu_plane->disabling) { in ipu_plane_disable_deferred()
294 ipu_plane->disabling = false; in ipu_plane_disable_deferred()
295 ipu_plane_disable(ipu_plane, false); in ipu_plane_disable_deferred()
532 struct ipu_plane *ipu_plane = to_ipu_plane(plane); in ipu_plane_atomic_disable() local
534 if (ipu_plane->dp) in ipu_plane_atomic_disable()
535 ipu_dp_disable_channel(ipu_plane->dp, true); in ipu_plane_atomic_disable()
536 ipu_plane->disabling = true; in ipu_plane_atomic_disable()
579 struct ipu_plane *ipu_plane = to_ipu_plane(plane); in ipu_plane_atomic_update() local
595 if (ipu_plane->dp_flow == IPU_DP_FLOW_SYNC_FG) in ipu_plane_atomic_update()
596 ipu_dp_set_window_pos(ipu_plane->dp, dst->x1, dst->y1); in ipu_plane_atomic_update()
598 switch (ipu_plane->dp_flow) { in ipu_plane_atomic_update()
601 ipu_dp_set_global_alpha(ipu_plane->dp, in ipu_plane_atomic_update()
605 ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true); in ipu_plane_atomic_update()
610 ipu_dp_set_global_alpha(ipu_plane->dp, in ipu_plane_atomic_update()
617 if (ipu_plane->dp_flow == IPU_DP_FLOW_SYNC_BG) in ipu_plane_atomic_update()
630 axi_id = ipu_chan_assign_axi_id(ipu_plane->dma); in ipu_plane_atomic_update()
631 ipu_prg_channel_configure(ipu_plane->ipu_ch, axi_id, width, in ipu_plane_atomic_update()
642 switch (ipu_plane->dp_flow) { in ipu_plane_atomic_update()
644 ipu_dp_setup_channel(ipu_plane->dp, new_state->color_encoding, in ipu_plane_atomic_update()
649 ipu_dp_setup_channel(ipu_plane->dp, new_state->color_encoding, in ipu_plane_atomic_update()
660 active = ipu_idmac_get_current_buffer(ipu_plane->ipu_ch); in ipu_plane_atomic_update()
661 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, !active, eba); in ipu_plane_atomic_update()
662 ipu_idmac_select_buffer(ipu_plane->ipu_ch, !active); in ipu_plane_atomic_update()
663 if (ipu_plane_separate_alpha(ipu_plane)) { in ipu_plane_atomic_update()
664 active = ipu_idmac_get_current_buffer(ipu_plane->alpha_ch); in ipu_plane_atomic_update()
665 ipu_cpmem_set_buffer(ipu_plane->alpha_ch, !active, in ipu_plane_atomic_update()
667 ipu_idmac_select_buffer(ipu_plane->alpha_ch, !active); in ipu_plane_atomic_update()
673 switch (ipu_plane->dp_flow) { in ipu_plane_atomic_update()
675 ipu_dp_setup_channel(ipu_plane->dp, DRM_COLOR_YCBCR_BT601, in ipu_plane_atomic_update()
680 ipu_dp_setup_channel(ipu_plane->dp, DRM_COLOR_YCBCR_BT601, in ipu_plane_atomic_update()
686 ipu_dmfc_config_wait4eot(ipu_plane->dmfc, width); in ipu_plane_atomic_update()
692 ipu_cpmem_zero(ipu_plane->ipu_ch); in ipu_plane_atomic_update()
693 ipu_cpmem_set_resolution(ipu_plane->ipu_ch, width, height); in ipu_plane_atomic_update()
694 ipu_cpmem_set_fmt(ipu_plane->ipu_ch, fb->format->format); in ipu_plane_atomic_update()
695 ipu_cpmem_set_burstsize(ipu_plane->ipu_ch, burstsize); in ipu_plane_atomic_update()
696 ipu_cpmem_set_high_priority(ipu_plane->ipu_ch); in ipu_plane_atomic_update()
697 ipu_idmac_enable_watermark(ipu_plane->ipu_ch, true); in ipu_plane_atomic_update()
698 ipu_idmac_set_double_buffer(ipu_plane->ipu_ch, 1); in ipu_plane_atomic_update()
699 ipu_cpmem_set_stride(ipu_plane->ipu_ch, fb->pitches[0]); in ipu_plane_atomic_update()
700 ipu_cpmem_set_axi_id(ipu_plane->ipu_ch, axi_id); in ipu_plane_atomic_update()
716 ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch, in ipu_plane_atomic_update()
719 dev_dbg(ipu_plane->base.dev->dev, in ipu_plane_atomic_update()
727 ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch, in ipu_plane_atomic_update()
730 dev_dbg(ipu_plane->base.dev->dev, in ipu_plane_atomic_update()
743 dev_dbg(ipu_plane->base.dev->dev, "phys = %lu %lu, x = %d, y = %d", in ipu_plane_atomic_update()
747 ipu_cpmem_set_burstsize(ipu_plane->ipu_ch, 16); in ipu_plane_atomic_update()
749 ipu_cpmem_zero(ipu_plane->alpha_ch); in ipu_plane_atomic_update()
750 ipu_cpmem_set_resolution(ipu_plane->alpha_ch, width, height); in ipu_plane_atomic_update()
751 ipu_cpmem_set_format_passthrough(ipu_plane->alpha_ch, 8); in ipu_plane_atomic_update()
752 ipu_cpmem_set_high_priority(ipu_plane->alpha_ch); in ipu_plane_atomic_update()
753 ipu_idmac_set_double_buffer(ipu_plane->alpha_ch, 1); in ipu_plane_atomic_update()
754 ipu_cpmem_set_stride(ipu_plane->alpha_ch, fb->pitches[1]); in ipu_plane_atomic_update()
755 ipu_cpmem_set_burstsize(ipu_plane->alpha_ch, 16); in ipu_plane_atomic_update()
756 ipu_cpmem_set_buffer(ipu_plane->alpha_ch, 0, alpha_eba); in ipu_plane_atomic_update()
757 ipu_cpmem_set_buffer(ipu_plane->alpha_ch, 1, alpha_eba); in ipu_plane_atomic_update()
760 dev_dbg(ipu_plane->base.dev->dev, "phys = %lu, x = %d, y = %d", in ipu_plane_atomic_update()
764 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, 0, eba); in ipu_plane_atomic_update()
765 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, 1, eba); in ipu_plane_atomic_update()
766 ipu_idmac_lock_enable(ipu_plane->ipu_ch, num_bursts); in ipu_plane_atomic_update()
767 ipu_plane_enable(ipu_plane); in ipu_plane_atomic_update()
778 struct ipu_plane *ipu_plane = to_ipu_plane(plane); in ipu_plane_atomic_update_pending() local
787 return ipu_prg_channel_configure_pending(ipu_plane->ipu_ch); in ipu_plane_atomic_update_pending()
805 struct ipu_plane *ipu_plane; in ipu_planes_assign_pre() local
827 ipu_plane = to_ipu_plane(plane); in ipu_planes_assign_pre()
838 if (!ipu_prg_present(ipu_plane->ipu) || !available_pres) in ipu_planes_assign_pre()
841 if (!ipu_prg_format_supported(ipu_plane->ipu, in ipu_planes_assign_pre()
852 ipu_plane = to_ipu_plane(plane); in ipu_planes_assign_pre()
866 if (ipu_prg_present(ipu_plane->ipu) && available_pres && in ipu_planes_assign_pre()
867 ipu_prg_format_supported(ipu_plane->ipu, in ipu_planes_assign_pre()
880 struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, in ipu_plane_init()
884 struct ipu_plane *ipu_plane; in ipu_plane_init() local
905 ipu_plane = drmm_universal_plane_alloc(dev, struct ipu_plane, base, in ipu_plane_init()
909 if (IS_ERR(ipu_plane)) { in ipu_plane_init()
912 return ipu_plane; in ipu_plane_init()
915 ipu_plane->ipu = ipu; in ipu_plane_init()
916 ipu_plane->dma = dma; in ipu_plane_init()
917 ipu_plane->dp_flow = dp; in ipu_plane_init()
919 drm_plane_helper_add(&ipu_plane->base, &ipu_plane_helper_funcs); in ipu_plane_init()
922 ret = drm_plane_create_zpos_property(&ipu_plane->base, zpos, 0, in ipu_plane_init()
925 ret = drm_plane_create_zpos_immutable_property(&ipu_plane->base, in ipu_plane_init()
930 ret = drm_plane_create_color_properties(&ipu_plane->base, in ipu_plane_init()
939 ret = ipu_plane_get_resources(dev, ipu_plane); in ipu_plane_init()
946 return ipu_plane; in ipu_plane_init()