Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Added comments, clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlowinski committed Aug 27, 2009
1 parent 279fe8e commit 95635db
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 67 deletions.
8 changes: 6 additions & 2 deletions src/video/ps3/SDL_ps3modes.c
Expand Up @@ -38,7 +38,7 @@ PS3_InitModes(_THIS)
return;
}

/* Setting up the DisplayMode */
/* Setting up the DisplayMode based on current settings */
struct ps3fb_ioctl_res res;
if (ioctl(data->fbdev, PS3FB_IOCTL_SCREENINFO, &res)) {
SDL_SetError("Can't get PS3FB_IOCTL_SCREENINFO");
Expand All @@ -48,14 +48,16 @@ PS3_InitModes(_THIS)
mode.w = res.xres;
mode.h = res.yres;

/* Setting up driver specific mode data */
/* Setting up driver specific mode data,
* Get the current ps3 specific videmode number */
if (ioctl(data->fbdev, PS3FB_IOCTL_GETMODE, (unsigned long)&vid)) {
SDL_SetError("Can't get PS3FB_IOCTL_GETMODE");
}
deprintf(2, "PS3FB_IOCTL_GETMODE = %u\n", vid);
modedata->mode = vid;
mode.driverdata = modedata;

/* Set display's videomode and add it */
SDL_zero(display);
display.desktop_mode = mode;
display.current_mode = mode;
Expand All @@ -64,6 +66,7 @@ PS3_InitModes(_THIS)
deprintf(1, "-PS3_InitModes()\n");
}

/* DisplayModes available on the PS3 */
static SDL_DisplayMode ps3fb_modedb[] = {
/* VESA */
{SDL_PIXELFORMAT_RGB888, 1280, 768, 0, NULL}, // WXGA
Expand All @@ -75,6 +78,7 @@ static SDL_DisplayMode ps3fb_modedb[] = {
{SDL_PIXELFORMAT_RGB888, 1920, 1080, 0, NULL} // 1080p
};

/* PS3 videomode number according to ps3fb_modedb */
static PS3_DisplayModeData ps3fb_data[] = {
{11}, {12}, {13}, {130}, {131}, {133},
};
Expand Down
19 changes: 4 additions & 15 deletions src/video/ps3/SDL_ps3render.c
Expand Up @@ -43,7 +43,6 @@ extern spe_program_handle_t yuv2rgb_spu;
extern spe_program_handle_t bilin_scaler_spu;

/* SDL surface based renderer implementation */

static SDL_Renderer *SDL_PS3_CreateRenderer(SDL_Window * window,
Uint32 flags);
static int SDL_PS3_DisplayModeChanged(SDL_Renderer * renderer);
Expand Down Expand Up @@ -107,7 +106,8 @@ typedef struct
/* size of a screen line: width * bpp/8 */
unsigned int line_length;

/* Use two buffers in fb? res < 720p */
/* Is the kernels fb size bigger than ~12MB
* double buffering will work for 1080p */
unsigned int double_buffering;

/* SPE threading stuff */
Expand Down Expand Up @@ -232,7 +232,7 @@ SDL_PS3_CreateRenderer(SDL_Window * window, Uint32 flags)
return NULL;
}

/* Set up the SPEs */
/* Set up the SPE threading data */
data->converter_thread_data = (spu_data_t *) malloc(sizeof(spu_data_t));
data->scaler_thread_data = (spu_data_t *) malloc(sizeof(spu_data_t));
if (data->converter_thread_data == NULL || data->scaler_thread_data == NULL) {
Expand Down Expand Up @@ -377,6 +377,7 @@ PS3_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
dst = (Uint8 *) dstpixels + rect->y * data->pitch + rect->x
* SDL_BYTESPERPIXEL(texture->format);
length = rect->w * SDL_BYTESPERPIXEL(texture->format);
/* Update the texture */
for (row = 0; row < rect->h; ++row) {
SDL_memcpy(dst, src, length);
src += pitch;
Expand Down Expand Up @@ -520,18 +521,6 @@ SDL_PS3_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
PS3_TextureData *txdata = (PS3_TextureData *) texture->driverdata;
SDL_VideoData *devdata = display->device->driverdata;

/* Debug info */
deprintf(1, "srcrect->w = %u\n", srcrect->w);
deprintf(1, "srcrect->h = %u\n", srcrect->h);
deprintf(1, "srcrect->x = %u\n", srcrect->x);
deprintf(1, "srcrect->y = %u\n", srcrect->y);
deprintf(1, "dstrect->w = %u\n", dstrect->w);
deprintf(1, "dstrect->h = %u\n", dstrect->h);
deprintf(1, "dstrect->x = %u\n", dstrect->x);
deprintf(1, "dstrect->y = %u\n", dstrect->y);
deprintf(1, "texture->w = %u\n", texture->w);
deprintf(1, "texture->h = %u\n", texture->h);

if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
deprintf(1, "Texture is in a FOURCC format\n");
if ((texture->format == SDL_PIXELFORMAT_YV12 || texture->format == SDL_PIXELFORMAT_IYUV)
Expand Down
25 changes: 0 additions & 25 deletions src/video/ps3/SDL_ps3spe.c
Expand Up @@ -27,31 +27,6 @@
#include "SDL_ps3video.h"
#include "SDL_ps3render_c.h"


/* This SPE API basically provides 3 ways to run and control a program
* on the SPE:
* - Start and stop the program (keepalive=0).
* SPE_Start() will implicitly boot up the program, create a thread and run
* the context.
* SPE_Stop() will join the (terminated) thread (may block) and return.
* - Boot the program and run it (keepalive=0).
* SPE_Boot() will create a context and load the program and finally start
* the context with SPE_Start().
* SPE_Stop() will savely end the program.
* - Boot, Run and send messages to the program (keepalive=1).
* Start the program by using one of the methods described above. When
* received the READY-message the program is in its infinite loop waiting
* for new messages.
* Every time you run the program, send SPU_START and the address of the
* according struct using SPE_SendMsg().
* SPE_WaitForMsg() will than wait for SPU_FIN and is blocking.
* SPE_Shutdown() sends SPU_EXIT and finally stops the program.
*
* Therefor the SPE program
* - either runs once and returns
* - or runs in an infinite loop and is controlled by messages.
*/

/* Start the SPE thread */
int SPE_Start(spu_data_t * spe_data)
{
Expand Down
25 changes: 25 additions & 0 deletions src/video/ps3/SDL_ps3spe_c.h
Expand Up @@ -19,6 +19,31 @@
Sam Lantinga
slouken@libsdl.org
*/

/* This SPE API basically provides 3 ways to run and control a program
* on the SPE:
* - Start and stop the program (keepalive=0).
* SPE_Start() will implicitly boot up the program, create a thread and run
* the context.
* SPE_Stop() will join the (terminated) thread (may block) and return.
* - Boot the program and run it (keepalive=0).
* SPE_Boot() will create a context and load the program and finally start
* the context with SPE_Start().
* SPE_Stop() will savely end the program.
* - Boot, Run and send messages to the program (keepalive=1).
* Start the program by using one of the methods described above. When
* received the READY-message the program is in its infinite loop waiting
* for new messages.
* Every time you run the program, send SPU_START and the address of the
* according struct using SPE_SendMsg().
* SPE_WaitForMsg() will than wait for SPU_FIN and is blocking.
* SPE_Shutdown() sends SPU_EXIT and finally stops the program.
*
* Therefor the SPE program
* - either runs once and returns
* - or runs in an infinite loop and is controlled by messages.
*/

#include "SDL_config.h"

#include "spulibs/spu_common.h"
Expand Down
23 changes: 0 additions & 23 deletions src/video/ps3/SDL_ps3video.c
Expand Up @@ -129,26 +129,6 @@ PS3_VideoInit(_THIS)
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
SDL_DisplayMode mode;

#if 0
/* Use a fake 32-bpp desktop mode */
mode.format = SDL_PIXELFORMAT_RGB888;
mode.w = 1920;
mode.h = 1080;
mode.refresh_rate = 0;
mode.driverdata = NULL;
SDL_AddBasicVideoDisplay(&mode);
SDL_AddRenderDriver(0, &SDL_PS3_RenderDriver);

//SDL_zero(mode);
SDL_AddDisplayMode(0, &mode);
//display.desktop_mode = mode;
//display.current_mode = mode;
#endif

/*
*PS3 stuff
*/

/* Create SPU fb_parms and thread structure */
data->fb_parms = (struct fb_writer_parms_t *)
memalign(16, sizeof(struct fb_writer_parms_t));
Expand Down Expand Up @@ -200,11 +180,8 @@ PS3_VideoInit(_THIS)
/* Blank screen */
memset(data->frame_buffer, 0x00, fb_finfo.smem_len);

#if 1
PS3_InitModes(_this);

SDL_AddRenderDriver(0, &SDL_PS3_RenderDriver);
#endif

/* We're done! */
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/video/ps3/spulibs/yuv2rgb.c
Expand Up @@ -31,10 +31,10 @@
#include <spu_mfcio.h>

// Debugging
#define DEBUG
//#define DEBUG

// Test environment for /2 resolutions
#define TESTING
//#define TESTING

#ifdef DEBUG
#define deprintf(fmt, args... ) \
Expand Down

0 comments on commit 95635db

Please sign in to comment.