static void gfx_ctx_ps3_get_available_resolutions(void) { unsigned i; bool defaultresolution; uint32_t resolution_count; uint16_t num_videomodes; uint32_t videomode[] = { CELL_VIDEO_OUT_RESOLUTION_480, CELL_VIDEO_OUT_RESOLUTION_576, CELL_VIDEO_OUT_RESOLUTION_960x1080, CELL_VIDEO_OUT_RESOLUTION_720, CELL_VIDEO_OUT_RESOLUTION_1280x1080, CELL_VIDEO_OUT_RESOLUTION_1440x1080, CELL_VIDEO_OUT_RESOLUTION_1600x1080, CELL_VIDEO_OUT_RESOLUTION_1080 }; global_t *global = global_get_ptr(); if (global->console.screen.resolutions.check) return; defaultresolution = true; num_videomodes = sizeof(videomode) / sizeof(uint32_t); resolution_count = 0; for (i = 0; i < num_videomodes; i++) { if (cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, videomode[i], CELL_VIDEO_OUT_ASPECT_AUTO, 0)) resolution_count++; } global->console.screen.resolutions.list = malloc(resolution_count * sizeof(uint32_t)); global->console.screen.resolutions.count = 0; for (i = 0; i < num_videomodes; i++) { if (cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, videomode[i], CELL_VIDEO_OUT_ASPECT_AUTO, 0)) { global->console.screen.resolutions.list[global->console.screen.resolutions.count++] = videomode[i]; global->console.screen.resolutions.initial.id = videomode[i]; if (global->console.screen.resolutions.current.id == videomode[i]) { defaultresolution = false; global->console.screen.resolutions.current.idx = global->console.screen.resolutions.count-1; } } } /* In case we didn't specify a resolution - make the last resolution that was added to the list (the highest resolution) the default resolution */ if (global->console.screen.resolutions.current.id > num_videomodes || defaultresolution) global->console.screen.resolutions.current.idx = global->console.screen.resolutions.count - 1; global->console.screen.resolutions.check = true; }
const ESVideoPlatform::ModeList& ESVideoPlatform::GetModes () { static ModeList modes; if(modes.size() == 0) { static struct { const char* Name; uint32_t ID; } modeList[] = { {"1080", CELL_VIDEO_OUT_RESOLUTION_1080}, {"720", CELL_VIDEO_OUT_RESOLUTION_720}, {"576", CELL_VIDEO_OUT_RESOLUTION_576}, {"480", CELL_VIDEO_OUT_RESOLUTION_480} }; for(int i = 0; i != 4; i ++) { if(cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, modeList[i].ID, 0, 0)) { Mode thisMode; thisMode.Name = modeList[i].Name; thisMode.ID = modeList[i].ID; modes.push_back(thisMode); } } } return modes; }
void PS3Graphics::GetAllAvailableResolutions() { bool defaultresolution = true; uint32_t videomode[] = { CELL_VIDEO_OUT_RESOLUTION_480, CELL_VIDEO_OUT_RESOLUTION_576, CELL_VIDEO_OUT_RESOLUTION_960x1080, CELL_VIDEO_OUT_RESOLUTION_720, CELL_VIDEO_OUT_RESOLUTION_1280x1080, CELL_VIDEO_OUT_RESOLUTION_1440x1080, CELL_VIDEO_OUT_RESOLUTION_1600x1080, CELL_VIDEO_OUT_RESOLUTION_1080}; // Provide future expandability of the videomode array uint16_t num_videomodes = sizeof(videomode)/sizeof(uint32_t); for (int i=0; i < num_videomodes; i++) { if (cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, videomode[i], CELL_VIDEO_OUT_ASPECT_AUTO,0)) { m_supportedResolutions.push_back(videomode[i]); m_initialResolution = videomode[i]; if (m_currentResolutionId == videomode[i]) { defaultresolution = false; m_currentResolutionPos = m_supportedResolutions.size()-1; } } } // In case we didn't specify a resolution - make the last resolution // that was added to the list (the highest resolution) the default resolution if (m_currentResolutionPos > num_videomodes | defaultresolution) m_currentResolutionPos = m_supportedResolutions.size()-1; }
static int chooseBestResolution(const uint32_t *resolutions, uint32_t numResolutions) { uint32_t bestResolution = 0; for (uint32_t i = 0; bestResolution == 0 && i < numResolutions; i++) { if(cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, resolutions[i], CELL_VIDEO_OUT_ASPECT_AUTO, 0)) { bestResolution = resolutions[i]; } } return bestResolution; }
static bool gfx_ctx_init(void *data) { (void)data; #if defined(HAVE_PSGL) PSGLinitOptions options = { .enable = PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS, .maxSPUs = 1, .initializeSPUs = GL_FALSE, }; // Initialize 6 SPUs but reserve 1 SPU as a raw SPU for PSGL sys_spu_initialize(6, 1); psglInit(&options); PSGLdeviceParameters params; params.enable = PSGL_DEVICE_PARAMETERS_COLOR_FORMAT | PSGL_DEVICE_PARAMETERS_DEPTH_FORMAT | PSGL_DEVICE_PARAMETERS_MULTISAMPLING_MODE; params.colorFormat = GL_ARGB_SCE; params.depthFormat = GL_NONE; params.multisamplingMode = GL_MULTISAMPLING_NONE_SCE; if (g_extern.lifecycle_state & (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE)) { RARCH_LOG("[PSGL Context]: Setting triple buffering.\n"); params.enable |= PSGL_DEVICE_PARAMETERS_BUFFERING_MODE; params.bufferingMode = PSGL_BUFFERING_MODE_TRIPLE; } if (g_extern.console.screen.resolutions.current.id) { params.enable |= PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT; params.width = gfx_ctx_get_resolution_width(g_extern.console.screen.resolutions.current.id); params.height = gfx_ctx_get_resolution_height(g_extern.console.screen.resolutions.current.id); if (params.width == 720 && params.height == 576) { RARCH_LOG("[PSGL Context]: 720x576 resolution detected, setting MODE_VIDEO_PAL_ENABLE.\n"); g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_PAL_ENABLE); } else g_extern.lifecycle_state &= ~(1ULL << MODE_VIDEO_PAL_ENABLE); } if (g_extern.lifecycle_state & (1ULL << MODE_VIDEO_PAL_TEMPORAL_ENABLE)) { RARCH_LOG("[PSGL Context]: Setting temporal PAL60 mode.\n"); params.enable |= PSGL_DEVICE_PARAMETERS_RESC_PAL_TEMPORAL_MODE; params.enable |= PSGL_DEVICE_PARAMETERS_RESC_RATIO_MODE; params.rescPalTemporalMode = RESC_PAL_TEMPORAL_MODE_60_INTERPOLATE; params.rescRatioMode = RESC_RATIO_MODE_FULLSCREEN; } gl_device = psglCreateDeviceExtended(¶ms); gl_context = psglCreateContext(); psglMakeCurrent(gl_context, gl_device); psglResetCurrentContext(); #endif g_extern.console.screen.pal_enable = cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, CELL_VIDEO_OUT_RESOLUTION_576, CELL_VIDEO_OUT_ASPECT_AUTO, 0); gfx_ctx_get_available_resolutions(); return true; } static bool gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) { (void)data; return true; }
int gfx_ctx_check_resolution(unsigned resolution_id) { return cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, resolution_id, CELL_VIDEO_OUT_ASPECT_AUTO, 0); }
static void *gfx_ctx_ps3_init(void *video_driver) { #ifdef HAVE_PSGL PSGLdeviceParameters params; PSGLinitOptions options; #endif global_t *global = global_get_ptr(); gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*) calloc(1, sizeof(gfx_ctx_ps3_data_t)); (void)video_driver; (void)global; if (!ps3) return NULL; #if defined(HAVE_PSGL) options.enable = PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS; options.maxSPUs = 1; options.initializeSPUs = GL_FALSE; /* Initialize 6 SPUs but reserve 1 SPU as a raw SPU for PSGL. */ sys_spu_initialize(6, 1); psglInit(&options); params.enable = PSGL_DEVICE_PARAMETERS_COLOR_FORMAT | PSGL_DEVICE_PARAMETERS_DEPTH_FORMAT | PSGL_DEVICE_PARAMETERS_MULTISAMPLING_MODE; params.colorFormat = GL_ARGB_SCE; params.depthFormat = GL_NONE; params.multisamplingMode = GL_MULTISAMPLING_NONE_SCE; if (global->console.screen.resolutions.current.id) { params.enable |= PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT; gfx_ctx_ps3_get_resolution( global->console.screen.resolutions.current.id, ¶ms.width, ¶ms.height); global->console.screen.pal_enable = false; if (params.width == 720 && params.height == 576) { RARCH_LOG("[PSGL Context]: 720x576 resolution detected, setting MODE_VIDEO_PAL_ENABLE.\n"); global->console.screen.pal_enable = true; } } if (global->console.screen.pal60_enable) { RARCH_LOG("[PSGL Context]: Setting temporal PAL60 mode.\n"); params.enable |= PSGL_DEVICE_PARAMETERS_RESC_PAL_TEMPORAL_MODE; params.enable |= PSGL_DEVICE_PARAMETERS_RESC_RATIO_MODE; params.rescPalTemporalMode = RESC_PAL_TEMPORAL_MODE_60_INTERPOLATE; params.rescRatioMode = RESC_RATIO_MODE_FULLSCREEN; } ps3->gl_device = psglCreateDeviceExtended(¶ms); ps3->gl_context = psglCreateContext(); psglMakeCurrent(ps3->gl_context, ps3->gl_device); psglResetCurrentContext(); #endif global->console.screen.pal_enable = cellVideoOutGetResolutionAvailability( CELL_VIDEO_OUT_PRIMARY, CELL_VIDEO_OUT_RESOLUTION_576, CELL_VIDEO_OUT_ASPECT_AUTO, 0); gfx_ctx_ps3_get_available_resolutions(); return ps3; }
int PS3Graphics::CheckResolution(uint32_t resId) { return cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, resId, \ CELL_VIDEO_OUT_ASPECT_AUTO,0); }