xref: /linux/drivers/gpu/drm/tegra/plane.c (revision e90124cb46bdb6b8dd642e0066207ace0fc3f972)
15acd3514SThierry Reding /*
25acd3514SThierry Reding  * Copyright (C) 2017 NVIDIA CORPORATION.  All rights reserved.
35acd3514SThierry Reding  *
45acd3514SThierry Reding  * This program is free software; you can redistribute it and/or modify
55acd3514SThierry Reding  * it under the terms of the GNU General Public License version 2 as
65acd3514SThierry Reding  * published by the Free Software Foundation.
75acd3514SThierry Reding  */
85acd3514SThierry Reding 
95acd3514SThierry Reding #include <drm/drm_atomic.h>
105acd3514SThierry Reding #include <drm/drm_atomic_helper.h>
115acd3514SThierry Reding #include <drm/drm_plane_helper.h>
125acd3514SThierry Reding 
135acd3514SThierry Reding #include "dc.h"
145acd3514SThierry Reding #include "plane.h"
155acd3514SThierry Reding 
165acd3514SThierry Reding static void tegra_plane_destroy(struct drm_plane *plane)
175acd3514SThierry Reding {
185acd3514SThierry Reding 	struct tegra_plane *p = to_tegra_plane(plane);
195acd3514SThierry Reding 
205acd3514SThierry Reding 	drm_plane_cleanup(plane);
215acd3514SThierry Reding 	kfree(p);
225acd3514SThierry Reding }
235acd3514SThierry Reding 
245acd3514SThierry Reding static void tegra_plane_reset(struct drm_plane *plane)
255acd3514SThierry Reding {
265acd3514SThierry Reding 	struct tegra_plane_state *state;
275acd3514SThierry Reding 
285acd3514SThierry Reding 	if (plane->state)
295acd3514SThierry Reding 		__drm_atomic_helper_plane_destroy_state(plane->state);
305acd3514SThierry Reding 
315acd3514SThierry Reding 	kfree(plane->state);
325acd3514SThierry Reding 	plane->state = NULL;
335acd3514SThierry Reding 
345acd3514SThierry Reding 	state = kzalloc(sizeof(*state), GFP_KERNEL);
355acd3514SThierry Reding 	if (state) {
365acd3514SThierry Reding 		plane->state = &state->base;
375acd3514SThierry Reding 		plane->state->plane = plane;
385acd3514SThierry Reding 	}
395acd3514SThierry Reding }
405acd3514SThierry Reding 
415acd3514SThierry Reding static struct drm_plane_state *
425acd3514SThierry Reding tegra_plane_atomic_duplicate_state(struct drm_plane *plane)
435acd3514SThierry Reding {
445acd3514SThierry Reding 	struct tegra_plane_state *state = to_tegra_plane_state(plane->state);
455acd3514SThierry Reding 	struct tegra_plane_state *copy;
46ebae8d07SThierry Reding 	unsigned int i;
475acd3514SThierry Reding 
485acd3514SThierry Reding 	copy = kmalloc(sizeof(*copy), GFP_KERNEL);
495acd3514SThierry Reding 	if (!copy)
505acd3514SThierry Reding 		return NULL;
515acd3514SThierry Reding 
525acd3514SThierry Reding 	__drm_atomic_helper_plane_duplicate_state(plane, &copy->base);
535acd3514SThierry Reding 	copy->tiling = state->tiling;
545acd3514SThierry Reding 	copy->format = state->format;
555acd3514SThierry Reding 	copy->swap = state->swap;
56ebae8d07SThierry Reding 	copy->opaque = state->opaque;
57ebae8d07SThierry Reding 
58ebae8d07SThierry Reding 	for (i = 0; i < 3; i++)
59ebae8d07SThierry Reding 		copy->dependent[i] = state->dependent[i];
605acd3514SThierry Reding 
615acd3514SThierry Reding 	return &copy->base;
625acd3514SThierry Reding }
635acd3514SThierry Reding 
645acd3514SThierry Reding static void tegra_plane_atomic_destroy_state(struct drm_plane *plane,
655acd3514SThierry Reding 					     struct drm_plane_state *state)
665acd3514SThierry Reding {
675acd3514SThierry Reding 	__drm_atomic_helper_plane_destroy_state(state);
685acd3514SThierry Reding 	kfree(state);
695acd3514SThierry Reding }
705acd3514SThierry Reding 
71*e90124cbSThierry Reding static bool tegra_plane_format_mod_supported(struct drm_plane *plane,
72*e90124cbSThierry Reding 					     uint32_t format,
73*e90124cbSThierry Reding 					     uint64_t modifier)
74*e90124cbSThierry Reding {
75*e90124cbSThierry Reding 	const struct drm_format_info *info = drm_format_info(format);
76*e90124cbSThierry Reding 
77*e90124cbSThierry Reding 	if (modifier == DRM_FORMAT_MOD_LINEAR)
78*e90124cbSThierry Reding 		return true;
79*e90124cbSThierry Reding 
80*e90124cbSThierry Reding 	if (info->num_planes == 1)
81*e90124cbSThierry Reding 		return true;
82*e90124cbSThierry Reding 
83*e90124cbSThierry Reding 	return false;
84*e90124cbSThierry Reding }
85*e90124cbSThierry Reding 
865acd3514SThierry Reding const struct drm_plane_funcs tegra_plane_funcs = {
875acd3514SThierry Reding 	.update_plane = drm_atomic_helper_update_plane,
885acd3514SThierry Reding 	.disable_plane = drm_atomic_helper_disable_plane,
895acd3514SThierry Reding 	.destroy = tegra_plane_destroy,
905acd3514SThierry Reding 	.reset = tegra_plane_reset,
915acd3514SThierry Reding 	.atomic_duplicate_state = tegra_plane_atomic_duplicate_state,
925acd3514SThierry Reding 	.atomic_destroy_state = tegra_plane_atomic_destroy_state,
93*e90124cbSThierry Reding 	.format_mod_supported = tegra_plane_format_mod_supported,
945acd3514SThierry Reding };
955acd3514SThierry Reding 
965acd3514SThierry Reding int tegra_plane_state_add(struct tegra_plane *plane,
975acd3514SThierry Reding 			  struct drm_plane_state *state)
985acd3514SThierry Reding {
995acd3514SThierry Reding 	struct drm_crtc_state *crtc_state;
1005acd3514SThierry Reding 	struct tegra_dc_state *tegra;
1015acd3514SThierry Reding 	struct drm_rect clip;
1025acd3514SThierry Reding 	int err;
1035acd3514SThierry Reding 
1045acd3514SThierry Reding 	/* Propagate errors from allocation or locking failures. */
1055acd3514SThierry Reding 	crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
1065acd3514SThierry Reding 	if (IS_ERR(crtc_state))
1075acd3514SThierry Reding 		return PTR_ERR(crtc_state);
1085acd3514SThierry Reding 
1095acd3514SThierry Reding 	clip.x1 = 0;
1105acd3514SThierry Reding 	clip.y1 = 0;
1115acd3514SThierry Reding 	clip.x2 = crtc_state->mode.hdisplay;
1125acd3514SThierry Reding 	clip.y2 = crtc_state->mode.vdisplay;
1135acd3514SThierry Reding 
1145acd3514SThierry Reding 	/* Check plane state for visibility and calculate clipping bounds */
1155acd3514SThierry Reding 	err = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
1165acd3514SThierry Reding 						  0, INT_MAX, true, true);
1175acd3514SThierry Reding 	if (err < 0)
1185acd3514SThierry Reding 		return err;
1195acd3514SThierry Reding 
1205acd3514SThierry Reding 	tegra = to_dc_state(crtc_state);
1215acd3514SThierry Reding 
1225acd3514SThierry Reding 	tegra->planes |= WIN_A_ACT_REQ << plane->index;
1235acd3514SThierry Reding 
1245acd3514SThierry Reding 	return 0;
1255acd3514SThierry Reding }
1265acd3514SThierry Reding 
1275acd3514SThierry Reding int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap)
1285acd3514SThierry Reding {
1295acd3514SThierry Reding 	/* assume no swapping of fetched data */
1305acd3514SThierry Reding 	if (swap)
1315acd3514SThierry Reding 		*swap = BYTE_SWAP_NOSWAP;
1325acd3514SThierry Reding 
1335acd3514SThierry Reding 	switch (fourcc) {
134511c7023SThierry Reding 	case DRM_FORMAT_ARGB4444:
135511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B4G4R4A4;
1367772fdaeSThierry Reding 		break;
1377772fdaeSThierry Reding 
138511c7023SThierry Reding 	case DRM_FORMAT_ARGB1555:
139511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B5G5R5A1;
1405acd3514SThierry Reding 		break;
1415acd3514SThierry Reding 
142511c7023SThierry Reding 	case DRM_FORMAT_RGB565:
143511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B5G6R5;
144511c7023SThierry Reding 		break;
145511c7023SThierry Reding 
146511c7023SThierry Reding 	case DRM_FORMAT_RGBA5551:
147511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_A1B5G5R5;
1487772fdaeSThierry Reding 		break;
1497772fdaeSThierry Reding 
1507772fdaeSThierry Reding 	case DRM_FORMAT_ARGB8888:
1515acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_B8G8R8A8;
1525acd3514SThierry Reding 		break;
1535acd3514SThierry Reding 
154511c7023SThierry Reding 	case DRM_FORMAT_ABGR8888:
155511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R8G8B8A8;
156511c7023SThierry Reding 		break;
157511c7023SThierry Reding 
158511c7023SThierry Reding 	case DRM_FORMAT_ABGR4444:
159511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R4G4B4A4;
160511c7023SThierry Reding 		break;
161511c7023SThierry Reding 
162511c7023SThierry Reding 	case DRM_FORMAT_ABGR1555:
163511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R5G5B5A;
164511c7023SThierry Reding 		break;
165511c7023SThierry Reding 
166511c7023SThierry Reding 	case DRM_FORMAT_BGRA5551:
167511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_AR5G5B5;
168511c7023SThierry Reding 		break;
169511c7023SThierry Reding 
170511c7023SThierry Reding 	case DRM_FORMAT_XRGB1555:
171511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B5G5R5X1;
172511c7023SThierry Reding 		break;
173511c7023SThierry Reding 
174511c7023SThierry Reding 	case DRM_FORMAT_RGBX5551:
175511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_X1B5G5R5;
176511c7023SThierry Reding 		break;
177511c7023SThierry Reding 
178511c7023SThierry Reding 	case DRM_FORMAT_XBGR1555:
179511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R5G5B5X1;
180511c7023SThierry Reding 		break;
181511c7023SThierry Reding 
182511c7023SThierry Reding 	case DRM_FORMAT_BGRX5551:
183511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_X1R5G5B5;
184511c7023SThierry Reding 		break;
185511c7023SThierry Reding 
186511c7023SThierry Reding 	case DRM_FORMAT_BGR565:
187511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R5G6B5;
188511c7023SThierry Reding 		break;
189511c7023SThierry Reding 
190511c7023SThierry Reding 	case DRM_FORMAT_BGRA8888:
191511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_A8R8G8B8;
192511c7023SThierry Reding 		break;
193511c7023SThierry Reding 
194511c7023SThierry Reding 	case DRM_FORMAT_RGBA8888:
195511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_A8B8G8R8;
196511c7023SThierry Reding 		break;
197511c7023SThierry Reding 
198511c7023SThierry Reding 	case DRM_FORMAT_XRGB8888:
199511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B8G8R8X8;
200511c7023SThierry Reding 		break;
201511c7023SThierry Reding 
202511c7023SThierry Reding 	case DRM_FORMAT_XBGR8888:
203511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R8G8B8X8;
2045acd3514SThierry Reding 		break;
2055acd3514SThierry Reding 
2065acd3514SThierry Reding 	case DRM_FORMAT_UYVY:
2075acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr422;
2085acd3514SThierry Reding 		break;
2095acd3514SThierry Reding 
2105acd3514SThierry Reding 	case DRM_FORMAT_YUYV:
2115acd3514SThierry Reding 		if (!swap)
2125acd3514SThierry Reding 			return -EINVAL;
2135acd3514SThierry Reding 
2145acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr422;
2155acd3514SThierry Reding 		*swap = BYTE_SWAP_SWAP2;
2165acd3514SThierry Reding 		break;
2175acd3514SThierry Reding 
2185acd3514SThierry Reding 	case DRM_FORMAT_YUV420:
2195acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr420P;
2205acd3514SThierry Reding 		break;
2215acd3514SThierry Reding 
2225acd3514SThierry Reding 	case DRM_FORMAT_YUV422:
2235acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr422P;
2245acd3514SThierry Reding 		break;
2255acd3514SThierry Reding 
2265acd3514SThierry Reding 	default:
2275acd3514SThierry Reding 		return -EINVAL;
2285acd3514SThierry Reding 	}
2295acd3514SThierry Reding 
2305acd3514SThierry Reding 	return 0;
2315acd3514SThierry Reding }
2325acd3514SThierry Reding 
2335acd3514SThierry Reding bool tegra_plane_format_is_yuv(unsigned int format, bool *planar)
2345acd3514SThierry Reding {
2355acd3514SThierry Reding 	switch (format) {
2365acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422:
2375acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422:
2385acd3514SThierry Reding 		if (planar)
2395acd3514SThierry Reding 			*planar = false;
2405acd3514SThierry Reding 
2415acd3514SThierry Reding 		return true;
2425acd3514SThierry Reding 
2435acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr420P:
2445acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV420P:
2455acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422P:
2465acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422P:
2475acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422R:
2485acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422R:
2495acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422RA:
2505acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422RA:
2515acd3514SThierry Reding 		if (planar)
2525acd3514SThierry Reding 			*planar = true;
2535acd3514SThierry Reding 
2545acd3514SThierry Reding 		return true;
2555acd3514SThierry Reding 	}
2565acd3514SThierry Reding 
2575acd3514SThierry Reding 	if (planar)
2585acd3514SThierry Reding 		*planar = false;
2595acd3514SThierry Reding 
2605acd3514SThierry Reding 	return false;
2615acd3514SThierry Reding }
262ebae8d07SThierry Reding 
263ebae8d07SThierry Reding static bool __drm_format_has_alpha(u32 format)
264ebae8d07SThierry Reding {
265ebae8d07SThierry Reding 	switch (format) {
266ebae8d07SThierry Reding 	case DRM_FORMAT_ARGB1555:
267ebae8d07SThierry Reding 	case DRM_FORMAT_RGBA5551:
268ebae8d07SThierry Reding 	case DRM_FORMAT_ABGR8888:
269ebae8d07SThierry Reding 	case DRM_FORMAT_ARGB8888:
270ebae8d07SThierry Reding 		return true;
271ebae8d07SThierry Reding 	}
272ebae8d07SThierry Reding 
273ebae8d07SThierry Reding 	return false;
274ebae8d07SThierry Reding }
275ebae8d07SThierry Reding 
276ebae8d07SThierry Reding /*
277ebae8d07SThierry Reding  * This is applicable to Tegra20 and Tegra30 only where the opaque formats can
278ebae8d07SThierry Reding  * be emulated using the alpha formats and alpha blending disabled.
279ebae8d07SThierry Reding  */
280ebae8d07SThierry Reding bool tegra_plane_format_has_alpha(unsigned int format)
281ebae8d07SThierry Reding {
282ebae8d07SThierry Reding 	switch (format) {
283ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_B5G5R5A1:
284ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_A1B5G5R5:
285ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_R8G8B8A8:
286ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_B8G8R8A8:
287ebae8d07SThierry Reding 		return true;
288ebae8d07SThierry Reding 	}
289ebae8d07SThierry Reding 
290ebae8d07SThierry Reding 	return false;
291ebae8d07SThierry Reding }
292ebae8d07SThierry Reding 
293ebae8d07SThierry Reding int tegra_plane_format_get_alpha(unsigned int opaque, unsigned int *alpha)
294ebae8d07SThierry Reding {
2955467a8b8SThierry Reding 	if (tegra_plane_format_is_yuv(opaque, NULL)) {
2965467a8b8SThierry Reding 		*alpha = opaque;
2975467a8b8SThierry Reding 		return 0;
2985467a8b8SThierry Reding 	}
2995467a8b8SThierry Reding 
300ebae8d07SThierry Reding 	switch (opaque) {
301ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_B5G5R5X1:
302ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_B5G5R5A1;
303ebae8d07SThierry Reding 		return 0;
304ebae8d07SThierry Reding 
305ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_X1B5G5R5:
306ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_A1B5G5R5;
307ebae8d07SThierry Reding 		return 0;
308ebae8d07SThierry Reding 
309ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_R8G8B8X8:
310ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_R8G8B8A8;
311ebae8d07SThierry Reding 		return 0;
312ebae8d07SThierry Reding 
313ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_B8G8R8X8:
314ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_B8G8R8A8;
315ebae8d07SThierry Reding 		return 0;
316ebae8d07SThierry Reding 	}
317ebae8d07SThierry Reding 
318ebae8d07SThierry Reding 	return -EINVAL;
319ebae8d07SThierry Reding }
320ebae8d07SThierry Reding 
3215e2e86f1SDmitry Osipenko static unsigned int tegra_plane_get_overlap_index(struct tegra_plane *plane,
322ebae8d07SThierry Reding 						  struct tegra_plane *other)
323ebae8d07SThierry Reding {
324ebae8d07SThierry Reding 	unsigned int index = 0, i;
325ebae8d07SThierry Reding 
326ebae8d07SThierry Reding 	WARN_ON(plane == other);
327ebae8d07SThierry Reding 
328ebae8d07SThierry Reding 	for (i = 0; i < 3; i++) {
329ebae8d07SThierry Reding 		if (i == plane->index)
330ebae8d07SThierry Reding 			continue;
331ebae8d07SThierry Reding 
332ebae8d07SThierry Reding 		if (i == other->index)
333ebae8d07SThierry Reding 			break;
334ebae8d07SThierry Reding 
335ebae8d07SThierry Reding 		index++;
336ebae8d07SThierry Reding 	}
337ebae8d07SThierry Reding 
338ebae8d07SThierry Reding 	return index;
339ebae8d07SThierry Reding }
340ebae8d07SThierry Reding 
341ebae8d07SThierry Reding void tegra_plane_check_dependent(struct tegra_plane *tegra,
342ebae8d07SThierry Reding 				 struct tegra_plane_state *state)
343ebae8d07SThierry Reding {
344ebae8d07SThierry Reding 	struct drm_plane_state *old, *new;
345ebae8d07SThierry Reding 	struct drm_plane *plane;
346ebae8d07SThierry Reding 	unsigned int zpos[2];
347ebae8d07SThierry Reding 	unsigned int i;
348ebae8d07SThierry Reding 
349ebae8d07SThierry Reding 	for (i = 0; i < 3; i++)
350ebae8d07SThierry Reding 		state->dependent[i] = false;
351ebae8d07SThierry Reding 
352ebae8d07SThierry Reding 	for (i = 0; i < 2; i++)
353ebae8d07SThierry Reding 		zpos[i] = 0;
354ebae8d07SThierry Reding 
355ebae8d07SThierry Reding 	for_each_oldnew_plane_in_state(state->base.state, plane, old, new, i) {
356ebae8d07SThierry Reding 		struct tegra_plane *p = to_tegra_plane(plane);
357ebae8d07SThierry Reding 		unsigned index;
358ebae8d07SThierry Reding 
359ebae8d07SThierry Reding 		/* skip this plane and planes on different CRTCs */
360ebae8d07SThierry Reding 		if (p == tegra || new->crtc != state->base.crtc)
361ebae8d07SThierry Reding 			continue;
362ebae8d07SThierry Reding 
363ebae8d07SThierry Reding 		index = tegra_plane_get_overlap_index(tegra, p);
364ebae8d07SThierry Reding 
365ebae8d07SThierry Reding 		/*
366ebae8d07SThierry Reding 		 * If any of the other planes is on top of this plane and uses
367ebae8d07SThierry Reding 		 * a format with an alpha component, mark this plane as being
368ebae8d07SThierry Reding 		 * dependent, meaning it's alpha value will be 1 minus the sum
369ebae8d07SThierry Reding 		 * of alpha components of the overlapping planes.
370ebae8d07SThierry Reding 		 */
371ebae8d07SThierry Reding 		if (p->index > tegra->index) {
372ebae8d07SThierry Reding 			if (__drm_format_has_alpha(new->fb->format->format))
373ebae8d07SThierry Reding 				state->dependent[index] = true;
374ebae8d07SThierry Reding 
375ebae8d07SThierry Reding 			/* keep track of the Z position */
376ebae8d07SThierry Reding 			zpos[index] = p->index;
377ebae8d07SThierry Reding 		}
378ebae8d07SThierry Reding 	}
379ebae8d07SThierry Reding 
380ebae8d07SThierry Reding 	/*
381ebae8d07SThierry Reding 	 * The region where three windows overlap is the intersection of the
382ebae8d07SThierry Reding 	 * two regions where two windows overlap. It contributes to the area
383ebae8d07SThierry Reding 	 * if any of the windows on top of it have an alpha component.
384ebae8d07SThierry Reding 	 */
385ebae8d07SThierry Reding 	for (i = 0; i < 2; i++)
386ebae8d07SThierry Reding 		state->dependent[2] = state->dependent[2] ||
387ebae8d07SThierry Reding 				      state->dependent[i];
388ebae8d07SThierry Reding 
389ebae8d07SThierry Reding 	/*
390ebae8d07SThierry Reding 	 * However, if any of the windows on top of this window is opaque, it
391ebae8d07SThierry Reding 	 * will completely conceal this window within that area, so avoid the
392ebae8d07SThierry Reding 	 * window from contributing to the area.
393ebae8d07SThierry Reding 	 */
394ebae8d07SThierry Reding 	for (i = 0; i < 2; i++) {
395ebae8d07SThierry Reding 		if (zpos[i] > tegra->index)
396ebae8d07SThierry Reding 			state->dependent[2] = state->dependent[2] &&
397ebae8d07SThierry Reding 					      state->dependent[i];
398ebae8d07SThierry Reding 	}
399ebae8d07SThierry Reding }
400