void PS3_DoubleBufferUpdate(_THIS, int numrects, SDL_Rect * rects)
{
	if (converter_thread_data && converter_thread_data->booted)
		SPE_WaitForMsg(this, converter_thread_data, SPU_FIN);

	
	s_bounded_input_width_offset = (s_writeable_width - s_bounded_input_width) >> 1;
	s_bounded_input_height_offset = (s_writeable_height - s_bounded_input_height) >> 1;
	s_center[0] = frame_buffer + s_bounded_input_width_offset * s_fb_pixel_size +
		s_bounded_input_height_offset * fb_finfo.line_length;
	s_center[1] = s_center[0] + real_height * fb_finfo.line_length;

	
	fb_parms->data = (unsigned char *)s_pixels;
	fb_parms->center = s_center[s_center_index];
	fb_parms->out_line_stride = fb_finfo.line_length;
	fb_parms->in_line_stride = s_input_line_length;
	fb_parms->bounded_input_height = s_bounded_input_height;
	fb_parms->bounded_input_width = s_bounded_input_width;
	fb_parms->fb_pixel_size = s_fb_pixel_size;

	deprintf(3, "[PS3->SPU] fb_thread_data->argp = 0x%x\n", fb_thread_data->argp);

	
	SPE_SendMsg(this, fb_thread_data, SPU_START);
	SPE_SendMsg(this, fb_thread_data, (unsigned int)fb_thread_data->argp);

	SPE_WaitForMsg(this, fb_thread_data, SPU_FIN);

	
	if (double_buffering)
		s_center_index = s_center_index ^ 0x01;
	PS3_FlipDoubleBuffer(this, this->screen);
}
int SPE_Start(_THIS, spu_data_t * spe_data)
{
	deprintf(2, "[PS3->SPU] Start SPE: %s\n", spe_data->program_name);
	if (!(spe_data->booted))
		SPE_Boot(this, spe_data);

	
	spe_data->entry = SPE_DEFAULT_ENTRY;
	spe_data->error_code = 0;

	
	deprintf(2, "[PS3->SPU] Create Thread: %s\n", spe_data->program_name);
	if (pthread_create
	    (&spe_data->thread, NULL, (void *)&SPE_RunContext, (void *)spe_data)) {
		deprintf(2, "[PS3->SPU] Could not create pthread for spe: %s\n", spe_data->program_name);
		SDL_SetError("[PS3->SPU] Could not create pthread for spe");
		return -1;
	}

	if (spe_data->keepalive)
		SPE_WaitForMsg(this, spe_data, SPU_READY);
}
/* Start the SPE thread */
int SPE_Start(spu_data_t * spe_data)
{
  deprintf(2, "[PS3->SPU] Start SPE: %s\n", spe_data->program_name);
  if (!(spe_data->booted))
    SPE_Boot(spe_data);

  /* To allow re-running of context, spe_ctx_entry has to be set before each call */
  spe_data->entry = SPE_DEFAULT_ENTRY;
  spe_data->error_code = 0;

  /* Create SPE thread and run */
  deprintf(2, "[PS3->SPU] Create Thread: %s\n", spe_data->program_name);
  if (pthread_create
      (&spe_data->thread, NULL, (void *)&SPE_RunContext, (void *)spe_data)) {
    deprintf(2, "[PS3->SPU] Could not create pthread for spe: %s\n", spe_data->program_name);
    SDL_SetError("[PS3->SPU] Could not create pthread for spe");
    return -1;
  }

  if (spe_data->keepalive)
    SPE_WaitForMsg(spe_data, SPU_READY);
}