xref: /linux/drivers/gpu/drm/tegra/plane.c (revision ee423808990d6fa6b367561a2390ad99b1551d6b)
1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
25acd3514SThierry Reding /*
35acd3514SThierry Reding  * Copyright (C) 2017 NVIDIA CORPORATION.  All rights reserved.
45acd3514SThierry Reding  */
55acd3514SThierry Reding 
6273da5a0SThierry Reding #include <linux/iommu.h>
704d5d5dfSDmitry Osipenko #include <linux/interconnect.h>
8273da5a0SThierry Reding 
95acd3514SThierry Reding #include <drm/drm_atomic.h>
105acd3514SThierry Reding #include <drm/drm_atomic_helper.h>
11eb1df694SSam Ravnborg #include <drm/drm_fourcc.h>
12820c1707SThomas Zimmermann #include <drm/drm_gem_atomic_helper.h>
135acd3514SThierry Reding #include <drm/drm_plane_helper.h>
145acd3514SThierry Reding 
155acd3514SThierry Reding #include "dc.h"
165acd3514SThierry Reding #include "plane.h"
175acd3514SThierry Reding 
185acd3514SThierry Reding static void tegra_plane_destroy(struct drm_plane *plane)
195acd3514SThierry Reding {
205acd3514SThierry Reding 	struct tegra_plane *p = to_tegra_plane(plane);
215acd3514SThierry Reding 
225acd3514SThierry Reding 	drm_plane_cleanup(plane);
235acd3514SThierry Reding 	kfree(p);
245acd3514SThierry Reding }
255acd3514SThierry Reding 
265acd3514SThierry Reding static void tegra_plane_reset(struct drm_plane *plane)
275acd3514SThierry Reding {
283dae08bcSDmitry Osipenko 	struct tegra_plane *p = to_tegra_plane(plane);
295acd3514SThierry Reding 	struct tegra_plane_state *state;
302e8d8749SThierry Reding 	unsigned int i;
315acd3514SThierry Reding 
325acd3514SThierry Reding 	if (plane->state)
335acd3514SThierry Reding 		__drm_atomic_helper_plane_destroy_state(plane->state);
345acd3514SThierry Reding 
355acd3514SThierry Reding 	kfree(plane->state);
365acd3514SThierry Reding 	plane->state = NULL;
375acd3514SThierry Reding 
385acd3514SThierry Reding 	state = kzalloc(sizeof(*state), GFP_KERNEL);
395acd3514SThierry Reding 	if (state) {
405acd3514SThierry Reding 		plane->state = &state->base;
415acd3514SThierry Reding 		plane->state->plane = plane;
423dae08bcSDmitry Osipenko 		plane->state->zpos = p->index;
433dae08bcSDmitry Osipenko 		plane->state->normalized_zpos = p->index;
442e8d8749SThierry Reding 
452e8d8749SThierry Reding 		for (i = 0; i < 3; i++)
462e8d8749SThierry Reding 			state->iova[i] = DMA_MAPPING_ERROR;
475acd3514SThierry Reding 	}
485acd3514SThierry Reding }
495acd3514SThierry Reding 
505acd3514SThierry Reding static struct drm_plane_state *
515acd3514SThierry Reding tegra_plane_atomic_duplicate_state(struct drm_plane *plane)
525acd3514SThierry Reding {
535acd3514SThierry Reding 	struct tegra_plane_state *state = to_tegra_plane_state(plane->state);
545acd3514SThierry Reding 	struct tegra_plane_state *copy;
55ebae8d07SThierry Reding 	unsigned int i;
565acd3514SThierry Reding 
575acd3514SThierry Reding 	copy = kmalloc(sizeof(*copy), GFP_KERNEL);
585acd3514SThierry Reding 	if (!copy)
595acd3514SThierry Reding 		return NULL;
605acd3514SThierry Reding 
615acd3514SThierry Reding 	__drm_atomic_helper_plane_duplicate_state(plane, &copy->base);
625acd3514SThierry Reding 	copy->tiling = state->tiling;
635acd3514SThierry Reding 	copy->format = state->format;
645acd3514SThierry Reding 	copy->swap = state->swap;
65cd740777SDmitry Osipenko 	copy->reflect_x = state->reflect_x;
66e9e476f7SDmitry Osipenko 	copy->reflect_y = state->reflect_y;
67ebae8d07SThierry Reding 	copy->opaque = state->opaque;
6804d5d5dfSDmitry Osipenko 	copy->total_peak_memory_bandwidth = state->total_peak_memory_bandwidth;
6904d5d5dfSDmitry Osipenko 	copy->peak_memory_bandwidth = state->peak_memory_bandwidth;
7004d5d5dfSDmitry Osipenko 	copy->avg_memory_bandwidth = state->avg_memory_bandwidth;
71ebae8d07SThierry Reding 
723dae08bcSDmitry Osipenko 	for (i = 0; i < 2; i++)
733dae08bcSDmitry Osipenko 		copy->blending[i] = state->blending[i];
745acd3514SThierry Reding 
752e8d8749SThierry Reding 	for (i = 0; i < 3; i++) {
762e8d8749SThierry Reding 		copy->iova[i] = DMA_MAPPING_ERROR;
77c6aeaf56SThierry Reding 		copy->map[i] = NULL;
782e8d8749SThierry Reding 	}
792e8d8749SThierry Reding 
805acd3514SThierry Reding 	return &copy->base;
815acd3514SThierry Reding }
825acd3514SThierry Reding 
835acd3514SThierry Reding static void tegra_plane_atomic_destroy_state(struct drm_plane *plane,
845acd3514SThierry Reding 					     struct drm_plane_state *state)
855acd3514SThierry Reding {
865acd3514SThierry Reding 	__drm_atomic_helper_plane_destroy_state(state);
875acd3514SThierry Reding 	kfree(state);
885acd3514SThierry Reding }
895acd3514SThierry Reding 
907b6f8467SThierry Reding static bool tegra_plane_supports_sector_layout(struct drm_plane *plane)
917b6f8467SThierry Reding {
927b6f8467SThierry Reding 	struct drm_crtc *crtc;
937b6f8467SThierry Reding 
947b6f8467SThierry Reding 	drm_for_each_crtc(crtc, plane->dev) {
957b6f8467SThierry Reding 		if (plane->possible_crtcs & drm_crtc_mask(crtc)) {
967b6f8467SThierry Reding 			struct tegra_dc *dc = to_tegra_dc(crtc);
977b6f8467SThierry Reding 
987b6f8467SThierry Reding 			if (!dc->soc->supports_sector_layout)
997b6f8467SThierry Reding 				return false;
1007b6f8467SThierry Reding 		}
1017b6f8467SThierry Reding 	}
1027b6f8467SThierry Reding 
1037b6f8467SThierry Reding 	return true;
1047b6f8467SThierry Reding }
1057b6f8467SThierry Reding 
106e90124cbSThierry Reding static bool tegra_plane_format_mod_supported(struct drm_plane *plane,
107e90124cbSThierry Reding 					     uint32_t format,
108e90124cbSThierry Reding 					     uint64_t modifier)
109e90124cbSThierry Reding {
110e90124cbSThierry Reding 	const struct drm_format_info *info = drm_format_info(format);
111e90124cbSThierry Reding 
112e90124cbSThierry Reding 	if (modifier == DRM_FORMAT_MOD_LINEAR)
113e90124cbSThierry Reding 		return true;
114e90124cbSThierry Reding 
1157b6f8467SThierry Reding 	/* check for the sector layout bit */
116c1d3cfbcSThierry Reding 	if (fourcc_mod_is_vendor(modifier, NVIDIA)) {
1177b6f8467SThierry Reding 		if (modifier & DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT) {
1187b6f8467SThierry Reding 			if (!tegra_plane_supports_sector_layout(plane))
1197b6f8467SThierry Reding 				return false;
1207b6f8467SThierry Reding 		}
1217b6f8467SThierry Reding 	}
1227b6f8467SThierry Reding 
123e90124cbSThierry Reding 	if (info->num_planes == 1)
124e90124cbSThierry Reding 		return true;
125e90124cbSThierry Reding 
126e90124cbSThierry Reding 	return false;
127e90124cbSThierry Reding }
128e90124cbSThierry Reding 
1295acd3514SThierry Reding const struct drm_plane_funcs tegra_plane_funcs = {
1305acd3514SThierry Reding 	.update_plane = drm_atomic_helper_update_plane,
1315acd3514SThierry Reding 	.disable_plane = drm_atomic_helper_disable_plane,
1325acd3514SThierry Reding 	.destroy = tegra_plane_destroy,
1335acd3514SThierry Reding 	.reset = tegra_plane_reset,
1345acd3514SThierry Reding 	.atomic_duplicate_state = tegra_plane_atomic_duplicate_state,
1355acd3514SThierry Reding 	.atomic_destroy_state = tegra_plane_atomic_destroy_state,
136e90124cbSThierry Reding 	.format_mod_supported = tegra_plane_format_mod_supported,
1375acd3514SThierry Reding };
1385acd3514SThierry Reding 
1392e8d8749SThierry Reding static int tegra_dc_pin(struct tegra_dc *dc, struct tegra_plane_state *state)
1402e8d8749SThierry Reding {
1412e8d8749SThierry Reding 	unsigned int i;
1422e8d8749SThierry Reding 	int err;
1432e8d8749SThierry Reding 
1442e8d8749SThierry Reding 	for (i = 0; i < state->base.fb->format->num_planes; i++) {
1452e8d8749SThierry Reding 		struct tegra_bo *bo = tegra_fb_get_plane(state->base.fb, i);
146c6aeaf56SThierry Reding 		struct host1x_bo_mapping *map;
1472e8d8749SThierry Reding 
1481f39b1dfSThierry Reding 		map = host1x_bo_pin(dc->dev, &bo->base, DMA_TO_DEVICE, &dc->client.cache);
149c6aeaf56SThierry Reding 		if (IS_ERR(map)) {
150c6aeaf56SThierry Reding 			err = PTR_ERR(map);
1512e8d8749SThierry Reding 			goto unpin;
1522e8d8749SThierry Reding 		}
1532e8d8749SThierry Reding 
154c6aeaf56SThierry Reding 		if (!dc->client.group) {
15549f82191SThierry Reding 			/*
15649f82191SThierry Reding 			 * The display controller needs contiguous memory, so
15749f82191SThierry Reding 			 * fail if the buffer is discontiguous and we fail to
15849f82191SThierry Reding 			 * map its SG table to a single contiguous chunk of
15949f82191SThierry Reding 			 * I/O virtual memory.
16049f82191SThierry Reding 			 */
161c6aeaf56SThierry Reding 			if (map->chunks > 1) {
16249f82191SThierry Reding 				err = -EINVAL;
16349f82191SThierry Reding 				goto unpin;
16449f82191SThierry Reding 			}
16549f82191SThierry Reding 
166c6aeaf56SThierry Reding 			state->iova[i] = map->phys;
1672e8d8749SThierry Reding 		} else {
168c6aeaf56SThierry Reding 			state->iova[i] = bo->iova;
1692e8d8749SThierry Reding 		}
170c6aeaf56SThierry Reding 
171c6aeaf56SThierry Reding 		state->map[i] = map;
1722e8d8749SThierry Reding 	}
1732e8d8749SThierry Reding 
1742e8d8749SThierry Reding 	return 0;
1752e8d8749SThierry Reding 
1762e8d8749SThierry Reding unpin:
1772e8d8749SThierry Reding 	dev_err(dc->dev, "failed to map plane %u: %d\n", i, err);
1782e8d8749SThierry Reding 
1792e8d8749SThierry Reding 	while (i--) {
180c6aeaf56SThierry Reding 		host1x_bo_unpin(state->map[i]);
1812e8d8749SThierry Reding 		state->iova[i] = DMA_MAPPING_ERROR;
182c6aeaf56SThierry Reding 		state->map[i] = NULL;
1832e8d8749SThierry Reding 	}
1842e8d8749SThierry Reding 
1852e8d8749SThierry Reding 	return err;
1862e8d8749SThierry Reding }
1872e8d8749SThierry Reding 
1882e8d8749SThierry Reding static void tegra_dc_unpin(struct tegra_dc *dc, struct tegra_plane_state *state)
1892e8d8749SThierry Reding {
1902e8d8749SThierry Reding 	unsigned int i;
1912e8d8749SThierry Reding 
1922e8d8749SThierry Reding 	for (i = 0; i < state->base.fb->format->num_planes; i++) {
193c6aeaf56SThierry Reding 		host1x_bo_unpin(state->map[i]);
1942e8d8749SThierry Reding 		state->iova[i] = DMA_MAPPING_ERROR;
195c6aeaf56SThierry Reding 		state->map[i] = NULL;
1962e8d8749SThierry Reding 	}
1972e8d8749SThierry Reding }
1982e8d8749SThierry Reding 
1992e8d8749SThierry Reding int tegra_plane_prepare_fb(struct drm_plane *plane,
2002e8d8749SThierry Reding 			   struct drm_plane_state *state)
2012e8d8749SThierry Reding {
2022e8d8749SThierry Reding 	struct tegra_dc *dc = to_tegra_dc(state->crtc);
203*ee423808SThierry Reding 	int err;
2042e8d8749SThierry Reding 
2052e8d8749SThierry Reding 	if (!state->fb)
2062e8d8749SThierry Reding 		return 0;
2072e8d8749SThierry Reding 
208*ee423808SThierry Reding 	err = drm_gem_plane_helper_prepare_fb(plane, state);
209*ee423808SThierry Reding 	if (err < 0)
210*ee423808SThierry Reding 		return err;
2112e8d8749SThierry Reding 
2122e8d8749SThierry Reding 	return tegra_dc_pin(dc, to_tegra_plane_state(state));
2132e8d8749SThierry Reding }
2142e8d8749SThierry Reding 
2152e8d8749SThierry Reding void tegra_plane_cleanup_fb(struct drm_plane *plane,
2162e8d8749SThierry Reding 			    struct drm_plane_state *state)
2172e8d8749SThierry Reding {
2182e8d8749SThierry Reding 	struct tegra_dc *dc = to_tegra_dc(state->crtc);
2192e8d8749SThierry Reding 
2202e8d8749SThierry Reding 	if (dc)
2212e8d8749SThierry Reding 		tegra_dc_unpin(dc, to_tegra_plane_state(state));
2222e8d8749SThierry Reding }
2232e8d8749SThierry Reding 
22404d5d5dfSDmitry Osipenko static int tegra_plane_calculate_memory_bandwidth(struct drm_plane_state *state)
22504d5d5dfSDmitry Osipenko {
22604d5d5dfSDmitry Osipenko 	struct tegra_plane_state *tegra_state = to_tegra_plane_state(state);
22704d5d5dfSDmitry Osipenko 	unsigned int i, bpp, dst_w, dst_h, src_w, src_h, mul;
22804d5d5dfSDmitry Osipenko 	const struct tegra_dc_soc_info *soc;
22904d5d5dfSDmitry Osipenko 	const struct drm_format_info *fmt;
23004d5d5dfSDmitry Osipenko 	struct drm_crtc_state *crtc_state;
23104d5d5dfSDmitry Osipenko 	u64 avg_bandwidth, peak_bandwidth;
23204d5d5dfSDmitry Osipenko 
23304d5d5dfSDmitry Osipenko 	if (!state->visible)
23404d5d5dfSDmitry Osipenko 		return 0;
23504d5d5dfSDmitry Osipenko 
23604d5d5dfSDmitry Osipenko 	crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
23704d5d5dfSDmitry Osipenko 	if (!crtc_state)
23804d5d5dfSDmitry Osipenko 		return -EINVAL;
23904d5d5dfSDmitry Osipenko 
24004d5d5dfSDmitry Osipenko 	src_w = drm_rect_width(&state->src) >> 16;
24104d5d5dfSDmitry Osipenko 	src_h = drm_rect_height(&state->src) >> 16;
24204d5d5dfSDmitry Osipenko 	dst_w = drm_rect_width(&state->dst);
24304d5d5dfSDmitry Osipenko 	dst_h = drm_rect_height(&state->dst);
24404d5d5dfSDmitry Osipenko 
24504d5d5dfSDmitry Osipenko 	fmt = state->fb->format;
24604d5d5dfSDmitry Osipenko 	soc = to_tegra_dc(state->crtc)->soc;
24704d5d5dfSDmitry Osipenko 
24804d5d5dfSDmitry Osipenko 	/*
24904d5d5dfSDmitry Osipenko 	 * Note that real memory bandwidth vary depending on format and
25004d5d5dfSDmitry Osipenko 	 * memory layout, we are not taking that into account because small
25104d5d5dfSDmitry Osipenko 	 * estimation error isn't important since bandwidth is rounded up
25204d5d5dfSDmitry Osipenko 	 * anyway.
25304d5d5dfSDmitry Osipenko 	 */
25404d5d5dfSDmitry Osipenko 	for (i = 0, bpp = 0; i < fmt->num_planes; i++) {
25504d5d5dfSDmitry Osipenko 		unsigned int bpp_plane = fmt->cpp[i] * 8;
25604d5d5dfSDmitry Osipenko 
25704d5d5dfSDmitry Osipenko 		/*
25804d5d5dfSDmitry Osipenko 		 * Sub-sampling is relevant for chroma planes only and vertical
25904d5d5dfSDmitry Osipenko 		 * readouts are not cached, hence only horizontal sub-sampling
26004d5d5dfSDmitry Osipenko 		 * matters.
26104d5d5dfSDmitry Osipenko 		 */
26204d5d5dfSDmitry Osipenko 		if (i > 0)
26304d5d5dfSDmitry Osipenko 			bpp_plane /= fmt->hsub;
26404d5d5dfSDmitry Osipenko 
26504d5d5dfSDmitry Osipenko 		bpp += bpp_plane;
26604d5d5dfSDmitry Osipenko 	}
26704d5d5dfSDmitry Osipenko 
26804d5d5dfSDmitry Osipenko 	/* average bandwidth in kbytes/sec */
26904d5d5dfSDmitry Osipenko 	avg_bandwidth  = min(src_w, dst_w) * min(src_h, dst_h);
27004d5d5dfSDmitry Osipenko 	avg_bandwidth *= drm_mode_vrefresh(&crtc_state->adjusted_mode);
27104d5d5dfSDmitry Osipenko 	avg_bandwidth  = DIV_ROUND_UP(avg_bandwidth * bpp, 8) + 999;
27204d5d5dfSDmitry Osipenko 	do_div(avg_bandwidth, 1000);
27304d5d5dfSDmitry Osipenko 
27404d5d5dfSDmitry Osipenko 	/* mode.clock in kHz, peak bandwidth in kbytes/sec */
27504d5d5dfSDmitry Osipenko 	peak_bandwidth = DIV_ROUND_UP(crtc_state->adjusted_mode.clock * bpp, 8);
27604d5d5dfSDmitry Osipenko 
27704d5d5dfSDmitry Osipenko 	/*
27804d5d5dfSDmitry Osipenko 	 * Tegra30/114 Memory Controller can't interleave DC memory requests
27904d5d5dfSDmitry Osipenko 	 * for the tiled windows because DC uses 16-bytes atom, while DDR3
28004d5d5dfSDmitry Osipenko 	 * uses 32-bytes atom.  Hence there is x2 memory overfetch for tiled
28104d5d5dfSDmitry Osipenko 	 * framebuffer and DDR3 on these SoCs.
28204d5d5dfSDmitry Osipenko 	 */
28304d5d5dfSDmitry Osipenko 	if (soc->plane_tiled_memory_bandwidth_x2 &&
28404d5d5dfSDmitry Osipenko 	    tegra_state->tiling.mode == TEGRA_BO_TILING_MODE_TILED)
28504d5d5dfSDmitry Osipenko 		mul = 2;
28604d5d5dfSDmitry Osipenko 	else
28704d5d5dfSDmitry Osipenko 		mul = 1;
28804d5d5dfSDmitry Osipenko 
28904d5d5dfSDmitry Osipenko 	/* ICC bandwidth in kbytes/sec */
29004d5d5dfSDmitry Osipenko 	tegra_state->peak_memory_bandwidth = kBps_to_icc(peak_bandwidth) * mul;
29104d5d5dfSDmitry Osipenko 	tegra_state->avg_memory_bandwidth  = kBps_to_icc(avg_bandwidth)  * mul;
29204d5d5dfSDmitry Osipenko 
29304d5d5dfSDmitry Osipenko 	return 0;
29404d5d5dfSDmitry Osipenko }
29504d5d5dfSDmitry Osipenko 
2965acd3514SThierry Reding int tegra_plane_state_add(struct tegra_plane *plane,
2975acd3514SThierry Reding 			  struct drm_plane_state *state)
2985acd3514SThierry Reding {
2995acd3514SThierry Reding 	struct drm_crtc_state *crtc_state;
3005acd3514SThierry Reding 	struct tegra_dc_state *tegra;
3015acd3514SThierry Reding 	int err;
3025acd3514SThierry Reding 
3035acd3514SThierry Reding 	/* Propagate errors from allocation or locking failures. */
3045acd3514SThierry Reding 	crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
3055acd3514SThierry Reding 	if (IS_ERR(crtc_state))
3065acd3514SThierry Reding 		return PTR_ERR(crtc_state);
3075acd3514SThierry Reding 
3085acd3514SThierry Reding 	/* Check plane state for visibility and calculate clipping bounds */
30981af63a4SVille Syrjälä 	err = drm_atomic_helper_check_plane_state(state, crtc_state,
3105acd3514SThierry Reding 						  0, INT_MAX, true, true);
3115acd3514SThierry Reding 	if (err < 0)
3125acd3514SThierry Reding 		return err;
3135acd3514SThierry Reding 
31404d5d5dfSDmitry Osipenko 	err = tegra_plane_calculate_memory_bandwidth(state);
31504d5d5dfSDmitry Osipenko 	if (err < 0)
31604d5d5dfSDmitry Osipenko 		return err;
31704d5d5dfSDmitry Osipenko 
3185acd3514SThierry Reding 	tegra = to_dc_state(crtc_state);
3195acd3514SThierry Reding 
3205acd3514SThierry Reding 	tegra->planes |= WIN_A_ACT_REQ << plane->index;
3215acd3514SThierry Reding 
3225acd3514SThierry Reding 	return 0;
3235acd3514SThierry Reding }
3245acd3514SThierry Reding 
3255acd3514SThierry Reding int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap)
3265acd3514SThierry Reding {
3275acd3514SThierry Reding 	/* assume no swapping of fetched data */
3285acd3514SThierry Reding 	if (swap)
3295acd3514SThierry Reding 		*swap = BYTE_SWAP_NOSWAP;
3305acd3514SThierry Reding 
3315acd3514SThierry Reding 	switch (fourcc) {
332511c7023SThierry Reding 	case DRM_FORMAT_ARGB4444:
333511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B4G4R4A4;
3347772fdaeSThierry Reding 		break;
3357772fdaeSThierry Reding 
336511c7023SThierry Reding 	case DRM_FORMAT_ARGB1555:
337511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B5G5R5A1;
3385acd3514SThierry Reding 		break;
3395acd3514SThierry Reding 
340511c7023SThierry Reding 	case DRM_FORMAT_RGB565:
341511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B5G6R5;
342511c7023SThierry Reding 		break;
343511c7023SThierry Reding 
344511c7023SThierry Reding 	case DRM_FORMAT_RGBA5551:
345511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_A1B5G5R5;
3467772fdaeSThierry Reding 		break;
3477772fdaeSThierry Reding 
3487772fdaeSThierry Reding 	case DRM_FORMAT_ARGB8888:
3495acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_B8G8R8A8;
3505acd3514SThierry Reding 		break;
3515acd3514SThierry Reding 
352511c7023SThierry Reding 	case DRM_FORMAT_ABGR8888:
353511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R8G8B8A8;
354511c7023SThierry Reding 		break;
355511c7023SThierry Reding 
356511c7023SThierry Reding 	case DRM_FORMAT_ABGR4444:
357511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R4G4B4A4;
358511c7023SThierry Reding 		break;
359511c7023SThierry Reding 
360511c7023SThierry Reding 	case DRM_FORMAT_ABGR1555:
361511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R5G5B5A;
362511c7023SThierry Reding 		break;
363511c7023SThierry Reding 
364511c7023SThierry Reding 	case DRM_FORMAT_BGRA5551:
365511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_AR5G5B5;
366511c7023SThierry Reding 		break;
367511c7023SThierry Reding 
368511c7023SThierry Reding 	case DRM_FORMAT_XRGB1555:
369511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B5G5R5X1;
370511c7023SThierry Reding 		break;
371511c7023SThierry Reding 
372511c7023SThierry Reding 	case DRM_FORMAT_RGBX5551:
373511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_X1B5G5R5;
374511c7023SThierry Reding 		break;
375511c7023SThierry Reding 
376511c7023SThierry Reding 	case DRM_FORMAT_XBGR1555:
377511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R5G5B5X1;
378511c7023SThierry Reding 		break;
379511c7023SThierry Reding 
380511c7023SThierry Reding 	case DRM_FORMAT_BGRX5551:
381511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_X1R5G5B5;
382511c7023SThierry Reding 		break;
383511c7023SThierry Reding 
384511c7023SThierry Reding 	case DRM_FORMAT_BGR565:
385511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R5G6B5;
386511c7023SThierry Reding 		break;
387511c7023SThierry Reding 
388511c7023SThierry Reding 	case DRM_FORMAT_BGRA8888:
389511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_A8R8G8B8;
390511c7023SThierry Reding 		break;
391511c7023SThierry Reding 
392511c7023SThierry Reding 	case DRM_FORMAT_RGBA8888:
393511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_A8B8G8R8;
394511c7023SThierry Reding 		break;
395511c7023SThierry Reding 
396511c7023SThierry Reding 	case DRM_FORMAT_XRGB8888:
397511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B8G8R8X8;
398511c7023SThierry Reding 		break;
399511c7023SThierry Reding 
400511c7023SThierry Reding 	case DRM_FORMAT_XBGR8888:
401511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R8G8B8X8;
4025acd3514SThierry Reding 		break;
4035acd3514SThierry Reding 
4045acd3514SThierry Reding 	case DRM_FORMAT_UYVY:
4055acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr422;
4065acd3514SThierry Reding 		break;
4075acd3514SThierry Reding 
4085acd3514SThierry Reding 	case DRM_FORMAT_YUYV:
4095acd3514SThierry Reding 		if (!swap)
4105acd3514SThierry Reding 			return -EINVAL;
4115acd3514SThierry Reding 
4125acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr422;
4135acd3514SThierry Reding 		*swap = BYTE_SWAP_SWAP2;
4145acd3514SThierry Reding 		break;
4155acd3514SThierry Reding 
4165acd3514SThierry Reding 	case DRM_FORMAT_YUV420:
4175acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr420P;
4185acd3514SThierry Reding 		break;
4195acd3514SThierry Reding 
4205acd3514SThierry Reding 	case DRM_FORMAT_YUV422:
4215acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr422P;
4225acd3514SThierry Reding 		break;
4235acd3514SThierry Reding 
4245acd3514SThierry Reding 	default:
4255acd3514SThierry Reding 		return -EINVAL;
4265acd3514SThierry Reding 	}
4275acd3514SThierry Reding 
4285acd3514SThierry Reding 	return 0;
4295acd3514SThierry Reding }
4305acd3514SThierry Reding 
431e16efff4SThierry Reding bool tegra_plane_format_is_indexed(unsigned int format)
432e16efff4SThierry Reding {
433e16efff4SThierry Reding 	switch (format) {
434e16efff4SThierry Reding 	case WIN_COLOR_DEPTH_P1:
435e16efff4SThierry Reding 	case WIN_COLOR_DEPTH_P2:
436e16efff4SThierry Reding 	case WIN_COLOR_DEPTH_P4:
437e16efff4SThierry Reding 	case WIN_COLOR_DEPTH_P8:
438e16efff4SThierry Reding 		return true;
439e16efff4SThierry Reding 	}
440e16efff4SThierry Reding 
441e16efff4SThierry Reding 	return false;
442e16efff4SThierry Reding }
443e16efff4SThierry Reding 
444e16efff4SThierry Reding bool tegra_plane_format_is_yuv(unsigned int format, bool *planar, unsigned int *bpc)
4455acd3514SThierry Reding {
4465acd3514SThierry Reding 	switch (format) {
4475acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422:
4485acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422:
4495acd3514SThierry Reding 		if (planar)
4505acd3514SThierry Reding 			*planar = false;
4515acd3514SThierry Reding 
452e16efff4SThierry Reding 		if (bpc)
453e16efff4SThierry Reding 			*bpc = 8;
454e16efff4SThierry Reding 
4555acd3514SThierry Reding 		return true;
4565acd3514SThierry Reding 
4575acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr420P:
4585acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV420P:
4595acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422P:
4605acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422P:
4615acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422R:
4625acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422R:
4635acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422RA:
4645acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422RA:
4655acd3514SThierry Reding 		if (planar)
4665acd3514SThierry Reding 			*planar = true;
4675acd3514SThierry Reding 
468e16efff4SThierry Reding 		if (bpc)
469e16efff4SThierry Reding 			*bpc = 8;
470e16efff4SThierry Reding 
4715acd3514SThierry Reding 		return true;
4725acd3514SThierry Reding 	}
4735acd3514SThierry Reding 
4745acd3514SThierry Reding 	if (planar)
4755acd3514SThierry Reding 		*planar = false;
4765acd3514SThierry Reding 
4775acd3514SThierry Reding 	return false;
4785acd3514SThierry Reding }
479ebae8d07SThierry Reding 
480ebae8d07SThierry Reding static bool __drm_format_has_alpha(u32 format)
481ebae8d07SThierry Reding {
482ebae8d07SThierry Reding 	switch (format) {
483ebae8d07SThierry Reding 	case DRM_FORMAT_ARGB1555:
484ebae8d07SThierry Reding 	case DRM_FORMAT_RGBA5551:
485ebae8d07SThierry Reding 	case DRM_FORMAT_ABGR8888:
486ebae8d07SThierry Reding 	case DRM_FORMAT_ARGB8888:
487ebae8d07SThierry Reding 		return true;
488ebae8d07SThierry Reding 	}
489ebae8d07SThierry Reding 
490ebae8d07SThierry Reding 	return false;
491ebae8d07SThierry Reding }
492ebae8d07SThierry Reding 
4933dae08bcSDmitry Osipenko static int tegra_plane_format_get_alpha(unsigned int opaque,
4943dae08bcSDmitry Osipenko 					unsigned int *alpha)
495ebae8d07SThierry Reding {
496e16efff4SThierry Reding 	if (tegra_plane_format_is_yuv(opaque, NULL, NULL)) {
4975467a8b8SThierry Reding 		*alpha = opaque;
4985467a8b8SThierry Reding 		return 0;
4995467a8b8SThierry Reding 	}
5005467a8b8SThierry Reding 
501ebae8d07SThierry Reding 	switch (opaque) {
502ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_B5G5R5X1:
503ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_B5G5R5A1;
504ebae8d07SThierry Reding 		return 0;
505ebae8d07SThierry Reding 
506ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_X1B5G5R5:
507ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_A1B5G5R5;
508ebae8d07SThierry Reding 		return 0;
509ebae8d07SThierry Reding 
510ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_R8G8B8X8:
511ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_R8G8B8A8;
512ebae8d07SThierry Reding 		return 0;
513ebae8d07SThierry Reding 
514ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_B8G8R8X8:
515ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_B8G8R8A8;
516ebae8d07SThierry Reding 		return 0;
5178a927d64SThierry Reding 
5188a927d64SThierry Reding 	case WIN_COLOR_DEPTH_B5G6R5:
5198a927d64SThierry Reding 		*alpha = opaque;
5208a927d64SThierry Reding 		return 0;
521ebae8d07SThierry Reding 	}
522ebae8d07SThierry Reding 
523ebae8d07SThierry Reding 	return -EINVAL;
524ebae8d07SThierry Reding }
525ebae8d07SThierry Reding 
5263dae08bcSDmitry Osipenko /*
5273dae08bcSDmitry Osipenko  * This is applicable to Tegra20 and Tegra30 only where the opaque formats can
5283dae08bcSDmitry Osipenko  * be emulated using the alpha formats and alpha blending disabled.
5293dae08bcSDmitry Osipenko  */
5303dae08bcSDmitry Osipenko static int tegra_plane_setup_opacity(struct tegra_plane *tegra,
5313dae08bcSDmitry Osipenko 				     struct tegra_plane_state *state)
5323dae08bcSDmitry Osipenko {
5333dae08bcSDmitry Osipenko 	unsigned int format;
5343dae08bcSDmitry Osipenko 	int err;
5353dae08bcSDmitry Osipenko 
5363dae08bcSDmitry Osipenko 	switch (state->format) {
5373dae08bcSDmitry Osipenko 	case WIN_COLOR_DEPTH_B5G5R5A1:
5383dae08bcSDmitry Osipenko 	case WIN_COLOR_DEPTH_A1B5G5R5:
5393dae08bcSDmitry Osipenko 	case WIN_COLOR_DEPTH_R8G8B8A8:
5403dae08bcSDmitry Osipenko 	case WIN_COLOR_DEPTH_B8G8R8A8:
5413dae08bcSDmitry Osipenko 		state->opaque = false;
5423dae08bcSDmitry Osipenko 		break;
5433dae08bcSDmitry Osipenko 
5443dae08bcSDmitry Osipenko 	default:
5453dae08bcSDmitry Osipenko 		err = tegra_plane_format_get_alpha(state->format, &format);
5463dae08bcSDmitry Osipenko 		if (err < 0)
5473dae08bcSDmitry Osipenko 			return err;
5483dae08bcSDmitry Osipenko 
5493dae08bcSDmitry Osipenko 		state->format = format;
5503dae08bcSDmitry Osipenko 		state->opaque = true;
5513dae08bcSDmitry Osipenko 		break;
5523dae08bcSDmitry Osipenko 	}
5533dae08bcSDmitry Osipenko 
5543dae08bcSDmitry Osipenko 	return 0;
5553dae08bcSDmitry Osipenko }
5563dae08bcSDmitry Osipenko 
5573dae08bcSDmitry Osipenko static int tegra_plane_check_transparency(struct tegra_plane *tegra,
5583dae08bcSDmitry Osipenko 					  struct tegra_plane_state *state)
5593dae08bcSDmitry Osipenko {
5603dae08bcSDmitry Osipenko 	struct drm_plane_state *old, *plane_state;
5613dae08bcSDmitry Osipenko 	struct drm_plane *plane;
5623dae08bcSDmitry Osipenko 
5633dae08bcSDmitry Osipenko 	old = drm_atomic_get_old_plane_state(state->base.state, &tegra->base);
5643dae08bcSDmitry Osipenko 
5653dae08bcSDmitry Osipenko 	/* check if zpos / transparency changed */
5663dae08bcSDmitry Osipenko 	if (old->normalized_zpos == state->base.normalized_zpos &&
5673dae08bcSDmitry Osipenko 	    to_tegra_plane_state(old)->opaque == state->opaque)
5683dae08bcSDmitry Osipenko 		return 0;
5693dae08bcSDmitry Osipenko 
5703dae08bcSDmitry Osipenko 	/* include all sibling planes into this commit */
5713dae08bcSDmitry Osipenko 	drm_for_each_plane(plane, tegra->base.dev) {
5723dae08bcSDmitry Osipenko 		struct tegra_plane *p = to_tegra_plane(plane);
5733dae08bcSDmitry Osipenko 
5743dae08bcSDmitry Osipenko 		/* skip this plane and planes on different CRTCs */
5753dae08bcSDmitry Osipenko 		if (p == tegra || p->dc != tegra->dc)
5763dae08bcSDmitry Osipenko 			continue;
5773dae08bcSDmitry Osipenko 
5783dae08bcSDmitry Osipenko 		plane_state = drm_atomic_get_plane_state(state->base.state,
5793dae08bcSDmitry Osipenko 							 plane);
5803dae08bcSDmitry Osipenko 		if (IS_ERR(plane_state))
5813dae08bcSDmitry Osipenko 			return PTR_ERR(plane_state);
5823dae08bcSDmitry Osipenko 	}
5833dae08bcSDmitry Osipenko 
5843dae08bcSDmitry Osipenko 	return 1;
5853dae08bcSDmitry Osipenko }
5863dae08bcSDmitry Osipenko 
5875e2e86f1SDmitry Osipenko static unsigned int tegra_plane_get_overlap_index(struct tegra_plane *plane,
588ebae8d07SThierry Reding 						  struct tegra_plane *other)
589ebae8d07SThierry Reding {
590ebae8d07SThierry Reding 	unsigned int index = 0, i;
591ebae8d07SThierry Reding 
592ebae8d07SThierry Reding 	WARN_ON(plane == other);
593ebae8d07SThierry Reding 
594ebae8d07SThierry Reding 	for (i = 0; i < 3; i++) {
595ebae8d07SThierry Reding 		if (i == plane->index)
596ebae8d07SThierry Reding 			continue;
597ebae8d07SThierry Reding 
598ebae8d07SThierry Reding 		if (i == other->index)
599ebae8d07SThierry Reding 			break;
600ebae8d07SThierry Reding 
601ebae8d07SThierry Reding 		index++;
602ebae8d07SThierry Reding 	}
603ebae8d07SThierry Reding 
604ebae8d07SThierry Reding 	return index;
605ebae8d07SThierry Reding }
606ebae8d07SThierry Reding 
6073dae08bcSDmitry Osipenko static void tegra_plane_update_transparency(struct tegra_plane *tegra,
608ebae8d07SThierry Reding 					    struct tegra_plane_state *state)
609ebae8d07SThierry Reding {
6103dae08bcSDmitry Osipenko 	struct drm_plane_state *new;
611ebae8d07SThierry Reding 	struct drm_plane *plane;
612ebae8d07SThierry Reding 	unsigned int i;
613ebae8d07SThierry Reding 
6143dae08bcSDmitry Osipenko 	for_each_new_plane_in_state(state->base.state, plane, new, i) {
615ebae8d07SThierry Reding 		struct tegra_plane *p = to_tegra_plane(plane);
616ebae8d07SThierry Reding 		unsigned index;
617ebae8d07SThierry Reding 
618ebae8d07SThierry Reding 		/* skip this plane and planes on different CRTCs */
6193dae08bcSDmitry Osipenko 		if (p == tegra || p->dc != tegra->dc)
620ebae8d07SThierry Reding 			continue;
621ebae8d07SThierry Reding 
622ebae8d07SThierry Reding 		index = tegra_plane_get_overlap_index(tegra, p);
623ebae8d07SThierry Reding 
6243dae08bcSDmitry Osipenko 		if (new->fb && __drm_format_has_alpha(new->fb->format->format))
6253dae08bcSDmitry Osipenko 			state->blending[index].alpha = true;
6263dae08bcSDmitry Osipenko 		else
6273dae08bcSDmitry Osipenko 			state->blending[index].alpha = false;
6283dae08bcSDmitry Osipenko 
6293dae08bcSDmitry Osipenko 		if (new->normalized_zpos > state->base.normalized_zpos)
6303dae08bcSDmitry Osipenko 			state->blending[index].top = true;
6313dae08bcSDmitry Osipenko 		else
6323dae08bcSDmitry Osipenko 			state->blending[index].top = false;
63348519232SDmitry Osipenko 
634ebae8d07SThierry Reding 		/*
6353dae08bcSDmitry Osipenko 		 * Missing framebuffer means that plane is disabled, in this
6363dae08bcSDmitry Osipenko 		 * case mark B / C window as top to be able to differentiate
6373dae08bcSDmitry Osipenko 		 * windows indices order in regards to zPos for the middle
6383dae08bcSDmitry Osipenko 		 * window X / Y registers programming.
639ebae8d07SThierry Reding 		 */
6403dae08bcSDmitry Osipenko 		if (!new->fb)
6413dae08bcSDmitry Osipenko 			state->blending[index].top = (index == 1);
642ebae8d07SThierry Reding 	}
643ebae8d07SThierry Reding }
644ebae8d07SThierry Reding 
6453dae08bcSDmitry Osipenko static int tegra_plane_setup_transparency(struct tegra_plane *tegra,
6463dae08bcSDmitry Osipenko 					  struct tegra_plane_state *state)
6473dae08bcSDmitry Osipenko {
6483dae08bcSDmitry Osipenko 	struct tegra_plane_state *tegra_state;
6493dae08bcSDmitry Osipenko 	struct drm_plane_state *new;
6503dae08bcSDmitry Osipenko 	struct drm_plane *plane;
6513dae08bcSDmitry Osipenko 	int err;
652ebae8d07SThierry Reding 
653ebae8d07SThierry Reding 	/*
6543dae08bcSDmitry Osipenko 	 * If planes zpos / transparency changed, sibling planes blending
6553dae08bcSDmitry Osipenko 	 * state may require adjustment and in this case they will be included
6563dae08bcSDmitry Osipenko 	 * into this atom commit, otherwise blending state is unchanged.
657ebae8d07SThierry Reding 	 */
6583dae08bcSDmitry Osipenko 	err = tegra_plane_check_transparency(tegra, state);
6593dae08bcSDmitry Osipenko 	if (err <= 0)
6603dae08bcSDmitry Osipenko 		return err;
6613dae08bcSDmitry Osipenko 
6623dae08bcSDmitry Osipenko 	/*
6633dae08bcSDmitry Osipenko 	 * All planes are now in the atomic state, walk them up and update
6643dae08bcSDmitry Osipenko 	 * transparency state for each plane.
6653dae08bcSDmitry Osipenko 	 */
6663dae08bcSDmitry Osipenko 	drm_for_each_plane(plane, tegra->base.dev) {
6673dae08bcSDmitry Osipenko 		struct tegra_plane *p = to_tegra_plane(plane);
6683dae08bcSDmitry Osipenko 
6693dae08bcSDmitry Osipenko 		/* skip planes on different CRTCs */
6703dae08bcSDmitry Osipenko 		if (p->dc != tegra->dc)
6713dae08bcSDmitry Osipenko 			continue;
6723dae08bcSDmitry Osipenko 
6733dae08bcSDmitry Osipenko 		new = drm_atomic_get_new_plane_state(state->base.state, plane);
6743dae08bcSDmitry Osipenko 		tegra_state = to_tegra_plane_state(new);
6753dae08bcSDmitry Osipenko 
6763dae08bcSDmitry Osipenko 		/*
6773dae08bcSDmitry Osipenko 		 * There is no need to update blending state for the disabled
6783dae08bcSDmitry Osipenko 		 * plane.
6793dae08bcSDmitry Osipenko 		 */
6803dae08bcSDmitry Osipenko 		if (new->fb)
6813dae08bcSDmitry Osipenko 			tegra_plane_update_transparency(p, tegra_state);
682ebae8d07SThierry Reding 	}
6833dae08bcSDmitry Osipenko 
6843dae08bcSDmitry Osipenko 	return 0;
6853dae08bcSDmitry Osipenko }
6863dae08bcSDmitry Osipenko 
6873dae08bcSDmitry Osipenko int tegra_plane_setup_legacy_state(struct tegra_plane *tegra,
6883dae08bcSDmitry Osipenko 				   struct tegra_plane_state *state)
6893dae08bcSDmitry Osipenko {
6903dae08bcSDmitry Osipenko 	int err;
6913dae08bcSDmitry Osipenko 
6923dae08bcSDmitry Osipenko 	err = tegra_plane_setup_opacity(tegra, state);
6933dae08bcSDmitry Osipenko 	if (err < 0)
6943dae08bcSDmitry Osipenko 		return err;
6953dae08bcSDmitry Osipenko 
6963dae08bcSDmitry Osipenko 	err = tegra_plane_setup_transparency(tegra, state);
6973dae08bcSDmitry Osipenko 	if (err < 0)
6983dae08bcSDmitry Osipenko 		return err;
6993dae08bcSDmitry Osipenko 
7003dae08bcSDmitry Osipenko 	return 0;
701ebae8d07SThierry Reding }
70204d5d5dfSDmitry Osipenko 
70304d5d5dfSDmitry Osipenko static const char * const tegra_plane_icc_names[TEGRA_DC_LEGACY_PLANES_NUM] = {
70404d5d5dfSDmitry Osipenko 	"wina", "winb", "winc", NULL, NULL, NULL, "cursor",
70504d5d5dfSDmitry Osipenko };
70604d5d5dfSDmitry Osipenko 
70704d5d5dfSDmitry Osipenko int tegra_plane_interconnect_init(struct tegra_plane *plane)
70804d5d5dfSDmitry Osipenko {
70904d5d5dfSDmitry Osipenko 	const char *icc_name = tegra_plane_icc_names[plane->index];
71004d5d5dfSDmitry Osipenko 	struct device *dev = plane->dc->dev;
71104d5d5dfSDmitry Osipenko 	struct tegra_dc *dc = plane->dc;
71204d5d5dfSDmitry Osipenko 	int err;
71304d5d5dfSDmitry Osipenko 
71404d5d5dfSDmitry Osipenko 	if (WARN_ON(plane->index >= TEGRA_DC_LEGACY_PLANES_NUM) ||
71504d5d5dfSDmitry Osipenko 	    WARN_ON(!tegra_plane_icc_names[plane->index]))
71604d5d5dfSDmitry Osipenko 		return -EINVAL;
71704d5d5dfSDmitry Osipenko 
71804d5d5dfSDmitry Osipenko 	plane->icc_mem = devm_of_icc_get(dev, icc_name);
71904d5d5dfSDmitry Osipenko 	err = PTR_ERR_OR_ZERO(plane->icc_mem);
72004d5d5dfSDmitry Osipenko 	if (err) {
72104d5d5dfSDmitry Osipenko 		dev_err_probe(dev, err, "failed to get %s interconnect\n",
72204d5d5dfSDmitry Osipenko 			      icc_name);
72304d5d5dfSDmitry Osipenko 		return err;
72404d5d5dfSDmitry Osipenko 	}
72504d5d5dfSDmitry Osipenko 
72604d5d5dfSDmitry Osipenko 	/* plane B on T20/30 has a dedicated memory client for a 6-tap vertical filter */
72704d5d5dfSDmitry Osipenko 	if (plane->index == 1 && dc->soc->has_win_b_vfilter_mem_client) {
72804d5d5dfSDmitry Osipenko 		plane->icc_mem_vfilter = devm_of_icc_get(dev, "winb-vfilter");
72904d5d5dfSDmitry Osipenko 		err = PTR_ERR_OR_ZERO(plane->icc_mem_vfilter);
73004d5d5dfSDmitry Osipenko 		if (err) {
73104d5d5dfSDmitry Osipenko 			dev_err_probe(dev, err, "failed to get %s interconnect\n",
73204d5d5dfSDmitry Osipenko 				      "winb-vfilter");
73304d5d5dfSDmitry Osipenko 			return err;
73404d5d5dfSDmitry Osipenko 		}
73504d5d5dfSDmitry Osipenko 	}
73604d5d5dfSDmitry Osipenko 
73704d5d5dfSDmitry Osipenko 	return 0;
73804d5d5dfSDmitry Osipenko }
739