Date: Wed, 4 Mar 2009 15:38:22 +0200
authorSam Lantinga <slouken@libsdl.org>
Wed, 04 Mar 2009 15:10:47 +0000
changeset 30870b6f51c29267
parent 3086 0102ed19c21a
child 3088 1825768f1f72
Date: Wed, 4 Mar 2009 15:38:22 +0200
From: "Mike Gorchak"
Subject: Re: About QNX support in SDL 1.3

Here is another batch of patches.

1) Makefile.in - added SDL_opengles.h header as header to install.
2) configure.in - Added special define to detect Common Lite OpenGL ES
library in case if Common library is not installed. Added check for
clock_gettime in libc (in QNX it is in libc).
3) SDL_config.h.in - Added SDL_VIDEO_RENDER_OPENGL_ES and
SDL_VIDEO_OPENGL_ES declarations for configure script autodetection.
4) SDL_opengles.h - Added GL_API definition if it is not defined. Added
extension GL_OES_draw_texture because OpenGL ES Renderer uses it without
declaration. Added GL_OES_vertex_buffer_object extension, which is supported
under QNX OpenGL ES. Added GL_OES_single_precision extension.
5) To the test directory I've added building OpenGL ES test applications
through the autotools suite. Was support for iPhone IDE building only.
Makefile.in
configure.in
include/SDL_config.h.in
include/SDL_opengles.h
include/SDL_syswm.h
src/video/photon/SDL_photon.c
src/video/qnxgf/SDL_gf_pixelfmt.c
src/video/qnxgf/SDL_gf_pixelfmt.h
src/video/qnxgf/SDL_gf_render.c
src/video/qnxgf/SDL_gf_render.h
src/video/qnxgf/SDL_qnxgf.c
src/video/qnxgf/SDL_qnxgf.h
test/Makefile.in
test/configure.in
test/testdyngles.c
     1.1 --- a/Makefile.in	Wed Mar 04 09:35:32 2009 +0000
     1.2 +++ b/Makefile.in	Wed Mar 04 15:10:47 2009 +0000
     1.3 @@ -42,7 +42,7 @@
     1.4  
     1.5  DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualC.html VisualC VisualCE Watcom-OS2.zip Watcom-Win32.zip WhatsNew Xcode
     1.6  
     1.7 -HDRS = SDL.h SDL_audio.h SDL_cdrom.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_pixels.h SDL_platform.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
     1.8 +HDRS = SDL.h SDL_audio.h SDL_cdrom.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengles.h SDL_pixels.h SDL_platform.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
     1.9  
    1.10  LT_AGE      = @LT_AGE@
    1.11  LT_CURRENT  = @LT_CURRENT@
     2.1 --- a/configure.in	Wed Mar 04 09:35:32 2009 +0000
     2.2 +++ b/configure.in	Wed Mar 04 15:10:47 2009 +0000
     2.3 @@ -1705,12 +1705,12 @@
     2.4          AC_MSG_RESULT($video_opengl)
     2.5          if test x$video_opengl = xyes; then
     2.6              AC_DEFINE(SDL_VIDEO_OPENGL_ES)
     2.7 -            AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
     2.8              EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CM"
     2.9          else
    2.10              AC_MSG_CHECKING(for QNX OpenGL ES (CL) support)
    2.11              video_opengl=no
    2.12              AC_TRY_COMPILE([
    2.13 +             #define COMMON_LITE
    2.14               #include <GLES/egl.h>
    2.15              ],[
    2.16              ],[
    2.17 @@ -1719,7 +1719,6 @@
    2.18              AC_MSG_RESULT($video_opengl)
    2.19              if test x$video_opengl = xyes; then
    2.20                  AC_DEFINE(SDL_VIDEO_OPENGL_ES)
    2.21 -                AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
    2.22                  EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CL"
    2.23              fi
    2.24          fi
    2.25 @@ -2295,6 +2294,12 @@
    2.26          if test x$have_clock_gettime = xyes; then
    2.27              AC_DEFINE(HAVE_CLOCK_GETTIME)
    2.28              EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
    2.29 +        else
    2.30 +            AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
    2.31 +            if test x$have_clock_gettime = xyes; then
    2.32 +               AC_DEFINE(HAVE_CLOCK_GETTIME)
    2.33 +               EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
    2.34 +            fi
    2.35          fi
    2.36      fi
    2.37  }
     3.1 --- a/include/SDL_config.h.in	Wed Mar 04 09:35:32 2009 +0000
     3.2 +++ b/include/SDL_config.h.in	Wed Mar 04 15:10:47 2009 +0000
     3.3 @@ -310,10 +310,12 @@
     3.4  #undef SDL_VIDEO_RENDER_D3D
     3.5  #undef SDL_VIDEO_RENDER_GDI
     3.6  #undef SDL_VIDEO_RENDER_OGL
     3.7 +#undef SDL_VIDEO_RENDER_OGL_ES
     3.8  #undef SDL_VIDEO_RENDER_X11
     3.9  
    3.10  /* Enable OpenGL support */
    3.11  #undef SDL_VIDEO_OPENGL
    3.12 +#undef SDL_VIDEO_OPENGL_ES
    3.13  #undef SDL_VIDEO_OPENGL_BGL
    3.14  #undef SDL_VIDEO_OPENGL_CGL
    3.15  #undef SDL_VIDEO_OPENGL_GLX
     4.1 --- a/include/SDL_opengles.h	Wed Mar 04 09:35:32 2009 +0000
     4.2 +++ b/include/SDL_opengles.h	Wed Mar 04 15:10:47 2009 +0000
     4.3 @@ -40,10 +40,6 @@
     4.4  #include <OpenGLES/ES1/gl.h>    /* Header File For The OpenGL ES Library */
     4.5  #endif
     4.6  
     4.7 -#if defined(__QNXNTO__) && defined(SDL_VIDEO_OPENGL_ES)
     4.8 -#include <GLES/egl.h>
     4.9 -#endif
    4.10 -
    4.11  #ifndef APIENTRY
    4.12  #define APIENTRY
    4.13  #endif
    4.14 @@ -52,6 +48,9 @@
    4.15  #define GL_APIENTRY
    4.16  #endif
    4.17  
    4.18 +#ifndef GL_API
    4.19 +#define GL_API
    4.20 +#endif /* GL_API */
    4.21  
    4.22  /*
    4.23  ** License Applicability. Except to the extent portions of this file are
    4.24 @@ -659,6 +658,29 @@
    4.25  #define GL_COORD_REPLACE_OES                                    0x8862
    4.26  #endif
    4.27  
    4.28 +/* GL_OES_draw_texture */
    4.29 +#ifndef GL_OES_draw_texture
    4.30 +#define GL_TEXTURE_CROP_RECT_OES                                0x8B9D
    4.31 +#endif /* GL_OES_draw_texture */
    4.32 +
    4.33 +/*  GL_OES_vertex_buffer_object */
    4.34 +#ifndef GL_OES_vertex_buffer_object
    4.35 +#define GL_ARRAY_BUFFER                                         0x8892
    4.36 +#define GL_ELEMENT_ARRAY_BUFFER                                 0x8893
    4.37 +#define GL_ARRAY_BUFFER_BINDING                                 0x8894
    4.38 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING                         0x8895
    4.39 +#define GL_VERTEX_ARRAY_BUFFER_BINDING                          0x8896
    4.40 +#define GL_NORMAL_ARRAY_BUFFER_BINDING                          0x8897
    4.41 +#define GL_COLOR_ARRAY_BUFFER_BINDING                           0x8898
    4.42 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING                   0x889A
    4.43 +#define GL_STATIC_DRAW                                          0x88E4
    4.44 +#define GL_DYNAMIC_DRAW                                         0x88E8
    4.45 +#define GL_WRITE_ONLY                                           0x88B9
    4.46 +#define GL_BUFFER_SIZE                                          0x8764
    4.47 +#define GL_BUFFER_USAGE                                         0x8765
    4.48 +#define GL_BUFFER_ACCESS                                        0x88BB
    4.49 +#endif /* GL_OES_vertex_buffer_object */
    4.50 +
    4.51  /*************************************************************/
    4.52  
    4.53  /* Available only in Common profile */
    4.54 @@ -945,6 +967,42 @@
    4.55  #define GL_OES_point_sprite 1
    4.56  #endif
    4.57  
    4.58 +/* GL_OES_draw_texture */
    4.59 +#ifndef GL_OES_draw_texture
    4.60 +#define GL_OES_draw_texture 1
    4.61 +    GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
    4.62 +    GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height);
    4.63 +    GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
    4.64 +    GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords);
    4.65 +    GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords);
    4.66 +    GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords);
    4.67 +    GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
    4.68 +    GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords);
    4.69 +#endif /* GL_OES_draw_texture */
    4.70 +
    4.71 +/* GL_OES_single_precision */
    4.72 +#ifndef GL_OES_single_precision
    4.73 +#define GL_OES_single_precision 1
    4.74 +    GL_API void GL_APIENTRY glDepthRangefOES (GLclampf zNear, GLclampf zFar);
    4.75 +    GL_API void GL_APIENTRY glFrustumfOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
    4.76 +    GL_API void GL_APIENTRY glOrthofOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
    4.77 +    GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);
    4.78 +    GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat eqn[4]);
    4.79 +    GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth);
    4.80 +#endif /* GL_OES_single_precision */
    4.81 +
    4.82 +/* GL_OES_vertex_buffer_object */
    4.83 +#ifndef GL_OES_vertex_buffer_object
    4.84 +#define GL_OES_vertex_buffer_object 1
    4.85 +    GL_API void APIENTRY glBindBufferOES(GLenum, GLuint);
    4.86 +    GL_API void APIENTRY glDeleteBuffersOES(GLsizei, const GLuint *);
    4.87 +    GL_API void APIENTRY glGenBuffersOES(GLsizei, GLuint *);
    4.88 +    GL_API GLboolean APIENTRY glIsBufferOES(GLuint);
    4.89 +    GL_API void APIENTRY glBufferDataOES(GLenum, GLsizeiptr, const GLvoid *, GLenum);
    4.90 +    GL_API void APIENTRY glBufferSubDataOES(GLenum, GLintptr, GLsizeiptr, const GLvoid *);
    4.91 +    GL_API void APIENTRY glGetBufferParameterivOES(GLenum, GLenum, GLint *);
    4.92 +#endif /* GL_OES_vertex_buffer_object */
    4.93 +
    4.94  #ifdef __cplusplus
    4.95  }
    4.96  #endif
     5.1 --- a/include/SDL_syswm.h	Wed Mar 04 09:35:32 2009 +0000
     5.2 +++ b/include/SDL_syswm.h	Wed Mar 04 15:10:47 2009 +0000
     5.3 @@ -169,7 +169,7 @@
     5.4      int window;                 /* The RISC OS display window */
     5.5  };
     5.6  
     5.7 -#elif defined(SDL_VIDEO_DRIVER_PHOTON)
     5.8 +#elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
     5.9  #include <sys/neutrino.h>
    5.10  #include <Ph.h>
    5.11  
    5.12 @@ -180,7 +180,7 @@
    5.13      int data;
    5.14  };
    5.15  
    5.16 -/* The QNX custom window manager information structure */
    5.17 +/* The QNX Photon custom window manager information structure */
    5.18  struct SDL_SysWMinfo
    5.19  {
    5.20      SDL_version version;
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/video/photon/SDL_photon.c	Wed Mar 04 15:10:47 2009 +0000
     6.3 @@ -0,0 +1,69 @@
     6.4 +/*
     6.5 +    SDL - Simple DirectMedia Layer
     6.6 +    Copyright (C) 1997-2009 Sam Lantinga
     6.7 +
     6.8 +    This library is free software; you can redistribute it and/or
     6.9 +    modify it under the terms of the GNU Lesser General Public
    6.10 +    License as published by the Free Software Foundation; either
    6.11 +    version 2.1 of the License, or (at your option) any later version.
    6.12 +
    6.13 +    This library is distributed in the hope that it will be useful,
    6.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    6.16 +    Lesser General Public License for more details.
    6.17 +
    6.18 +    You should have received a copy of the GNU Lesser General Public
    6.19 +    License along with this library; if not, write to the Free Software
    6.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    6.21 +
    6.22 +    Sam Lantinga
    6.23 +    slouken@libsdl.org
    6.24 +*/
    6.25 +
    6.26 +#include "SDL_config.h"
    6.27 +
    6.28 +#include "../SDL_sysvideo.h"
    6.29 +
    6.30 +static SDL_bool photon_initialized=SDL_FALSE;
    6.31 +
    6.32 +static int photon_available(void)
    6.33 +{
    6.34 +   int status;
    6.35 +
    6.36 +   /* Check if Photon was initialized before */
    6.37 +   if (photon_initialized==SDL_FALSE)
    6.38 +   {
    6.39 +      /* Initialize Photon widget library and open channel to Photon */
    6.40 +      status=PtInit(NULL);
    6.41 +      if (status==0)
    6.42 +      {
    6.43 +         photon_initialized=SDL_TRUE;
    6.44 +         return 1;
    6.45 +      }
    6.46 +      else
    6.47 +      {
    6.48 +         photon_initialized=SDL_FALSE;
    6.49 +         return 0;
    6.50 +      }
    6.51 +   }
    6.52 +
    6.53 +   return 1;
    6.54 +}
    6.55 +
    6.56 +static void photon_destroy(SDL_VideoDevice* device)
    6.57 +{
    6.58 +}
    6.59 +
    6.60 +static SDL_VideoDevice* photon_create(int devindex)
    6.61 +{
    6.62 +}
    6.63 +
    6.64 +VideoBootStrap photon_bootstrap=
    6.65 +{
    6.66 +   "photon",
    6.67 +   "SDL Photon video driver",
    6.68 +   photon_available,
    6.69 +   photon_create
    6.70 +};
    6.71 +
    6.72 +/* vi: set ts=4 sw=4 expandtab: */
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/video/qnxgf/SDL_gf_pixelfmt.c	Wed Mar 04 15:10:47 2009 +0000
     7.3 @@ -0,0 +1,168 @@
     7.4 +/*
     7.5 +    SDL - Simple DirectMedia Layer
     7.6 +    Copyright (C) 1997-2009 Sam Lantinga
     7.7 +
     7.8 +    This library is free software; you can redistribute it and/or
     7.9 +    modify it under the terms of the GNU Lesser General Public
    7.10 +    License as published by the Free Software Foundation; either
    7.11 +    version 2.1 of the License, or (at your option) any later version.
    7.12 +
    7.13 +    This library is distributed in the hope that it will be useful,
    7.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    7.16 +    Lesser General Public License for more details.
    7.17 +
    7.18 +    You should have received a copy of the GNU Lesser General Public
    7.19 +    License along with this library; if not, write to the Free Software
    7.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    7.21 +
    7.22 +    Sam Lantinga
    7.23 +    slouken@libsdl.org
    7.24 +*/
    7.25 +
    7.26 +#include "SDL_config.h"
    7.27 +#include "SDL_gf_pixelfmt.h"
    7.28 +
    7.29 +gf_format_t qnxgf_sdl_to_gf_pixelformat(uint32_t pixelfmt)
    7.30 +{
    7.31 +   switch(pixelfmt)
    7.32 +   {
    7.33 +      case SDL_PIXELFORMAT_INDEX8:
    7.34 +           {
    7.35 +              return GF_FORMAT_PAL8;
    7.36 +           }
    7.37 +           break;
    7.38 +      case SDL_PIXELFORMAT_ARGB1555:
    7.39 +           {
    7.40 +              return GF_FORMAT_PACK_ARGB1555;
    7.41 +           }
    7.42 +           break;
    7.43 +      case SDL_PIXELFORMAT_ABGR1555:
    7.44 +           {
    7.45 +              return GF_FORMAT_PACK_ARGB1555;
    7.46 +           }
    7.47 +           break;
    7.48 +      case SDL_PIXELFORMAT_RGB565:
    7.49 +           {
    7.50 +              return GF_FORMAT_PACK_RGB565;
    7.51 +           }
    7.52 +           break;
    7.53 +      case SDL_PIXELFORMAT_RGB888:
    7.54 +           {
    7.55 +              return GF_FORMAT_BGR888;
    7.56 +           }
    7.57 +           break;
    7.58 +      case SDL_PIXELFORMAT_BGRA8888:
    7.59 +           {
    7.60 +              return GF_FORMAT_BGRA8888;
    7.61 +           }
    7.62 +           break;
    7.63 +      case SDL_PIXELFORMAT_ARGB8888:
    7.64 +           {
    7.65 +              return GF_FORMAT_ARGB8888;
    7.66 +           }
    7.67 +           break;
    7.68 +      case SDL_PIXELFORMAT_YV12:
    7.69 +           {
    7.70 +              return GF_FORMAT_PLANAR_YUV_YV12;
    7.71 +           }
    7.72 +           break;
    7.73 +      case SDL_PIXELFORMAT_YUY2:
    7.74 +           {
    7.75 +              return GF_FORMAT_PACK_YUV_YUY2;
    7.76 +           }
    7.77 +           break;
    7.78 +      case SDL_PIXELFORMAT_UYVY:
    7.79 +           {
    7.80 +              return GF_FORMAT_PACK_YUV_UYVY;
    7.81 +           }
    7.82 +           break;
    7.83 +      case SDL_PIXELFORMAT_YVYU:
    7.84 +           {
    7.85 +              return GF_FORMAT_PACK_YUV_YVYU;
    7.86 +           }
    7.87 +           break;
    7.88 +   }
    7.89 +
    7.90 +   return GF_FORMAT_INVALID;
    7.91 +}
    7.92 +
    7.93 +uint32_t qnxgf_gf_to_sdl_pixelformat(gf_format_t pixelfmt)
    7.94 +{
    7.95 +   switch(pixelfmt)
    7.96 +   {
    7.97 +      case GF_FORMAT_PAL8:
    7.98 +           {
    7.99 +              return SDL_PIXELFORMAT_INDEX8;
   7.100 +           }
   7.101 +           break;
   7.102 +      case GF_FORMAT_PKLE_ARGB1555:
   7.103 +           {
   7.104 +              return SDL_PIXELFORMAT_ARGB1555;
   7.105 +           }
   7.106 +           break;
   7.107 +      case GF_FORMAT_PACK_ARGB1555:
   7.108 +           {
   7.109 +              return SDL_PIXELFORMAT_ARGB1555;
   7.110 +           }
   7.111 +           break;
   7.112 +      case GF_FORMAT_PKBE_ARGB1555:
   7.113 +           {
   7.114 +              return SDL_PIXELFORMAT_ABGR1555;
   7.115 +           }
   7.116 +           break;
   7.117 +      case GF_FORMAT_PKBE_RGB565:
   7.118 +           {
   7.119 +              return SDL_PIXELFORMAT_RGB565;
   7.120 +           }
   7.121 +           break;
   7.122 +      case GF_FORMAT_PKLE_RGB565:
   7.123 +           {
   7.124 +              return SDL_PIXELFORMAT_RGB565;
   7.125 +           }
   7.126 +           break;
   7.127 +      case GF_FORMAT_PACK_RGB565:
   7.128 +           {
   7.129 +              return SDL_PIXELFORMAT_RGB565;
   7.130 +           }
   7.131 +           break;
   7.132 +      case GF_FORMAT_BGR888:
   7.133 +           {
   7.134 +              return SDL_PIXELFORMAT_RGB888;
   7.135 +           }
   7.136 +           break;
   7.137 +      case GF_FORMAT_BGRA8888:
   7.138 +           {
   7.139 +              return SDL_PIXELFORMAT_BGRA8888;
   7.140 +           }
   7.141 +           break;
   7.142 +      case GF_FORMAT_ARGB8888:
   7.143 +           {
   7.144 +              return SDL_PIXELFORMAT_ARGB8888;
   7.145 +           }
   7.146 +           break;
   7.147 +
   7.148 +      case GF_FORMAT_PLANAR_YUV_YV12:
   7.149 +           {
   7.150 +              return SDL_PIXELFORMAT_YV12;
   7.151 +           }
   7.152 +           break;
   7.153 +      case GF_FORMAT_PACK_YUV_YUY2:
   7.154 +           {
   7.155 +              return SDL_PIXELFORMAT_YUY2;
   7.156 +           }
   7.157 +           break;
   7.158 +      case GF_FORMAT_PACK_YUV_UYVY:
   7.159 +           {
   7.160 +              return SDL_PIXELFORMAT_UYVY;
   7.161 +           }
   7.162 +           break;
   7.163 +      case GF_FORMAT_PACK_YUV_YVYU:
   7.164 +           {
   7.165 +              return SDL_PIXELFORMAT_YVYU;
   7.166 +           }
   7.167 +           break;
   7.168 +   }
   7.169 +
   7.170 +   return SDL_PIXELFORMAT_UNKNOWN;
   7.171 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/video/qnxgf/SDL_gf_pixelfmt.h	Wed Mar 04 15:10:47 2009 +0000
     8.3 @@ -0,0 +1,33 @@
     8.4 +/*
     8.5 +    SDL - Simple DirectMedia Layer
     8.6 +    Copyright (C) 1997-2009 Sam Lantinga
     8.7 +
     8.8 +    This library is free software; you can redistribute it and/or
     8.9 +    modify it under the terms of the GNU Lesser General Public
    8.10 +    License as published by the Free Software Foundation; either
    8.11 +    version 2.1 of the License, or (at your option) any later version.
    8.12 +
    8.13 +    This library is distributed in the hope that it will be useful,
    8.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.16 +    Lesser General Public License for more details.
    8.17 +
    8.18 +    You should have received a copy of the GNU Lesser General Public
    8.19 +    License along with this library; if not, write to the Free Software
    8.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    8.21 +
    8.22 +    Sam Lantinga
    8.23 +    slouken@libsdl.org
    8.24 +*/
    8.25 +
    8.26 +#ifndef __SDL_GF_PIXELFMT_H__
    8.27 +#define __SDL_GF_PIXELFMT_H__
    8.28 +
    8.29 +#include "../SDL_sysvideo.h"
    8.30 +
    8.31 +#include <gf/gf.h>
    8.32 +
    8.33 +gf_format_t qnxgf_sdl_to_gf_pixelformat(uint32_t pixelfmt);
    8.34 +uint32_t    qnxgf_gf_to_sdl_pixelformat(gf_format_t pixelfmt);
    8.35 +
    8.36 +#endif /* __SDL_GF_PIXELFMT_H__ */
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/video/qnxgf/SDL_gf_render.c	Wed Mar 04 15:10:47 2009 +0000
     9.3 @@ -0,0 +1,69 @@
     9.4 +/*
     9.5 +    SDL - Simple DirectMedia Layer
     9.6 +    Copyright (C) 1997-2009 Sam Lantinga
     9.7 +
     9.8 +    This library is free software; you can redistribute it and/or
     9.9 +    modify it under the terms of the GNU Lesser General Public
    9.10 +    License as published by the Free Software Foundation; either
    9.11 +    version 2.1 of the License, or (at your option) any later version.
    9.12 +
    9.13 +    This library is distributed in the hope that it will be useful,
    9.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.16 +    Lesser General Public License for more details.
    9.17 +
    9.18 +    You should have received a copy of the GNU Lesser General Public
    9.19 +    License along with this library; if not, write to the Free Software
    9.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    9.21 +
    9.22 +    Sam Lantinga
    9.23 +    slouken@libsdl.org
    9.24 +*/
    9.25 +
    9.26 +#include "SDL_config.h"
    9.27 +
    9.28 +#include "../SDL_pixels_c.h"
    9.29 +#include "../SDL_yuv_sw_c.h"
    9.30 +
    9.31 +#include "SDL_video.h"
    9.32 +
    9.33 +#include "SDL_gf_render.h"
    9.34 +
    9.35 +static SDL_Renderer* GF_CreateRenderer(SDL_Window* window, Uint32 flags)
    9.36 +{
    9.37 +}
    9.38 +
    9.39 +SDL_RenderDriver GF_RenderDriver=
    9.40 +{
    9.41 +    GF_CreateRenderer,
    9.42 +    {
    9.43 +       "qnxgf",
    9.44 +       (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
    9.45 +        SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
    9.46 +        SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC |
    9.47 +        SDL_RENDERER_ACCELERATED),
    9.48 +       (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
    9.49 +        SDL_TEXTUREMODULATE_ALPHA),
    9.50 +       (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK |
    9.51 +        SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
    9.52 +       (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_SLOW),
    9.53 +       13,
    9.54 +       {
    9.55 +          SDL_PIXELFORMAT_INDEX8,
    9.56 +          SDL_PIXELFORMAT_RGB555,
    9.57 +          SDL_PIXELFORMAT_RGB565,
    9.58 +          SDL_PIXELFORMAT_RGB888,
    9.59 +          SDL_PIXELFORMAT_BGR888,
    9.60 +          SDL_PIXELFORMAT_ARGB8888,
    9.61 +          SDL_PIXELFORMAT_RGBA8888,
    9.62 +          SDL_PIXELFORMAT_ABGR8888,
    9.63 +          SDL_PIXELFORMAT_BGRA8888,
    9.64 +          SDL_PIXELFORMAT_YV12,
    9.65 +          SDL_PIXELFORMAT_YUY2,
    9.66 +          SDL_PIXELFORMAT_UYVY,
    9.67 +          SDL_PIXELFORMAT_YVYU
    9.68 +       },
    9.69 +       0,
    9.70 +       0
    9.71 +    }
    9.72 +};
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/src/video/qnxgf/SDL_gf_render.h	Wed Mar 04 15:10:47 2009 +0000
    10.3 @@ -0,0 +1,30 @@
    10.4 +/*
    10.5 +    SDL - Simple DirectMedia Layer
    10.6 +    Copyright (C) 1997-2009 Sam Lantinga
    10.7 +
    10.8 +    This library is free software; you can redistribute it and/or
    10.9 +    modify it under the terms of the GNU Lesser General Public
   10.10 +    License as published by the Free Software Foundation; either
   10.11 +    version 2.1 of the License, or (at your option) any later version.
   10.12 +
   10.13 +    This library is distributed in the hope that it will be useful,
   10.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   10.16 +    Lesser General Public License for more details.
   10.17 +
   10.18 +    You should have received a copy of the GNU Lesser General Public
   10.19 +    License along with this library; if not, write to the Free Software
   10.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   10.21 +
   10.22 +    Sam Lantinga
   10.23 +    slouken@libsdl.org
   10.24 +*/
   10.25 +
   10.26 +#ifndef __SDL_GF_RENDER_H__
   10.27 +#define __SDL_GF_RENDER_H__
   10.28 +
   10.29 +#include "../SDL_sysvideo.h"
   10.30 +
   10.31 +#include <gf/gf.h>
   10.32 +
   10.33 +#endif /* __SDL_GF_RENDER_H__ */
    11.1 --- a/src/video/qnxgf/SDL_qnxgf.c	Wed Mar 04 09:35:32 2009 +0000
    11.2 +++ b/src/video/qnxgf/SDL_qnxgf.c	Wed Mar 04 15:10:47 2009 +0000
    11.3 @@ -23,13 +23,543 @@
    11.4  #include "SDL_config.h"
    11.5  
    11.6  #include "../SDL_sysvideo.h"
    11.7 +#include "SDL_version.h"
    11.8 +#include "SDL_syswm.h"
    11.9 +
   11.10 +/* Include QNX Graphics Framework declarations */
   11.11 +#include <gf/gf.h>
   11.12 +
   11.13 +#include "SDL_qnxgf.h"
   11.14 +#include "SDL_gf_pixelfmt.h"
   11.15 +
   11.16 +/******************************************************************************/
   11.17 +/* SDL Generic video modes, which could provide GF                            */
   11.18 +/* This is real pain in the ass. GF is just wrapper around a selected driver  */
   11.19 +/* some drivers could support double scan modes, like 320x200, 512x384, etc   */
   11.20 +/* but some drivers are not. Later we can distinguish one driver from another */
   11.21 +/* Feel free to add any new custom graphics mode                              */
   11.22 +/******************************************************************************/
   11.23 +static SDL_DisplayMode generic_mode[]=
   11.24 +{
   11.25 +   {0, 320, 200, 70, NULL},    /* 320x200 modes are 70Hz and 85Hz          */
   11.26 +   {0, 320, 200, 85, NULL},
   11.27 +   {0, 320, 240, 70, NULL},    /* 320x240 modes are 70Hz and 85Hz          */
   11.28 +   {0, 320, 240, 85, NULL},
   11.29 +   {0, 512, 384, 60, NULL},    /* 512x384 modes are 60Hz and 70Hz          */
   11.30 +   {0, 512, 384, 70, NULL},
   11.31 +   {0, 640, 480, 60, NULL},    /* 640x480 modes are 60Hz, 75Hz, 85Hz       */
   11.32 +   {0, 640, 480, 75, NULL},
   11.33 +   {0, 640, 480, 85, NULL},
   11.34 +   {0, 800, 600, 60, NULL},    /* 800x600 modes are 60Hz, 75Hz, 85Hz       */
   11.35 +   {0, 800, 600, 75, NULL},
   11.36 +   {0, 800, 600, 85, NULL},
   11.37 +   {0, 800, 480, 60, NULL},    /* 800x480 mode is 60Hz only                */
   11.38 +   {0, 1024, 640, 60, NULL},   /* 1024x640 mode is 60Hz only               */
   11.39 +   {0, 1024, 768, 60, NULL},   /* 1024x768 modes are 60Hz, 70Hz, 75Hz      */
   11.40 +   {0, 1024, 768, 70, NULL},
   11.41 +   {0, 1024, 768, 75, NULL},
   11.42 +   {0, 1280, 720, 60, NULL},   /* 1280x720 mode is 60Hz only               */
   11.43 +   {0, 1280, 768, 60, NULL},   /* 1280x768 mode is 60Hz only               */
   11.44 +   {0, 1280, 800, 60, NULL},   /* 1280x800 mode is 60Hz only               */
   11.45 +   {0, 1280, 960, 60, NULL},   /* 1280x960 mode is 60Hz only               */
   11.46 +   {0, 1280, 1024, 60, NULL},  /* 1280x1024 mode is 60Hz only              */
   11.47 +   {0, 1400, 1050, 60, NULL},  /* 1400x1050 mode is 60Hz only              */
   11.48 +   {0, 1440, 900, 60, NULL},   /* 1440x900 mode is 60Hz only               */
   11.49 +   {0, 1440, 960, 60, NULL},   /* 1440x960 mode is 60Hz only               */
   11.50 +   {0, 1600, 1200, 60, NULL},  /* 1600x1200 mode is 60Hz only              */
   11.51 +   {0, 1680, 1050, 60, NULL},  /* 1680x1050 mode is 60Hz only              */
   11.52 +   {0, 1920, 1080, 60, NULL},  /* 1920x1080 mode is 60Hz only              */
   11.53 +   {0, 1920, 1200, 60, NULL},  /* 1920x1200 mode is 60Hz only              */
   11.54 +   {0, 2048, 1536, 60, NULL},  /* 2048x1536 mode is 60Hz only              */
   11.55 +   {0, 2048, 1080, 60, NULL},  /* 2048x1080 mode is 60Hz only              */
   11.56 +   {0,    0,    0,  0, NULL}   /* End of generic mode list                 */
   11.57 +};
   11.58 +
   11.59 +/*****************************************************************************/
   11.60 +/* SDL Video Device initialization functions                                 */
   11.61 +/*****************************************************************************/
   11.62 +
   11.63 +static int qnxgf_available(void)
   11.64 +{
   11.65 +   gf_dev_t gfdev;
   11.66 +   gf_dev_info_t gfdev_info;
   11.67 +   int status;
   11.68 +
   11.69 +   /* Try to attach to graphics device driver */
   11.70 +   status=gf_dev_attach(&gfdev, GF_DEVICE_INDEX(0), &gfdev_info);
   11.71 +   if (status!=GF_ERR_OK)
   11.72 +   {
   11.73 +      return 0;
   11.74 +   }
   11.75 +
   11.76 +   /* Detach from graphics device driver for now */
   11.77 +   gf_dev_detach(gfdev);
   11.78 +
   11.79 +   return 1;
   11.80 +}
   11.81 +
   11.82 +static void qnxgf_destroy(SDL_VideoDevice* device)
   11.83 +{
   11.84 +   SDL_VideoData* gfdata=(SDL_VideoData*) device->driverdata;
   11.85 +
   11.86 +   /* Detach from graphics device driver, if it was initialized */
   11.87 +   if (gfdata->gfinitialized!=SDL_FALSE)
   11.88 +   {
   11.89 +      gf_dev_detach(gfdata->gfdev);
   11.90 +   }
   11.91 +
   11.92 +   if (device->driverdata!=NULL)
   11.93 +   {
   11.94 +      SDL_free(device->driverdata);
   11.95 +      device->driverdata=NULL;
   11.96 +   }
   11.97 +   SDL_free(device);
   11.98 +}
   11.99 +
  11.100 +static SDL_VideoDevice* qnxgf_create(int devindex)
  11.101 +{
  11.102 +   SDL_VideoDevice* device;
  11.103 +   SDL_VideoData*   gfdata;
  11.104 +   int              status;
  11.105 +
  11.106 +   /* Initialize SDL_VideoDevice structure */
  11.107 +   device = (SDL_VideoDevice*)SDL_calloc(1, sizeof(SDL_VideoDevice));
  11.108 +   if (device==NULL)
  11.109 +   {
  11.110 +      SDL_OutOfMemory();
  11.111 +      return NULL;
  11.112 +   }
  11.113 +
  11.114 +   /* Initialize internal GF specific data */
  11.115 +   gfdata = (SDL_VideoData*)SDL_calloc(1, sizeof(SDL_VideoData));
  11.116 +   if (gfdata==NULL)
  11.117 +   {
  11.118 +      SDL_OutOfMemory();
  11.119 +      SDL_free(device);
  11.120 +      return NULL;
  11.121 +   }
  11.122 +   device->driverdata=gfdata;
  11.123 +
  11.124 +   /* Try to attach to graphics device driver */
  11.125 +   status=gf_dev_attach(&gfdata->gfdev, GF_DEVICE_INDEX(devindex), &gfdata->gfdev_info);
  11.126 +   if (status!=GF_ERR_OK)
  11.127 +   {
  11.128 +      SDL_OutOfMemory();
  11.129 +      SDL_free(gfdata);
  11.130 +      SDL_free(device);
  11.131 +      return NULL;
  11.132 +   }
  11.133 +
  11.134 +   /* Setup amount of available displays and current display */
  11.135 +   device->num_displays=0;
  11.136 +   device->current_display=0;
  11.137 +
  11.138 +   /* Setup device shutdown function */
  11.139 +   gfdata->gfinitialized=SDL_TRUE;
  11.140 +   device->free=qnxgf_destroy;
  11.141 +
  11.142 +   /* Setup all functions which we can handle */
  11.143 +   device->VideoInit=qnxgf_videoinit;
  11.144 +   device->VideoQuit=qnxgf_videoquit;
  11.145 +   device->GetDisplayModes=qnxgf_getdisplaymodes;
  11.146 +   device->SetDisplayMode=qnxgf_setdisplaymode;
  11.147 +   device->SetDisplayPalette=qnxgf_setdisplaypalette;
  11.148 +   device->GetDisplayPalette=qnxgf_getdisplaypalette;
  11.149 +   device->SetDisplayGammaRamp=qnxgf_setdisplaygammaramp;
  11.150 +   device->GetDisplayGammaRamp=qnxgf_getdisplaygammaramp;
  11.151 +   device->CreateWindow=qnxgf_createwindow;
  11.152 +   device->CreateWindowFrom=qnxgf_createwindowfrom;
  11.153 +   device->SetWindowTitle=qnxgf_setwindowtitle;
  11.154 +   device->SetWindowIcon=qnxgf_setwindowicon;
  11.155 +   device->SetWindowPosition=qnxgf_setwindowposition;
  11.156 +   device->SetWindowSize=qnxgf_setwindowsize;
  11.157 +   device->ShowWindow=qnxgf_showwindow;
  11.158 +   device->HideWindow=qnxgf_hidewindow;
  11.159 +   device->RaiseWindow=qnxgf_raisewindow;
  11.160 +   device->MaximizeWindow=qnxgf_maximizewindow;
  11.161 +   device->MinimizeWindow=qnxgf_minimizewindow;
  11.162 +   device->RestoreWindow=qnxgf_restorewindow;
  11.163 +   device->SetWindowGrab=qnxgf_setwindowgrab;
  11.164 +   device->DestroyWindow=qnxgf_destroywindow;
  11.165 +   device->GetWindowWMInfo=qnxgf_getwindowwminfo;
  11.166 +   device->GL_LoadLibrary=qnxgf_gl_loadlibrary;
  11.167 +   device->GL_GetProcAddress=qnxgf_gl_getprocaddres;
  11.168 +   device->GL_UnloadLibrary=qnxgf_gl_unloadlibrary;
  11.169 +   device->GL_CreateContext=qnxgf_gl_createcontext;
  11.170 +   device->GL_MakeCurrent=qnxgf_gl_makecurrent;
  11.171 +   device->GL_SetSwapInterval=qnxgf_gl_setswapinterval;
  11.172 +   device->GL_GetSwapInterval=qnxgf_gl_getswapinterval;
  11.173 +   device->GL_SwapWindow=qnxgf_gl_swapwindow;
  11.174 +   device->GL_DeleteContext=qnxgf_gl_deletecontext;
  11.175 +   device->PumpEvents=qnxgf_pumpevents;
  11.176 +   device->SuspendScreenSaver=qnxgf_suspendscreensaver;
  11.177 +
  11.178 +   return device;
  11.179 +}
  11.180  
  11.181  VideoBootStrap qnxgf_bootstrap=
  11.182  {
  11.183 -   "QNXGF",
  11.184 -   "QNX Graphics Framework",
  11.185 -   NULL,
  11.186 -   NULL
  11.187 +   "qnxgf",
  11.188 +   "SDL QNX Graphics Framework (GF) video driver",
  11.189 +   qnxgf_available,
  11.190 +   qnxgf_create
  11.191  };
  11.192  
  11.193 +/*****************************************************************************/
  11.194 +/* SDL Video and Display initialization/handling functions                   */
  11.195 +/*****************************************************************************/
  11.196 +int qnxgf_videoinit(_THIS)
  11.197 +{
  11.198 +   SDL_VideoData* gfdata=(SDL_VideoData*)_this->driverdata;
  11.199 +   uint32_t it;
  11.200 +
  11.201 +   /* Add each detected output to SDL */
  11.202 +   for (it=0; it<gfdata->gfdev_info.ndisplays; it++)
  11.203 +   {
  11.204 +      SDL_VideoDisplay  display;
  11.205 +      SDL_DisplayMode   current_mode;
  11.206 +      SDL_DisplayData*  didata;
  11.207 +      int status;
  11.208 +
  11.209 +      didata=(SDL_DisplayData*)SDL_calloc(1, sizeof(SDL_DisplayData));
  11.210 +      if (didata==NULL)
  11.211 +      {
  11.212 +         /* memory allocation problem */
  11.213 +         SDL_OutOfMemory();
  11.214 +         return -1;
  11.215 +      }
  11.216 +
  11.217 +      status=gf_display_query(gfdata->gfdev, it, &didata->display_info);
  11.218 +      if (status==GF_ERR_OK)
  11.219 +      {
  11.220 +         SDL_zero(current_mode);
  11.221 +         current_mode.w=didata->display_info.xres;
  11.222 +         current_mode.h=didata->display_info.yres;
  11.223 +         current_mode.refresh_rate=didata->display_info.refresh;
  11.224 +         current_mode.format=qnxgf_gf_to_sdl_pixelformat(didata->display_info.format);
  11.225 +         current_mode.driverdata=NULL;
  11.226 +      }
  11.227 +      else
  11.228 +      {
  11.229 +         /* video initialization problem */
  11.230 +         SDL_free(didata);
  11.231 +         SDL_SetError("Display query failed");
  11.232 +         return -1;
  11.233 +      }
  11.234 +
  11.235 +      /* Attach GF to selected display */
  11.236 +      status=gf_display_attach(&didata->display, gfdata->gfdev, it, NULL);
  11.237 +      if (status!=GF_ERR_OK)
  11.238 +      {
  11.239 +         /* video initialization problem */
  11.240 +         SDL_free(didata);
  11.241 +         SDL_SetError("Couldn't not attach to display");
  11.242 +         return -1;
  11.243 +      }
  11.244 +
  11.245 +      SDL_zero(display);
  11.246 +      display.desktop_mode = current_mode;
  11.247 +      display.current_mode = current_mode;
  11.248 +      display.driverdata = didata;
  11.249 +      SDL_AddVideoDisplay(&display);
  11.250 +   }
  11.251 +
  11.252 +   /* video has been initialized successfully */
  11.253 +   return 1;
  11.254 +}
  11.255 +
  11.256 +void qnxgf_videoquit(_THIS)
  11.257 +{
  11.258 +   SDL_DisplayData* didata;
  11.259 +   uint32_t it;
  11.260 +
  11.261 +   for(it=0; it<_this->num_displays; it++)
  11.262 +   {
  11.263 +      didata=_this->displays[it].driverdata;
  11.264 +
  11.265 +      /* Detach from selected display */
  11.266 +      gf_display_detach(didata->display);
  11.267 +   }
  11.268 +}
  11.269 +
  11.270 +void qnxgf_getdisplaymodes(_THIS)
  11.271 +{
  11.272 +   SDL_DisplayData* didata = (SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.273 +   SDL_DisplayMode  mode;
  11.274 +   gf_modeinfo_t    modeinfo;
  11.275 +   uint32_t it=0;
  11.276 +   uint32_t jt=0;
  11.277 +   uint32_t kt=0;
  11.278 +   int      status;
  11.279 +
  11.280 +   do {
  11.281 +      status=gf_display_query_mode(didata->display, it, &modeinfo);
  11.282 +      if (status==GF_ERR_OK)
  11.283 +      {
  11.284 +         /* Parsing current mode */
  11.285 +         if ((modeinfo.flags & GF_MODE_GENERIC)==GF_MODE_GENERIC)
  11.286 +         {
  11.287 +            /* This mode is generic, so we can add to SDL our resolutions */
  11.288 +            /* Only pixel format is fixed, refresh rate could be any      */
  11.289 +            jt=0;
  11.290 +            do {
  11.291 +               if (generic_mode[jt].w==0)
  11.292 +               {
  11.293 +                  break;
  11.294 +               }
  11.295 +
  11.296 +               mode.w=generic_mode[jt].w;
  11.297 +               mode.h=generic_mode[jt].h;
  11.298 +               mode.refresh_rate=generic_mode[jt].refresh_rate;
  11.299 +               mode.format=qnxgf_gf_to_sdl_pixelformat(modeinfo.primary_format);
  11.300 +               mode.driverdata=NULL;
  11.301 +               SDL_AddDisplayMode(_this->current_display, &mode);
  11.302 +
  11.303 +               jt++;
  11.304 +            } while(1);
  11.305 +         }
  11.306 +         else
  11.307 +         {
  11.308 +            /* Add this display mode as is in case if it is non-generic */
  11.309 +            /* But go through the each refresh rate, supported by gf    */
  11.310 +            jt=0;
  11.311 +            do {
  11.312 +               if (modeinfo.refresh[jt]!=0)
  11.313 +               {
  11.314 +                  mode.w=modeinfo.xres;
  11.315 +                  mode.h=modeinfo.yres;
  11.316 +                  mode.refresh_rate=modeinfo.refresh[jt];
  11.317 +                  mode.format=qnxgf_gf_to_sdl_pixelformat(modeinfo.primary_format);
  11.318 +                  mode.driverdata=NULL;
  11.319 +                  SDL_AddDisplayMode(_this->current_display, &mode);
  11.320 +                  jt++;
  11.321 +               }
  11.322 +               else
  11.323 +               {
  11.324 +                  break;
  11.325 +               }
  11.326 +            } while(1);
  11.327 +         }
  11.328 +      }
  11.329 +      else
  11.330 +      {
  11.331 +         if (status==GF_ERR_PARM)
  11.332 +         {
  11.333 +            /* out of available modes, all are listed */
  11.334 +            break;
  11.335 +         }
  11.336 +
  11.337 +         /* Error occured during mode listing */
  11.338 +         break;
  11.339 +      }
  11.340 +      it++;
  11.341 +   } while(1);
  11.342 +}
  11.343 +
  11.344 +int qnxgf_setdisplaymode(_THIS, SDL_DisplayMode* mode)
  11.345 +{
  11.346 +   SDL_DisplayData* didata = (SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.347 +   int result;
  11.348 +
  11.349 +   result=gf_display_set_mode(didata->display, mode->w, mode->h, mode->refresh_rate,
  11.350 +                              qnxgf_sdl_to_gf_pixelformat(mode->format), 0);
  11.351 +   if (result!=GF_ERR_OK)
  11.352 +   {
  11.353 +      /* Display mode/resolution switch has been failed */
  11.354 +      SDL_SetError("Mode is not supported by qnxgf driver");
  11.355 +      return -1;
  11.356 +   }
  11.357 +
  11.358 +   return 0;
  11.359 +}
  11.360 +
  11.361 +int qnxgf_setdisplaypalette(_THIS, SDL_Palette* palette)
  11.362 +{
  11.363 +   /* Palette must be set through the QNXGF renderer */
  11.364 +   /* It connected to surface, part of it            */
  11.365 +
  11.366 +   /* Setting display palette operation has been failed */
  11.367 +   return -1;
  11.368 +}
  11.369 +
  11.370 +int qnxgf_getdisplaypalette(_THIS, SDL_Palette* palette)
  11.371 +{
  11.372 +   /* We can give to upper level palette, which it set before */
  11.373 +
  11.374 +   /* Getting display palette operation has been failed */
  11.375 +   return -1;
  11.376 +}
  11.377 +
  11.378 +int qnxgf_setdisplaygammaramp(_THIS, Uint16* ramp)
  11.379 +{
  11.380 +   SDL_DisplayData* didata = (SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.381 +   int status;
  11.382 +
  11.383 +   /* GF can set Color LUT independently for each color channel, but SDL */
  11.384 +   /* uses combined gamma ramp, set it to each channel                   */
  11.385 +   status=gf_display_set_color_lut16(didata->display, (uint16_t*)ramp, (uint16_t*)ramp, (uint16_t*)ramp);
  11.386 +   if (status!=GF_ERR_OK)
  11.387 +   {
  11.388 +      /* Setting display gamma ramp operation has been failed */
  11.389 +      return -1;
  11.390 +   }
  11.391 +
  11.392 +   return 0;
  11.393 +}
  11.394 +
  11.395 +int qnxgf_getdisplaygammaramp(_THIS, Uint16* ramp)
  11.396 +{
  11.397 +   /* We need to return previous gamma set */
  11.398 +
  11.399 +   /* Getting display gamma ramp operation has been failed */
  11.400 +   return -1;
  11.401 +}
  11.402 +
  11.403 +int qnxgf_createwindow(_THIS, SDL_Window* window)
  11.404 +{
  11.405 +   /* Failed to create new window */
  11.406 +   return -1;
  11.407 +}
  11.408 +
  11.409 +int qnxgf_createwindowfrom(_THIS, SDL_Window* window, const void* data)
  11.410 +{
  11.411 +   /* Failed to create window from another window */
  11.412 +   return -1;
  11.413 +}
  11.414 +
  11.415 +void qnxgf_setwindowtitle(_THIS, SDL_Window* window)
  11.416 +{
  11.417 +}
  11.418 +
  11.419 +void qnxgf_setwindowicon(_THIS, SDL_Window* window, SDL_Surface* icon)
  11.420 +{
  11.421 +}
  11.422 +
  11.423 +void qnxgf_setwindowposition(_THIS, SDL_Window* window)
  11.424 +{
  11.425 +}
  11.426 +
  11.427 +void qnxgf_setwindowsize(_THIS, SDL_Window* window)
  11.428 +{
  11.429 +}
  11.430 +
  11.431 +void qnxgf_showwindow(_THIS, SDL_Window* window)
  11.432 +{
  11.433 +}
  11.434 +
  11.435 +void qnxgf_hidewindow(_THIS, SDL_Window* window)
  11.436 +{
  11.437 +}
  11.438 +
  11.439 +void qnxgf_raisewindow(_THIS, SDL_Window* window)
  11.440 +{
  11.441 +}
  11.442 +
  11.443 +void qnxgf_maximizewindow(_THIS, SDL_Window* window)
  11.444 +{
  11.445 +}
  11.446 +
  11.447 +void qnxgf_minimizewindow(_THIS, SDL_Window* window)
  11.448 +{
  11.449 +}
  11.450 +
  11.451 +void qnxgf_restorewindow(_THIS, SDL_Window* window)
  11.452 +{
  11.453 +}
  11.454 +
  11.455 +void qnxgf_setwindowgrab(_THIS, SDL_Window* window)
  11.456 +{
  11.457 +}
  11.458 +
  11.459 +void qnxgf_destroywindow(_THIS, SDL_Window* window)
  11.460 +{
  11.461 +   printf("qnxgf_destroywindow()\n");
  11.462 +}
  11.463 +
  11.464 +/*****************************************************************************/
  11.465 +/* SDL Window Manager function                                               */
  11.466 +/*****************************************************************************/
  11.467 +SDL_bool qnxgf_getwindowwminfo(_THIS, SDL_Window* window, struct SDL_SysWMinfo* info)
  11.468 +{
  11.469 +   if (info->version.major <= SDL_MAJOR_VERSION)
  11.470 +   {
  11.471 +      return SDL_TRUE;
  11.472 +   }
  11.473 +   else
  11.474 +   {
  11.475 +      SDL_SetError("Application not compiled with SDL %d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
  11.476 +      return SDL_FALSE;
  11.477 +   }
  11.478 +
  11.479 +   /* Failed to get window manager information */
  11.480 +   return SDL_FALSE;
  11.481 +}
  11.482 +
  11.483 +/*****************************************************************************/
  11.484 +/* SDL OpenGL/OpenGL ES functions                                            */
  11.485 +/*****************************************************************************/
  11.486 +int qnxgf_gl_loadlibrary(_THIS, const char* path)
  11.487 +{
  11.488 +   /* Failed to load new GL library */
  11.489 +   return -1;
  11.490 +}
  11.491 +
  11.492 +void* qnxgf_gl_getprocaddres(_THIS, const char* proc)
  11.493 +{
  11.494 +   /* Failed to get GL function address pointer */
  11.495 +   return NULL;
  11.496 +}
  11.497 +
  11.498 +void qnxgf_gl_unloadlibrary(_THIS)
  11.499 +{
  11.500 +}
  11.501 +
  11.502 +SDL_GLContext qnxgf_gl_createcontext(_THIS, SDL_Window* window)
  11.503 +{
  11.504 +   /* Failed to create GL context */
  11.505 +   return NULL;
  11.506 +}
  11.507 +
  11.508 +int qnxgf_gl_makecurrent(_THIS, SDL_Window* window, SDL_GLContext context)
  11.509 +{
  11.510 +   /* Failed to set current GL context */
  11.511 +   return -1;
  11.512 +}
  11.513 +
  11.514 +int qnxgf_gl_setswapinterval(_THIS, int interval)
  11.515 +{
  11.516 +   /* Failed to set swap interval */
  11.517 +   return -1;
  11.518 +}
  11.519 +
  11.520 +int qnxgf_gl_getswapinterval(_THIS)
  11.521 +{
  11.522 +   /* Failed to get default swap interval */
  11.523 +   return -1;
  11.524 +}
  11.525 +
  11.526 +void qnxgf_gl_swapwindow(_THIS, SDL_Window* window)
  11.527 +{
  11.528 +}
  11.529 +
  11.530 +void qnxgf_gl_deletecontext(_THIS, SDL_GLContext context)
  11.531 +{
  11.532 +}
  11.533 +
  11.534 +/*****************************************************************************/
  11.535 +/* SDL Event handling function                                               */
  11.536 +/*****************************************************************************/
  11.537 +void qnxgf_pumpevents(_THIS)
  11.538 +{
  11.539 +}
  11.540 +
  11.541 +/*****************************************************************************/
  11.542 +/* SDL screen saver related functions                                        */
  11.543 +/*****************************************************************************/
  11.544 +void qnxgf_suspendscreensaver(_THIS)
  11.545 +{
  11.546 +   /* There is no screensaver in pure console, it may exist when running */
  11.547 +   /* GF under Photon, but I do not know, how to disable screensaver     */
  11.548 +}
  11.549 +
  11.550  /* vi: set ts=4 sw=4 expandtab: */
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/src/video/qnxgf/SDL_qnxgf.h	Wed Mar 04 15:10:47 2009 +0000
    12.3 @@ -0,0 +1,91 @@
    12.4 +/*
    12.5 +    SDL - Simple DirectMedia Layer
    12.6 +    Copyright (C) 1997-2009 Sam Lantinga
    12.7 +
    12.8 +    This library is free software; you can redistribute it and/or
    12.9 +    modify it under the terms of the GNU Lesser General Public
   12.10 +    License as published by the Free Software Foundation; either
   12.11 +    version 2.1 of the License, or (at your option) any later version.
   12.12 +
   12.13 +    This library is distributed in the hope that it will be useful,
   12.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12.16 +    Lesser General Public License for more details.
   12.17 +
   12.18 +    You should have received a copy of the GNU Lesser General Public
   12.19 +    License along with this library; if not, write to the Free Software
   12.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   12.21 +
   12.22 +    Sam Lantinga
   12.23 +    slouken@libsdl.org
   12.24 +*/
   12.25 +
   12.26 +#ifndef __SDL_QNXGF_H__
   12.27 +#define __SDL_QNXGF_H__
   12.28 +
   12.29 +#include "../SDL_sysvideo.h"
   12.30 +
   12.31 +#include <gf/gf.h>
   12.32 +
   12.33 +typedef struct SDL_VideoData
   12.34 +{
   12.35 +   gf_dev_t      gfdev;              /* GF device handle                     */
   12.36 +   gf_dev_info_t gfdev_info;         /* GF device information                */
   12.37 +   SDL_bool      gfinitialized;      /* GF device initialization status      */
   12.38 +} SDL_VideoData;
   12.39 +
   12.40 +typedef struct SDL_DisplayData
   12.41 +{
   12.42 +   gf_display_info_t display_info;   /* GF display information               */
   12.43 +   gf_display_t      display;        /* GF display handle                    */
   12.44 +} SDL_DisplayData;
   12.45 +
   12.46 +/****************************************************************************/
   12.47 +/* SDL_VideoDevice functions declaration                                    */
   12.48 +/****************************************************************************/
   12.49 +
   12.50 +/* Display and window functions */
   12.51 +int qnxgf_videoinit(_THIS);
   12.52 +void qnxgf_videoquit(_THIS);
   12.53 +void qnxgf_getdisplaymodes(_THIS);
   12.54 +int qnxgf_setdisplaymode(_THIS, SDL_DisplayMode* mode);
   12.55 +int qnxgf_setdisplaypalette(_THIS, SDL_Palette* palette);
   12.56 +int qnxgf_getdisplaypalette(_THIS, SDL_Palette* palette);
   12.57 +int qnxgf_setdisplaygammaramp(_THIS, Uint16* ramp);
   12.58 +int qnxgf_getdisplaygammaramp(_THIS, Uint16* ramp);
   12.59 +int qnxgf_createwindow(_THIS, SDL_Window* window);
   12.60 +int qnxgf_createwindowfrom(_THIS, SDL_Window* window, const void* data);
   12.61 +void qnxgf_setwindowtitle(_THIS, SDL_Window* window);
   12.62 +void qnxgf_setwindowicon(_THIS, SDL_Window* window, SDL_Surface* icon);
   12.63 +void qnxgf_setwindowposition(_THIS, SDL_Window* window);
   12.64 +void qnxgf_setwindowsize(_THIS, SDL_Window* window);
   12.65 +void qnxgf_showwindow(_THIS, SDL_Window* window);
   12.66 +void qnxgf_hidewindow(_THIS, SDL_Window* window);
   12.67 +void qnxgf_raisewindow(_THIS, SDL_Window* window);
   12.68 +void qnxgf_maximizewindow(_THIS, SDL_Window* window);
   12.69 +void qnxgf_minimizewindow(_THIS, SDL_Window* window);
   12.70 +void qnxgf_restorewindow(_THIS, SDL_Window* window);
   12.71 +void qnxgf_setwindowgrab(_THIS, SDL_Window* window);
   12.72 +void qnxgf_destroywindow(_THIS, SDL_Window* window);
   12.73 +
   12.74 +/* Window manager function */
   12.75 +SDL_bool qnxgf_getwindowwminfo(_THIS, SDL_Window* window, struct SDL_SysWMinfo* info);
   12.76 +
   12.77 +/* OpenGL/OpenGL ES functions */
   12.78 +int qnxgf_gl_loadlibrary(_THIS, const char* path);
   12.79 +void* qnxgf_gl_getprocaddres(_THIS, const char* proc);
   12.80 +void qnxgf_gl_unloadlibrary(_THIS);
   12.81 +SDL_GLContext qnxgf_gl_createcontext(_THIS, SDL_Window* window);
   12.82 +int qnxgf_gl_makecurrent(_THIS, SDL_Window* window, SDL_GLContext context);
   12.83 +int qnxgf_gl_setswapinterval(_THIS, int interval);
   12.84 +int qnxgf_gl_getswapinterval(_THIS);
   12.85 +void qnxgf_gl_swapwindow(_THIS, SDL_Window* window);
   12.86 +void qnxgf_gl_deletecontext(_THIS, SDL_GLContext context);
   12.87 +
   12.88 +/* Event handling function */
   12.89 +void qnxgf_pumpevents(_THIS);
   12.90 +
   12.91 +/* Screen saver related function */
   12.92 +void qnxgf_suspendscreensaver(_THIS);
   12.93 +
   12.94 +#endif /* __SDL_QNXGF_H__ */
    13.1 --- a/test/Makefile.in	Wed Mar 04 09:35:32 2009 +0000
    13.2 +++ b/test/Makefile.in	Wed Mar 04 15:10:47 2009 +0000
    13.3 @@ -7,7 +7,7 @@
    13.4  CFLAGS  = @CFLAGS@
    13.5  LIBS	= @LIBS@
    13.6  
    13.7 -TARGETS = checkkeys$(EXE) graywin$(EXE) loopwave$(EXE) testresample$(EXE) testaudioinfo$(EXE) testmultiaudio$(EXE) testalpha$(EXE) testbitmap$(EXE) testblitspeed$(EXE) testcdrom$(EXE) testcursor$(EXE) testintersections$(EXE) testdraw2$(EXE) testdyngl$(EXE) testerror$(EXE) testfile$(EXE) testgamma$(EXE) testgl$(EXE) testgl2$(EXE) testhread$(EXE) testiconv$(EXE) testjoystick$(EXE) testkeys$(EXE) testlock$(EXE) testoverlay2$(EXE) testoverlay$(EXE) testpalette$(EXE) testplatform$(EXE) testsem$(EXE) testsprite$(EXE) testsprite2$(EXE) testtimer$(EXE) testver$(EXE) testvidinfo$(EXE) testwin$(EXE) testwm$(EXE) testwm2$(EXE) threadwin$(EXE) torturethread$(EXE) testloadso$(EXE) testhaptic$(EXE) testmmousetablet$(EXE)
    13.8 +TARGETS = checkkeys$(EXE) graywin$(EXE) loopwave$(EXE) testresample$(EXE) testaudioinfo$(EXE) testmultiaudio$(EXE) testalpha$(EXE) testbitmap$(EXE) testblitspeed$(EXE) testcdrom$(EXE) testcursor$(EXE) testintersections$(EXE) testdraw2$(EXE) testdyngl$(EXE) testdyngles$(EXE) testerror$(EXE) testfile$(EXE) testgamma$(EXE) testgl$(EXE) testgl2$(EXE) testgles$(EXE) testhread$(EXE) testiconv$(EXE) testjoystick$(EXE) testkeys$(EXE) testlock$(EXE) testoverlay2$(EXE) testoverlay$(EXE) testpalette$(EXE) testplatform$(EXE) testsem$(EXE) testsprite$(EXE) testsprite2$(EXE) testtimer$(EXE) testver$(EXE) testvidinfo$(EXE) testwin$(EXE) testwm$(EXE) testwm2$(EXE) threadwin$(EXE) torturethread$(EXE) testloadso$(EXE) testhaptic$(EXE) testmmousetablet$(EXE)
    13.9  
   13.10  all: Makefile $(TARGETS)
   13.11  
   13.12 @@ -56,6 +56,9 @@
   13.13  testdyngl$(EXE): $(srcdir)/testdyngl.c
   13.14  	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
   13.15  
   13.16 +testdyngles$(EXE): $(srcdir)/testdyngles.c
   13.17 +	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
   13.18 +
   13.19  testerror$(EXE): $(srcdir)/testerror.c
   13.20  	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
   13.21  
   13.22 @@ -71,6 +74,9 @@
   13.23  testgl2$(EXE): $(srcdir)/testgl2.c $(srcdir)/common.c
   13.24  	$(CC) -o $@ $(srcdir)/testgl2.c $(srcdir)/common.c $(CFLAGS) $(LIBS) @GLLIB@ @MATHLIB@
   13.25  
   13.26 +testgles$(EXE): $(srcdir)/testgles.c $(srcdir)/common.c
   13.27 +	$(CC) -o $@ $(srcdir)/testgles.c $(srcdir)/common.c $(CFLAGS) $(LIBS) @GLLIB@ @MATHLIB@
   13.28 +
   13.29  testhread$(EXE): $(srcdir)/testhread.c
   13.30  	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
   13.31  
    14.1 --- a/test/configure.in	Wed Mar 04 09:35:32 2009 +0000
    14.2 +++ b/test/configure.in	Wed Mar 04 15:10:47 2009 +0000
    14.3 @@ -49,7 +49,12 @@
    14.4          else
    14.5              SYS_GL_LIBS="-lOSMesa"
    14.6          fi
    14.7 -		;;
    14.8 +        ;;
    14.9 +    *-*-qnx*)
   14.10 +        EXE=""
   14.11 +        MATHLIB=""
   14.12 +        SYS_GL_LIBS="-lGLES_CM"
   14.13 +        ;;
   14.14      *)
   14.15          EXE=""
   14.16          MATHLIB="-lm"
   14.17 @@ -99,6 +104,30 @@
   14.18  else
   14.19      GLLIB=""
   14.20  fi
   14.21 +
   14.22 +dnl Check for OpenGL ES
   14.23 +AC_MSG_CHECKING(for OpenGL ES support)
   14.24 +have_opengles=no
   14.25 +AC_TRY_COMPILE([
   14.26 + #if defined (__QNXNTO__)
   14.27 +    #include <GLES/gl.h>
   14.28 + #elif defined (__IPHONEOS__)
   14.29 +    #include <OpenGLES/ES1/gl.h>
   14.30 + #else
   14.31 +    #error "No OpenGL ES support"
   14.32 + #endif /* __QNXNTO__ */
   14.33 +],[
   14.34 +],[
   14.35 +have_opengles=yes
   14.36 +])
   14.37 +AC_MSG_RESULT($have_opengles)
   14.38 +if test x$have_opengles = xyes; then
   14.39 +    CFLAGS="$CFLAGS -DHAVE_OPENGLES"
   14.40 +    GLLIB="$XPATH $SYS_GL_LIBS"
   14.41 +else
   14.42 +    GLLIB=""
   14.43 +fi
   14.44 +
   14.45  AC_SUBST(GLLIB)
   14.46  
   14.47  dnl Finally create all the generated files
    15.1 --- a/test/testdyngles.c	Wed Mar 04 09:35:32 2009 +0000
    15.2 +++ b/test/testdyngles.c	Wed Mar 04 15:10:47 2009 +0000
    15.3 @@ -129,7 +129,7 @@
    15.4      }
    15.5  
    15.6      if (SDL_GL_LoadLibrary(gl_library) < 0) {
    15.7 -        printf("Unable to dynamically open GL lib : %s\n", SDL_GetError());
    15.8 +        printf("Unable to dynamically open GL ES lib : %s\n", SDL_GetError());
    15.9          quit(1);
   15.10      }
   15.11  
   15.12 @@ -139,7 +139,7 @@
   15.13      }
   15.14  
   15.15      /* Set the window manager title bar */
   15.16 -    SDL_WM_SetCaption("SDL Dynamic OpenGL Loading Test", "testdyngl");
   15.17 +    SDL_WM_SetCaption("SDL Dynamic OpenGL ES Loading Test", "testdyngles");
   15.18  
   15.19      init_glfuncs(&f);
   15.20  
   15.21 @@ -206,7 +206,7 @@
   15.22  int
   15.23  main(int argc, char *argv[])
   15.24  {
   15.25 -    printf("No OpenGL support on this system\n");
   15.26 +    printf("No OpenGL ES support on this system\n");
   15.27      return 1;
   15.28  }
   15.29