Date: Thu, 12 Mar 2009 15:14:38 +0200
authorSam Lantinga <slouken@libsdl.org>
Tue, 17 Mar 2009 03:24:22 +0000
changeset 3092cad1aefa2ed9
parent 3091 32efcc94b3da
child 3093 375ee92745e8
Date: Thu, 12 Mar 2009 15:14:38 +0200
From: "Mike Gorchak"
Subject: New QNX patches

In photon.tar.gz there are new files to be placed into ./src/video/photon/
directory.

qnx3.diff - new patches for QNX support. Since I've found a lot of bugs in
the new GF QNX Graphics Framework and I'm suspended development for GF
driver until already found bugs will be fixed and switched to Photon driver
implementation.

sdl.diff - I've found that renderer creation result has not been checked and
SDL shows error like: "there is no current renderer", now SDL will show
correct error which was set be renderer.
README.QNX
src/video/SDL_video.c
src/video/photon/SDL_photon.c
src/video/photon/SDL_photon.h
src/video/photon/SDL_photon_render.c
src/video/photon/SDL_photon_render.h
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
     1.1 --- a/README.QNX	Sun Mar 15 15:50:18 2009 +0000
     1.2 +++ b/README.QNX	Tue Mar 17 03:24:22 2009 +0000
     1.3 @@ -1,4 +1,57 @@
     1.4  README.QNX by Mike Gorchak <mike@malva.ua>, <lestat@i.com.ua>
     1.5 -Last changed at 02 Mar 2009.
     1.6 +Last changed at 10 Mar 2009.
     1.7  
     1.8  QNX Photon and GF drivers are under construction. Please be patient.
     1.9 +
    1.10 +---------------------
    1.11 + -- SDL GF driver --
    1.12 +---------------------
    1.13 +
    1.14 +Here is an additional information about SDL GF driver:
    1.15 + * 0. Introduction.
    1.16 + * 1. Environment variables which SDL GF driver supports.
    1.17 + * 2. Custom video modes.
    1.18 + * 3. Limitations.
    1.19 +
    1.20 +0. Introduction.
    1.21 +
    1.22 +   SDL GF driver is a layer between SDL and QNX Graphics Framework (GF). Hardware
    1.23 +accelerated features which SDL could support depends on real hardware capabilities.
    1.24 +
    1.25 +1. Environment variables which GF driver supports.
    1.26 +
    1.27 +   GF driver supports the following environment variables for QNX GF specific
    1.28 +customization options:
    1.29 +   a) SDL_VIDEO_GF_REFRESH_RATE - refresh rate of video output in Hz. Without
    1.30 +      this environment variable declaration SDL controls refresh rate of your
    1.31 +      display. If this enironment variable is set to 0, SDL will control refresh
    1.32 +      rate of display, otherwise value of SDL_VIDEO_GF_REFRESH_RATE is used for
    1.33 +      all screen resolutions as refresh rate. This example will set 60Hz refresh
    1.34 +      rate as refresh rate for all graphics modes:
    1.35 +
    1.36 +      export SDL_VIDEO_GF_REFRESH_RATE=60
    1.37 +
    1.38 +2. Custom video modes.
    1.39 +
    1.40 +   Since most QNX graphics drivers supports GENERIC video modes, i.e. you could
    1.41 +specify any horizontal and vertical resolution and any refresh rate, SDL GF
    1.42 +driver uses its own fullscreen modes list, which could be incomplete. You could
    1.43 +add any custom video mode, which your QNX graphics driver supports by editing
    1.44 +file ./src/video/qnxgf/SDL_qnxgf.c. Custom graphics mode definition looks like
    1.45 +
    1.46 +   {0, 1024, 640, 60, NULL},   /* 1024x640 mode is 60Hz only               */
    1.47 +
    1.48 +You must specify horizontal resolution as second parameter, vertical resolution
    1.49 +as third parameter and refresh rate as fourth parameter. Please leave first and
    1.50 +last parameters as 0 and NULL. Then please send me your changes to e-mail address
    1.51 +which is specified in the header of this document.
    1.52 +
    1.53 +3. Limitations.
    1.54 +
    1.55 +   There are few limitations while using SDL GF driver:
    1.56 +
    1.57 +   a) Since GF driver supports fullscreen modes only, when you are not specifing
    1.58 +SDL_WINDOW_FULLSCREEN flag, an SDL GF driver will try to find the fullscreen
    1.59 +graphics mode which corresponds to SDL window size. Refresh rate will be the
    1.60 +lowest available, if SDL_VIDEO_GF_REFRESH_RATE environment variable is not set.
    1.61 +
     2.1 --- a/src/video/SDL_video.c	Sun Mar 15 15:50:18 2009 +0000
     2.2 +++ b/src/video/SDL_video.c	Tue Mar 17 03:24:22 2009 +0000
     2.3 @@ -664,6 +664,7 @@
     2.4          SDL_SetError("Couldn't find display mode match");
     2.5          return -1;
     2.6      }
     2.7 +
     2.8      if (SDL_memcmp
     2.9          (&fullscreen_mode, &display->fullscreen_mode,
    2.10           sizeof(fullscreen_mode)) == 0) {
    2.11 @@ -1492,6 +1493,13 @@
    2.12      /* Create a new renderer instance */
    2.13      window->renderer = SDL_CurrentDisplay.render_drivers[index]
    2.14          .CreateRenderer(window, flags);
    2.15 +
    2.16 +    if (window->renderer==NULL)
    2.17 +    {
    2.18 +       /* Assuming renderer set its error */
    2.19 +       return -1;
    2.20 +    }
    2.21 +
    2.22      SDL_SelectRenderer(window->id);
    2.23  
    2.24      return 0;
     3.1 --- a/src/video/photon/SDL_photon.c	Sun Mar 15 15:50:18 2009 +0000
     3.2 +++ b/src/video/photon/SDL_photon.c	Tue Mar 17 03:24:22 2009 +0000
     3.3 @@ -18,11 +18,21 @@
     3.4  
     3.5      Sam Lantinga
     3.6      slouken@libsdl.org
     3.7 +
     3.8 +    QNX Photon GUI SDL driver
     3.9 +    Copyright (C) 2009 Mike Gorchak
    3.10 +    (mike@malva.ua, lestat@i.com.ua)
    3.11  */
    3.12  
    3.13  #include "SDL_config.h"
    3.14  
    3.15  #include "../SDL_sysvideo.h"
    3.16 +#include "SDL_version.h"
    3.17 +#include "SDL_syswm.h"
    3.18 +
    3.19 +#include "../SDL_sysvideo.h"
    3.20 +
    3.21 +#include "SDL_photon.h"
    3.22  
    3.23  static SDL_bool photon_initialized=SDL_FALSE;
    3.24  
    3.25 @@ -56,14 +66,301 @@
    3.26  
    3.27  static SDL_VideoDevice* photon_create(int devindex)
    3.28  {
    3.29 +   SDL_VideoDevice* device;
    3.30 +   SDL_VideoData*   phdata;
    3.31 +   int              status;
    3.32 +
    3.33 +   /* Check if photon could be initialized */
    3.34 +   status=photon_available();
    3.35 +   if (status==0)
    3.36 +   {
    3.37 +      /* Photon could not be used */
    3.38 +      return NULL;
    3.39 +   }
    3.40 +
    3.41 +   /* Initialize SDL_VideoDevice structure */
    3.42 +   device=(SDL_VideoDevice*)SDL_calloc(1, sizeof(SDL_VideoDevice));
    3.43 +   if (device==NULL)
    3.44 +   {
    3.45 +      SDL_OutOfMemory();
    3.46 +      return NULL;
    3.47 +   }
    3.48 +
    3.49 +   /* Initialize internal photon specific data */
    3.50 +   phdata=(SDL_VideoData*)SDL_calloc(1, sizeof(SDL_VideoData));
    3.51 +   if (phdata==NULL)
    3.52 +   {
    3.53 +      SDL_OutOfMemory();
    3.54 +      SDL_free(device);
    3.55 +      return NULL;
    3.56 +   }
    3.57 +   device->driverdata=phdata;
    3.58 +
    3.59 +   /* Setup amount of available displays and current display */
    3.60 +   device->num_displays=0;
    3.61 +   device->current_display=0;
    3.62  }
    3.63  
    3.64  VideoBootStrap photon_bootstrap=
    3.65  {
    3.66     "photon",
    3.67 -   "SDL Photon video driver",
    3.68 +   "SDL QNX Photon video driver",
    3.69     photon_available,
    3.70     photon_create
    3.71  };
    3.72  
    3.73 +/*****************************************************************************/
    3.74 +/* SDL Video and Display initialization/handling functions                   */
    3.75 +/*****************************************************************************/
    3.76 +int photon_videoinit(_THIS)
    3.77 +{
    3.78 +   SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
    3.79 +
    3.80 +   /* Check for environment variables which could override some SDL settings */
    3.81 +//   didata->custom_refresh=0;
    3.82 +//   override = SDL_getenv("SDL_VIDEO_PHOTON_REFRESH_RATE");
    3.83 +//   if (override!=NULL)
    3.84 +//   {
    3.85 +//      if (SDL_sscanf(override, "%u", &didata->custom_refresh)!=1)
    3.86 +//      {
    3.87 +//         didata->custom_refresh=0;
    3.88 +//      }
    3.89 +//   }
    3.90 +
    3.91 +   /* Add photon renderer to SDL */
    3.92 +   photon_addrenderdriver(_this);
    3.93 +
    3.94 +   /* video has been initialized successfully */
    3.95 +   return 1;
    3.96 +}
    3.97 +
    3.98 +void photon_videoquit(_THIS)
    3.99 +{
   3.100 +   SDL_DisplayData* didata;
   3.101 +   uint32_t it;
   3.102 +
   3.103 +   /* SDL will restore our desktop mode on exit */
   3.104 +   for(it=0; it<_this->num_displays; it++)
   3.105 +   {
   3.106 +      didata=_this->displays[it].driverdata;
   3.107 +   }
   3.108 +}
   3.109 +
   3.110 +void photon_getdisplaymodes(_THIS)
   3.111 +{
   3.112 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
   3.113 +   SDL_DisplayMode  mode;
   3.114 +
   3.115 +}
   3.116 +
   3.117 +int photon_setdisplaymode(_THIS, SDL_DisplayMode* mode)
   3.118 +{
   3.119 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
   3.120 +
   3.121 +   return 0;
   3.122 +}
   3.123 +
   3.124 +int photon_setdisplaypalette(_THIS, SDL_Palette* palette)
   3.125 +{
   3.126 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
   3.127 +
   3.128 +   /* Setting display palette operation has been failed */
   3.129 +   return -1;
   3.130 +}
   3.131 +
   3.132 +int photon_getdisplaypalette(_THIS, SDL_Palette* palette)
   3.133 +{
   3.134 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
   3.135 +
   3.136 +   /* Getting display palette operation has been failed */
   3.137 +   return -1;
   3.138 +}
   3.139 +
   3.140 +int photon_setdisplaygammaramp(_THIS, Uint16* ramp)
   3.141 +{
   3.142 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
   3.143 +
   3.144 +   /* Setting display gamma ramp operation has been failed */
   3.145 +   return -1;
   3.146 +}
   3.147 +
   3.148 +int photon_getdisplaygammaramp(_THIS, Uint16* ramp)
   3.149 +{
   3.150 +   /* Getting display gamma ramp operation has been failed */
   3.151 +   return -1;
   3.152 +}
   3.153 +
   3.154 +int photon_createwindow(_THIS, SDL_Window* window)
   3.155 +{
   3.156 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
   3.157 +   SDL_WindowData*  wdata;
   3.158 +
   3.159 +   /* Allocate window internal data */
   3.160 +   wdata=(SDL_WindowData*)SDL_calloc(1, sizeof(SDL_WindowData));
   3.161 +   if (wdata==NULL)
   3.162 +   {
   3.163 +      SDL_OutOfMemory();
   3.164 +      return -1;
   3.165 +   }
   3.166 +
   3.167 +   /* Setup driver data for this window */
   3.168 +   window->driverdata=wdata;
   3.169 +
   3.170 +   /* Check if window must support OpenGL ES rendering */
   3.171 +   if ((window->flags & SDL_WINDOW_OPENGL)==SDL_WINDOW_OPENGL)
   3.172 +   {
   3.173 +      /* Mark this window as OpenGL ES compatible */
   3.174 +      wdata->uses_gles=SDL_TRUE;
   3.175 +   }
   3.176 +
   3.177 +   /* Window has been successfully created */
   3.178 +   return 0;
   3.179 +}
   3.180 +
   3.181 +int photon_createwindowfrom(_THIS, SDL_Window* window, const void* data)
   3.182 +{
   3.183 +   /* Failed to create window from another window */
   3.184 +   return -1;
   3.185 +}
   3.186 +
   3.187 +void photon_setwindowtitle(_THIS, SDL_Window* window)
   3.188 +{
   3.189 +}
   3.190 +
   3.191 +void photon_setwindowicon(_THIS, SDL_Window* window, SDL_Surface* icon)
   3.192 +{
   3.193 +}
   3.194 +
   3.195 +void photon_setwindowposition(_THIS, SDL_Window* window)
   3.196 +{
   3.197 +}
   3.198 +
   3.199 +void photon_setwindowsize(_THIS, SDL_Window* window)
   3.200 +{
   3.201 +}
   3.202 +
   3.203 +void photon_showwindow(_THIS, SDL_Window* window)
   3.204 +{
   3.205 +}
   3.206 +
   3.207 +void photon_hidewindow(_THIS, SDL_Window* window)
   3.208 +{
   3.209 +}
   3.210 +
   3.211 +void photon_raisewindow(_THIS, SDL_Window* window)
   3.212 +{
   3.213 +}
   3.214 +
   3.215 +void photon_maximizewindow(_THIS, SDL_Window* window)
   3.216 +{
   3.217 +}
   3.218 +
   3.219 +void photon_minimizewindow(_THIS, SDL_Window* window)
   3.220 +{
   3.221 +}
   3.222 +
   3.223 +void photon_restorewindow(_THIS, SDL_Window* window)
   3.224 +{
   3.225 +}
   3.226 +
   3.227 +void photon_setwindowgrab(_THIS, SDL_Window* window)
   3.228 +{
   3.229 +}
   3.230 +
   3.231 +void photon_destroywindow(_THIS, SDL_Window* window)
   3.232 +{
   3.233 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
   3.234 +   SDL_WindowData*  wdata=(SDL_WindowData*)window->driverdata;
   3.235 +
   3.236 +   if (wdata!=NULL)
   3.237 +   {
   3.238 +   }
   3.239 +}
   3.240 +
   3.241 +/*****************************************************************************/
   3.242 +/* SDL Window Manager function                                               */
   3.243 +/*****************************************************************************/
   3.244 +SDL_bool photon_getwindowwminfo(_THIS, SDL_Window* window, struct SDL_SysWMinfo* info)
   3.245 +{
   3.246 +   if (info->version.major<=SDL_MAJOR_VERSION)
   3.247 +   {
   3.248 +      return SDL_TRUE;
   3.249 +   }
   3.250 +   else
   3.251 +   {
   3.252 +      SDL_SetError("application not compiled with SDL %d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
   3.253 +      return SDL_FALSE;
   3.254 +   }
   3.255 +
   3.256 +   /* Failed to get window manager information */
   3.257 +   return SDL_FALSE;
   3.258 +}
   3.259 +
   3.260 +/*****************************************************************************/
   3.261 +/* SDL OpenGL/OpenGL ES functions                                            */
   3.262 +/*****************************************************************************/
   3.263 +int photon_gl_loadlibrary(_THIS, const char* path)
   3.264 +{
   3.265 +   /* Failed to load new GL library */
   3.266 +   return -1;
   3.267 +}
   3.268 +
   3.269 +void* photon_gl_getprocaddres(_THIS, const char* proc)
   3.270 +{
   3.271 +   /* Failed to get GL function address pointer */
   3.272 +   return NULL;
   3.273 +}
   3.274 +
   3.275 +void photon_gl_unloadlibrary(_THIS)
   3.276 +{
   3.277 +}
   3.278 +
   3.279 +SDL_GLContext photon_gl_createcontext(_THIS, SDL_Window* window)
   3.280 +{
   3.281 +   /* Failed to create GL context */
   3.282 +   return NULL;
   3.283 +}
   3.284 +
   3.285 +int photon_gl_makecurrent(_THIS, SDL_Window* window, SDL_GLContext context)
   3.286 +{
   3.287 +   /* Failed to set current GL context */
   3.288 +   return -1;
   3.289 +}
   3.290 +
   3.291 +int photon_gl_setswapinterval(_THIS, int interval)
   3.292 +{
   3.293 +   /* Failed to set swap interval */
   3.294 +   return -1;
   3.295 +}
   3.296 +
   3.297 +int photon_gl_getswapinterval(_THIS)
   3.298 +{
   3.299 +   /* Failed to get default swap interval */
   3.300 +   return -1;
   3.301 +}
   3.302 +
   3.303 +void photon_gl_swapwindow(_THIS, SDL_Window* window)
   3.304 +{
   3.305 +}
   3.306 +
   3.307 +void photon_gl_deletecontext(_THIS, SDL_GLContext context)
   3.308 +{
   3.309 +}
   3.310 +
   3.311 +/*****************************************************************************/
   3.312 +/* SDL Event handling function                                               */
   3.313 +/*****************************************************************************/
   3.314 +void photon_pumpevents(_THIS)
   3.315 +{
   3.316 +}
   3.317 +
   3.318 +/*****************************************************************************/
   3.319 +/* SDL screen saver related functions                                        */
   3.320 +/*****************************************************************************/
   3.321 +void photon_suspendscreensaver(_THIS)
   3.322 +{
   3.323 +   /* There is no screensaver in pure console, it may exist when running */
   3.324 +   /* GF under Photon, but I do not know, how to disable screensaver     */
   3.325 +}
   3.326 +
   3.327  /* vi: set ts=4 sw=4 expandtab: */
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/video/photon/SDL_photon.h	Tue Mar 17 03:24:22 2009 +0000
     4.3 @@ -0,0 +1,116 @@
     4.4 +/*
     4.5 +    SDL - Simple DirectMedia Layer
     4.6 +    Copyright (C) 1997-2009 Sam Lantinga
     4.7 +
     4.8 +    This library is free software; you can redistribute it and/or
     4.9 +    modify it under the terms of the GNU Lesser General Public
    4.10 +    License as published by the Free Software Foundation; either
    4.11 +    version 2.1 of the License, or (at your option) any later version.
    4.12 +
    4.13 +    This library is distributed in the hope that it will be useful,
    4.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.16 +    Lesser General Public License for more details.
    4.17 +
    4.18 +    You should have received a copy of the GNU Lesser General Public
    4.19 +    License along with this library; if not, write to the Free Software
    4.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    4.21 +
    4.22 +    Sam Lantinga
    4.23 +    slouken@libsdl.org
    4.24 +
    4.25 +    QNX Photon GUI SDL driver
    4.26 +    Copyright (C) 2009 Mike Gorchak
    4.27 +    (mike@malva.ua, lestat@i.com.ua)
    4.28 +*/
    4.29 +
    4.30 +#ifndef __SDL_PHOTON_H__
    4.31 +#define __SDL_PHOTON_H__
    4.32 +
    4.33 +#include "../SDL_sysvideo.h"
    4.34 +
    4.35 +#include <Ph.h>
    4.36 +
    4.37 +typedef struct SDL_VideoData
    4.38 +{
    4.39 +} SDL_VideoData;
    4.40 +
    4.41 +#define SDL_VIDEO_PHOTON_DEVICENAME_MAX 257
    4.42 +
    4.43 +typedef struct SDL_DisplayData
    4.44 +{
    4.45 +   uint32_t          custom_refresh;   /* Custom refresh rate for all modes  */
    4.46 +   SDL_DisplayMode   current_mode;     /* Current video mode                 */
    4.47 +   uint8_t           description[SDL_VIDEO_PHOTON_DEVICENAME_MAX];
    4.48 +                                       /* Device description                 */
    4.49 +   uint32_t          caps;             /* Device capabilities                */
    4.50 +} SDL_DisplayData;
    4.51 +
    4.52 +typedef struct SDL_WindowData
    4.53 +{
    4.54 +   SDL_bool     uses_gles;           /* if true window must support OpenGL ES*/
    4.55 +} SDL_WindowData;
    4.56 +
    4.57 +/****************************************************************************/
    4.58 +/* Low level Photon graphics driver capabilities                            */
    4.59 +/****************************************************************************/
    4.60 +typedef struct Photon_DeviceCaps
    4.61 +{
    4.62 +   uint8_t* name;
    4.63 +   uint32_t caps;
    4.64 +} Photon_DeviceCaps;
    4.65 +
    4.66 +#define SDL_PHOTON_UNACCELERATED         0x00000000
    4.67 +#define SDL_PHOTON_ACCELERATED           0x00000001
    4.68 +
    4.69 +/****************************************************************************/
    4.70 +/* SDL_VideoDevice functions declaration                                    */
    4.71 +/****************************************************************************/
    4.72 +
    4.73 +/* Display and window functions */
    4.74 +int photon_videoinit(_THIS);
    4.75 +void photon_videoquit(_THIS);
    4.76 +void photon_getdisplaymodes(_THIS);
    4.77 +int photon_setdisplaymode(_THIS, SDL_DisplayMode* mode);
    4.78 +int photon_setdisplaypalette(_THIS, SDL_Palette* palette);
    4.79 +int photon_getdisplaypalette(_THIS, SDL_Palette* palette);
    4.80 +int photon_setdisplaygammaramp(_THIS, Uint16* ramp);
    4.81 +int photon_getdisplaygammaramp(_THIS, Uint16* ramp);
    4.82 +int photon_createwindow(_THIS, SDL_Window* window);
    4.83 +int photon_createwindowfrom(_THIS, SDL_Window* window, const void* data);
    4.84 +void photon_setwindowtitle(_THIS, SDL_Window* window);
    4.85 +void photon_setwindowicon(_THIS, SDL_Window* window, SDL_Surface* icon);
    4.86 +void photon_setwindowposition(_THIS, SDL_Window* window);
    4.87 +void photon_setwindowsize(_THIS, SDL_Window* window);
    4.88 +void photon_showwindow(_THIS, SDL_Window* window);
    4.89 +void photon_hidewindow(_THIS, SDL_Window* window);
    4.90 +void photon_raisewindow(_THIS, SDL_Window* window);
    4.91 +void photon_maximizewindow(_THIS, SDL_Window* window);
    4.92 +void photon_minimizewindow(_THIS, SDL_Window* window);
    4.93 +void photon_restorewindow(_THIS, SDL_Window* window);
    4.94 +void photon_setwindowgrab(_THIS, SDL_Window* window);
    4.95 +void photon_destroywindow(_THIS, SDL_Window* window);
    4.96 +
    4.97 +/* Window manager function */
    4.98 +SDL_bool photon_getwindowwminfo(_THIS, SDL_Window* window, struct SDL_SysWMinfo* info);
    4.99 +
   4.100 +/* OpenGL/OpenGL ES functions */
   4.101 +int photon_gl_loadlibrary(_THIS, const char* path);
   4.102 +void* photon_gl_getprocaddres(_THIS, const char* proc);
   4.103 +void photon_gl_unloadlibrary(_THIS);
   4.104 +SDL_GLContext photon_gl_createcontext(_THIS, SDL_Window* window);
   4.105 +int photon_gl_makecurrent(_THIS, SDL_Window* window, SDL_GLContext context);
   4.106 +int photon_gl_setswapinterval(_THIS, int interval);
   4.107 +int photon_gl_getswapinterval(_THIS);
   4.108 +void photon_gl_swapwindow(_THIS, SDL_Window* window);
   4.109 +void photon_gl_deletecontext(_THIS, SDL_GLContext context);
   4.110 +
   4.111 +/* Event handling function */
   4.112 +void photon_pumpevents(_THIS);
   4.113 +
   4.114 +/* Screen saver related function */
   4.115 +void photon_suspendscreensaver(_THIS);
   4.116 +
   4.117 +#endif /* __SDL_PHOTON_H__ */
   4.118 +
   4.119 +/* vi: set ts=4 sw=4 expandtab: */
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/video/photon/SDL_photon_render.c	Tue Mar 17 03:24:22 2009 +0000
     5.3 @@ -0,0 +1,342 @@
     5.4 +/*
     5.5 +    SDL - Simple DirectMedia Layer
     5.6 +    Copyright (C) 1997-2009 Sam Lantinga
     5.7 +
     5.8 +    This library is free software; you can redistribute it and/or
     5.9 +    modify it under the terms of the GNU Lesser General Public
    5.10 +    License as published by the Free Software Foundation; either
    5.11 +    version 2.1 of the License, or (at your option) any later version.
    5.12 +
    5.13 +    This library is distributed in the hope that it will be useful,
    5.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    5.16 +    Lesser General Public License for more details.
    5.17 +
    5.18 +    You should have received a copy of the GNU Lesser General Public
    5.19 +    License along with this library; if not, write to the Free Software
    5.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    5.21 +
    5.22 +    Sam Lantinga
    5.23 +    slouken@libsdl.org
    5.24 +
    5.25 +    QNX Photon GUI SDL driver
    5.26 +    Copyright (C) 2009 Mike Gorchak
    5.27 +    (mike@malva.ua, lestat@i.com.ua)
    5.28 +*/
    5.29 +
    5.30 +#include "SDL_config.h"
    5.31 +
    5.32 +#include "../SDL_pixels_c.h"
    5.33 +#include "../SDL_yuv_sw_c.h"
    5.34 +
    5.35 +#include "SDL_video.h"
    5.36 +
    5.37 +#include "SDL_photon_render.h"
    5.38 +#include "SDL_photon.h"
    5.39 +
    5.40 +static SDL_Renderer* photon_createrenderer(SDL_Window* window, Uint32 flags);
    5.41 +static int photon_displaymodechanged(SDL_Renderer* renderer);
    5.42 +static int photon_activaterenderer(SDL_Renderer* renderer);
    5.43 +static int photon_createtexture(SDL_Renderer* renderer, SDL_Texture* texture);
    5.44 +static int photon_querytexturepixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch);
    5.45 +static int photon_settexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Color* colors, int firstcolor, int ncolors);
    5.46 +static int photon_gettexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, SDL_Color* colors, int firstcolor, int ncolors);
    5.47 +static int photon_settexturecolormod(SDL_Renderer* renderer, SDL_Texture* texture);
    5.48 +static int photon_settexturealphamod(SDL_Renderer* renderer, SDL_Texture* texture);
    5.49 +static int photon_settextureblendmode(SDL_Renderer* renderer, SDL_Texture* texture);
    5.50 +static int photon_settexturescalemode(SDL_Renderer* renderer, SDL_Texture* texture);
    5.51 +static int photon_updatetexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch);
    5.52 +static int photon_locktexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int markDirty, void** pixels, int* pitch);
    5.53 +static void photon_unlocktexture(SDL_Renderer* renderer, SDL_Texture* texture);
    5.54 +static void photon_dirtytexture(SDL_Renderer* renderer, SDL_Texture* texture, int numrects, const SDL_Rect* rects);
    5.55 +static int photon_renderpoint(SDL_Renderer* renderer, int x, int y);
    5.56 +static int photon_renderline(SDL_Renderer* renderer, int x1, int y1, int x2, int y2);
    5.57 +static int photon_renderfill(SDL_Renderer* renderer, const SDL_Rect* rect);
    5.58 +static int photon_rendercopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect);
    5.59 +static void photon_renderpresent(SDL_Renderer* renderer);
    5.60 +static void photon_destroytexture(SDL_Renderer* renderer, SDL_Texture* texture);
    5.61 +static void photon_destroyrenderer(SDL_Renderer* renderer);
    5.62 +
    5.63 +SDL_RenderDriver photon_renderdriver=
    5.64 +{
    5.65 +    photon_createrenderer,
    5.66 +    {
    5.67 +       "photon",
    5.68 +       (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
    5.69 +        SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
    5.70 +        SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
    5.71 +        SDL_RENDERER_ACCELERATED),
    5.72 +       (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
    5.73 +        SDL_TEXTUREMODULATE_ALPHA),
    5.74 +       (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK |
    5.75 +        SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
    5.76 +       (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_SLOW),
    5.77 +       13,
    5.78 +       {
    5.79 +          SDL_PIXELFORMAT_INDEX8,
    5.80 +          SDL_PIXELFORMAT_RGB555,
    5.81 +          SDL_PIXELFORMAT_RGB565,
    5.82 +          SDL_PIXELFORMAT_RGB888,
    5.83 +          SDL_PIXELFORMAT_BGR888,
    5.84 +          SDL_PIXELFORMAT_ARGB8888,
    5.85 +          SDL_PIXELFORMAT_RGBA8888,
    5.86 +          SDL_PIXELFORMAT_ABGR8888,
    5.87 +          SDL_PIXELFORMAT_BGRA8888,
    5.88 +          SDL_PIXELFORMAT_YV12,
    5.89 +          SDL_PIXELFORMAT_YUY2,
    5.90 +          SDL_PIXELFORMAT_UYVY,
    5.91 +          SDL_PIXELFORMAT_YVYU
    5.92 +       },
    5.93 +       0,
    5.94 +       0
    5.95 +    }
    5.96 +};
    5.97 +
    5.98 +static SDL_Renderer* photon_createrenderer(SDL_Window* window, Uint32 flags)
    5.99 +{
   5.100 +   SDL_VideoDisplay* display = SDL_GetDisplayFromWindow(window);
   5.101 +   SDL_DisplayData* didata = (SDL_DisplayData*)display->driverdata;
   5.102 +   SDL_WindowData* wdata = (SDL_WindowData*)window->driverdata;
   5.103 +   SDL_Renderer* renderer = NULL;
   5.104 +   SDL_RenderData* rdata = NULL;
   5.105 +
   5.106 +   /* Allocate new renderer structure */
   5.107 +   renderer=(SDL_Renderer*)SDL_calloc(1, sizeof(SDL_Renderer));
   5.108 +   if (renderer==NULL)
   5.109 +   {
   5.110 +      SDL_OutOfMemory();
   5.111 +      return NULL;
   5.112 +   }
   5.113 +
   5.114 +   /* Allocate renderer data */
   5.115 +   rdata=(SDL_RenderData*)SDL_calloc(1, sizeof(SDL_RenderData));
   5.116 +   if (rdata==NULL)
   5.117 +   {
   5.118 +      SDL_free(renderer);
   5.119 +      SDL_OutOfMemory();
   5.120 +      return NULL;
   5.121 +   }
   5.122 +
   5.123 +   renderer->DisplayModeChanged=photon_displaymodechanged;
   5.124 +   renderer->ActivateRenderer=photon_activaterenderer;
   5.125 +   renderer->CreateTexture=photon_createtexture;
   5.126 +   renderer->QueryTexturePixels=photon_querytexturepixels;
   5.127 +   renderer->SetTexturePalette=photon_settexturepalette;
   5.128 +   renderer->GetTexturePalette=photon_gettexturepalette;
   5.129 +   renderer->SetTextureAlphaMod=photon_settexturealphamod;
   5.130 +   renderer->SetTextureColorMod=photon_settexturecolormod;
   5.131 +   renderer->SetTextureBlendMode=photon_settextureblendmode;
   5.132 +   renderer->SetTextureScaleMode=photon_settexturescalemode;
   5.133 +   renderer->UpdateTexture=photon_updatetexture;
   5.134 +   renderer->LockTexture=photon_locktexture;
   5.135 +   renderer->UnlockTexture=photon_unlocktexture;
   5.136 +   renderer->DirtyTexture=photon_dirtytexture;
   5.137 +   renderer->RenderPoint=photon_renderpoint;
   5.138 +   renderer->RenderLine=photon_renderline;
   5.139 +   renderer->RenderFill=photon_renderfill;
   5.140 +   renderer->RenderCopy=photon_rendercopy;
   5.141 +   renderer->RenderPresent = photon_renderpresent;
   5.142 +   renderer->DestroyTexture = photon_destroytexture;
   5.143 +   renderer->DestroyRenderer = photon_destroyrenderer;
   5.144 +   renderer->info = photon_renderdriver.info;
   5.145 +   renderer->window = window->id;
   5.146 +   renderer->driverdata = rdata;
   5.147 +
   5.148 +   /* Set render acceleration flag in case it is accelerated */
   5.149 +   if ((didata->caps & SDL_PHOTON_ACCELERATED)==SDL_PHOTON_ACCELERATED)
   5.150 +   {
   5.151 +      renderer->info.flags=SDL_RENDERER_ACCELERATED;
   5.152 +   }
   5.153 +   else
   5.154 +   {
   5.155 +      renderer->info.flags&=~(SDL_RENDERER_ACCELERATED);
   5.156 +   }
   5.157 +
   5.158 +   rdata->window=window;
   5.159 +
   5.160 +   /* Check if upper level requested synchronization on vsync signal */
   5.161 +   if ((flags & SDL_RENDERER_PRESENTVSYNC)==SDL_RENDERER_PRESENTVSYNC)
   5.162 +   {
   5.163 +       rdata->enable_vsync=SDL_TRUE;
   5.164 +   }
   5.165 +   else
   5.166 +   {
   5.167 +      rdata->enable_vsync=SDL_FALSE;
   5.168 +   }
   5.169 +
   5.170 +   /* Check what buffer copy/flip scheme is requested */
   5.171 +   rdata->surfaces_count=0;
   5.172 +   if ((flags & SDL_RENDERER_SINGLEBUFFER)==SDL_RENDERER_SINGLEBUFFER)
   5.173 +   {
   5.174 +      if ((flags & SDL_RENDERER_PRESENTDISCARD)==SDL_RENDERER_PRESENTDISCARD)
   5.175 +      {
   5.176 +         renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD;
   5.177 +      }
   5.178 +      else
   5.179 +      {
   5.180 +         renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
   5.181 +      }
   5.182 +      rdata->surfaces_count=1;
   5.183 +      rdata->surface_visible_idx=0;
   5.184 +      rdata->surface_render_idx=0;
   5.185 +   }
   5.186 +   else
   5.187 +   {
   5.188 +      if ((flags & SDL_RENDERER_PRESENTFLIP2)==SDL_RENDERER_PRESENTFLIP2)
   5.189 +      {
   5.190 +         renderer->info.flags|=SDL_RENDERER_PRESENTFLIP2;
   5.191 +         rdata->surfaces_count=2;
   5.192 +         rdata->surface_visible_idx=0;
   5.193 +         rdata->surface_render_idx=1;
   5.194 +      }
   5.195 +      else
   5.196 +      {
   5.197 +         if ((flags & SDL_RENDERER_PRESENTFLIP3)==SDL_RENDERER_PRESENTFLIP3)
   5.198 +         {
   5.199 +            renderer->info.flags|=SDL_RENDERER_PRESENTFLIP3;
   5.200 +            rdata->surfaces_count=3;
   5.201 +            rdata->surface_visible_idx=0;
   5.202 +            rdata->surface_render_idx=1;
   5.203 +         }
   5.204 +         else
   5.205 +         {
   5.206 +            renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
   5.207 +            rdata->surfaces_count=1;
   5.208 +            rdata->surface_visible_idx=0;
   5.209 +            rdata->surface_render_idx=0;
   5.210 +         }
   5.211 +      }
   5.212 +   }
   5.213 +
   5.214 +   return renderer;
   5.215 +}
   5.216 +
   5.217 +void photon_addrenderdriver(_THIS)
   5.218 +{
   5.219 +   uint32_t it;
   5.220 +
   5.221 +   for (it=0; it<_this->num_displays; it++)
   5.222 +   {
   5.223 +      SDL_AddRenderDriver(it, &photon_renderdriver);
   5.224 +   }
   5.225 +}
   5.226 +
   5.227 +/****************************************************************************/
   5.228 +/* SDL render interface                                                     */
   5.229 +/****************************************************************************/
   5.230 +static int photon_displaymodechanged(SDL_Renderer* renderer)
   5.231 +{
   5.232 +   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
   5.233 +
   5.234 +   /* Remove all allocated surfaces, they are no more valid */
   5.235 +
   5.236 +   /* TODO: Add video mode change detection and new parameters detection */
   5.237 +
   5.238 +   return 0;
   5.239 +}
   5.240 +
   5.241 +static int photon_activaterenderer(SDL_Renderer* renderer)
   5.242 +{
   5.243 +   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
   5.244 +   SDL_VideoDisplay* display = SDL_GetDisplayFromWindow(rdata->window);
   5.245 +   SDL_DisplayData* didata = (SDL_DisplayData*)display->driverdata;
   5.246 +
   5.247 +   return 0;
   5.248 +}
   5.249 +
   5.250 +static int photon_createtexture(SDL_Renderer* renderer, SDL_Texture* texture)
   5.251 +{
   5.252 +   SDL_RenderData* renderdata=(SDL_RenderData*)renderer->driverdata;
   5.253 +   SDL_Window* window=SDL_GetWindowFromID(renderer->window);
   5.254 +   SDL_VideoDisplay* display=SDL_GetDisplayFromWindow(window);
   5.255 +   SDL_TextureData* tdata=NULL;
   5.256 +
   5.257 +   /* Allocate texture driver data */
   5.258 +   tdata=(SDL_TextureData*)SDL_calloc(1, sizeof(SDL_TextureData));
   5.259 +   if (tdata==NULL)
   5.260 +   {
   5.261 +      SDL_OutOfMemory();
   5.262 +      return -1;
   5.263 +   }
   5.264 +
   5.265 +   /* Set texture driver data */
   5.266 +   texture->driverdata=tdata;
   5.267 +
   5.268 +}
   5.269 +
   5.270 +static int photon_querytexturepixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch)
   5.271 +{
   5.272 +}
   5.273 +
   5.274 +static int photon_settexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Color* colors, int firstcolor, int ncolors)
   5.275 +{
   5.276 +}
   5.277 +
   5.278 +static int photon_gettexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, SDL_Color* colors, int firstcolor, int ncolors)
   5.279 +{
   5.280 +}
   5.281 +
   5.282 +static int photon_settexturecolormod(SDL_Renderer* renderer, SDL_Texture* texture)
   5.283 +{
   5.284 +}
   5.285 +
   5.286 +static int photon_settexturealphamod(SDL_Renderer* renderer, SDL_Texture* texture)
   5.287 +{
   5.288 +}
   5.289 +
   5.290 +static int photon_settextureblendmode(SDL_Renderer* renderer, SDL_Texture* texture)
   5.291 +{
   5.292 +}
   5.293 +
   5.294 +static int photon_settexturescalemode(SDL_Renderer* renderer, SDL_Texture* texture)
   5.295 +{
   5.296 +}
   5.297 +
   5.298 +static int photon_updatetexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch)
   5.299 +{
   5.300 +}
   5.301 +
   5.302 +static int photon_locktexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int markDirty, void** pixels, int* pitch)
   5.303 +{
   5.304 +}
   5.305 +
   5.306 +static void photon_unlocktexture(SDL_Renderer* renderer, SDL_Texture* texture)
   5.307 +{
   5.308 +}
   5.309 +
   5.310 +static void photon_dirtytexture(SDL_Renderer* renderer, SDL_Texture* texture, int numrects, const SDL_Rect* rects)
   5.311 +{
   5.312 +}
   5.313 +
   5.314 +static int photon_renderpoint(SDL_Renderer* renderer, int x, int y)
   5.315 +{
   5.316 +}
   5.317 +
   5.318 +static int photon_renderline(SDL_Renderer* renderer, int x1, int y1, int x2, int y2)
   5.319 +{
   5.320 +}
   5.321 +
   5.322 +static int photon_renderfill(SDL_Renderer* renderer, const SDL_Rect* rect)
   5.323 +{
   5.324 +}
   5.325 +
   5.326 +static int photon_rendercopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect)
   5.327 +{
   5.328 +}
   5.329 +
   5.330 +static void photon_renderpresent(SDL_Renderer* renderer)
   5.331 +{
   5.332 +}
   5.333 +
   5.334 +static void photon_destroytexture(SDL_Renderer* renderer, SDL_Texture* texture)
   5.335 +{
   5.336 +}
   5.337 +
   5.338 +static void photon_destroyrenderer(SDL_Renderer* renderer)
   5.339 +{
   5.340 +   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
   5.341 +   uint32_t it;
   5.342 +
   5.343 +}
   5.344 +
   5.345 +/* vi: set ts=4 sw=4 expandtab: */
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/video/photon/SDL_photon_render.h	Tue Mar 17 03:24:22 2009 +0000
     6.3 @@ -0,0 +1,53 @@
     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 +    QNX Photon GUI SDL driver
    6.26 +    Copyright (C) 2009 Mike Gorchak
    6.27 +    (mike@malva.ua, lestat@i.com.ua)
    6.28 +*/
    6.29 +
    6.30 +#ifndef __SDL_PHOTON_RENDER_H__
    6.31 +#define __SDL_PHOTON_RENDER_H__
    6.32 +
    6.33 +#include "../SDL_sysvideo.h"
    6.34 +
    6.35 +#include <Ph.h>
    6.36 +
    6.37 +#define SDL_PHOTON_MAX_SURFACES 3
    6.38 +
    6.39 +typedef struct SDL_RenderData
    6.40 +{
    6.41 +   SDL_Window*        window;        /* SDL window type                    */
    6.42 +   SDL_bool           enable_vsync;  /* VSYNC flip synchronization enable  */
    6.43 +   uint32_t           surface_visible_idx; /* Index of visible surface     */
    6.44 +   uint32_t           surface_render_idx;  /* Index of render surface      */
    6.45 +   uint32_t           surfaces_count;      /* Amount of allocated surfaces */
    6.46 +} SDL_RenderData;
    6.47 +
    6.48 +typedef struct SDL_TextureData
    6.49 +{
    6.50 +} SDL_TextureData;
    6.51 +
    6.52 +extern void photon_addrenderdriver(_THIS);
    6.53 +
    6.54 +#endif /* __SDL_PHOTON_RENDER_H__ */
    6.55 +
    6.56 +/* vi: set ts=4 sw=4 expandtab: */
     7.1 --- a/src/video/qnxgf/SDL_gf_pixelfmt.c	Sun Mar 15 15:50:18 2009 +0000
     7.2 +++ b/src/video/qnxgf/SDL_gf_pixelfmt.c	Tue Mar 17 03:24:22 2009 +0000
     7.3 @@ -18,6 +18,10 @@
     7.4  
     7.5      Sam Lantinga
     7.6      slouken@libsdl.org
     7.7 +
     7.8 +    QNX Graphics Framework SDL driver
     7.9 +    Copyright (C) 2009 Mike Gorchak
    7.10 +    (mike@malva.ua, lestat@i.com.ua)
    7.11  */
    7.12  
    7.13  #include "SDL_config.h"
    7.14 @@ -166,3 +170,5 @@
    7.15  
    7.16     return SDL_PIXELFORMAT_UNKNOWN;
    7.17  }
    7.18 +
    7.19 +/* vi: set ts=4 sw=4 expandtab: */
     8.1 --- a/src/video/qnxgf/SDL_gf_pixelfmt.h	Sun Mar 15 15:50:18 2009 +0000
     8.2 +++ b/src/video/qnxgf/SDL_gf_pixelfmt.h	Tue Mar 17 03:24:22 2009 +0000
     8.3 @@ -18,6 +18,10 @@
     8.4  
     8.5      Sam Lantinga
     8.6      slouken@libsdl.org
     8.7 +
     8.8 +    QNX Graphics Framework SDL driver
     8.9 +    Copyright (C) 2009 Mike Gorchak
    8.10 +    (mike@malva.ua, lestat@i.com.ua)
    8.11  */
    8.12  
    8.13  #ifndef __SDL_GF_PIXELFMT_H__
    8.14 @@ -31,3 +35,5 @@
    8.15  uint32_t    qnxgf_gf_to_sdl_pixelformat(gf_format_t pixelfmt);
    8.16  
    8.17  #endif /* __SDL_GF_PIXELFMT_H__ */
    8.18 +
    8.19 +/* vi: set ts=4 sw=4 expandtab: */
     9.1 --- a/src/video/qnxgf/SDL_gf_render.c	Sun Mar 15 15:50:18 2009 +0000
     9.2 +++ b/src/video/qnxgf/SDL_gf_render.c	Tue Mar 17 03:24:22 2009 +0000
     9.3 @@ -18,6 +18,10 @@
     9.4  
     9.5      Sam Lantinga
     9.6      slouken@libsdl.org
     9.7 +
     9.8 +    QNX Graphics Framework SDL driver
     9.9 +    Copyright (C) 2009 Mike Gorchak
    9.10 +    (mike@malva.ua, lestat@i.com.ua)
    9.11  */
    9.12  
    9.13  #include "SDL_config.h"
    9.14 @@ -28,19 +32,39 @@
    9.15  #include "SDL_video.h"
    9.16  
    9.17  #include "SDL_gf_render.h"
    9.18 +#include "SDL_qnxgf.h"
    9.19  
    9.20 -static SDL_Renderer* GF_CreateRenderer(SDL_Window* window, Uint32 flags)
    9.21 +static SDL_Renderer* gf_createrenderer(SDL_Window* window, Uint32 flags);
    9.22 +static int gf_displaymodechanged(SDL_Renderer* renderer);
    9.23 +static int gf_activaterenderer(SDL_Renderer* renderer);
    9.24 +static int gf_createtexture(SDL_Renderer* renderer, SDL_Texture* texture);
    9.25 +static int gf_querytexturepixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch);
    9.26 +static int gf_settexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Color* colors, int firstcolor, int ncolors);
    9.27 +static int gf_gettexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, SDL_Color* colors, int firstcolor, int ncolors);
    9.28 +static int gf_settexturecolormod(SDL_Renderer* renderer, SDL_Texture* texture);
    9.29 +static int gf_settexturealphamod(SDL_Renderer* renderer, SDL_Texture* texture);
    9.30 +static int gf_settextureblendmode(SDL_Renderer* renderer, SDL_Texture* texture);
    9.31 +static int gf_settexturescalemode(SDL_Renderer* renderer, SDL_Texture* texture);
    9.32 +static int gf_updatetexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch);
    9.33 +static int gf_locktexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int markDirty, void** pixels, int* pitch);
    9.34 +static void gf_unlocktexture(SDL_Renderer* renderer, SDL_Texture* texture);
    9.35 +static void gf_dirtytexture(SDL_Renderer* renderer, SDL_Texture* texture, int numrects, const SDL_Rect* rects);
    9.36 +static int gf_renderpoint(SDL_Renderer* renderer, int x, int y);
    9.37 +static int gf_renderline(SDL_Renderer* renderer, int x1, int y1, int x2, int y2);
    9.38 +static int gf_renderfill(SDL_Renderer* renderer, const SDL_Rect* rect);
    9.39 +static int gf_rendercopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect);
    9.40 +static void gf_renderpresent(SDL_Renderer* renderer);
    9.41 +static void gf_destroytexture(SDL_Renderer* renderer, SDL_Texture* texture);
    9.42 +static void gf_destroyrenderer(SDL_Renderer* renderer);
    9.43 +
    9.44 +SDL_RenderDriver gf_renderdriver=
    9.45  {
    9.46 -}
    9.47 -
    9.48 -SDL_RenderDriver GF_RenderDriver=
    9.49 -{
    9.50 -    GF_CreateRenderer,
    9.51 +    gf_createrenderer,
    9.52      {
    9.53         "qnxgf",
    9.54         (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
    9.55          SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
    9.56 -        SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC |
    9.57 +        SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
    9.58          SDL_RENDERER_ACCELERATED),
    9.59         (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
    9.60          SDL_TEXTUREMODULATE_ALPHA),
    9.61 @@ -67,3 +91,301 @@
    9.62         0
    9.63      }
    9.64  };
    9.65 +
    9.66 +static SDL_Renderer* gf_createrenderer(SDL_Window* window, Uint32 flags)
    9.67 +{
    9.68 +   SDL_VideoDisplay* display = SDL_GetDisplayFromWindow(window);
    9.69 +   SDL_DisplayData* didata = (SDL_DisplayData*)display->driverdata;
    9.70 +   SDL_WindowData* wdata = (SDL_WindowData*)window->driverdata;
    9.71 +   SDL_Renderer* renderer = NULL;
    9.72 +   SDL_RenderData* rdata = NULL;
    9.73 +   uint32_t it;
    9.74 +   int32_t  jt;
    9.75 +   int32_t  status;
    9.76 +
    9.77 +   /* Allocate new renderer structure */
    9.78 +   renderer=(SDL_Renderer*)SDL_calloc(1, sizeof(SDL_Renderer));
    9.79 +   if (renderer==NULL)
    9.80 +   {
    9.81 +      SDL_OutOfMemory();
    9.82 +      return NULL;
    9.83 +   }
    9.84 +
    9.85 +   /* Allocate renderer data */
    9.86 +   rdata=(SDL_RenderData*)SDL_calloc(1, sizeof(SDL_RenderData));
    9.87 +   if (rdata==NULL)
    9.88 +   {
    9.89 +      SDL_free(renderer);
    9.90 +      SDL_OutOfMemory();
    9.91 +      return NULL;
    9.92 +   }
    9.93 +
    9.94 +   renderer->DisplayModeChanged=gf_displaymodechanged;
    9.95 +   renderer->ActivateRenderer=gf_activaterenderer;
    9.96 +   renderer->CreateTexture=gf_createtexture;
    9.97 +   renderer->QueryTexturePixels=gf_querytexturepixels;
    9.98 +   renderer->SetTexturePalette=gf_settexturepalette;
    9.99 +   renderer->GetTexturePalette=gf_gettexturepalette;
   9.100 +   renderer->SetTextureAlphaMod=gf_settexturealphamod;
   9.101 +   renderer->SetTextureColorMod=gf_settexturecolormod;
   9.102 +   renderer->SetTextureBlendMode=gf_settextureblendmode;
   9.103 +   renderer->SetTextureScaleMode=gf_settexturescalemode;
   9.104 +   renderer->UpdateTexture=gf_updatetexture;
   9.105 +   renderer->LockTexture=gf_locktexture;
   9.106 +   renderer->UnlockTexture=gf_unlocktexture;
   9.107 +   renderer->DirtyTexture=gf_dirtytexture;
   9.108 +   renderer->RenderPoint=gf_renderpoint;
   9.109 +   renderer->RenderLine=gf_renderline;
   9.110 +   renderer->RenderFill=gf_renderfill;
   9.111 +   renderer->RenderCopy=gf_rendercopy;
   9.112 +   renderer->RenderPresent = gf_renderpresent;
   9.113 +   renderer->DestroyTexture = gf_destroytexture;
   9.114 +   renderer->DestroyRenderer = gf_destroyrenderer;
   9.115 +   renderer->info = gf_renderdriver.info;
   9.116 +   renderer->window = window->id;
   9.117 +   renderer->driverdata = rdata;
   9.118 +
   9.119 +   /* Set render acceleration flag in case it is accelerated */
   9.120 +   if ((didata->caps & SDL_GF_ACCELERATED)==SDL_GF_ACCELERATED)
   9.121 +   {
   9.122 +      renderer->info.flags=SDL_RENDERER_ACCELERATED;
   9.123 +   }
   9.124 +   else
   9.125 +   {
   9.126 +      renderer->info.flags&=~(SDL_RENDERER_ACCELERATED);
   9.127 +   }
   9.128 +
   9.129 +   rdata->window=window;
   9.130 +
   9.131 +   /* Check if upper level requested synchronization on vsync signal */
   9.132 +   if ((flags & SDL_RENDERER_PRESENTVSYNC)==SDL_RENDERER_PRESENTVSYNC)
   9.133 +   {
   9.134 +       rdata->enable_vsync=SDL_TRUE;
   9.135 +   }
   9.136 +   else
   9.137 +   {
   9.138 +      rdata->enable_vsync=SDL_FALSE;
   9.139 +   }
   9.140 +
   9.141 +   /* Check what buffer copy/flip scheme is requested */
   9.142 +   rdata->surfaces_count=0;
   9.143 +   if ((flags & SDL_RENDERER_SINGLEBUFFER)==SDL_RENDERER_SINGLEBUFFER)
   9.144 +   {
   9.145 +      if ((flags & SDL_RENDERER_PRESENTDISCARD)==SDL_RENDERER_PRESENTDISCARD)
   9.146 +      {
   9.147 +         renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD;
   9.148 +      }
   9.149 +      else
   9.150 +      {
   9.151 +         renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
   9.152 +      }
   9.153 +      rdata->surfaces_count=1;
   9.154 +      rdata->surface_visible_idx=0;
   9.155 +      rdata->surface_render_idx=0;
   9.156 +   }
   9.157 +   else
   9.158 +   {
   9.159 +      if ((flags & SDL_RENDERER_PRESENTFLIP2)==SDL_RENDERER_PRESENTFLIP2)
   9.160 +      {
   9.161 +         renderer->info.flags|=SDL_RENDERER_PRESENTFLIP2;
   9.162 +         rdata->surfaces_count=2;
   9.163 +         rdata->surface_visible_idx=0;
   9.164 +         rdata->surface_render_idx=1;
   9.165 +      }
   9.166 +      else
   9.167 +      {
   9.168 +         if ((flags & SDL_RENDERER_PRESENTFLIP3)==SDL_RENDERER_PRESENTFLIP3)
   9.169 +         {
   9.170 +            renderer->info.flags|=SDL_RENDERER_PRESENTFLIP3;
   9.171 +            rdata->surfaces_count=3;
   9.172 +            rdata->surface_visible_idx=0;
   9.173 +            rdata->surface_render_idx=1;
   9.174 +         }
   9.175 +         else
   9.176 +         {
   9.177 +            renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
   9.178 +            rdata->surfaces_count=1;
   9.179 +            rdata->surface_visible_idx=0;
   9.180 +            rdata->surface_render_idx=0;
   9.181 +         }
   9.182 +      }
   9.183 +   }
   9.184 +
   9.185 +   /* Create layer surfaces, which could be visible */
   9.186 +   for (it=0; it<rdata->surfaces_count; it++)
   9.187 +   {
   9.188 +      /* TODO: add palette creation */
   9.189 +      /*       do not waste surfaces when using GL ES */
   9.190 +
   9.191 +      /* Create displayable surfaces */
   9.192 +      status=gf_surface_create_layer(&rdata->surface[it], &didata->layer, 1, 0,
   9.193 +             didata->current_mode.w, didata->current_mode.h,
   9.194 +             qnxgf_sdl_to_gf_pixelformat(didata->current_mode.format), NULL, 
   9.195 +             GF_SURFACE_CREATE_2D_ACCESSIBLE);
   9.196 +
   9.197 +      if (status!=GF_ERR_OK)
   9.198 +      {
   9.199 +         /* Free already allocated surfaces */
   9.200 +         for (jt=it-1; jt>0; jt--)
   9.201 +         {
   9.202 +            gf_surface_free(rdata->surface[jt]);
   9.203 +         }
   9.204 +         SDL_free(rdata);
   9.205 +         SDL_free(renderer);
   9.206 +         if (status==GF_ERR_MEM)
   9.207 +         {
   9.208 +            SDL_SetError("unsufficient free video memory");
   9.209 +         }
   9.210 +         else
   9.211 +         {
   9.212 +            SDL_SetError("error during displayable surface creation");
   9.213 +         }
   9.214 +         return NULL;
   9.215 +      }
   9.216 +
   9.217 +      /* Get detailed information about allocated surface */
   9.218 +      gf_surface_get_info(rdata->surface[it], &rdata->surface_info[it]);
   9.219 +   }
   9.220 +
   9.221 +   return renderer;
   9.222 +}
   9.223 +
   9.224 +void gf_addrenderdriver(_THIS)
   9.225 +{
   9.226 +   uint32_t it;
   9.227 +
   9.228 +   for (it=0; it<_this->num_displays; it++)
   9.229 +   {
   9.230 +      SDL_AddRenderDriver(it, &gf_renderdriver);
   9.231 +   }
   9.232 +}
   9.233 +
   9.234 +/****************************************************************************/
   9.235 +/* SDL render interface                                                     */
   9.236 +/****************************************************************************/
   9.237 +static int gf_displaymodechanged(SDL_Renderer* renderer)
   9.238 +{
   9.239 +   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
   9.240 +
   9.241 +   /* Remove all allocated surfaces, they are no more valid */
   9.242 +
   9.243 +   /* TODO: Add video mode change detection and new parameters detection */
   9.244 +
   9.245 +   return 0;
   9.246 +}
   9.247 +
   9.248 +static int gf_activaterenderer(SDL_Renderer* renderer)
   9.249 +{
   9.250 +   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
   9.251 +   SDL_VideoDisplay* display = SDL_GetDisplayFromWindow(rdata->window);
   9.252 +   SDL_DisplayData* didata = (SDL_DisplayData*)display->driverdata;
   9.253 +
   9.254 +   /* Setup current surface as visible */
   9.255 +   gf_layer_set_surfaces(didata->layer, &rdata->surface[rdata->surface_visible_idx], 1);
   9.256 +
   9.257 +   /* Set visible surface when hardware in idle state */
   9.258 +   gf_layer_update(didata->layer, GF_LAYER_UPDATE_NO_WAIT_IDLE);
   9.259 +
   9.260 +   return 0;
   9.261 +}
   9.262 +
   9.263 +static int gf_createtexture(SDL_Renderer* renderer, SDL_Texture* texture)
   9.264 +{
   9.265 +   SDL_RenderData* renderdata=(SDL_RenderData*)renderer->driverdata;
   9.266 +   SDL_Window* window=SDL_GetWindowFromID(renderer->window);
   9.267 +   SDL_VideoDisplay* display=SDL_GetDisplayFromWindow(window);
   9.268 +   SDL_TextureData* tdata=NULL;
   9.269 +
   9.270 +   /* Allocate texture driver data */
   9.271 +   tdata=(SDL_TextureData*)SDL_calloc(1, sizeof(SDL_TextureData));
   9.272 +   if (tdata==NULL)
   9.273 +   {
   9.274 +      SDL_OutOfMemory();
   9.275 +      return -1;
   9.276 +   }
   9.277 +
   9.278 +   /* Set texture driver data */
   9.279 +   texture->driverdata=tdata;
   9.280 +
   9.281 +}
   9.282 +
   9.283 +static int gf_querytexturepixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch)
   9.284 +{
   9.285 +}
   9.286 +
   9.287 +static int gf_settexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Color* colors, int firstcolor, int ncolors)
   9.288 +{
   9.289 +}
   9.290 +
   9.291 +static int gf_gettexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, SDL_Color* colors, int firstcolor, int ncolors)
   9.292 +{
   9.293 +}
   9.294 +
   9.295 +static int gf_settexturecolormod(SDL_Renderer* renderer, SDL_Texture* texture)
   9.296 +{
   9.297 +}
   9.298 +
   9.299 +static int gf_settexturealphamod(SDL_Renderer* renderer, SDL_Texture* texture)
   9.300 +{
   9.301 +}
   9.302 +
   9.303 +static int gf_settextureblendmode(SDL_Renderer* renderer, SDL_Texture* texture)
   9.304 +{
   9.305 +}
   9.306 +
   9.307 +static int gf_settexturescalemode(SDL_Renderer* renderer, SDL_Texture* texture)
   9.308 +{
   9.309 +}
   9.310 +
   9.311 +static int gf_updatetexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch)
   9.312 +{
   9.313 +}
   9.314 +
   9.315 +static int gf_locktexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int markDirty, void** pixels, int* pitch)
   9.316 +{
   9.317 +}
   9.318 +
   9.319 +static void gf_unlocktexture(SDL_Renderer* renderer, SDL_Texture* texture)
   9.320 +{
   9.321 +}
   9.322 +
   9.323 +static void gf_dirtytexture(SDL_Renderer* renderer, SDL_Texture* texture, int numrects, const SDL_Rect* rects)
   9.324 +{
   9.325 +}
   9.326 +
   9.327 +static int gf_renderpoint(SDL_Renderer* renderer, int x, int y)
   9.328 +{
   9.329 +}
   9.330 +
   9.331 +static int gf_renderline(SDL_Renderer* renderer, int x1, int y1, int x2, int y2)
   9.332 +{
   9.333 +}
   9.334 +
   9.335 +static int gf_renderfill(SDL_Renderer* renderer, const SDL_Rect* rect)
   9.336 +{
   9.337 +}
   9.338 +
   9.339 +static int gf_rendercopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect)
   9.340 +{
   9.341 +}
   9.342 +
   9.343 +static void gf_renderpresent(SDL_Renderer* renderer)
   9.344 +{
   9.345 +}
   9.346 +
   9.347 +static void gf_destroytexture(SDL_Renderer* renderer, SDL_Texture* texture)
   9.348 +{
   9.349 +}
   9.350 +
   9.351 +static void gf_destroyrenderer(SDL_Renderer* renderer)
   9.352 +{
   9.353 +   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
   9.354 +   uint32_t it;
   9.355 +
   9.356 +   for (it=0; it<rdata->surfaces_count; it++)
   9.357 +   {
   9.358 +      gf_surface_free(rdata->surface[it]);
   9.359 +   }
   9.360 +}
   9.361 +
   9.362 +/* vi: set ts=4 sw=4 expandtab: */
    10.1 --- a/src/video/qnxgf/SDL_gf_render.h	Sun Mar 15 15:50:18 2009 +0000
    10.2 +++ b/src/video/qnxgf/SDL_gf_render.h	Tue Mar 17 03:24:22 2009 +0000
    10.3 @@ -18,6 +18,10 @@
    10.4  
    10.5      Sam Lantinga
    10.6      slouken@libsdl.org
    10.7 +
    10.8 +    QNX Graphics Framework SDL driver
    10.9 +    Copyright (C) 2009 Mike Gorchak
   10.10 +    (mike@malva.ua, lestat@i.com.ua)
   10.11  */
   10.12  
   10.13  #ifndef __SDL_GF_RENDER_H__
   10.14 @@ -27,4 +31,27 @@
   10.15  
   10.16  #include <gf/gf.h>
   10.17  
   10.18 +#define SDL_GF_MAX_SURFACES 3
   10.19 +
   10.20 +typedef struct SDL_RenderData
   10.21 +{
   10.22 +   SDL_Window*        window;        /* SDL window type                    */
   10.23 +   SDL_bool           enable_vsync;  /* VSYNC flip synchronization enable  */
   10.24 +   gf_surface_t       surface[SDL_GF_MAX_SURFACES]; /* Surface handles     */
   10.25 +   gf_surface_info_t  surface_info[SDL_GF_MAX_SURFACES]; /* Surface info   */
   10.26 +   uint32_t           surface_visible_idx; /* Index of visible surface     */
   10.27 +   uint32_t           surface_render_idx;  /* Index of render surface      */
   10.28 +   uint32_t           surfaces_count;      /* Amount of allocated surfaces */
   10.29 +} SDL_RenderData;
   10.30 +
   10.31 +typedef struct SDL_TextureData
   10.32 +{
   10.33 +   gf_surface_t       surface;
   10.34 +   gf_surface_info_t  surface_info;
   10.35 +} SDL_TextureData;
   10.36 +
   10.37 +extern void gf_addrenderdriver(_THIS);
   10.38 +
   10.39  #endif /* __SDL_GF_RENDER_H__ */
   10.40 +
   10.41 +/* vi: set ts=4 sw=4 expandtab: */
    11.1 --- a/src/video/qnxgf/SDL_qnxgf.c	Sun Mar 15 15:50:18 2009 +0000
    11.2 +++ b/src/video/qnxgf/SDL_qnxgf.c	Tue Mar 17 03:24:22 2009 +0000
    11.3 @@ -18,6 +18,10 @@
    11.4  
    11.5      Sam Lantinga
    11.6      slouken@libsdl.org
    11.7 +
    11.8 +    QNX Graphics Framework SDL driver
    11.9 +    Copyright (C) 2009 Mike Gorchak
   11.10 +    (mike@malva.ua, lestat@i.com.ua)
   11.11  */
   11.12  
   11.13  #include "SDL_config.h"
   11.14 @@ -30,6 +34,7 @@
   11.15  #include <gf/gf.h>
   11.16  
   11.17  #include "SDL_qnxgf.h"
   11.18 +#include "SDL_gf_render.h"
   11.19  #include "SDL_gf_pixelfmt.h"
   11.20  
   11.21  /******************************************************************************/
   11.22 @@ -62,7 +67,10 @@
   11.23     {0, 1280, 768, 60, NULL},   /* 1280x768 mode is 60Hz only               */
   11.24     {0, 1280, 800, 60, NULL},   /* 1280x800 mode is 60Hz only               */
   11.25     {0, 1280, 960, 60, NULL},   /* 1280x960 mode is 60Hz only               */
   11.26 -   {0, 1280, 1024, 60, NULL},  /* 1280x1024 mode is 60Hz only              */
   11.27 +   {0, 1280, 1024, 60, NULL},  /* 1280x1024 modes are 60Hz, 75Hz, 85Hz and */
   11.28 +   {0, 1280, 1024, 75, NULL},  /* 100 Hz                                   */
   11.29 +   {0, 1280, 1024, 85, NULL},  /*                                          */
   11.30 +   {0, 1280, 1024, 100, NULL}, /*                                          */
   11.31     {0, 1400, 1050, 60, NULL},  /* 1400x1050 mode is 60Hz only              */
   11.32     {0, 1440, 900, 60, NULL},   /* 1440x900 mode is 60Hz only               */
   11.33     {0, 1440, 960, 60, NULL},   /* 1440x960 mode is 60Hz only               */
   11.34 @@ -75,6 +83,69 @@
   11.35     {0,    0,    0,  0, NULL}   /* End of generic mode list                 */
   11.36  };
   11.37  
   11.38 +/* Low level device graphics driver names, which they are reporting */
   11.39 +GF_DeviceCaps gf_devicename[]=
   11.40 +{
   11.41 +   /* ATI Rage 128 graphics driver (devg-ati_rage128)      */
   11.42 +   {"ati_rage128", SDL_GF_ACCELERATED},
   11.43 +   /* Fujitsu Carmine graphics driver (devg-carmine.so)    */
   11.44 +   {"carmine", SDL_GF_ACCELERATED},
   11.45 +   /* C&T graphics driver (devg-chips.so)                  */
   11.46 +   {"chips", SDL_GF_ACCELERATED},
   11.47 +   /* Fujitsu Coral graphics driver (devg-coral.so)        */
   11.48 +   {"coral", SDL_GF_ACCELERATED},
   11.49 +   /* Intel integrated graphics driver (devg-extreme2.so)  */
   11.50 +   {"extreme2", SDL_GF_ACCELERATED},
   11.51 +   /* Unaccelerated FB driver (devg-flat.so)               */
   11.52 +   {"flat", SDL_GF_UNACCELERATED},
   11.53 +   /* NS Geode graphics driver (devg-geode.so)             */
   11.54 +   {"geode", SDL_GF_ACCELERATED},
   11.55 +   /* Geode LX graphics driver (devg-geodelx.so)           */
   11.56 +   {"geodelx", SDL_GF_ACCELERATED},
   11.57 +   /* Intel integrated graphics driver (devg-gma9xx.so)    */
   11.58 +   {"gma", SDL_GF_ACCELERATED},
   11.59 +   /* Intel integrated graphics driver (devg-i810.so)      */
   11.60 +   {"i810", SDL_GF_ACCELERATED},
   11.61 +   /* Intel integrated graphics driver (devg-i830.so)      */
   11.62 +   {"i830", SDL_GF_ACCELERATED},
   11.63 +   /* Geode LX graphics driver (devg-lx800.so)             */
   11.64 +   {"lx800", SDL_GF_ACCELERATED},
   11.65 +   /* Matrox Gxx graphics driver (devg-matroxg.so)         */
   11.66 +   {"matroxg", SDL_GF_ACCELERATED},
   11.67 +   /* Intel Poulsbo graphics driver (devg-poulsbo.so)      */
   11.68 +   {"poulsbo", SDL_GF_ACCELERATED},
   11.69 +   /* ATI Radeon driver (devg-radeon.so)                   */
   11.70 +   {"radeon", SDL_GF_ACCELERATED},
   11.71 +   /* ATI Rage driver (devg-rage.so)                       */
   11.72 +   {"rage", SDL_GF_ACCELERATED},
   11.73 +   /* S3 Savage graphics driver (devg-s3_savage.so)        */
   11.74 +   {"s3_savage", SDL_GF_ACCELERATED},
   11.75 +   /* SiS630 integrated graphics driver (devg-sis630.so)   */
   11.76 +   {"sis630", SDL_GF_ACCELERATED},
   11.77 +   /* PowerVR SGX 535 graphics driver (devg-poulsbo.so)    */
   11.78 +   {"sgx", SDL_GF_ACCELERATED},
   11.79 +   /* SM Voyager GX graphics driver (devg-smi5xx.so)       */
   11.80 +   {"smi5xx", SDL_GF_ACCELERATED},
   11.81 +   /* Silicon Motion graphics driver (devg-smi7xx.so)      */
   11.82 +   {"smi7xx", SDL_GF_ACCELERATED},
   11.83 +   /* SVGA unaccelerated gfx driver (devg-svga.so)         */
   11.84 +   {"svga", SDL_GF_UNACCELERATED},
   11.85 +   /* nVidia TNT graphics driver (devg-tnt.so)             */
   11.86 +   {"tnt", SDL_GF_ACCELERATED},
   11.87 +   /* VIA integrated graphics driver (devg-tvia.so)        */
   11.88 +   {"tvia", SDL_GF_ACCELERATED},
   11.89 +   /* VIA UniChrome graphics driver (devg-unichrome.so)    */
   11.90 +   {"unichrome", SDL_GF_ACCELERATED},
   11.91 +   /* VESA unaccelerated gfx driver (devg-vesa.so)         */
   11.92 +   {"vesa", SDL_GF_UNACCELERATED},
   11.93 +   /* VmWare graphics driver (devg-volari.so)              */
   11.94 +   {"vmware", SDL_GF_ACCELERATED},
   11.95 +   /* XGI XP10 graphics driver (devg-volari.so)            */
   11.96 +   {"volari", SDL_GF_ACCELERATED},
   11.97 +   /* End of list */
   11.98 +   {NULL, 0x00000000}
   11.99 +};
  11.100 +
  11.101  /*****************************************************************************/
  11.102  /* SDL Video Device initialization functions                                 */
  11.103  /*****************************************************************************/
  11.104 @@ -110,10 +181,8 @@
  11.105  
  11.106     if (device->driverdata!=NULL)
  11.107     {
  11.108 -      SDL_free(device->driverdata);
  11.109        device->driverdata=NULL;
  11.110     }
  11.111 -   SDL_free(device);
  11.112  }
  11.113  
  11.114  static SDL_VideoDevice* qnxgf_create(int devindex)
  11.115 @@ -123,7 +192,7 @@
  11.116     int              status;
  11.117  
  11.118     /* Initialize SDL_VideoDevice structure */
  11.119 -   device = (SDL_VideoDevice*)SDL_calloc(1, sizeof(SDL_VideoDevice));
  11.120 +   device=(SDL_VideoDevice*)SDL_calloc(1, sizeof(SDL_VideoDevice));
  11.121     if (device==NULL)
  11.122     {
  11.123        SDL_OutOfMemory();
  11.124 @@ -131,7 +200,7 @@
  11.125     }
  11.126  
  11.127     /* Initialize internal GF specific data */
  11.128 -   gfdata = (SDL_VideoData*)SDL_calloc(1, sizeof(SDL_VideoData));
  11.129 +   gfdata=(SDL_VideoData*)SDL_calloc(1, sizeof(SDL_VideoData));
  11.130     if (gfdata==NULL)
  11.131     {
  11.132        SDL_OutOfMemory();
  11.133 @@ -212,6 +281,8 @@
  11.134  {
  11.135     SDL_VideoData* gfdata=(SDL_VideoData*)_this->driverdata;
  11.136     uint32_t it;
  11.137 +   uint32_t jt;
  11.138 +   char* override;
  11.139  
  11.140     /* Add each detected output to SDL */
  11.141     for (it=0; it<gfdata->gfdev_info.ndisplays; it++)
  11.142 @@ -243,7 +314,7 @@
  11.143        {
  11.144           /* video initialization problem */
  11.145           SDL_free(didata);
  11.146 -         SDL_SetError("Display query failed");
  11.147 +         SDL_SetError("display query failed");
  11.148           return -1;
  11.149        }
  11.150  
  11.151 @@ -253,17 +324,69 @@
  11.152        {
  11.153           /* video initialization problem */
  11.154           SDL_free(didata);
  11.155 -         SDL_SetError("Couldn't not attach to display");
  11.156 +         SDL_SetError("couldn't attach to display");
  11.157           return -1;
  11.158        }
  11.159  
  11.160 +      /* Initialize status variables */
  11.161 +      didata->layer_attached=SDL_FALSE;
  11.162 +
  11.163 +      /* Attach to main display layer */
  11.164 +      status=gf_layer_attach(&didata->layer, didata->display, didata->display_info.main_layer_index, 0);
  11.165 +      if (status!=GF_ERR_OK)
  11.166 +      {
  11.167 +         SDL_SetError("couldn't attach to main layer, it could be busy");
  11.168 +
  11.169 +         /* Failed to attach to main layer */
  11.170 +         return -1;
  11.171 +      }
  11.172 +
  11.173 +      /* Enable layer in case if hardware supports layer enable/disable */
  11.174 +      gf_layer_enable(didata->layer);
  11.175 +
  11.176 +      /* Mark main display layer is attached */
  11.177 +      didata->layer_attached=SDL_TRUE;
  11.178 +
  11.179 +      /* Copy device name for each display */
  11.180 +      SDL_strlcpy(didata->description, gfdata->gfdev_info.description, SDL_VIDEO_GF_DEVICENAME_MAX-1);
  11.181 +
  11.182 +      /* Search device capabilities and possible workarounds */
  11.183 +      jt=0;
  11.184 +      do {
  11.185 +         if (gf_devicename[jt].name==NULL)
  11.186 +         {
  11.187 +            break;
  11.188 +         }
  11.189 +         if (SDL_strncmp(gf_devicename[jt].name, didata->description, SDL_strlen(gf_devicename[jt].name))==0)
  11.190 +         {
  11.191 +            didata->caps=gf_devicename[jt].caps;
  11.192 +         }
  11.193 +         jt++;
  11.194 +      } while(1);
  11.195 +
  11.196 +      /* Initialize display structure */
  11.197        SDL_zero(display);
  11.198        display.desktop_mode = current_mode;
  11.199        display.current_mode = current_mode;
  11.200        display.driverdata = didata;
  11.201 +      didata->current_mode=current_mode;
  11.202        SDL_AddVideoDisplay(&display);
  11.203 +
  11.204 +      /* Check for environment variables which could override some SDL settings */
  11.205 +      didata->custom_refresh=0;
  11.206 +      override = SDL_getenv("SDL_VIDEO_GF_REFRESH_RATE");
  11.207 +      if (override!=NULL)
  11.208 +      {
  11.209 +         if (SDL_sscanf(override, "%u", &didata->custom_refresh)!=1)
  11.210 +         {
  11.211 +            didata->custom_refresh=0;
  11.212 +         }
  11.213 +      }
  11.214     }
  11.215  
  11.216 +   /* Add GF renderer to SDL */
  11.217 +   gf_addrenderdriver(_this);
  11.218 +
  11.219     /* video has been initialized successfully */
  11.220     return 1;
  11.221  }
  11.222 @@ -273,6 +396,7 @@
  11.223     SDL_DisplayData* didata;
  11.224     uint32_t it;
  11.225  
  11.226 +   /* SDL will restore our desktop mode on exit */
  11.227     for(it=0; it<_this->num_displays; it++)
  11.228     {
  11.229        didata=_this->displays[it].driverdata;
  11.230 @@ -284,7 +408,7 @@
  11.231  
  11.232  void qnxgf_getdisplaymodes(_THIS)
  11.233  {
  11.234 -   SDL_DisplayData* didata = (SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.235 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.236     SDL_DisplayMode  mode;
  11.237     gf_modeinfo_t    modeinfo;
  11.238     uint32_t it=0;
  11.239 @@ -358,25 +482,155 @@
  11.240  
  11.241  int qnxgf_setdisplaymode(_THIS, SDL_DisplayMode* mode)
  11.242  {
  11.243 -   SDL_DisplayData* didata = (SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.244 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.245 +   uint32_t refresh_rate=0;
  11.246     int result;
  11.247  
  11.248 -   result=gf_display_set_mode(didata->display, mode->w, mode->h, mode->refresh_rate,
  11.249 +   /* Current display dimensions and bpp are no more valid */
  11.250 +   didata->current_mode.format=SDL_PIXELFORMAT_UNKNOWN;
  11.251 +   didata->current_mode.w=0;
  11.252 +   didata->current_mode.h=0;
  11.253 +
  11.254 +   /* Check if custom refresh rate requested */
  11.255 +   if (didata->custom_refresh!=0)
  11.256 +   {
  11.257 +      refresh_rate=didata->custom_refresh;
  11.258 +   }
  11.259 +   else
  11.260 +   {
  11.261 +      refresh_rate=mode->refresh_rate;
  11.262 +   }
  11.263 +
  11.264 +   /* Check if SDL GF driver needs to find appropriate refresh rate itself */
  11.265 +   if (refresh_rate==0)
  11.266 +   {
  11.267 +      uint32_t it;
  11.268 +      SDL_DisplayMode tempmode;
  11.269 +
  11.270 +      /* Clear display mode structure */
  11.271 +      SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode));
  11.272 +      tempmode.refresh_rate=0x0000FFFF;
  11.273 +
  11.274 +      /* Check if window width and height matches one of our modes */
  11.275 +      for (it=0; it<SDL_CurrentDisplay.num_display_modes; it++)
  11.276 +      {
  11.277 +         if ((SDL_CurrentDisplay.display_modes[it].w==mode->w) &&
  11.278 +             (SDL_CurrentDisplay.display_modes[it].h==mode->h) &&
  11.279 +             (SDL_CurrentDisplay.display_modes[it].format==mode->format))
  11.280 +         {
  11.281 +            /* Find the lowest refresh rate available */
  11.282 +            if (tempmode.refresh_rate>SDL_CurrentDisplay.display_modes[it].refresh_rate)
  11.283 +            {
  11.284 +               tempmode=SDL_CurrentDisplay.display_modes[it];
  11.285 +            }
  11.286 +         }
  11.287 +      }
  11.288 +      if (tempmode.refresh_rate!=0x0000FFFF)
  11.289 +      {
  11.290 +         refresh_rate=tempmode.refresh_rate;
  11.291 +      }
  11.292 +      else
  11.293 +      {
  11.294 +         /* Let video driver decide what to do with this */
  11.295 +         refresh_rate=0;
  11.296 +      }
  11.297 +   }
  11.298 +
  11.299 +   /* Check if SDL GF driver needs to check custom refresh rate */
  11.300 +   if (didata->custom_refresh!=0)
  11.301 +   {
  11.302 +      uint32_t it;
  11.303 +      SDL_DisplayMode tempmode;
  11.304 +
  11.305 +      /* Clear display mode structure */
  11.306 +      SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode));
  11.307 +      tempmode.refresh_rate=0x0000FFFF;
  11.308 +
  11.309 +      /* Check if window width and height matches one of our modes */
  11.310 +      for (it=0; it<SDL_CurrentDisplay.num_display_modes; it++)
  11.311 +      {
  11.312 +         if ((SDL_CurrentDisplay.display_modes[it].w==mode->w) &&
  11.313 +             (SDL_CurrentDisplay.display_modes[it].h==mode->h) &&
  11.314 +             (SDL_CurrentDisplay.display_modes[it].format==mode->format))
  11.315 +         {
  11.316 +            /* Find the lowest refresh rate available */
  11.317 +            if (tempmode.refresh_rate>SDL_CurrentDisplay.display_modes[it].refresh_rate)
  11.318 +            {
  11.319 +               tempmode=SDL_CurrentDisplay.display_modes[it];
  11.320 +            }
  11.321 +
  11.322 +            /* Check if requested refresh rate found */
  11.323 +            if (refresh_rate==SDL_CurrentDisplay.display_modes[it].refresh_rate)
  11.324 +            {
  11.325 +               tempmode=SDL_CurrentDisplay.display_modes[it];
  11.326 +               break;
  11.327 +            }
  11.328 +         }
  11.329 +      }
  11.330 +      if (tempmode.refresh_rate!=0x0000FFFF)
  11.331 +      {
  11.332 +         refresh_rate=tempmode.refresh_rate;
  11.333 +      }
  11.334 +      else
  11.335 +      {
  11.336 +         /* Let video driver decide what to do with this */
  11.337 +         refresh_rate=0;
  11.338 +      }
  11.339 +   }
  11.340 +
  11.341 +   /* Detach layer before switch to new graphics mode */
  11.342 +   if (didata->layer_attached==SDL_TRUE)
  11.343 +   {
  11.344 +      /* Disable layer if hardware supports this */
  11.345 +      gf_layer_disable(didata->layer);
  11.346 +
  11.347 +      /* Detach from layer, free it for others */
  11.348 +      gf_layer_detach(didata->layer);
  11.349 +
  11.350 +      /* Mark it as detached */
  11.351 +      didata->layer_attached=SDL_FALSE;
  11.352 +   }
  11.353 +
  11.354 +   /* Set new display video mode */
  11.355 +   result=gf_display_set_mode(didata->display, mode->w, mode->h, refresh_rate,
  11.356                                qnxgf_sdl_to_gf_pixelformat(mode->format), 0);
  11.357     if (result!=GF_ERR_OK)
  11.358     {
  11.359        /* Display mode/resolution switch has been failed */
  11.360 -      SDL_SetError("Mode is not supported by qnxgf driver");
  11.361 +      SDL_SetError("mode is not supported by graphics driver");
  11.362        return -1;
  11.363     }
  11.364 +   else
  11.365 +   {
  11.366 +      didata->current_mode=*mode;
  11.367 +      didata->current_mode.refresh_rate=refresh_rate;
  11.368 +   }
  11.369 +
  11.370 +   /* Attach to main display layer */
  11.371 +   result=gf_layer_attach(&didata->layer, didata->display, didata->display_info.main_layer_index, 0);
  11.372 +   if (result!=GF_ERR_OK)
  11.373 +   {
  11.374 +      SDL_SetError("couldn't attach to main layer, it could be busy");
  11.375 +
  11.376 +      /* Failed to attach to main displayable layer */
  11.377 +      return -1;
  11.378 +   }
  11.379 +
  11.380 +   /* Enable layer in case if hardware supports layer enable/disable */
  11.381 +   gf_layer_enable(didata->layer);
  11.382 +
  11.383 +   /* Mark main display layer is attached */
  11.384 +   didata->layer_attached=SDL_TRUE;
  11.385  
  11.386     return 0;
  11.387  }
  11.388  
  11.389  int qnxgf_setdisplaypalette(_THIS, SDL_Palette* palette)
  11.390  {
  11.391 -   /* Palette must be set through the QNXGF renderer */
  11.392 -   /* It connected to surface, part of it            */
  11.393 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.394 +
  11.395 +   /* QNX GF doesn't have support for global palette changing, but we */
  11.396 +   /* could store it for usage in future */
  11.397  
  11.398     /* Setting display palette operation has been failed */
  11.399     return -1;
  11.400 @@ -384,7 +638,10 @@
  11.401  
  11.402  int qnxgf_getdisplaypalette(_THIS, SDL_Palette* palette)
  11.403  {
  11.404 -   /* We can give to upper level palette, which it set before */
  11.405 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.406 +
  11.407 +   /* We can't provide current palette settings and looks like SDL          */
  11.408 +   /* do not call this function also, in such case this function returns -1 */
  11.409  
  11.410     /* Getting display palette operation has been failed */
  11.411     return -1;
  11.412 @@ -392,12 +649,11 @@
  11.413  
  11.414  int qnxgf_setdisplaygammaramp(_THIS, Uint16* ramp)
  11.415  {
  11.416 -   SDL_DisplayData* didata = (SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.417 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.418     int status;
  11.419  
  11.420 -   /* GF can set Color LUT independently for each color channel, but SDL */
  11.421 -   /* uses combined gamma ramp, set it to each channel                   */
  11.422 -   status=gf_display_set_color_lut16(didata->display, (uint16_t*)ramp, (uint16_t*)ramp, (uint16_t*)ramp);
  11.423 +   /* Setup gamma ramp, for each color channel */
  11.424 +   status=gf_display_set_color_lut16(didata->display, (uint16_t*)ramp, (uint16_t*)ramp+256, (uint16_t*)ramp+512);
  11.425     if (status!=GF_ERR_OK)
  11.426     {
  11.427        /* Setting display gamma ramp operation has been failed */
  11.428 @@ -409,7 +665,8 @@
  11.429  
  11.430  int qnxgf_getdisplaygammaramp(_THIS, Uint16* ramp)
  11.431  {
  11.432 -   /* We need to return previous gamma set */
  11.433 +   /* TODO: We need to return previous gamma set           */
  11.434 +   /*       Also we need some initial fake gamma to return */
  11.435  
  11.436     /* Getting display gamma ramp operation has been failed */
  11.437     return -1;
  11.438 @@ -417,8 +674,82 @@
  11.439  
  11.440  int qnxgf_createwindow(_THIS, SDL_Window* window)
  11.441  {
  11.442 -   /* Failed to create new window */
  11.443 -   return -1;
  11.444 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.445 +   SDL_WindowData*  wdata;
  11.446 +
  11.447 +   /* QNX GF supports fullscreen window modes only */
  11.448 +   if ((window->flags & SDL_WINDOW_FULLSCREEN)!=SDL_WINDOW_FULLSCREEN)
  11.449 +   {
  11.450 +      uint32_t it;
  11.451 +      SDL_DisplayMode mode;
  11.452 +
  11.453 +      /* Clear display mode structure */
  11.454 +      SDL_memset(&mode, 0x00, sizeof(SDL_DisplayMode));
  11.455 +      mode.refresh_rate=0x0000FFFF;
  11.456 +
  11.457 +      /* Check if window width and height matches one of our modes */
  11.458 +      for (it=0; it<SDL_CurrentDisplay.num_display_modes; it++)
  11.459 +      {
  11.460 +         if ((SDL_CurrentDisplay.display_modes[it].w==window->w) &&
  11.461 +             (SDL_CurrentDisplay.display_modes[it].h==window->h) &&
  11.462 +             (SDL_CurrentDisplay.display_modes[it].format==SDL_CurrentDisplay.desktop_mode.format))
  11.463 +         {
  11.464 +            /* Find the lowest refresh rate available */
  11.465 +            if (mode.refresh_rate>SDL_CurrentDisplay.display_modes[it].refresh_rate)
  11.466 +            {
  11.467 +               mode=SDL_CurrentDisplay.display_modes[it];
  11.468 +            }
  11.469 +         }
  11.470 +      }
  11.471 +
  11.472 +      /* Check if end of display list has been reached */
  11.473 +      if (mode.refresh_rate==0x0000FFFF)
  11.474 +      {
  11.475 +         SDL_SetError("desired video mode is not supported");
  11.476 +
  11.477 +         /* Failed to create new window */
  11.478 +         return -1;
  11.479 +      }
  11.480 +      else
  11.481 +      {
  11.482 +         /* Tell to the caller that mode will be fullscreen */
  11.483 +         window->flags|=SDL_WINDOW_FULLSCREEN;
  11.484 +
  11.485 +         /* Setup fullscreen mode, bpp used from desktop mode in this case */
  11.486 +         qnxgf_setdisplaymode(_this, &mode);
  11.487 +      }
  11.488 +   }
  11.489 +
  11.490 +   /* Setup our own window decorations, which are depend on fullscreen mode */
  11.491 +   window->flags|=SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS |
  11.492 +                  SDL_WINDOW_MAXIMIZED | SDL_WINDOW_INPUT_GRABBED |
  11.493 +                  SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS;
  11.494 +   window->flags&=~(SDL_WINDOW_RESIZABLE | SDL_WINDOW_MINIMIZED);
  11.495 +
  11.496 +   /* Ignore any window position settings */
  11.497 +   window->x=SDL_WINDOWPOS_UNDEFINED;
  11.498 +   window->y=SDL_WINDOWPOS_UNDEFINED;
  11.499 +
  11.500 +   /* Allocate window internal data */
  11.501 +   wdata=(SDL_WindowData*)SDL_calloc(1, sizeof(SDL_WindowData));
  11.502 +   if (wdata==NULL)
  11.503 +   {
  11.504 +      SDL_OutOfMemory();
  11.505 +      return -1;
  11.506 +   }
  11.507 +
  11.508 +   /* Setup driver data for this window */
  11.509 +   window->driverdata=wdata;
  11.510 +
  11.511 +   /* Check if window must support OpenGL ES rendering */
  11.512 +   if ((window->flags & SDL_WINDOW_OPENGL)==SDL_WINDOW_OPENGL)
  11.513 +   {
  11.514 +      /* Mark this window as OpenGL ES compatible */
  11.515 +      wdata->uses_gles=SDL_TRUE;
  11.516 +   }
  11.517 +
  11.518 +   /* Window has been successfully created */
  11.519 +   return 0;
  11.520  }
  11.521  
  11.522  int qnxgf_createwindowfrom(_THIS, SDL_Window* window, const void* data)
  11.523 @@ -473,7 +804,12 @@
  11.524  
  11.525  void qnxgf_destroywindow(_THIS, SDL_Window* window)
  11.526  {
  11.527 -   printf("qnxgf_destroywindow()\n");
  11.528 +   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
  11.529 +   SDL_WindowData*  wdata=(SDL_WindowData*)window->driverdata;
  11.530 +
  11.531 +   if (wdata!=NULL)
  11.532 +   {
  11.533 +   }
  11.534  }
  11.535  
  11.536  /*****************************************************************************/
  11.537 @@ -481,13 +817,16 @@
  11.538  /*****************************************************************************/
  11.539  SDL_bool qnxgf_getwindowwminfo(_THIS, SDL_Window* window, struct SDL_SysWMinfo* info)
  11.540  {
  11.541 -   if (info->version.major <= SDL_MAJOR_VERSION)
  11.542 +   /* QNX GF do not operates at window level, this means we are have no */
  11.543 +   /* Window Manager available, no specific data in SDL_SysWMinfo too   */
  11.544 +
  11.545 +   if (info->version.major<=SDL_MAJOR_VERSION)
  11.546     {
  11.547        return SDL_TRUE;
  11.548     }
  11.549     else
  11.550     {
  11.551 -      SDL_SetError("Application not compiled with SDL %d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
  11.552 +      SDL_SetError("application not compiled with SDL %d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
  11.553        return SDL_FALSE;
  11.554     }
  11.555  
    12.1 --- a/src/video/qnxgf/SDL_qnxgf.h	Sun Mar 15 15:50:18 2009 +0000
    12.2 +++ b/src/video/qnxgf/SDL_qnxgf.h	Tue Mar 17 03:24:22 2009 +0000
    12.3 @@ -18,6 +18,10 @@
    12.4  
    12.5      Sam Lantinga
    12.6      slouken@libsdl.org
    12.7 +
    12.8 +    QNX Graphics Framework SDL driver
    12.9 +    Copyright (C) 2009 Mike Gorchak
   12.10 +    (mike@malva.ua, lestat@i.com.ua)
   12.11  */
   12.12  
   12.13  #ifndef __SDL_QNXGF_H__
   12.14 @@ -34,12 +38,38 @@
   12.15     SDL_bool      gfinitialized;      /* GF device initialization status      */
   12.16  } SDL_VideoData;
   12.17  
   12.18 +#define SDL_VIDEO_GF_DEVICENAME_MAX 257
   12.19 +
   12.20  typedef struct SDL_DisplayData
   12.21  {
   12.22 -   gf_display_info_t display_info;   /* GF display information               */
   12.23 -   gf_display_t      display;        /* GF display handle                    */
   12.24 +   gf_display_info_t display_info;     /* GF display information             */
   12.25 +   gf_display_t      display;          /* GF display handle                  */
   12.26 +   uint32_t          custom_refresh;   /* Custom refresh rate for all modes  */
   12.27 +   SDL_DisplayMode   current_mode;     /* Current video mode                 */
   12.28 +   uint8_t           description[SDL_VIDEO_GF_DEVICENAME_MAX];
   12.29 +                                       /* Device description                 */
   12.30 +   uint32_t          caps;             /* Device capabilities                */
   12.31 +   SDL_bool          layer_attached;   /* Layer attach status                */
   12.32 +   gf_layer_t        layer;            /* Graphics layer to which attached   */
   12.33  } SDL_DisplayData;
   12.34  
   12.35 +typedef struct SDL_WindowData
   12.36 +{
   12.37 +   SDL_bool     uses_gles;           /* if true window must support OpenGL ES*/
   12.38 +} SDL_WindowData;
   12.39 +
   12.40 +/****************************************************************************/
   12.41 +/* Low level GF graphics driver capabilities                                */
   12.42 +/****************************************************************************/
   12.43 +typedef struct GF_DeviceCaps
   12.44 +{
   12.45 +   uint8_t* name;
   12.46 +   uint32_t caps;
   12.47 +} GF_DeviceCaps;
   12.48 +
   12.49 +#define SDL_GF_UNACCELERATED         0x00000000
   12.50 +#define SDL_GF_ACCELERATED           0x00000001
   12.51 +
   12.52  /****************************************************************************/
   12.53  /* SDL_VideoDevice functions declaration                                    */
   12.54  /****************************************************************************/
   12.55 @@ -89,3 +119,5 @@
   12.56  void qnxgf_suspendscreensaver(_THIS);
   12.57  
   12.58  #endif /* __SDL_QNXGF_H__ */
   12.59 +
   12.60 +/* vi: set ts=4 sw=4 expandtab: */