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>
This commit is contained in:
Родитель
486936cd93
Коммит
9b82f3e617
|
@ -516,4 +516,7 @@ void ps3_sync_irq(int node);
|
||||||
u32 ps3_get_hw_thread_id(int cpu);
|
u32 ps3_get_hw_thread_id(int cpu);
|
||||||
u64 ps3_get_spe_id(void *arg);
|
u64 ps3_get_spe_id(void *arg);
|
||||||
|
|
||||||
|
/* mutex synchronizing GPU accesses and video mode changes */
|
||||||
|
extern struct mutex ps3_gpu_mutex;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -740,8 +740,4 @@ extern int ps3av_audio_mute(int);
|
||||||
extern int ps3av_audio_mute_analog(int);
|
extern int ps3av_audio_mute_analog(int);
|
||||||
extern int ps3av_dev_open(void);
|
extern int ps3av_dev_open(void);
|
||||||
extern int ps3av_dev_close(void);
|
extern int ps3av_dev_close(void);
|
||||||
extern void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data),
|
|
||||||
void *flip_data);
|
|
||||||
extern void ps3av_flip_ctl(int on);
|
|
||||||
|
|
||||||
#endif /* _ASM_POWERPC_PS3AV_H_ */
|
#endif /* _ASM_POWERPC_PS3AV_H_ */
|
||||||
|
|
|
@ -42,6 +42,10 @@
|
||||||
#define DBG pr_debug
|
#define DBG pr_debug
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* mutex synchronizing GPU accesses and video mode changes */
|
||||||
|
DEFINE_MUTEX(ps3_gpu_mutex);
|
||||||
|
EXPORT_SYMBOL_GPL(ps3_gpu_mutex);
|
||||||
|
|
||||||
#if !defined(CONFIG_SMP)
|
#if !defined(CONFIG_SMP)
|
||||||
static void smp_send_stop(void) {}
|
static void smp_send_stop(void) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,8 +59,6 @@ static struct ps3av {
|
||||||
struct ps3av_reply_hdr reply_hdr;
|
struct ps3av_reply_hdr reply_hdr;
|
||||||
u8 raw[PS3AV_BUF_SIZE];
|
u8 raw[PS3AV_BUF_SIZE];
|
||||||
} recv_buf;
|
} recv_buf;
|
||||||
void (*flip_ctl)(int on, void *data);
|
|
||||||
void *flip_data;
|
|
||||||
} *ps3av;
|
} *ps3av;
|
||||||
|
|
||||||
/* color space */
|
/* color space */
|
||||||
|
@ -939,24 +937,6 @@ int ps3av_audio_mute(int mute)
|
||||||
|
|
||||||
EXPORT_SYMBOL_GPL(ps3av_audio_mute);
|
EXPORT_SYMBOL_GPL(ps3av_audio_mute);
|
||||||
|
|
||||||
void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data),
|
|
||||||
void *flip_data)
|
|
||||||
{
|
|
||||||
mutex_lock(&ps3av->mutex);
|
|
||||||
ps3av->flip_ctl = flip_ctl;
|
|
||||||
ps3av->flip_data = flip_data;
|
|
||||||
mutex_unlock(&ps3av->mutex);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(ps3av_register_flip_ctl);
|
|
||||||
|
|
||||||
void ps3av_flip_ctl(int on)
|
|
||||||
{
|
|
||||||
mutex_lock(&ps3av->mutex);
|
|
||||||
if (ps3av->flip_ctl)
|
|
||||||
ps3av->flip_ctl(on, ps3av->flip_data);
|
|
||||||
mutex_unlock(&ps3av->mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ps3av_probe(struct ps3_system_bus_device *dev)
|
static int ps3av_probe(struct ps3_system_bus_device *dev)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
|
@ -864,7 +864,7 @@ int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *avb, u32 send_len)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
ps3av_flip_ctl(0); /* flip off */
|
mutex_lock(&ps3_gpu_mutex);
|
||||||
|
|
||||||
/* avb packet */
|
/* avb packet */
|
||||||
res = ps3av_do_pkt(PS3AV_CID_AVB_PARAM, send_len, sizeof(*avb),
|
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)
|
||||||
res);
|
res);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
ps3av_flip_ctl(1); /* flip on */
|
mutex_unlock(&ps3_gpu_mutex);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -460,12 +460,16 @@ static void ps3fb_sync_image(struct device *dev, u64 frame_offset,
|
||||||
line_length |= (u64)src_line_length << 32;
|
line_length |= (u64)src_line_length << 32;
|
||||||
|
|
||||||
src_offset += GPU_FB_START;
|
src_offset += GPU_FB_START;
|
||||||
|
|
||||||
|
mutex_lock(&ps3_gpu_mutex);
|
||||||
status = lv1_gpu_context_attribute(ps3fb.context_handle,
|
status = lv1_gpu_context_attribute(ps3fb.context_handle,
|
||||||
L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
|
L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
|
||||||
dst_offset, GPU_IOIF + src_offset,
|
dst_offset, GPU_IOIF + src_offset,
|
||||||
L1GPU_FB_BLIT_WAIT_FOR_COMPLETION |
|
L1GPU_FB_BLIT_WAIT_FOR_COMPLETION |
|
||||||
(width << 16) | height,
|
(width << 16) | height,
|
||||||
line_length);
|
line_length);
|
||||||
|
mutex_unlock(&ps3_gpu_mutex);
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
dev_err(dev,
|
dev_err(dev,
|
||||||
"%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n",
|
"%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n",
|
||||||
|
@ -784,15 +788,6 @@ static int ps3fb_wait_for_vsync(u32 crtc)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ps3fb_flip_ctl(int on, void *data)
|
|
||||||
{
|
|
||||||
struct ps3fb_priv *priv = data;
|
|
||||||
if (on)
|
|
||||||
atomic_dec_if_positive(&priv->ext_flip);
|
|
||||||
else
|
|
||||||
atomic_inc(&priv->ext_flip);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ioctl
|
* ioctl
|
||||||
|
@ -1228,7 +1223,6 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
ps3fb.task = task;
|
ps3fb.task = task;
|
||||||
ps3av_register_flip_ctl(ps3fb_flip_ctl, &ps3fb);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1258,10 +1252,9 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
|
||||||
|
|
||||||
dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__);
|
dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__);
|
||||||
|
|
||||||
ps3fb_flip_ctl(0, &ps3fb); /* flip off */
|
atomic_inc(&ps3fb.ext_flip); /* flip off */
|
||||||
ps3fb.dinfo->irq.mask = 0;
|
ps3fb.dinfo->irq.mask = 0;
|
||||||
|
|
||||||
ps3av_register_flip_ctl(NULL, NULL);
|
|
||||||
if (ps3fb.task) {
|
if (ps3fb.task) {
|
||||||
struct task_struct *task = ps3fb.task;
|
struct task_struct *task = ps3fb.task;
|
||||||
ps3fb.task = NULL;
|
ps3fb.task = NULL;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче