fix uclibc subdir
[openwrt.git] / target / linux / ps3 / patches-2.6.28 / 0002-powerpc-ps3-Replace-the-flip_ctl-logic-in-ps3av-and.patch
1 From 9b82f3e61758ed897200f0244b63a77c1791bcba Mon Sep 17 00:00:00 2001
2 From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
3 Date: Thu, 30 Oct 2008 08:12:58 +0000
4 Subject: powerpc/ps3: Replace the flip_ctl logic in ps3av and ps3fb by a mutex
5
6 Introduce ps3_gpu_mutex to synchronizes GPU-related operations, like:
7 - invoking the L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT command using the
8 lv1_gpu_context_attribute() hypervisor call,
9 - handling the PS3AV_CID_AVB_PARAM packet in the PS3 A/V Settings driver.
10
11 Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
12 Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
13 Signed-off-by: Paul Mackerras <paulus@samba.org>
14 ---
15 arch/powerpc/include/asm/ps3.h | 3 +++
16 arch/powerpc/include/asm/ps3av.h | 4 ----
17 arch/powerpc/platforms/ps3/setup.c | 4 ++++
18 drivers/ps3/ps3av.c | 20 --------------------
19 drivers/ps3/ps3av_cmd.c | 4 ++--
20 drivers/video/ps3fb.c | 17 +++++------------
21 6 files changed, 14 insertions(+), 38 deletions(-)
22
23 diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
24 index f9e34c4..4299365 100644
25 --- a/arch/powerpc/include/asm/ps3.h
26 +++ b/arch/powerpc/include/asm/ps3.h
27 @@ -516,4 +516,7 @@ void ps3_sync_irq(int node);
28 u32 ps3_get_hw_thread_id(int cpu);
29 u64 ps3_get_spe_id(void *arg);
30
31 +/* mutex synchronizing GPU accesses and video mode changes */
32 +extern struct mutex ps3_gpu_mutex;
33 +
34 #endif
35 diff --git a/arch/powerpc/include/asm/ps3av.h b/arch/powerpc/include/asm/ps3av.h
36 index 5aa22cf..cd24ac1 100644
37 --- a/arch/powerpc/include/asm/ps3av.h
38 +++ b/arch/powerpc/include/asm/ps3av.h
39 @@ -740,8 +740,4 @@ extern int ps3av_audio_mute(int);
40 extern int ps3av_audio_mute_analog(int);
41 extern int ps3av_dev_open(void);
42 extern int ps3av_dev_close(void);
43 -extern void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data),
44 - void *flip_data);
45 -extern void ps3av_flip_ctl(int on);
46 -
47 #endif /* _ASM_POWERPC_PS3AV_H_ */
48 diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
49 index 77bc330..bfc33fb 100644
50 --- a/arch/powerpc/platforms/ps3/setup.c
51 +++ b/arch/powerpc/platforms/ps3/setup.c
52 @@ -42,6 +42,10 @@
53 #define DBG pr_debug
54 #endif
55
56 +/* mutex synchronizing GPU accesses and video mode changes */
57 +DEFINE_MUTEX(ps3_gpu_mutex);
58 +EXPORT_SYMBOL_GPL(ps3_gpu_mutex);
59 +
60 #if !defined(CONFIG_SMP)
61 static void smp_send_stop(void) {}
62 #endif
63 diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c
64 index 06848b2..5324978 100644
65 --- a/drivers/ps3/ps3av.c
66 +++ b/drivers/ps3/ps3av.c
67 @@ -59,8 +59,6 @@ static struct ps3av {
68 struct ps3av_reply_hdr reply_hdr;
69 u8 raw[PS3AV_BUF_SIZE];
70 } recv_buf;
71 - void (*flip_ctl)(int on, void *data);
72 - void *flip_data;
73 } *ps3av;
74
75 /* color space */
76 @@ -939,24 +937,6 @@ int ps3av_audio_mute(int mute)
77
78 EXPORT_SYMBOL_GPL(ps3av_audio_mute);
79
80 -void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data),
81 - void *flip_data)
82 -{
83 - mutex_lock(&ps3av->mutex);
84 - ps3av->flip_ctl = flip_ctl;
85 - ps3av->flip_data = flip_data;
86 - mutex_unlock(&ps3av->mutex);
87 -}
88 -EXPORT_SYMBOL_GPL(ps3av_register_flip_ctl);
89 -
90 -void ps3av_flip_ctl(int on)
91 -{
92 - mutex_lock(&ps3av->mutex);
93 - if (ps3av->flip_ctl)
94 - ps3av->flip_ctl(on, ps3av->flip_data);
95 - mutex_unlock(&ps3av->mutex);
96 -}
97 -
98 static int ps3av_probe(struct ps3_system_bus_device *dev)
99 {
100 int res;
101 diff --git a/drivers/ps3/ps3av_cmd.c b/drivers/ps3/ps3av_cmd.c
102 index 11eb503..716596e 100644
103 --- a/drivers/ps3/ps3av_cmd.c
104 +++ b/drivers/ps3/ps3av_cmd.c
105 @@ -864,7 +864,7 @@ int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *avb, u32 send_len)
106 {
107 int res;
108
109 - ps3av_flip_ctl(0); /* flip off */
110 + mutex_lock(&ps3_gpu_mutex);
111
112 /* avb packet */
113 res = ps3av_do_pkt(PS3AV_CID_AVB_PARAM, send_len, sizeof(*avb),
114 @@ -878,7 +878,7 @@ int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *avb, u32 send_len)
115 res);
116
117 out:
118 - ps3av_flip_ctl(1); /* flip on */
119 + mutex_unlock(&ps3_gpu_mutex);
120 return res;
121 }
122
123 diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
124 index 4b5d807..bd3e39b 100644
125 --- a/drivers/video/ps3fb.c
126 +++ b/drivers/video/ps3fb.c
127 @@ -460,12 +460,16 @@ static void ps3fb_sync_image(struct device *dev, u64 frame_offset,
128 line_length |= (u64)src_line_length << 32;
129
130 src_offset += GPU_FB_START;
131 +
132 + mutex_lock(&ps3_gpu_mutex);
133 status = lv1_gpu_context_attribute(ps3fb.context_handle,
134 L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
135 dst_offset, GPU_IOIF + src_offset,
136 L1GPU_FB_BLIT_WAIT_FOR_COMPLETION |
137 (width << 16) | height,
138 line_length);
139 + mutex_unlock(&ps3_gpu_mutex);
140 +
141 if (status)
142 dev_err(dev,
143 "%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n",
144 @@ -784,15 +788,6 @@ static int ps3fb_wait_for_vsync(u32 crtc)
145 return 0;
146 }
147
148 -static void ps3fb_flip_ctl(int on, void *data)
149 -{
150 - struct ps3fb_priv *priv = data;
151 - if (on)
152 - atomic_dec_if_positive(&priv->ext_flip);
153 - else
154 - atomic_inc(&priv->ext_flip);
155 -}
156 -
157
158 /*
159 * ioctl
160 @@ -1228,7 +1223,6 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
161 }
162
163 ps3fb.task = task;
164 - ps3av_register_flip_ctl(ps3fb_flip_ctl, &ps3fb);
165
166 return 0;
167
168 @@ -1258,10 +1252,9 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
169
170 dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__);
171
172 - ps3fb_flip_ctl(0, &ps3fb); /* flip off */
173 + atomic_inc(&ps3fb.ext_flip); /* flip off */
174 ps3fb.dinfo->irq.mask = 0;
175
176 - ps3av_register_flip_ctl(NULL, NULL);
177 if (ps3fb.task) {
178 struct task_struct *task = ps3fb.task;
179 ps3fb.task = NULL;
180 --
181 1.6.0.4
182
This page took 0.051533 seconds and 5 git commands to generate.