예제 #1
0
int SPE_Shutdown(_THIS, spu_data_t * spe_data)
{
	if (spe_data->keepalive && spe_data->booted) {
		SPE_SendMsg(this, spe_data, SPU_EXIT);
		SPE_Stop(this, spe_data);
	}

	
	deprintf(2, "[PS3->SPU] Destroy SPE context: %s\n", spe_data->program_name);
	if (spe_context_destroy(spe_data->ctx)) {
		deprintf(2, "[PS3->SPU] Failed destroying context: %s\n", spe_data->program_name);
		SDL_SetError("[PS3->SPU] Failed destroying context");
		return -1;
	}
	deprintf(2, "[PS3->SPU] SPE shutdown successful: %s\n", spe_data->program_name);
	return 0;
}
예제 #2
0
int PS3_DisplayYUVOverlay(_THIS, SDL_Overlay *overlay, SDL_Rect *src, SDL_Rect *dst) {
	if ((overlay == NULL) || (overlay->hwdata == NULL)) {
		return -1;
	}

	Uint8 *lum, *Cr, *Cb;
	struct private_yuvhwdata *hwdata;
	SDL_Surface *display;

	hwdata = overlay->hwdata;
	display = hwdata->display;

	/* Do we have to scale? */
	if ((src->w != dst->w) || (src->h != dst->h) ) {
		hwdata->scale = 1;
		deprintf(1, "[PS3] We need to scale\n");
	} else {
		hwdata->scale = 0;
		deprintf(1, "[PS3] No scaling\n");
	}

	/* Find out where the various portions of the image are */
	switch (overlay->format) {
		case SDL_YV12_OVERLAY:
			lum = (Uint8 *)overlay->pixels[0];
			Cr =  (Uint8 *)overlay->pixels[1];
			Cb =  (Uint8 *)overlay->pixels[2];
			break;
		case SDL_IYUV_OVERLAY:
			lum = (Uint8 *)overlay->pixels[0];
			Cr =  (Uint8 *)overlay->pixels[2];
			Cb =  (Uint8 *)overlay->pixels[1];
			break;
		default:
			SDL_SetError("Unsupported YUV format in blit");
			return -1;
	}

	if (hwdata->scale) {
		/* Alloc mem for scaled YUV picture */
		hwdata->scaler_out = (Uint8 *) memalign(16, dst->w * dst->h + ((dst->w * dst->h) >> 1));
		if (hwdata->scaler_out == NULL) {
			SDL_FreeYUVOverlay(overlay);
			SDL_OutOfMemory();
			return -1;
		}

		/* Set parms for scaling */
		hwdata->scaler_parms->src_pixel_width = src->w;
		hwdata->scaler_parms->src_pixel_height = src->h;
		hwdata->scaler_parms->dst_pixel_width = dst->w;
		hwdata->scaler_parms->dst_pixel_height = dst->h;
		hwdata->scaler_parms->y_plane = lum;
		hwdata->scaler_parms->v_plane = Cr;
		hwdata->scaler_parms->u_plane = Cb;
		hwdata->scaler_parms->dstBuffer = hwdata->scaler_out;
		scaler_thread_data->argp = (void *)hwdata->scaler_parms;

		/* Scale the YUV overlay to given size */
		SPE_Start(this, scaler_thread_data);
		SPE_Stop(this, scaler_thread_data);

		/* Set parms for converting after scaling */
		hwdata->converter_parms->y_plane = hwdata->scaler_out;
		hwdata->converter_parms->v_plane = hwdata->scaler_out + dst->w * dst->h;
		hwdata->converter_parms->u_plane = hwdata->scaler_out + dst->w * dst->h + ((dst->w * dst->h) >> 2);
	} else {