The video output system allows you to query and configure the PS3’s display settings, including resolution, aspect ratio, color format, and refresh rates.
Overview
The video API (sysutil/video.h) provides:
Query available resolutions and display modes
Configure video output settings
Support for multiple aspect ratios (4:3, 16:9)
Different color formats (RGB, YUV)
Multiple output ports (HDMI, Component, etc.)
3D display modes
Common Resolutions
The PS3 supports various video resolutions:
Resolution Constant Typical Usage 1920x1080 VIDEO_RESOLUTION_1080Full HD (1080p/1080i) 1280x720 VIDEO_RESOLUTION_720HD Ready (720p) 720x480 VIDEO_RESOLUTION_480NTSC SD 720x576 VIDEO_RESOLUTION_576PAL SD 1600x1080 VIDEO_RESOLUTION_1600x1080Special modes 1440x1080 VIDEO_RESOLUTION_1440x1080Special modes 1280x1080 VIDEO_RESOLUTION_1280x1080Special modes 960x1080 VIDEO_RESOLUTION_960x1080Special modes
Always check which resolutions are available on the user’s display before configuring video output.
Quick Start
Get Current Video State
Query the current display configuration: #include <sysutil/video.h>
videoState state;
videoGetState (VIDEO_PRIMARY, 0 , & state );
printf ( "Current resolution: %d \n " , state.displayMode.resolution);
printf ( "Aspect ratio: %d \n " , state.displayMode.aspect);
printf ( "State: %d \n " , state.state);
Get Resolution Dimensions
Convert resolution ID to actual width/height: videoResolution resolution;
videoGetResolution (VIDEO_RESOLUTION_720, & resolution );
printf ( "720p is %d x %d \n " , resolution.width, resolution.height);
// Output: 720p is 1280x720
Configure Video Output
Set your desired video mode: videoConfiguration config;
memset ( & config , 0 , sizeof (videoConfiguration));
config.resolution = VIDEO_RESOLUTION_720;
config.format = VIDEO_BUFFER_FORMAT_XRGB;
config.aspect = VIDEO_ASPECT_16_9;
config.pitch = resolution.width * 4 ; // 4 bytes per pixel
s32 ret = videoConfigure (VIDEO_PRIMARY, & config , NULL , 0 );
if (ret != 0 ) {
printf ( "Failed to configure video: %d \n " , ret);
}
Aspect Ratios
The PS3 supports three aspect ratio modes:
Auto Aspect
4:3 Aspect
16:9 Aspect
config.aspect = VIDEO_ASPECT_AUTO;
// Use display's native aspect ratio
VIDEO_ASPECT_AUTO is recommended as it respects the user’s display settings.
Choose the color format for your frame buffer:
Format Description VIDEO_BUFFER_FORMAT_XRGB32-bit RGB (XRGB8888) VIDEO_BUFFER_FORMAT_XBGR32-bit BGR (XBGR8888) VIDEO_BUFFER_FORMAT_FLOATFloating-point format
// Most common: XRGB format
config.format = VIDEO_BUFFER_FORMAT_XRGB;
Scan Modes
Display modes can be interlaced or progressive:
Mode Constant Description Interlaced VIDEO_SCANMODE_INTERLACE1080i, traditional TV Progressive VIDEO_SCANMODE_PROGRESSIVE720p, 1080p
videoState state;
videoGetState (VIDEO_PRIMARY, 0 , & state );
if (state.displayMode.scanMode == VIDEO_SCANMODE_PROGRESSIVE) {
printf ( "Progressive scan enabled \n " );
} else {
printf ( "Interlaced mode \n " );
}
Checking Available Resolutions
Before configuring, verify the resolution is supported:
s32 availability = videoGetResolutionAvailability (
VIDEO_PRIMARY,
VIDEO_RESOLUTION_1080,
VIDEO_ASPECT_16_9,
0
);
if (availability == 0 ) {
printf ( "1080p is available \n " );
// Safe to configure
} else {
printf ( "1080p not supported, trying 720p \n " );
// Fall back to lower resolution
}
Querying Display Devices
Get information about connected displays:
// Get number of connected displays
u32 numDevices = videoGetNumberOfDevice (VIDEO_PRIMARY);
printf ( "Connected displays: %d \n " , numDevices);
// Get detailed info for each device
for (u32 i = 0 ; i < numDevices; i ++ ) {
videoDeviceInfo info;
if ( videoGetDeviceInfo (VIDEO_PRIMARY, i, & info) == 0 ) {
printf ( "Device %d : \n " , i);
printf ( " Port type: 0x %02x \n " , info . portType );
printf ( " Color space: %d \n " , info . colorSpace );
printf ( " State: %d \n " , info . state );
printf ( " Available modes: %d \n " , info . availableModeCount );
// List supported modes
for ( int j = 0 ; j < info . availableModeCount ; j ++ ) {
videoDisplayMode * mode = & info . availableModes [j];
printf ( " Mode %d : resolution= %d , aspect= %d \n " ,
j, mode -> resolution , mode -> aspect );
}
}
}
Display Port Types
The PS3 can output video through various ports:
Port Constant Description None VIDEO_PORT_NONENo output HDMI VIDEO_PORT_HDMIHDMI digital output Composite VIDEO_PORT_COMPOSITEYellow RCA cable Component VIDEO_PORT_COMPONENTYPbPr cables RGB VIDEO_PORT_RGBRGB SCART D-Terminal VIDEO_PORT_DJapanese D-Terminal
videoDeviceInfo info;
videoGetDeviceInfo (VIDEO_PRIMARY, 0 , & info );
switch ( info . portType ) {
case VIDEO_PORT_HDMI:
printf ( "HDMI connection \n " );
break ;
case VIDEO_PORT_COMPONENT:
printf ( "Component cables \n " );
break ;
case VIDEO_PORT_COMPOSITE:
printf ( "Composite cable \n " );
break ;
default :
printf ( "Other connection: 0x %02x \n " , info.portType);
}
Refresh Rates
Query supported refresh rates:
videoState state;
videoGetState (VIDEO_PRIMARY, 0 , & state );
u16 rates = state.displayMode.refreshRates;
if (rates & VIDEO_REFRESH_60HZ) {
printf ( "60Hz supported \n " );
}
if (rates & VIDEO_REFRESH_59_94HZ) {
printf ( "59.94Hz supported \n " );
}
if (rates & VIDEO_REFRESH_50HZ) {
printf ( "50Hz supported (PAL) \n " );
}
if (rates & VIDEO_REFRESH_30HZ) {
printf ( "30Hz supported \n " );
}
3D Display Modes
The PS3 supports stereoscopic 3D output:
Mode Constant 720p 3D VIDEO_RESOLUTION_720_3D_FRAME_PACKING1024x720 3D VIDEO_RESOLUTION_1024x720_3D_FRAME_PACKING960x720 3D VIDEO_RESOLUTION_960x720_3D_FRAME_PACKING800x720 3D VIDEO_RESOLUTION_800x720_3D_FRAME_PACKING640x720 3D VIDEO_RESOLUTION_640x720_3D_FRAME_PACKING
// Check if 3D is available
if ( videoGetResolutionAvailability (
VIDEO_PRIMARY,
VIDEO_RESOLUTION_720_3D_FRAME_PACKING,
VIDEO_ASPECT_16_9,
0 ) == 0 ) {
printf ( "3D mode available \n " );
// Configure for 3D output
}
Video State Values
The video state indicates the current status:
State Description VIDEO_STATE_DISABLEDVideo output disabled VIDEO_STATE_ENABLEDVideo output enabled VIDEO_STATE_BUSYVideo system busy
videoState state;
videoGetState (VIDEO_PRIMARY, 0 , & state );
if (state.state == VIDEO_STATE_ENABLED) {
printf ( "Video is ready \n " );
}
Practical Example
Complete video configuration with fallback:
#include <sysutil/video.h>
int configure_video () {
videoState state;
videoResolution resolution;
videoConfiguration config;
// Get current state
if ( videoGetState (VIDEO_PRIMARY, 0 , & state) != 0 ) {
printf ( "Failed to get video state \n " );
return - 1 ;
}
// Try to use 1080p first
int res_id = VIDEO_RESOLUTION_1080;
if ( videoGetResolutionAvailability (VIDEO_PRIMARY, res_id,
VIDEO_ASPECT_16_9, 0 ) != 0 ) {
// Fall back to 720p
res_id = VIDEO_RESOLUTION_720;
if ( videoGetResolutionAvailability (VIDEO_PRIMARY, res_id,
VIDEO_ASPECT_16_9, 0 ) != 0 ) {
// Fall back to 480p
res_id = VIDEO_RESOLUTION_480;
}
}
// Get actual dimensions
if ( videoGetResolution (res_id, & resolution) != 0 ) {
printf ( "Failed to get resolution \n " );
return - 1 ;
}
printf ( "Using resolution: %d x %d \n " , resolution . width , resolution . height );
// Configure video output
memset ( & config, 0 , sizeof (videoConfiguration));
config . resolution = res_id;
config . format = VIDEO_BUFFER_FORMAT_XRGB;
config . aspect = VIDEO_ASPECT_AUTO;
config . pitch = resolution . width * 4 ; // 4 bytes per pixel (XRGB)
if ( videoConfigure (VIDEO_PRIMARY, & config, NULL , 0 ) != 0 ) {
printf ( "Failed to configure video \n " );
return - 1 ;
}
printf ( "Video configured successfully \n " );
return 0 ;
}
Video Callbacks
Register callbacks to handle display events:
s32 video_callback (u32 slot , u32 videoOut , u32 deviceIndex ,
u32 event , videoDeviceInfo * info , void * userData ) {
printf ( "Video event: %d \n " , event);
printf ( "Device %d on output %d \n " , deviceIndex, videoOut);
return 0 ;
}
// Register callback
videoRegisterCallback ( 0 , video_callback, NULL );
// Later, unregister
videoUnregisterCallback ( 0 );
Video callbacks are called when displays are connected/disconnected or when settings change. Handle these events gracefully to avoid disrupting gameplay.
API Reference
Query Functions
videoGetState
videoGetResolution
videoGetResolutionAvailability
videoGetNumberOfDevice
videoGetDeviceInfo
// Get current video state
s32 videoGetState (
s32 videoOut , // VIDEO_PRIMARY or VIDEO_SECONDARY
s32 deviceIndex , // Usually 0
videoState * state // Output state
);
Configuration Functions
videoConfigure
videoGetConfiguration
// Configure video output
s32 videoConfigure (
s32 videoOut ,
videoConfiguration * config ,
void * option , // Usually NULL
s32 blocking // 0 for non-blocking, 1 for blocking
);
Callback Functions
videoRegisterCallback
videoUnregisterCallback
// Register video event callback
s32 videoRegisterCallback (
u32 slot ,
videoCallback cbVideo ,
void * userData
);
Best Practices
Resolution Selection:
Always check videoGetResolutionAvailability() before configuring
Provide fallback resolutions (1080p → 720p → 480p)
Use VIDEO_ASPECT_AUTO to respect user preferences
Calculate pitch correctly: width * bytes_per_pixel
Performance:
Higher resolutions require more memory and bandwidth
Consider your rendering performance when choosing resolution
Test on various display configurations
Compatibility:
Support both 4:3 and 16:9 displays
Handle both HDMI and analog connections
Respect user’s display settings when possible
Calling videoConfigure() may cause a brief screen flicker
Don’t reconfigure video output frequently during gameplay
Always verify resolution availability before attempting to use it
The pitch must match your actual buffer stride