src/video/pandora/SDL_pandora.c
author Sam Lantinga <slouken@libsdl.org>
Thu, 10 Feb 2011 14:44:25 -0800
changeset 5246 58265e606e4e
parent 3697 f7b03b6838cb
child 5262 b530ef003506
permissions -rw-r--r--
Window coordinates are in the global space and windows are not tied to a particular display.
Also added Ctrl-Enter keybinding to the test code to toggle fullscreen mode for testing.
slouken@3161
     1
/*
slouken@3161
     2
    SDL - Simple DirectMedia Layer
slouken@3697
     3
    Copyright (C) 1997-2010 Sam Lantinga
slouken@3161
     4
slouken@3161
     5
    This library is free software; you can redistribute it and/or
slouken@3161
     6
    modify it under the terms of the GNU Lesser General Public
slouken@3161
     7
    License as published by the Free Software Foundation; either
slouken@3161
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@3161
     9
slouken@3161
    10
    This library is distributed in the hope that it will be useful,
slouken@3161
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@3161
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@3161
    13
    Lesser General Public License for more details.
slouken@3161
    14
slouken@3161
    15
    You should have received a copy of the GNU Lesser General Public
slouken@3161
    16
    License along with this library; if not, write to the Free Software
slouken@3161
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@3161
    18
slouken@3161
    19
    Sam Lantinga
slouken@3161
    20
    slouken@libsdl.org
slouken@3161
    21
slouken@3161
    22
    Open Pandora SDL driver
slouken@3161
    23
    Copyright (C) 2009 David Carré
slouken@3161
    24
    (cpasjuste@gmail.com)
slouken@3161
    25
*/
slouken@3161
    26
slouken@3161
    27
/* SDL internals */
slouken@3161
    28
#include "SDL_config.h"
slouken@3161
    29
#include "../SDL_sysvideo.h"
slouken@3161
    30
#include "SDL_version.h"
slouken@3161
    31
#include "SDL_syswm.h"
slouken@3161
    32
#include "SDL_loadso.h"
slouken@3161
    33
#include "SDL_events.h"
slouken@3161
    34
#include "../../events/SDL_mouse_c.h"
slouken@3161
    35
#include "../../events/SDL_keyboard_c.h"
slouken@3161
    36
slouken@3161
    37
/* PND declarations */
slouken@3161
    38
#include "SDL_pandora.h"
slouken@3161
    39
#include "SDL_pandora_events.h"
slouken@3161
    40
slouken@3438
    41
/* WIZ declarations */
slouken@3438
    42
#include "GLES/gl.h"
slouken@3438
    43
#ifdef WIZ_GLES_LITE
slouken@3438
    44
static NativeWindowType hNativeWnd = 0; // A handle to the window we will create.
slouken@3438
    45
#endif
slouken@3438
    46
slouken@3161
    47
static SDL_bool PND_initialized = SDL_FALSE;
slouken@3161
    48
slouken@3161
    49
static int
slouken@3161
    50
PND_available(void)
slouken@3161
    51
{
slouken@3161
    52
    return 1;
slouken@3161
    53
}
slouken@3161
    54
slouken@3161
    55
static void
slouken@3161
    56
PND_destroy(SDL_VideoDevice * device)
slouken@3161
    57
{
slouken@3161
    58
    SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata;
slouken@3161
    59
slouken@3161
    60
    if (device->driverdata != NULL) {
slouken@3161
    61
        device->driverdata = NULL;
slouken@3161
    62
    }
slouken@3161
    63
}
slouken@3161
    64
slouken@3161
    65
static SDL_VideoDevice *
slouken@3161
    66
PND_create()
slouken@3161
    67
{
slouken@3161
    68
    SDL_VideoDevice *device;
slouken@3161
    69
    SDL_VideoData *phdata;
slouken@3161
    70
    int status;
slouken@3161
    71
slouken@3161
    72
    /* Check if pandora could be initialized */
slouken@3161
    73
    status = PND_available();
slouken@3161
    74
    if (status == 0) {
slouken@3161
    75
        /* PND could not be used */
slouken@3161
    76
        return NULL;
slouken@3161
    77
    }
slouken@3161
    78
slouken@3161
    79
    /* Initialize SDL_VideoDevice structure */
slouken@3161
    80
    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
slouken@3161
    81
    if (device == NULL) {
slouken@3161
    82
        SDL_OutOfMemory();
slouken@3161
    83
        return NULL;
slouken@3161
    84
    }
slouken@3161
    85
slouken@3161
    86
    /* Initialize internal Pandora specific data */
slouken@3161
    87
    phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
slouken@3161
    88
    if (phdata == NULL) {
slouken@3161
    89
        SDL_OutOfMemory();
slouken@3161
    90
        SDL_free(device);
slouken@3161
    91
        return NULL;
slouken@3161
    92
    }
slouken@3161
    93
slouken@3161
    94
    device->driverdata = phdata;
slouken@3161
    95
slouken@3161
    96
    phdata->egl_initialized = SDL_TRUE;
slouken@3161
    97
slouken@3161
    98
slouken@3161
    99
    /* Setup amount of available displays and current display */
slouken@3238
   100
    device->num_displays = 0;
slouken@3238
   101
    device->current_display = 0;
slouken@3161
   102
slouken@3161
   103
    /* Set device free function */
slouken@3161
   104
    device->free = PND_destroy;
slouken@3161
   105
slouken@3161
   106
    /* Setup all functions which we can handle */
slouken@3161
   107
    device->VideoInit = PND_videoinit;
slouken@3161
   108
    device->VideoQuit = PND_videoquit;
slouken@3161
   109
    device->GetDisplayModes = PND_getdisplaymodes;
slouken@3161
   110
    device->SetDisplayMode = PND_setdisplaymode;
slouken@3161
   111
    device->CreateWindow = PND_createwindow;
slouken@3161
   112
    device->CreateWindowFrom = PND_createwindowfrom;
slouken@3161
   113
    device->SetWindowTitle = PND_setwindowtitle;
slouken@3161
   114
    device->SetWindowIcon = PND_setwindowicon;
slouken@3161
   115
    device->SetWindowPosition = PND_setwindowposition;
slouken@3161
   116
    device->SetWindowSize = PND_setwindowsize;
slouken@3161
   117
    device->ShowWindow = PND_showwindow;
slouken@3161
   118
    device->HideWindow = PND_hidewindow;
slouken@3161
   119
    device->RaiseWindow = PND_raisewindow;
slouken@3161
   120
    device->MaximizeWindow = PND_maximizewindow;
slouken@3161
   121
    device->MinimizeWindow = PND_minimizewindow;
slouken@3161
   122
    device->RestoreWindow = PND_restorewindow;
slouken@3161
   123
    device->SetWindowGrab = PND_setwindowgrab;
slouken@3161
   124
    device->DestroyWindow = PND_destroywindow;
slouken@3161
   125
    device->GetWindowWMInfo = PND_getwindowwminfo;
slouken@3161
   126
    device->GL_LoadLibrary = PND_gl_loadlibrary;
slouken@3161
   127
    device->GL_GetProcAddress = PND_gl_getprocaddres;
slouken@3161
   128
    device->GL_UnloadLibrary = PND_gl_unloadlibrary;
slouken@3161
   129
    device->GL_CreateContext = PND_gl_createcontext;
slouken@3161
   130
    device->GL_MakeCurrent = PND_gl_makecurrent;
slouken@3161
   131
    device->GL_SetSwapInterval = PND_gl_setswapinterval;
slouken@3161
   132
    device->GL_GetSwapInterval = PND_gl_getswapinterval;
slouken@3161
   133
    device->GL_SwapWindow = PND_gl_swapwindow;
slouken@3161
   134
    device->GL_DeleteContext = PND_gl_deletecontext;
slouken@3161
   135
    device->PumpEvents = PND_PumpEvents;
slouken@3161
   136
slouken@3161
   137
    return device;
slouken@3161
   138
}
slouken@3161
   139
slouken@3161
   140
VideoBootStrap PND_bootstrap = {
slouken@3438
   141
#ifdef WIZ_GLES_LITE
slouken@3438
   142
    "wiz",
slouken@3438
   143
    "SDL Wiz Video Driver",
slouken@3438
   144
#else
slouken@3161
   145
    "pandora",
slouken@3161
   146
    "SDL Pandora Video Driver",
slouken@3438
   147
#endif
slouken@3161
   148
    PND_available,
slouken@3161
   149
    PND_create
slouken@3161
   150
};
slouken@3161
   151
slouken@3161
   152
/*****************************************************************************/
slouken@3161
   153
/* SDL Video and Display initialization/handling functions                   */
slouken@3161
   154
/*****************************************************************************/
slouken@3161
   155
int
slouken@3161
   156
PND_videoinit(_THIS)
slouken@3161
   157
{
slouken@3161
   158
    SDL_VideoDisplay display;
slouken@3161
   159
    SDL_DisplayMode current_mode;
slouken@3161
   160
slouken@3161
   161
    SDL_zero(current_mode);
slouken@3438
   162
#ifdef WIZ_GLES_LITE
slouken@3438
   163
    current_mode.w = 320;
slouken@3438
   164
    current_mode.h = 240;
slouken@3438
   165
#else
slouken@3161
   166
    current_mode.w = 800;
slouken@3161
   167
    current_mode.h = 480;
slouken@3438
   168
#endif
slouken@3161
   169
    current_mode.refresh_rate = 60;
slouken@3161
   170
    current_mode.format = SDL_PIXELFORMAT_RGB565;
slouken@3161
   171
    current_mode.driverdata = NULL;
slouken@3161
   172
slouken@3161
   173
    SDL_zero(display);
slouken@3161
   174
    display.desktop_mode = current_mode;
slouken@3161
   175
    display.current_mode = current_mode;
slouken@3161
   176
    display.driverdata = NULL;
slouken@3161
   177
slouken@3161
   178
    SDL_AddVideoDisplay(&display);
slouken@3161
   179
slouken@3161
   180
    return 1;
slouken@3161
   181
}
slouken@3161
   182
slouken@3161
   183
void
slouken@3161
   184
PND_videoquit(_THIS)
slouken@3161
   185
{
slouken@3161
   186
slouken@3161
   187
}
slouken@3161
   188
slouken@3161
   189
void
slouken@3500
   190
PND_getdisplaymodes(_THIS, SDL_VideoDisplay * display)
slouken@3161
   191
{
slouken@3161
   192
slouken@3161
   193
}
slouken@3161
   194
slouken@3161
   195
int
slouken@3500
   196
PND_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
slouken@3161
   197
{
slouken@3161
   198
    return 0;
slouken@3161
   199
}
slouken@3161
   200
slouken@3161
   201
int
slouken@3161
   202
PND_createwindow(_THIS, SDL_Window * window)
slouken@3161
   203
{
slouken@3161
   204
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3161
   205
slouken@3161
   206
    SDL_WindowData *wdata;
slouken@3161
   207
slouken@3161
   208
    uint32_t winargc = 0;
slouken@3161
   209
    int32_t status;
slouken@3161
   210
slouken@3161
   211
slouken@3161
   212
    /* Allocate window internal data */
slouken@3161
   213
    wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
slouken@3161
   214
    if (wdata == NULL) {
slouken@3161
   215
        SDL_OutOfMemory();
slouken@3161
   216
        return -1;
slouken@3161
   217
    }
slouken@3161
   218
slouken@3161
   219
    /* Setup driver data for this window */
slouken@3161
   220
    window->driverdata = wdata;
slouken@3161
   221
slouken@3161
   222
    /* Check if window must support OpenGL ES rendering */
slouken@3161
   223
    if ((window->flags & SDL_WINDOW_OPENGL) == SDL_WINDOW_OPENGL) {
slouken@3161
   224
slouken@3161
   225
        EGLBoolean initstatus;
slouken@3161
   226
slouken@3161
   227
        /* Mark this window as OpenGL ES compatible */
slouken@3161
   228
        wdata->uses_gles = SDL_TRUE;
slouken@3161
   229
slouken@3161
   230
        /* Create connection to OpenGL ES */
slouken@3161
   231
        if (phdata->egl_display == EGL_NO_DISPLAY) {
slouken@3161
   232
            phdata->egl_display = eglGetDisplay((NativeDisplayType) 0);
slouken@3161
   233
            if (phdata->egl_display == EGL_NO_DISPLAY) {
slouken@3161
   234
                SDL_SetError("PND: Can't get connection to OpenGL ES");
slouken@3161
   235
                return -1;
slouken@3161
   236
            }
slouken@3161
   237
slouken@3161
   238
            initstatus = eglInitialize(phdata->egl_display, NULL, NULL);
slouken@3161
   239
            if (initstatus != EGL_TRUE) {
slouken@3161
   240
                SDL_SetError("PND: Can't init OpenGL ES library");
slouken@3161
   241
                return -1;
slouken@3161
   242
            }
slouken@3161
   243
        }
slouken@3161
   244
slouken@3161
   245
        phdata->egl_refcount++;
slouken@3161
   246
    }
slouken@3161
   247
slouken@3161
   248
    /* Window has been successfully created */
slouken@3161
   249
    return 0;
slouken@3161
   250
}
slouken@3161
   251
slouken@3161
   252
int
slouken@3161
   253
PND_createwindowfrom(_THIS, SDL_Window * window, const void *data)
slouken@3161
   254
{
slouken@3161
   255
    return -1;
slouken@3161
   256
}
slouken@3161
   257
slouken@3161
   258
void
slouken@3161
   259
PND_setwindowtitle(_THIS, SDL_Window * window)
slouken@3161
   260
{
slouken@3161
   261
}
slouken@3161
   262
void
slouken@3161
   263
PND_setwindowicon(_THIS, SDL_Window * window, SDL_Surface * icon)
slouken@3161
   264
{
slouken@3161
   265
}
slouken@3161
   266
void
slouken@3161
   267
PND_setwindowposition(_THIS, SDL_Window * window)
slouken@3161
   268
{
slouken@3161
   269
}
slouken@3161
   270
void
slouken@3161
   271
PND_setwindowsize(_THIS, SDL_Window * window)
slouken@3161
   272
{
slouken@3161
   273
}
slouken@3161
   274
void
slouken@3161
   275
PND_showwindow(_THIS, SDL_Window * window)
slouken@3161
   276
{
slouken@3161
   277
}
slouken@3161
   278
void
slouken@3161
   279
PND_hidewindow(_THIS, SDL_Window * window)
slouken@3161
   280
{
slouken@3161
   281
}
slouken@3161
   282
void
slouken@3161
   283
PND_raisewindow(_THIS, SDL_Window * window)
slouken@3161
   284
{
slouken@3161
   285
}
slouken@3161
   286
void
slouken@3161
   287
PND_maximizewindow(_THIS, SDL_Window * window)
slouken@3161
   288
{
slouken@3161
   289
}
slouken@3161
   290
void
slouken@3161
   291
PND_minimizewindow(_THIS, SDL_Window * window)
slouken@3161
   292
{
slouken@3161
   293
}
slouken@3161
   294
void
slouken@3161
   295
PND_restorewindow(_THIS, SDL_Window * window)
slouken@3161
   296
{
slouken@3161
   297
}
slouken@3161
   298
void
slouken@3161
   299
PND_setwindowgrab(_THIS, SDL_Window * window)
slouken@3161
   300
{
slouken@3238
   301
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3238
   302
    eglTerminate(phdata->egl_display);
slouken@3161
   303
}
slouken@3161
   304
void
slouken@3161
   305
PND_destroywindow(_THIS, SDL_Window * window)
slouken@3161
   306
{
slouken@3235
   307
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3235
   308
    eglTerminate(phdata->egl_display);
slouken@3161
   309
}
slouken@3161
   310
slouken@3161
   311
/*****************************************************************************/
slouken@3161
   312
/* SDL Window Manager function                                               */
slouken@3161
   313
/*****************************************************************************/
slouken@3161
   314
SDL_bool
slouken@3161
   315
PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
slouken@3161
   316
{
slouken@3161
   317
    if (info->version.major <= SDL_MAJOR_VERSION) {
slouken@3161
   318
        return SDL_TRUE;
slouken@3161
   319
    } else {
slouken@3161
   320
        SDL_SetError("application not compiled with SDL %d.%d\n",
slouken@3161
   321
                     SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
slouken@3161
   322
        return SDL_FALSE;
slouken@3161
   323
    }
slouken@3161
   324
slouken@3161
   325
    /* Failed to get window manager information */
slouken@3161
   326
    return SDL_FALSE;
slouken@3161
   327
}
slouken@3161
   328
slouken@3161
   329
/*****************************************************************************/
slouken@3161
   330
/* SDL OpenGL/OpenGL ES functions                                            */
slouken@3161
   331
/*****************************************************************************/
slouken@3161
   332
int
slouken@3161
   333
PND_gl_loadlibrary(_THIS, const char *path)
slouken@3161
   334
{
slouken@3161
   335
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3161
   336
slouken@3161
   337
    /* Check if OpenGL ES library is specified for GF driver */
slouken@3161
   338
    if (path == NULL) {
slouken@3161
   339
        path = SDL_getenv("SDL_OPENGL_LIBRARY");
slouken@3161
   340
        if (path == NULL) {
slouken@3161
   341
            path = SDL_getenv("SDL_OPENGLES_LIBRARY");
slouken@3161
   342
        }
slouken@3161
   343
    }
slouken@3161
   344
slouken@3161
   345
    /* Check if default library loading requested */
slouken@3161
   346
    if (path == NULL) {
slouken@3161
   347
        /* Already linked with GF library which provides egl* subset of  */
slouken@3161
   348
        /* functions, use Common profile of OpenGL ES library by default */
slouken@3438
   349
#ifdef WIZ_GLES_LITE
slouken@3438
   350
	path = "/lib/libopengles_lite.so";
slouken@3438
   351
#else
slouken@3161
   352
        path = "/usr/lib/libGLES_CM.so";
slouken@3438
   353
#endif
slouken@3161
   354
    }
slouken@3161
   355
slouken@3161
   356
    /* Load dynamic library */
slouken@3161
   357
    _this->gl_config.dll_handle = SDL_LoadObject(path);
slouken@3161
   358
    if (!_this->gl_config.dll_handle) {
slouken@3161
   359
        /* Failed to load new GL ES library */
slouken@3161
   360
        SDL_SetError("PND: Failed to locate OpenGL ES library");
slouken@3161
   361
        return -1;
slouken@3161
   362
    }
slouken@3161
   363
slouken@3161
   364
    /* Store OpenGL ES library path and name */
slouken@3161
   365
    SDL_strlcpy(_this->gl_config.driver_path, path,
slouken@3161
   366
                SDL_arraysize(_this->gl_config.driver_path));
slouken@3161
   367
slouken@3161
   368
    /* New OpenGL ES library is loaded */
slouken@3161
   369
    return 0;
slouken@3161
   370
}
slouken@3161
   371
slouken@3161
   372
void *
slouken@3161
   373
PND_gl_getprocaddres(_THIS, const char *proc)
slouken@3161
   374
{
slouken@3161
   375
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3161
   376
    void *function_address;
slouken@3161
   377
slouken@3161
   378
    /* Try to get function address through the egl interface */
slouken@3161
   379
    function_address = eglGetProcAddress(proc);
slouken@3161
   380
    if (function_address != NULL) {
slouken@3161
   381
        return function_address;
slouken@3161
   382
    }
slouken@3161
   383
slouken@3161
   384
    /* Then try to get function in the OpenGL ES library */
slouken@3161
   385
    if (_this->gl_config.dll_handle) {
slouken@3161
   386
        function_address =
slouken@3161
   387
            SDL_LoadFunction(_this->gl_config.dll_handle, proc);
slouken@3161
   388
        if (function_address != NULL) {
slouken@3161
   389
            return function_address;
slouken@3161
   390
        }
slouken@3161
   391
    }
slouken@3161
   392
slouken@3161
   393
    /* Failed to get GL ES function address pointer */
slouken@3161
   394
    SDL_SetError("PND: Cannot locate OpenGL ES function name");
slouken@3161
   395
    return NULL;
slouken@3161
   396
}
slouken@3161
   397
slouken@3161
   398
void
slouken@3161
   399
PND_gl_unloadlibrary(_THIS)
slouken@3161
   400
{
slouken@3161
   401
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3161
   402
slouken@3161
   403
    if (phdata->egl_initialized == SDL_TRUE) {
slouken@3161
   404
        /* Unload OpenGL ES library */
slouken@3161
   405
        if (_this->gl_config.dll_handle) {
slouken@3161
   406
            SDL_UnloadObject(_this->gl_config.dll_handle);
slouken@3161
   407
            _this->gl_config.dll_handle = NULL;
slouken@3161
   408
        }
slouken@3161
   409
    } else {
slouken@3161
   410
        SDL_SetError("PND: GF initialization failed, no OpenGL ES support");
slouken@3161
   411
    }
slouken@3161
   412
}
slouken@3161
   413
slouken@3161
   414
SDL_GLContext
slouken@3161
   415
PND_gl_createcontext(_THIS, SDL_Window * window)
slouken@3161
   416
{
slouken@3161
   417
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3161
   418
    SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
slouken@3161
   419
    SDL_DisplayData *didata =
slouken@5246
   420
        (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
slouken@3161
   421
    EGLBoolean status;
slouken@3161
   422
    int32_t gfstatus;
slouken@3161
   423
    EGLint configs;
slouken@3161
   424
    uint32_t attr_pos;
slouken@3161
   425
    EGLint attr_value;
slouken@3161
   426
    EGLint cit;
slouken@3161
   427
slouken@3161
   428
    /* Check if EGL was initialized */
slouken@3161
   429
    if (phdata->egl_initialized != SDL_TRUE) {
slouken@3161
   430
        SDL_SetError("PND: EGL initialization failed, no OpenGL ES support");
slouken@3161
   431
        return NULL;
slouken@3161
   432
    }
slouken@3161
   433
slouken@3161
   434
    /* Prepare attributes list to pass them to OpenGL ES */
slouken@3161
   435
    attr_pos = 0;
slouken@3161
   436
    wdata->gles_attributes[attr_pos++] = EGL_SURFACE_TYPE;
slouken@3161
   437
    wdata->gles_attributes[attr_pos++] = EGL_WINDOW_BIT;
slouken@3161
   438
    wdata->gles_attributes[attr_pos++] = EGL_RED_SIZE;
slouken@3161
   439
    wdata->gles_attributes[attr_pos++] = _this->gl_config.red_size;
slouken@3161
   440
    wdata->gles_attributes[attr_pos++] = EGL_GREEN_SIZE;
slouken@3161
   441
    wdata->gles_attributes[attr_pos++] = _this->gl_config.green_size;
slouken@3161
   442
    wdata->gles_attributes[attr_pos++] = EGL_BLUE_SIZE;
slouken@3161
   443
    wdata->gles_attributes[attr_pos++] = _this->gl_config.blue_size;
slouken@3161
   444
    wdata->gles_attributes[attr_pos++] = EGL_ALPHA_SIZE;
slouken@3161
   445
slouken@3161
   446
    /* Setup alpha size in bits */
slouken@3161
   447
    if (_this->gl_config.alpha_size) {
slouken@3161
   448
        wdata->gles_attributes[attr_pos++] = _this->gl_config.alpha_size;
slouken@3161
   449
    } else {
slouken@3161
   450
        wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   451
    }
slouken@3161
   452
slouken@3161
   453
    /* Setup color buffer size */
slouken@3161
   454
    if (_this->gl_config.buffer_size) {
slouken@3161
   455
        wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE;
slouken@3161
   456
        wdata->gles_attributes[attr_pos++] = _this->gl_config.buffer_size;
slouken@3161
   457
    } else {
slouken@3161
   458
        wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE;
slouken@3161
   459
        wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   460
    }
slouken@3161
   461
slouken@3161
   462
    /* Setup depth buffer bits */
slouken@3161
   463
    wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE;
slouken@3161
   464
    wdata->gles_attributes[attr_pos++] = _this->gl_config.depth_size;
slouken@3161
   465
slouken@3161
   466
    /* Setup stencil bits */
slouken@3161
   467
    if (_this->gl_config.stencil_size) {
slouken@3161
   468
        wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE;
slouken@3161
   469
        wdata->gles_attributes[attr_pos++] = _this->gl_config.buffer_size;
slouken@3161
   470
    } else {
slouken@3161
   471
        wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE;
slouken@3161
   472
        wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   473
    }
slouken@3161
   474
slouken@3161
   475
    /* Set number of samples in multisampling */
slouken@3161
   476
    if (_this->gl_config.multisamplesamples) {
slouken@3161
   477
        wdata->gles_attributes[attr_pos++] = EGL_SAMPLES;
slouken@3161
   478
        wdata->gles_attributes[attr_pos++] =
slouken@3161
   479
            _this->gl_config.multisamplesamples;
slouken@3161
   480
    }
slouken@3161
   481
slouken@3161
   482
    /* Multisample buffers, OpenGL ES 1.0 spec defines 0 or 1 buffer */
slouken@3161
   483
    if (_this->gl_config.multisamplebuffers) {
slouken@3161
   484
        wdata->gles_attributes[attr_pos++] = EGL_SAMPLE_BUFFERS;
slouken@3161
   485
        wdata->gles_attributes[attr_pos++] =
slouken@3161
   486
            _this->gl_config.multisamplebuffers;
slouken@3161
   487
    }
slouken@3161
   488
slouken@3161
   489
    /* Finish attributes list */
slouken@3161
   490
    wdata->gles_attributes[attr_pos] = EGL_NONE;
slouken@3161
   491
slouken@3161
   492
    /* Request first suitable framebuffer configuration */
slouken@3161
   493
    status = eglChooseConfig(phdata->egl_display, wdata->gles_attributes,
slouken@3161
   494
                             wdata->gles_configs, 1, &configs);
slouken@3161
   495
    if (status != EGL_TRUE) {
slouken@3161
   496
        SDL_SetError("PND: Can't find closest configuration for OpenGL ES");
slouken@3161
   497
        return NULL;
slouken@3161
   498
    }
slouken@3161
   499
slouken@3161
   500
    /* Check if nothing has been found, try "don't care" settings */
slouken@3161
   501
    if (configs == 0) {
slouken@3161
   502
        int32_t it;
slouken@3161
   503
        int32_t jt;
slouken@3161
   504
        GLint depthbits[4] = { 32, 24, 16, EGL_DONT_CARE };
slouken@3161
   505
slouken@3161
   506
        for (it = 0; it < 4; it++) {
slouken@3161
   507
            for (jt = 16; jt >= 0; jt--) {
slouken@3161
   508
                /* Don't care about color buffer bits, use what exist */
slouken@3161
   509
                /* Replace previous set data with EGL_DONT_CARE       */
slouken@3161
   510
                attr_pos = 0;
slouken@3161
   511
                wdata->gles_attributes[attr_pos++] = EGL_SURFACE_TYPE;
slouken@3161
   512
                wdata->gles_attributes[attr_pos++] = EGL_WINDOW_BIT;
slouken@3161
   513
                wdata->gles_attributes[attr_pos++] = EGL_RED_SIZE;
slouken@3161
   514
                wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   515
                wdata->gles_attributes[attr_pos++] = EGL_GREEN_SIZE;
slouken@3161
   516
                wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   517
                wdata->gles_attributes[attr_pos++] = EGL_BLUE_SIZE;
slouken@3161
   518
                wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   519
                wdata->gles_attributes[attr_pos++] = EGL_ALPHA_SIZE;
slouken@3161
   520
                wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   521
                wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE;
slouken@3161
   522
                wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   523
slouken@3161
   524
                /* Try to find requested or smallest depth */
slouken@3161
   525
                if (_this->gl_config.depth_size) {
slouken@3161
   526
                    wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE;
slouken@3161
   527
                    wdata->gles_attributes[attr_pos++] = depthbits[it];
slouken@3161
   528
                } else {
slouken@3161
   529
                    wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE;
slouken@3161
   530
                    wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   531
                }
slouken@3161
   532
slouken@3161
   533
                if (_this->gl_config.stencil_size) {
slouken@3161
   534
                    wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE;
slouken@3161
   535
                    wdata->gles_attributes[attr_pos++] = jt;
slouken@3161
   536
                } else {
slouken@3161
   537
                    wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE;
slouken@3161
   538
                    wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   539
                }
slouken@3161
   540
slouken@3161
   541
                wdata->gles_attributes[attr_pos++] = EGL_SAMPLES;
slouken@3161
   542
                wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   543
                wdata->gles_attributes[attr_pos++] = EGL_SAMPLE_BUFFERS;
slouken@3161
   544
                wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
slouken@3161
   545
                wdata->gles_attributes[attr_pos] = EGL_NONE;
slouken@3161
   546
slouken@3161
   547
                /* Request first suitable framebuffer configuration */
slouken@3161
   548
                status =
slouken@3161
   549
                    eglChooseConfig(phdata->egl_display,
slouken@3161
   550
                                    wdata->gles_attributes,
slouken@3161
   551
                                    wdata->gles_configs, 1, &configs);
slouken@3161
   552
slouken@3161
   553
                if (status != EGL_TRUE) {
slouken@3161
   554
                    SDL_SetError
slouken@3161
   555
                        ("PND: Can't find closest configuration for OpenGL ES");
slouken@3161
   556
                    return NULL;
slouken@3161
   557
                }
slouken@3161
   558
                if (configs != 0) {
slouken@3161
   559
                    break;
slouken@3161
   560
                }
slouken@3161
   561
            }
slouken@3161
   562
            if (configs != 0) {
slouken@3161
   563
                break;
slouken@3161
   564
            }
slouken@3161
   565
        }
slouken@3161
   566
slouken@3161
   567
        /* No available configs */
slouken@3161
   568
        if (configs == 0) {
slouken@3161
   569
            SDL_SetError("PND: Can't find any configuration for OpenGL ES");
slouken@3161
   570
            return NULL;
slouken@3161
   571
        }
slouken@3161
   572
    }
slouken@3161
   573
slouken@3161
   574
    /* Initialize config index */
slouken@3161
   575
    wdata->gles_config = 0;
slouken@3161
   576
slouken@3161
   577
    /* Now check each configuration to find out the best */
slouken@3161
   578
    for (cit = 0; cit < configs; cit++) {
slouken@3161
   579
        uint32_t stencil_found;
slouken@3161
   580
        uint32_t depth_found;
slouken@3161
   581
slouken@3161
   582
        stencil_found = 0;
slouken@3161
   583
        depth_found = 0;
slouken@3161
   584
slouken@3161
   585
        if (_this->gl_config.stencil_size) {
slouken@3161
   586
            status =
slouken@3161
   587
                eglGetConfigAttrib(phdata->egl_display,
slouken@3161
   588
                                   wdata->gles_configs[cit], EGL_STENCIL_SIZE,
slouken@3161
   589
                                   &attr_value);
slouken@3161
   590
            if (status == EGL_TRUE) {
slouken@3161
   591
                if (attr_value != 0) {
slouken@3161
   592
                    stencil_found = 1;
slouken@3161
   593
                }
slouken@3161
   594
            }
slouken@3161
   595
        } else {
slouken@3161
   596
            stencil_found = 1;
slouken@3161
   597
        }
slouken@3161
   598
slouken@3161
   599
        if (_this->gl_config.depth_size) {
slouken@3161
   600
            status =
slouken@3161
   601
                eglGetConfigAttrib(phdata->egl_display,
slouken@3161
   602
                                   wdata->gles_configs[cit], EGL_DEPTH_SIZE,
slouken@3161
   603
                                   &attr_value);
slouken@3161
   604
            if (status == EGL_TRUE) {
slouken@3161
   605
                if (attr_value != 0) {
slouken@3161
   606
                    depth_found = 1;
slouken@3161
   607
                }
slouken@3161
   608
            }
slouken@3161
   609
        } else {
slouken@3161
   610
            depth_found = 1;
slouken@3161
   611
        }
slouken@3161
   612
slouken@3161
   613
        /* Exit from loop if found appropriate configuration */
slouken@3161
   614
        if ((depth_found != 0) && (stencil_found != 0)) {
slouken@3161
   615
            break;
slouken@3161
   616
        }
slouken@3161
   617
    }
slouken@3161
   618
slouken@3161
   619
    /* If best could not be found, use first */
slouken@3161
   620
    if (cit == configs) {
slouken@3161
   621
        cit = 0;
slouken@3161
   622
    }
slouken@3161
   623
    wdata->gles_config = cit;
slouken@3161
   624
slouken@3161
   625
    /* Create OpenGL ES context */
slouken@3161
   626
    wdata->gles_context =
slouken@3161
   627
        eglCreateContext(phdata->egl_display,
slouken@3161
   628
                         wdata->gles_configs[wdata->gles_config], NULL, NULL);
slouken@3161
   629
    if (wdata->gles_context == EGL_NO_CONTEXT) {
slouken@3161
   630
        SDL_SetError("PND: OpenGL ES context creation has been failed");
slouken@3161
   631
        return NULL;
slouken@3161
   632
    }
slouken@3161
   633
slouken@3438
   634
#ifdef WIZ_GLES_LITE
slouken@3438
   635
    if( !hNativeWnd ) {
slouken@3438
   636
	hNativeWnd = (NativeWindowType)malloc(16*1024);
slouken@3438
   637
slouken@3438
   638
	if(!hNativeWnd)
slouken@3438
   639
	    printf( "Error : Wiz framebuffer allocatation failed\n" ); 
slouken@3438
   640
	else
slouken@3438
   641
	    printf( "SDL13: Wiz framebuffer allocated: %X\n", hNativeWnd );
slouken@3438
   642
    }
slouken@3438
   643
    else {
slouken@3438
   644
	printf( "SDL13: Wiz framebuffer already allocated: %X\n", hNativeWnd );
slouken@3438
   645
    }
slouken@3438
   646
slouken@3438
   647
    wdata->gles_surface =
slouken@3438
   648
	eglCreateWindowSurface(phdata->egl_display, 
slouken@3438
   649
			       wdata->gles_configs[wdata->gles_config],
slouken@3438
   650
			       hNativeWnd, NULL );
slouken@3438
   651
#else
slouken@3161
   652
    wdata->gles_surface =
slouken@3161
   653
        eglCreateWindowSurface(phdata->egl_display,
slouken@3161
   654
                               wdata->gles_configs[wdata->gles_config],
slouken@3161
   655
                               (NativeWindowType) 0, NULL);
slouken@3438
   656
#endif
slouken@3438
   657
slouken@3438
   658
slouken@3161
   659
    if (wdata->gles_surface == 0) {
slouken@3161
   660
        SDL_SetError("Error : eglCreateWindowSurface failed;\n");
slouken@3161
   661
        return NULL;
slouken@3161
   662
    }
slouken@3161
   663
slouken@3161
   664
    /* Make just created context current */
slouken@3161
   665
    status =
slouken@3161
   666
        eglMakeCurrent(phdata->egl_display, wdata->gles_surface,
slouken@3161
   667
                       wdata->gles_surface, wdata->gles_context);
slouken@3161
   668
    if (status != EGL_TRUE) {
slouken@3161
   669
        /* Destroy OpenGL ES surface */
slouken@3161
   670
        eglDestroySurface(phdata->egl_display, wdata->gles_surface);
slouken@3161
   671
        eglDestroyContext(phdata->egl_display, wdata->gles_context);
slouken@3161
   672
        wdata->gles_context = EGL_NO_CONTEXT;
slouken@3161
   673
        SDL_SetError("PND: Can't set OpenGL ES context on creation");
slouken@3161
   674
        return NULL;
slouken@3161
   675
    }
slouken@3161
   676
slouken@3161
   677
    _this->gl_config.accelerated = 1;
slouken@3161
   678
slouken@3161
   679
    /* Always clear stereo enable, since OpenGL ES do not supports stereo */
slouken@3161
   680
    _this->gl_config.stereo = 0;
slouken@3161
   681
slouken@3161
   682
    /* Get back samples and samplebuffers configurations. Rest framebuffer */
slouken@3161
   683
    /* parameters could be obtained through the OpenGL ES API              */
slouken@3161
   684
    status =
slouken@3161
   685
        eglGetConfigAttrib(phdata->egl_display,
slouken@3161
   686
                           wdata->gles_configs[wdata->gles_config],
slouken@3161
   687
                           EGL_SAMPLES, &attr_value);
slouken@3161
   688
    if (status == EGL_TRUE) {
slouken@3161
   689
        _this->gl_config.multisamplesamples = attr_value;
slouken@3161
   690
    }
slouken@3161
   691
    status =
slouken@3161
   692
        eglGetConfigAttrib(phdata->egl_display,
slouken@3161
   693
                           wdata->gles_configs[wdata->gles_config],
slouken@3161
   694
                           EGL_SAMPLE_BUFFERS, &attr_value);
slouken@3161
   695
    if (status == EGL_TRUE) {
slouken@3161
   696
        _this->gl_config.multisamplebuffers = attr_value;
slouken@3161
   697
    }
slouken@3161
   698
slouken@3161
   699
    /* Get back stencil and depth buffer sizes */
slouken@3161
   700
    status =
slouken@3161
   701
        eglGetConfigAttrib(phdata->egl_display,
slouken@3161
   702
                           wdata->gles_configs[wdata->gles_config],
slouken@3161
   703
                           EGL_DEPTH_SIZE, &attr_value);
slouken@3161
   704
    if (status == EGL_TRUE) {
slouken@3161
   705
        _this->gl_config.depth_size = attr_value;
slouken@3161
   706
    }
slouken@3161
   707
    status =
slouken@3161
   708
        eglGetConfigAttrib(phdata->egl_display,
slouken@3161
   709
                           wdata->gles_configs[wdata->gles_config],
slouken@3161
   710
                           EGL_STENCIL_SIZE, &attr_value);
slouken@3161
   711
    if (status == EGL_TRUE) {
slouken@3161
   712
        _this->gl_config.stencil_size = attr_value;
slouken@3161
   713
    }
slouken@3161
   714
slouken@3161
   715
    /* Under PND OpenGL ES output can't be double buffered */
slouken@3161
   716
    _this->gl_config.double_buffer = 0;
slouken@3161
   717
slouken@3161
   718
    /* GL ES context was successfully created */
slouken@3161
   719
    return wdata->gles_context;
slouken@3161
   720
}
slouken@3161
   721
slouken@3161
   722
int
slouken@3161
   723
PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context)
slouken@3161
   724
{
slouken@3161
   725
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3161
   726
    SDL_WindowData *wdata;
slouken@3161
   727
    EGLBoolean status;
slouken@3161
   728
slouken@3161
   729
    if (phdata->egl_initialized != SDL_TRUE) {
slouken@3161
   730
        SDL_SetError("PND: GF initialization failed, no OpenGL ES support");
slouken@3161
   731
        return -1;
slouken@3161
   732
    }
slouken@3161
   733
slouken@3161
   734
    if ((window == NULL) && (context == NULL)) {
slouken@3161
   735
        status =
slouken@3161
   736
            eglMakeCurrent(phdata->egl_display, EGL_NO_SURFACE,
slouken@3161
   737
                           EGL_NO_SURFACE, EGL_NO_CONTEXT);
slouken@3161
   738
        if (status != EGL_TRUE) {
slouken@3161
   739
            /* Failed to set current GL ES context */
slouken@3161
   740
            SDL_SetError("PND: Can't set OpenGL ES context");
slouken@3161
   741
            return -1;
slouken@3161
   742
        }
slouken@3161
   743
    } else {
slouken@3161
   744
        wdata = (SDL_WindowData *) window->driverdata;
slouken@3161
   745
        if (wdata->gles_surface == EGL_NO_SURFACE) {
slouken@3161
   746
            SDL_SetError
slouken@3161
   747
                ("PND: OpenGL ES surface is not initialized for this window");
slouken@3161
   748
            return -1;
slouken@3161
   749
        }
slouken@3161
   750
        if (wdata->gles_context == EGL_NO_CONTEXT) {
slouken@3161
   751
            SDL_SetError
slouken@3161
   752
                ("PND: OpenGL ES context is not initialized for this window");
slouken@3161
   753
            return -1;
slouken@3161
   754
        }
slouken@3161
   755
        if (wdata->gles_context != context) {
slouken@3161
   756
            SDL_SetError
slouken@3161
   757
                ("PND: OpenGL ES context is not belong to this window");
slouken@3161
   758
            return -1;
slouken@3161
   759
        }
slouken@3161
   760
        status =
slouken@3161
   761
            eglMakeCurrent(phdata->egl_display, wdata->gles_surface,
slouken@3161
   762
                           wdata->gles_surface, wdata->gles_context);
slouken@3161
   763
        if (status != EGL_TRUE) {
slouken@3161
   764
            /* Failed to set current GL ES context */
slouken@3161
   765
            SDL_SetError("PND: Can't set OpenGL ES context");
slouken@3161
   766
            return -1;
slouken@3161
   767
        }
slouken@3161
   768
    }
slouken@3161
   769
    return 0;
slouken@3161
   770
}
slouken@3161
   771
slouken@3161
   772
int
slouken@3161
   773
PND_gl_setswapinterval(_THIS, int interval)
slouken@3161
   774
{
slouken@3161
   775
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3161
   776
    EGLBoolean status;
slouken@3161
   777
slouken@3161
   778
    if (phdata->egl_initialized != SDL_TRUE) {
slouken@3161
   779
        SDL_SetError("PND: EGL initialization failed, no OpenGL ES support");
slouken@3161
   780
        return -1;
slouken@3161
   781
    }
slouken@3161
   782
slouken@3161
   783
    /* Check if OpenGL ES connection has been initialized */
slouken@3161
   784
    if (phdata->egl_display != EGL_NO_DISPLAY) {
slouken@3161
   785
        /* Set swap OpenGL ES interval */
slouken@3161
   786
        status = eglSwapInterval(phdata->egl_display, interval);
slouken@3161
   787
        if (status == EGL_TRUE) {
slouken@3161
   788
            /* Return success to upper level */
slouken@3161
   789
            phdata->swapinterval = interval;
slouken@3161
   790
            return 0;
slouken@3161
   791
        }
slouken@3161
   792
    }
slouken@3161
   793
slouken@3161
   794
    /* Failed to set swap interval */
slouken@3161
   795
    SDL_SetError("PND: Cannot set swap interval");
slouken@3161
   796
    return -1;
slouken@3161
   797
}
slouken@3161
   798
slouken@3161
   799
int
slouken@3161
   800
PND_gl_getswapinterval(_THIS)
slouken@3161
   801
{
slouken@3161
   802
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3161
   803
slouken@3161
   804
    if (phdata->egl_initialized != SDL_TRUE) {
slouken@3161
   805
        SDL_SetError("PND: GLES initialization failed, no OpenGL ES support");
slouken@3161
   806
        return -1;
slouken@3161
   807
    }
slouken@3161
   808
slouken@3161
   809
    /* Return default swap interval value */
slouken@3161
   810
    return phdata->swapinterval;
slouken@3161
   811
}
slouken@3161
   812
slouken@3161
   813
void
slouken@3161
   814
PND_gl_swapwindow(_THIS, SDL_Window * window)
slouken@3161
   815
{
slouken@3161
   816
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3161
   817
    SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
slouken@3161
   818
    SDL_DisplayData *didata =
slouken@5246
   819
        (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
slouken@3161
   820
slouken@3161
   821
slouken@3161
   822
    if (phdata->egl_initialized != SDL_TRUE) {
slouken@3161
   823
        SDL_SetError("PND: GLES initialization failed, no OpenGL ES support");
slouken@3161
   824
        return;
slouken@3161
   825
    }
slouken@3161
   826
slouken@3161
   827
    /* Many applications do not uses glFinish(), so we call it for them */
slouken@3161
   828
    glFinish();
slouken@3161
   829
slouken@3161
   830
    /* Wait until OpenGL ES rendering is completed */
slouken@3161
   831
    eglWaitGL();
slouken@3161
   832
slouken@3161
   833
    eglSwapBuffers(phdata->egl_display, wdata->gles_surface);
slouken@3161
   834
}
slouken@3161
   835
slouken@3161
   836
void
slouken@3161
   837
PND_gl_deletecontext(_THIS, SDL_GLContext context)
slouken@3161
   838
{
slouken@3161
   839
    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
slouken@3161
   840
    EGLBoolean status;
slouken@3161
   841
slouken@3161
   842
    if (phdata->egl_initialized != SDL_TRUE) {
slouken@3161
   843
        SDL_SetError("PND: GLES initialization failed, no OpenGL ES support");
slouken@3161
   844
        return;
slouken@3161
   845
    }
slouken@3161
   846
slouken@3161
   847
    /* Check if OpenGL ES connection has been initialized */
slouken@3161
   848
    if (phdata->egl_display != EGL_NO_DISPLAY) {
slouken@3161
   849
        if (context != EGL_NO_CONTEXT) {
slouken@3161
   850
            status = eglDestroyContext(phdata->egl_display, context);
slouken@3161
   851
            if (status != EGL_TRUE) {
slouken@3161
   852
                /* Error during OpenGL ES context destroying */
slouken@3161
   853
                SDL_SetError("PND: OpenGL ES context destroy error");
slouken@3161
   854
                return;
slouken@3161
   855
            }
slouken@3161
   856
        }
slouken@3161
   857
    }
slouken@3161
   858
slouken@3438
   859
#ifdef WIZ_GLES_LITE
slouken@3438
   860
    if( hNativeWnd != 0 )
slouken@3438
   861
    {
slouken@3438
   862
	  free(hNativeWnd);
slouken@3438
   863
	  hNativeWnd = 0;
slouken@3438
   864
	  printf( "SDL13: Wiz framebuffer released\n" );
slouken@3438
   865
    }
slouken@3438
   866
#endif
slouken@3438
   867
slouken@3161
   868
    return;
slouken@3161
   869
}
slouken@3161
   870
slouken@3161
   871
/* vi: set ts=4 sw=4 expandtab: */