static void PS3_VideoQuit(_THIS)
{
	if (fb_dev_fd > 0) {
		
		if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo))
			SDL_SetError("[PS3] Can't restore original fb_var_screeninfo");

		
		ioctl(fb_dev_fd, PS3FB_IOCTL_OFF, 0);
		close(fb_dev_fd);
		fb_dev_fd = -1;
	}

	if (frame_buffer) {
		munmap(frame_buffer, fb_finfo.smem_len);
		frame_buffer = 0;
	}

	if (fb_parms)
		free((void *)fb_parms);
	if (fb_thread_data) {
		SPE_Shutdown(this, fb_thread_data);
		free((void *)fb_thread_data);
	}

	if (this->screen) {
		if (double_buffering && this->screen->pixels) {
			free(this->screen->pixels);
		}
		this->screen->pixels = NULL;
	}

	enable_cursor(1);
	deprintf(1, "[PS3] VideoQuit\n");
}
void
PS3_VideoQuit(_THIS)
{
    deprintf(1, "PS3_VideoQuit()\n");
    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;

    PS3_QuitModes(_this);

    /* Unmap framebuffer */
    if (data->frame_buffer) {
        struct fb_fix_screeninfo fb_finfo;
        if (ioctl(data->fbdev, FBIOGET_FSCREENINFO, &fb_finfo) != -1) {
            munmap(data->frame_buffer, fb_finfo.smem_len);
            data->frame_buffer = 0;
        }
    }

    /* Shutdown SPE and related resources */
    if (data->fb_parms)
        free((void *)data->fb_parms);
    if (data->fb_thread_data) {
        SPE_Shutdown(data->fb_thread_data);
        free((void *)data->fb_thread_data);
    }

    /* Close device */
    if (data->fbdev) {
        /* Give control of frame buffer back to kernel */
        ioctl(data->fbdev, PS3FB_IOCTL_OFF, 0);
        close(data->fbdev);
        data->fbdev = -1;
    }
}