aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>2008-10-30 04:12:58 -0400
committerPaul Mackerras <paulus@samba.org>2008-11-19 00:03:54 -0500
commit9b82f3e61758ed897200f0244b63a77c1791bcba (patch)
treeed1a41b22151fabf4e096ca6b4bee8f1931599c7 /drivers
parent486936cd93e99c802153b3f2f629c5ce62b8c0d4 (diff)
powerpc/ps3: Replace the flip_ctl logic in ps3av and ps3fb by a mutex
Introduce ps3_gpu_mutex to synchronizes GPU-related operations, like: - invoking the L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT command using the lv1_gpu_context_attribute() hypervisor call, - handling the PS3AV_CID_AVB_PARAM packet in the PS3 A/V Settings driver. Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ps3/ps3av.c20
-rw-r--r--drivers/ps3/ps3av_cmd.c4
-rw-r--r--drivers/video/ps3fb.c17
3 files changed, 7 insertions, 34 deletions
diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c
index 06848b254d57..5324978b73fb 100644
--- a/drivers/ps3/ps3av.c
+++ b/drivers/ps3/ps3av.c
@@ -59,8 +59,6 @@ static struct ps3av {
59 struct ps3av_reply_hdr reply_hdr; 59 struct ps3av_reply_hdr reply_hdr;
60 u8 raw[PS3AV_BUF_SIZE]; 60 u8 raw[PS3AV_BUF_SIZE];
61 } recv_buf; 61 } recv_buf;
62 void (*flip_ctl)(int on, void *data);
63 void *flip_data;
64} *ps3av; 62} *ps3av;
65 63
66/* color space */ 64/* color space */
@@ -939,24 +937,6 @@ int ps3av_audio_mute(int mute)
939 937
940EXPORT_SYMBOL_GPL(ps3av_audio_mute); 938EXPORT_SYMBOL_GPL(ps3av_audio_mute);
941 939
942void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data),
943 void *flip_data)
944{
945 mutex_lock(&ps3av->mutex);
946 ps3av->flip_ctl = flip_ctl;
947 ps3av->flip_data = flip_data;
948 mutex_unlock(&ps3av->mutex);
949}
950EXPORT_SYMBOL_GPL(ps3av_register_flip_ctl);
951
952void ps3av_flip_ctl(int on)
953{
954 mutex_lock(&ps3av->mutex);
955 if (ps3av->flip_ctl)
956 ps3av->flip_ctl(on, ps3av->flip_data);
957 mutex_unlock(&ps3av->mutex);
958}
959
960static int ps3av_probe(struct ps3_system_bus_device *dev) 940static int ps3av_probe(struct ps3_system_bus_device *dev)
961{ 941{
962 int res; 942 int res;
diff --git a/drivers/ps3/ps3av_cmd.c b/drivers/ps3/ps3av_cmd.c
index 11eb50318fec..716596e8e5b0 100644
--- a/drivers/ps3/ps3av_cmd.c
+++ b/drivers/ps3/ps3av_cmd.c
@@ -864,7 +864,7 @@ int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *avb, u32 send_len)
864{ 864{
865 int res; 865 int res;
866 866
867 ps3av_flip_ctl(0); /* flip off */ 867 mutex_lock(&ps3_gpu_mutex);
868 868
869 /* avb packet */ 869 /* avb packet */
870 res = ps3av_do_pkt(PS3AV_CID_AVB_PARAM, send_len, sizeof(*avb), 870 res = ps3av_do_pkt(PS3AV_CID_AVB_PARAM, send_len, sizeof(*avb),
@@ -878,7 +878,7 @@ int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *avb, u32 send_len)
878 res); 878 res);
879 879
880 out: 880 out:
881 ps3av_flip_ctl(1); /* flip on */ 881 mutex_unlock(&ps3_gpu_mutex);
882 return res; 882 return res;
883} 883}
884 884
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 4b5d80771904..bd3e39baf7d2 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -460,12 +460,16 @@ static void ps3fb_sync_image(struct device *dev, u64 frame_offset,
460 line_length |= (u64)src_line_length << 32; 460 line_length |= (u64)src_line_length << 32;
461 461
462 src_offset += GPU_FB_START; 462 src_offset += GPU_FB_START;
463
464 mutex_lock(&ps3_gpu_mutex);
463 status = lv1_gpu_context_attribute(ps3fb.context_handle, 465 status = lv1_gpu_context_attribute(ps3fb.context_handle,
464 L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, 466 L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
465 dst_offset, GPU_IOIF + src_offset, 467 dst_offset, GPU_IOIF + src_offset,
466 L1GPU_FB_BLIT_WAIT_FOR_COMPLETION | 468 L1GPU_FB_BLIT_WAIT_FOR_COMPLETION |
467 (width << 16) | height, 469 (width << 16) | height,
468 line_length); 470 line_length);
471 mutex_unlock(&ps3_gpu_mutex);
472
469 if (status) 473 if (status)
470 dev_err(dev, 474 dev_err(dev,
471 "%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n", 475 "%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n",
@@ -784,15 +788,6 @@ static int ps3fb_wait_for_vsync(u32 crtc)
784 return 0; 788 return 0;
785} 789}
786 790
787static void ps3fb_flip_ctl(int on, void *data)
788{
789 struct ps3fb_priv *priv = data;
790 if (on)
791 atomic_dec_if_positive(&priv->ext_flip);
792 else
793 atomic_inc(&priv->ext_flip);
794}
795
796 791
797 /* 792 /*
798 * ioctl 793 * ioctl
@@ -1228,7 +1223,6 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1228 } 1223 }
1229 1224
1230 ps3fb.task = task; 1225 ps3fb.task = task;
1231 ps3av_register_flip_ctl(ps3fb_flip_ctl, &ps3fb);
1232 1226
1233 return 0; 1227 return 0;
1234 1228
@@ -1258,10 +1252,9 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1258 1252
1259 dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__); 1253 dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__);
1260 1254
1261 ps3fb_flip_ctl(0, &ps3fb); /* flip off */ 1255 atomic_inc(&ps3fb.ext_flip); /* flip off */
1262 ps3fb.dinfo->irq.mask = 0; 1256 ps3fb.dinfo->irq.mask = 0;
1263 1257
1264 ps3av_register_flip_ctl(NULL, NULL);
1265 if (ps3fb.task) { 1258 if (ps3fb.task) {
1266 struct task_struct *task = ps3fb.task; 1259 struct task_struct *task = ps3fb.task;
1267 ps3fb.task = NULL; 1260 ps3fb.task = NULL;