summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-omap-pm/dss2/0040-DSS2-Provided-proper-exclusion-for-destination-colo.patch
blob: 471a2a7f6c1b93f117a6f81c68b0a8da04162fbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
From a5129f272a48aa22629137c9c31e60eddb8c3f5d Mon Sep 17 00:00:00 2001
From: Hardik Shah <hardik.shah@ti.com>
Date: Fri, 17 Apr 2009 14:24:46 +0530
Subject: [PATCH 40/69] DSS2: Provided proper exclusion for destination color keying and alpha blending.

OMAP does not support destination color key and alpha blending
simultaneously.  So this patch does not allow the user
so set both at a time.

Signed-off-by: Hardik Shah <hardik.shah@ti.com>
---
 drivers/video/omap2/dss/manager.c |   50 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 49 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
index 7965a84..108489c 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -137,12 +137,26 @@ static ssize_t manager_color_key_type_store(struct omap_overlay_manager *mgr,
 	u32 key_value;
 
 	for (key_type = OMAP_DSS_COLOR_KEY_GFX_DST;
-	     key_type < ARRAY_SIZE(color_key_type_str); key_type++) {
+			key_type < ARRAY_SIZE(color_key_type_str); key_type++) {
 		if (sysfs_streq(buf, color_key_type_str[key_type]))
 			break;
 	}
 	if (key_type == ARRAY_SIZE(color_key_type_str))
 		return -EINVAL;
+	/* OMAP does not support destination color key and alpha blending
+	 * simultaneously.  So if alpha blending and color keying both are
+	 * enabled then refrain from setting the color key type to
+	 * gfx-destination
+	 */
+	if (!key_type) {
+		bool color_key_enabled;
+		bool alpha_blending_enabled;
+		color_key_enabled = mgr->get_trans_key_status(mgr);
+		alpha_blending_enabled = mgr->get_alpha_blending_status(mgr);
+		if (color_key_enabled && alpha_blending_enabled)
+			return -EINVAL;
+	}
+
 	mgr->get_trans_key_type_and_value(mgr, NULL, &key_value);
 	mgr->set_trans_key_type_and_value(mgr, key_type, key_value);
 
@@ -188,6 +202,23 @@ static ssize_t manager_color_key_enabled_store(struct omap_overlay_manager *mgr,
 	if (sscanf(buf, "%d", &enable) != 1)
 		return -EINVAL;
 
+	/* OMAP does not support destination color keying and
+	 * alpha blending simultaneously.  so if alpha blending
+	 * is enabled refrain from enabling destination color
+	 * keying.
+	 */
+	if (enable) {
+		bool enabled;
+		enabled = mgr->get_alpha_blending_status(mgr);
+		if (enabled) {
+			enum omap_dss_color_key_type key_type;
+			mgr->get_trans_key_type_and_value(mgr,
+					&key_type, NULL);
+			if (!key_type)
+				return -EINVAL;
+		}
+
+	}
 	mgr->enable_trans_key(mgr, enable);
 
 	return size;
@@ -205,6 +236,23 @@ static ssize_t manager_alpha_blending_enabled_store(
 	int enable;
 	if (sscanf(buf, "%d", &enable) != 1)
 		return -EINVAL;
+	/* OMAP does not support destination color keying and
+	 * alpha blending simultaneously.  so if destination
+	 * color keying is enabled refrain from enabling
+	 * alpha blending
+	 */
+	if (enable) {
+		bool enabled;
+		enabled = mgr->get_trans_key_status(mgr);
+		if (enabled) {
+			enum omap_dss_color_key_type key_type;
+			mgr->get_trans_key_type_and_value(mgr, &key_type, NULL);
+			if (!key_type)
+				return -EINVAL;
+
+		}
+
+	}
 	mgr->enable_alpha_blending(mgr, enable);
 	return size;
 }
-- 
1.6.2.4