comparison src/video/pandora/SDL_pandora.c @ 3438:ca5663493497

Scott to slouken Heres the wiz patch and additional files. (I think I got everything)
author Sam Lantinga <slouken@libsdl.org>
date Tue, 17 Nov 2009 04:53:15 +0000
parents 96492d29034a
children 4b594623401b
comparison
equal deleted inserted replaced
3437:dc2911c207e4 3438:ca5663493497
35 #include "../../events/SDL_keyboard_c.h" 35 #include "../../events/SDL_keyboard_c.h"
36 36
37 /* PND declarations */ 37 /* PND declarations */
38 #include "SDL_pandora.h" 38 #include "SDL_pandora.h"
39 #include "SDL_pandora_events.h" 39 #include "SDL_pandora_events.h"
40
41 /* WIZ declarations */
42 #include "GLES/gl.h"
43 #ifdef WIZ_GLES_LITE
44 static NativeWindowType hNativeWnd = 0; // A handle to the window we will create.
45 #endif
40 46
41 static SDL_bool PND_initialized = SDL_FALSE; 47 static SDL_bool PND_initialized = SDL_FALSE;
42 48
43 static int 49 static int
44 PND_available(void) 50 PND_available(void)
134 140
135 return device; 141 return device;
136 } 142 }
137 143
138 VideoBootStrap PND_bootstrap = { 144 VideoBootStrap PND_bootstrap = {
145 #ifdef WIZ_GLES_LITE
146 "wiz",
147 "SDL Wiz Video Driver",
148 #else
139 "pandora", 149 "pandora",
140 "SDL Pandora Video Driver", 150 "SDL Pandora Video Driver",
151 #endif
141 PND_available, 152 PND_available,
142 PND_create 153 PND_create
143 }; 154 };
144 155
145 /*****************************************************************************/ 156 /*****************************************************************************/
150 { 161 {
151 SDL_VideoDisplay display; 162 SDL_VideoDisplay display;
152 SDL_DisplayMode current_mode; 163 SDL_DisplayMode current_mode;
153 164
154 SDL_zero(current_mode); 165 SDL_zero(current_mode);
166 #ifdef WIZ_GLES_LITE
167 current_mode.w = 320;
168 current_mode.h = 240;
169 #else
155 current_mode.w = 800; 170 current_mode.w = 800;
156 current_mode.h = 480; 171 current_mode.h = 480;
172 #endif
157 current_mode.refresh_rate = 60; 173 current_mode.refresh_rate = 60;
158 current_mode.format = SDL_PIXELFORMAT_RGB565; 174 current_mode.format = SDL_PIXELFORMAT_RGB565;
159 current_mode.driverdata = NULL; 175 current_mode.driverdata = NULL;
160 176
161 SDL_zero(display); 177 SDL_zero(display);
369 385
370 /* Check if default library loading requested */ 386 /* Check if default library loading requested */
371 if (path == NULL) { 387 if (path == NULL) {
372 /* Already linked with GF library which provides egl* subset of */ 388 /* Already linked with GF library which provides egl* subset of */
373 /* functions, use Common profile of OpenGL ES library by default */ 389 /* functions, use Common profile of OpenGL ES library by default */
390 #ifdef WIZ_GLES_LITE
391 path = "/lib/libopengles_lite.so";
392 #else
374 path = "/usr/lib/libGLES_CM.so"; 393 path = "/usr/lib/libGLES_CM.so";
394 #endif
375 } 395 }
376 396
377 /* Load dynamic library */ 397 /* Load dynamic library */
378 _this->gl_config.dll_handle = SDL_LoadObject(path); 398 _this->gl_config.dll_handle = SDL_LoadObject(path);
379 if (!_this->gl_config.dll_handle) { 399 if (!_this->gl_config.dll_handle) {
650 if (wdata->gles_context == EGL_NO_CONTEXT) { 670 if (wdata->gles_context == EGL_NO_CONTEXT) {
651 SDL_SetError("PND: OpenGL ES context creation has been failed"); 671 SDL_SetError("PND: OpenGL ES context creation has been failed");
652 return NULL; 672 return NULL;
653 } 673 }
654 674
675 #ifdef WIZ_GLES_LITE
676 if( !hNativeWnd ) {
677 hNativeWnd = (NativeWindowType)malloc(16*1024);
678
679 if(!hNativeWnd)
680 printf( "Error : Wiz framebuffer allocatation failed\n" );
681 else
682 printf( "SDL13: Wiz framebuffer allocated: %X\n", hNativeWnd );
683 }
684 else {
685 printf( "SDL13: Wiz framebuffer already allocated: %X\n", hNativeWnd );
686 }
687
688 wdata->gles_surface =
689 eglCreateWindowSurface(phdata->egl_display,
690 wdata->gles_configs[wdata->gles_config],
691 hNativeWnd, NULL );
692 #else
655 wdata->gles_surface = 693 wdata->gles_surface =
656 eglCreateWindowSurface(phdata->egl_display, 694 eglCreateWindowSurface(phdata->egl_display,
657 wdata->gles_configs[wdata->gles_config], 695 wdata->gles_configs[wdata->gles_config],
658 (NativeWindowType) 0, NULL); 696 (NativeWindowType) 0, NULL);
697 #endif
698
699
659 if (wdata->gles_surface == 0) { 700 if (wdata->gles_surface == 0) {
660 SDL_SetError("Error : eglCreateWindowSurface failed;\n"); 701 SDL_SetError("Error : eglCreateWindowSurface failed;\n");
661 return NULL; 702 return NULL;
662 } 703 }
663 704
854 return; 895 return;
855 } 896 }
856 } 897 }
857 } 898 }
858 899
900 #ifdef WIZ_GLES_LITE
901 if( hNativeWnd != 0 )
902 {
903 free(hNativeWnd);
904 hNativeWnd = 0;
905 printf( "SDL13: Wiz framebuffer released\n" );
906 }
907 #endif
908
859 return; 909 return;
860 } 910 }
861 911
862 /* vi: set ts=4 sw=4 expandtab: */ 912 /* vi: set ts=4 sw=4 expandtab: */