Date: Thu, 12 Mar 2009 15:14:38 +0200
authorSam Lantinga <slouken@libsdl.org>
Tue, 17 Mar 2009 03:24:22 +0000
changeset 3092 cad1aefa2ed9
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
--- a/README.QNX	Sun Mar 15 15:50:18 2009 +0000
+++ b/README.QNX	Tue Mar 17 03:24:22 2009 +0000
@@ -1,4 +1,57 @@
 README.QNX by Mike Gorchak <mike@malva.ua>, <lestat@i.com.ua>
-Last changed at 02 Mar 2009.
+Last changed at 10 Mar 2009.
 
 QNX Photon and GF drivers are under construction. Please be patient.
+
+---------------------
+ -- SDL GF driver --
+---------------------
+
+Here is an additional information about SDL GF driver:
+ * 0. Introduction.
+ * 1. Environment variables which SDL GF driver supports.
+ * 2. Custom video modes.
+ * 3. Limitations.
+
+0. Introduction.
+
+   SDL GF driver is a layer between SDL and QNX Graphics Framework (GF). Hardware
+accelerated features which SDL could support depends on real hardware capabilities.
+
+1. Environment variables which GF driver supports.
+
+   GF driver supports the following environment variables for QNX GF specific
+customization options:
+   a) SDL_VIDEO_GF_REFRESH_RATE - refresh rate of video output in Hz. Without
+      this environment variable declaration SDL controls refresh rate of your
+      display. If this enironment variable is set to 0, SDL will control refresh
+      rate of display, otherwise value of SDL_VIDEO_GF_REFRESH_RATE is used for
+      all screen resolutions as refresh rate. This example will set 60Hz refresh
+      rate as refresh rate for all graphics modes:
+
+      export SDL_VIDEO_GF_REFRESH_RATE=60
+
+2. Custom video modes.
+
+   Since most QNX graphics drivers supports GENERIC video modes, i.e. you could
+specify any horizontal and vertical resolution and any refresh rate, SDL GF
+driver uses its own fullscreen modes list, which could be incomplete. You could
+add any custom video mode, which your QNX graphics driver supports by editing
+file ./src/video/qnxgf/SDL_qnxgf.c. Custom graphics mode definition looks like
+
+   {0, 1024, 640, 60, NULL},   /* 1024x640 mode is 60Hz only               */
+
+You must specify horizontal resolution as second parameter, vertical resolution
+as third parameter and refresh rate as fourth parameter. Please leave first and
+last parameters as 0 and NULL. Then please send me your changes to e-mail address
+which is specified in the header of this document.
+
+3. Limitations.
+
+   There are few limitations while using SDL GF driver:
+
+   a) Since GF driver supports fullscreen modes only, when you are not specifing
+SDL_WINDOW_FULLSCREEN flag, an SDL GF driver will try to find the fullscreen
+graphics mode which corresponds to SDL window size. Refresh rate will be the
+lowest available, if SDL_VIDEO_GF_REFRESH_RATE environment variable is not set.
+
--- a/src/video/SDL_video.c	Sun Mar 15 15:50:18 2009 +0000
+++ b/src/video/SDL_video.c	Tue Mar 17 03:24:22 2009 +0000
@@ -664,6 +664,7 @@
         SDL_SetError("Couldn't find display mode match");
         return -1;
     }
+
     if (SDL_memcmp
         (&fullscreen_mode, &display->fullscreen_mode,
          sizeof(fullscreen_mode)) == 0) {
@@ -1492,6 +1493,13 @@
     /* Create a new renderer instance */
     window->renderer = SDL_CurrentDisplay.render_drivers[index]
         .CreateRenderer(window, flags);
+
+    if (window->renderer==NULL)
+    {
+       /* Assuming renderer set its error */
+       return -1;
+    }
+
     SDL_SelectRenderer(window->id);
 
     return 0;
--- a/src/video/photon/SDL_photon.c	Sun Mar 15 15:50:18 2009 +0000
+++ b/src/video/photon/SDL_photon.c	Tue Mar 17 03:24:22 2009 +0000
@@ -18,11 +18,21 @@
 
     Sam Lantinga
     slouken@libsdl.org
+
+    QNX Photon GUI SDL driver
+    Copyright (C) 2009 Mike Gorchak
+    (mike@malva.ua, lestat@i.com.ua)
 */
 
 #include "SDL_config.h"
 
 #include "../SDL_sysvideo.h"
+#include "SDL_version.h"
+#include "SDL_syswm.h"
+
+#include "../SDL_sysvideo.h"
+
+#include "SDL_photon.h"
 
 static SDL_bool photon_initialized=SDL_FALSE;
 
@@ -56,14 +66,301 @@
 
 static SDL_VideoDevice* photon_create(int devindex)
 {
+   SDL_VideoDevice* device;
+   SDL_VideoData*   phdata;
+   int              status;
+
+   /* Check if photon could be initialized */
+   status=photon_available();
+   if (status==0)
+   {
+      /* Photon could not be used */
+      return NULL;
+   }
+
+   /* Initialize SDL_VideoDevice structure */
+   device=(SDL_VideoDevice*)SDL_calloc(1, sizeof(SDL_VideoDevice));
+   if (device==NULL)
+   {
+      SDL_OutOfMemory();
+      return NULL;
+   }
+
+   /* Initialize internal photon specific data */
+   phdata=(SDL_VideoData*)SDL_calloc(1, sizeof(SDL_VideoData));
+   if (phdata==NULL)
+   {
+      SDL_OutOfMemory();
+      SDL_free(device);
+      return NULL;
+   }
+   device->driverdata=phdata;
+
+   /* Setup amount of available displays and current display */
+   device->num_displays=0;
+   device->current_display=0;
 }
 
 VideoBootStrap photon_bootstrap=
 {
    "photon",
-   "SDL Photon video driver",
+   "SDL QNX Photon video driver",
    photon_available,
    photon_create
 };
 
+/*****************************************************************************/
+/* SDL Video and Display initialization/handling functions                   */
+/*****************************************************************************/
+int photon_videoinit(_THIS)
+{
+   SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
+
+   /* Check for environment variables which could override some SDL settings */
+//   didata->custom_refresh=0;
+//   override = SDL_getenv("SDL_VIDEO_PHOTON_REFRESH_RATE");
+//   if (override!=NULL)
+//   {
+//      if (SDL_sscanf(override, "%u", &didata->custom_refresh)!=1)
+//      {
+//         didata->custom_refresh=0;
+//      }
+//   }
+
+   /* Add photon renderer to SDL */
+   photon_addrenderdriver(_this);
+
+   /* video has been initialized successfully */
+   return 1;
+}
+
+void photon_videoquit(_THIS)
+{
+   SDL_DisplayData* didata;
+   uint32_t it;
+
+   /* SDL will restore our desktop mode on exit */
+   for(it=0; it<_this->num_displays; it++)
+   {
+      didata=_this->displays[it].driverdata;
+   }
+}
+
+void photon_getdisplaymodes(_THIS)
+{
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+   SDL_DisplayMode  mode;
+
+}
+
+int photon_setdisplaymode(_THIS, SDL_DisplayMode* mode)
+{
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+
+   return 0;
+}
+
+int photon_setdisplaypalette(_THIS, SDL_Palette* palette)
+{
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+
+   /* Setting display palette operation has been failed */
+   return -1;
+}
+
+int photon_getdisplaypalette(_THIS, SDL_Palette* palette)
+{
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+
+   /* Getting display palette operation has been failed */
+   return -1;
+}
+
+int photon_setdisplaygammaramp(_THIS, Uint16* ramp)
+{
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+
+   /* Setting display gamma ramp operation has been failed */
+   return -1;
+}
+
+int photon_getdisplaygammaramp(_THIS, Uint16* ramp)
+{
+   /* Getting display gamma ramp operation has been failed */
+   return -1;
+}
+
+int photon_createwindow(_THIS, SDL_Window* window)
+{
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+   SDL_WindowData*  wdata;
+
+   /* Allocate window internal data */
+   wdata=(SDL_WindowData*)SDL_calloc(1, sizeof(SDL_WindowData));
+   if (wdata==NULL)
+   {
+      SDL_OutOfMemory();
+      return -1;
+   }
+
+   /* Setup driver data for this window */
+   window->driverdata=wdata;
+
+   /* Check if window must support OpenGL ES rendering */
+   if ((window->flags & SDL_WINDOW_OPENGL)==SDL_WINDOW_OPENGL)
+   {
+      /* Mark this window as OpenGL ES compatible */
+      wdata->uses_gles=SDL_TRUE;
+   }
+
+   /* Window has been successfully created */
+   return 0;
+}
+
+int photon_createwindowfrom(_THIS, SDL_Window* window, const void* data)
+{
+   /* Failed to create window from another window */
+   return -1;
+}
+
+void photon_setwindowtitle(_THIS, SDL_Window* window)
+{
+}
+
+void photon_setwindowicon(_THIS, SDL_Window* window, SDL_Surface* icon)
+{
+}
+
+void photon_setwindowposition(_THIS, SDL_Window* window)
+{
+}
+
+void photon_setwindowsize(_THIS, SDL_Window* window)
+{
+}
+
+void photon_showwindow(_THIS, SDL_Window* window)
+{
+}
+
+void photon_hidewindow(_THIS, SDL_Window* window)
+{
+}
+
+void photon_raisewindow(_THIS, SDL_Window* window)
+{
+}
+
+void photon_maximizewindow(_THIS, SDL_Window* window)
+{
+}
+
+void photon_minimizewindow(_THIS, SDL_Window* window)
+{
+}
+
+void photon_restorewindow(_THIS, SDL_Window* window)
+{
+}
+
+void photon_setwindowgrab(_THIS, SDL_Window* window)
+{
+}
+
+void photon_destroywindow(_THIS, SDL_Window* window)
+{
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+   SDL_WindowData*  wdata=(SDL_WindowData*)window->driverdata;
+
+   if (wdata!=NULL)
+   {
+   }
+}
+
+/*****************************************************************************/
+/* SDL Window Manager function                                               */
+/*****************************************************************************/
+SDL_bool photon_getwindowwminfo(_THIS, SDL_Window* window, struct SDL_SysWMinfo* info)
+{
+   if (info->version.major<=SDL_MAJOR_VERSION)
+   {
+      return SDL_TRUE;
+   }
+   else
+   {
+      SDL_SetError("application not compiled with SDL %d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+      return SDL_FALSE;
+   }
+
+   /* Failed to get window manager information */
+   return SDL_FALSE;
+}
+
+/*****************************************************************************/
+/* SDL OpenGL/OpenGL ES functions                                            */
+/*****************************************************************************/
+int photon_gl_loadlibrary(_THIS, const char* path)
+{
+   /* Failed to load new GL library */
+   return -1;
+}
+
+void* photon_gl_getprocaddres(_THIS, const char* proc)
+{
+   /* Failed to get GL function address pointer */
+   return NULL;
+}
+
+void photon_gl_unloadlibrary(_THIS)
+{
+}
+
+SDL_GLContext photon_gl_createcontext(_THIS, SDL_Window* window)
+{
+   /* Failed to create GL context */
+   return NULL;
+}
+
+int photon_gl_makecurrent(_THIS, SDL_Window* window, SDL_GLContext context)
+{
+   /* Failed to set current GL context */
+   return -1;
+}
+
+int photon_gl_setswapinterval(_THIS, int interval)
+{
+   /* Failed to set swap interval */
+   return -1;
+}
+
+int photon_gl_getswapinterval(_THIS)
+{
+   /* Failed to get default swap interval */
+   return -1;
+}
+
+void photon_gl_swapwindow(_THIS, SDL_Window* window)
+{
+}
+
+void photon_gl_deletecontext(_THIS, SDL_GLContext context)
+{
+}
+
+/*****************************************************************************/
+/* SDL Event handling function                                               */
+/*****************************************************************************/
+void photon_pumpevents(_THIS)
+{
+}
+
+/*****************************************************************************/
+/* SDL screen saver related functions                                        */
+/*****************************************************************************/
+void photon_suspendscreensaver(_THIS)
+{
+   /* There is no screensaver in pure console, it may exist when running */
+   /* GF under Photon, but I do not know, how to disable screensaver     */
+}
+
 /* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/photon/SDL_photon.h	Tue Mar 17 03:24:22 2009 +0000
@@ -0,0 +1,116 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2009 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+
+    QNX Photon GUI SDL driver
+    Copyright (C) 2009 Mike Gorchak
+    (mike@malva.ua, lestat@i.com.ua)
+*/
+
+#ifndef __SDL_PHOTON_H__
+#define __SDL_PHOTON_H__
+
+#include "../SDL_sysvideo.h"
+
+#include <Ph.h>
+
+typedef struct SDL_VideoData
+{
+} SDL_VideoData;
+
+#define SDL_VIDEO_PHOTON_DEVICENAME_MAX 257
+
+typedef struct SDL_DisplayData
+{
+   uint32_t          custom_refresh;   /* Custom refresh rate for all modes  */
+   SDL_DisplayMode   current_mode;     /* Current video mode                 */
+   uint8_t           description[SDL_VIDEO_PHOTON_DEVICENAME_MAX];
+                                       /* Device description                 */
+   uint32_t          caps;             /* Device capabilities                */
+} SDL_DisplayData;
+
+typedef struct SDL_WindowData
+{
+   SDL_bool     uses_gles;           /* if true window must support OpenGL ES*/
+} SDL_WindowData;
+
+/****************************************************************************/
+/* Low level Photon graphics driver capabilities                            */
+/****************************************************************************/
+typedef struct Photon_DeviceCaps
+{
+   uint8_t* name;
+   uint32_t caps;
+} Photon_DeviceCaps;
+
+#define SDL_PHOTON_UNACCELERATED         0x00000000
+#define SDL_PHOTON_ACCELERATED           0x00000001
+
+/****************************************************************************/
+/* SDL_VideoDevice functions declaration                                    */
+/****************************************************************************/
+
+/* Display and window functions */
+int photon_videoinit(_THIS);
+void photon_videoquit(_THIS);
+void photon_getdisplaymodes(_THIS);
+int photon_setdisplaymode(_THIS, SDL_DisplayMode* mode);
+int photon_setdisplaypalette(_THIS, SDL_Palette* palette);
+int photon_getdisplaypalette(_THIS, SDL_Palette* palette);
+int photon_setdisplaygammaramp(_THIS, Uint16* ramp);
+int photon_getdisplaygammaramp(_THIS, Uint16* ramp);
+int photon_createwindow(_THIS, SDL_Window* window);
+int photon_createwindowfrom(_THIS, SDL_Window* window, const void* data);
+void photon_setwindowtitle(_THIS, SDL_Window* window);
+void photon_setwindowicon(_THIS, SDL_Window* window, SDL_Surface* icon);
+void photon_setwindowposition(_THIS, SDL_Window* window);
+void photon_setwindowsize(_THIS, SDL_Window* window);
+void photon_showwindow(_THIS, SDL_Window* window);
+void photon_hidewindow(_THIS, SDL_Window* window);
+void photon_raisewindow(_THIS, SDL_Window* window);
+void photon_maximizewindow(_THIS, SDL_Window* window);
+void photon_minimizewindow(_THIS, SDL_Window* window);
+void photon_restorewindow(_THIS, SDL_Window* window);
+void photon_setwindowgrab(_THIS, SDL_Window* window);
+void photon_destroywindow(_THIS, SDL_Window* window);
+
+/* Window manager function */
+SDL_bool photon_getwindowwminfo(_THIS, SDL_Window* window, struct SDL_SysWMinfo* info);
+
+/* OpenGL/OpenGL ES functions */
+int photon_gl_loadlibrary(_THIS, const char* path);
+void* photon_gl_getprocaddres(_THIS, const char* proc);
+void photon_gl_unloadlibrary(_THIS);
+SDL_GLContext photon_gl_createcontext(_THIS, SDL_Window* window);
+int photon_gl_makecurrent(_THIS, SDL_Window* window, SDL_GLContext context);
+int photon_gl_setswapinterval(_THIS, int interval);
+int photon_gl_getswapinterval(_THIS);
+void photon_gl_swapwindow(_THIS, SDL_Window* window);
+void photon_gl_deletecontext(_THIS, SDL_GLContext context);
+
+/* Event handling function */
+void photon_pumpevents(_THIS);
+
+/* Screen saver related function */
+void photon_suspendscreensaver(_THIS);
+
+#endif /* __SDL_PHOTON_H__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/photon/SDL_photon_render.c	Tue Mar 17 03:24:22 2009 +0000
@@ -0,0 +1,342 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2009 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+
+    QNX Photon GUI SDL driver
+    Copyright (C) 2009 Mike Gorchak
+    (mike@malva.ua, lestat@i.com.ua)
+*/
+
+#include "SDL_config.h"
+
+#include "../SDL_pixels_c.h"
+#include "../SDL_yuv_sw_c.h"
+
+#include "SDL_video.h"
+
+#include "SDL_photon_render.h"
+#include "SDL_photon.h"
+
+static SDL_Renderer* photon_createrenderer(SDL_Window* window, Uint32 flags);
+static int photon_displaymodechanged(SDL_Renderer* renderer);
+static int photon_activaterenderer(SDL_Renderer* renderer);
+static int photon_createtexture(SDL_Renderer* renderer, SDL_Texture* texture);
+static int photon_querytexturepixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch);
+static int photon_settexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Color* colors, int firstcolor, int ncolors);
+static int photon_gettexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, SDL_Color* colors, int firstcolor, int ncolors);
+static int photon_settexturecolormod(SDL_Renderer* renderer, SDL_Texture* texture);
+static int photon_settexturealphamod(SDL_Renderer* renderer, SDL_Texture* texture);
+static int photon_settextureblendmode(SDL_Renderer* renderer, SDL_Texture* texture);
+static int photon_settexturescalemode(SDL_Renderer* renderer, SDL_Texture* texture);
+static int photon_updatetexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch);
+static int photon_locktexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int markDirty, void** pixels, int* pitch);
+static void photon_unlocktexture(SDL_Renderer* renderer, SDL_Texture* texture);
+static void photon_dirtytexture(SDL_Renderer* renderer, SDL_Texture* texture, int numrects, const SDL_Rect* rects);
+static int photon_renderpoint(SDL_Renderer* renderer, int x, int y);
+static int photon_renderline(SDL_Renderer* renderer, int x1, int y1, int x2, int y2);
+static int photon_renderfill(SDL_Renderer* renderer, const SDL_Rect* rect);
+static int photon_rendercopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect);
+static void photon_renderpresent(SDL_Renderer* renderer);
+static void photon_destroytexture(SDL_Renderer* renderer, SDL_Texture* texture);
+static void photon_destroyrenderer(SDL_Renderer* renderer);
+
+SDL_RenderDriver photon_renderdriver=
+{
+    photon_createrenderer,
+    {
+       "photon",
+       (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
+        SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
+        SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
+        SDL_RENDERER_ACCELERATED),
+       (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
+        SDL_TEXTUREMODULATE_ALPHA),
+       (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK |
+        SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
+       (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_SLOW),
+       13,
+       {
+          SDL_PIXELFORMAT_INDEX8,
+          SDL_PIXELFORMAT_RGB555,
+          SDL_PIXELFORMAT_RGB565,
+          SDL_PIXELFORMAT_RGB888,
+          SDL_PIXELFORMAT_BGR888,
+          SDL_PIXELFORMAT_ARGB8888,
+          SDL_PIXELFORMAT_RGBA8888,
+          SDL_PIXELFORMAT_ABGR8888,
+          SDL_PIXELFORMAT_BGRA8888,
+          SDL_PIXELFORMAT_YV12,
+          SDL_PIXELFORMAT_YUY2,
+          SDL_PIXELFORMAT_UYVY,
+          SDL_PIXELFORMAT_YVYU
+       },
+       0,
+       0
+    }
+};
+
+static SDL_Renderer* photon_createrenderer(SDL_Window* window, Uint32 flags)
+{
+   SDL_VideoDisplay* display = SDL_GetDisplayFromWindow(window);
+   SDL_DisplayData* didata = (SDL_DisplayData*)display->driverdata;
+   SDL_WindowData* wdata = (SDL_WindowData*)window->driverdata;
+   SDL_Renderer* renderer = NULL;
+   SDL_RenderData* rdata = NULL;
+
+   /* Allocate new renderer structure */
+   renderer=(SDL_Renderer*)SDL_calloc(1, sizeof(SDL_Renderer));
+   if (renderer==NULL)
+   {
+      SDL_OutOfMemory();
+      return NULL;
+   }
+
+   /* Allocate renderer data */
+   rdata=(SDL_RenderData*)SDL_calloc(1, sizeof(SDL_RenderData));
+   if (rdata==NULL)
+   {
+      SDL_free(renderer);
+      SDL_OutOfMemory();
+      return NULL;
+   }
+
+   renderer->DisplayModeChanged=photon_displaymodechanged;
+   renderer->ActivateRenderer=photon_activaterenderer;
+   renderer->CreateTexture=photon_createtexture;
+   renderer->QueryTexturePixels=photon_querytexturepixels;
+   renderer->SetTexturePalette=photon_settexturepalette;
+   renderer->GetTexturePalette=photon_gettexturepalette;
+   renderer->SetTextureAlphaMod=photon_settexturealphamod;
+   renderer->SetTextureColorMod=photon_settexturecolormod;
+   renderer->SetTextureBlendMode=photon_settextureblendmode;
+   renderer->SetTextureScaleMode=photon_settexturescalemode;
+   renderer->UpdateTexture=photon_updatetexture;
+   renderer->LockTexture=photon_locktexture;
+   renderer->UnlockTexture=photon_unlocktexture;
+   renderer->DirtyTexture=photon_dirtytexture;
+   renderer->RenderPoint=photon_renderpoint;
+   renderer->RenderLine=photon_renderline;
+   renderer->RenderFill=photon_renderfill;
+   renderer->RenderCopy=photon_rendercopy;
+   renderer->RenderPresent = photon_renderpresent;
+   renderer->DestroyTexture = photon_destroytexture;
+   renderer->DestroyRenderer = photon_destroyrenderer;
+   renderer->info = photon_renderdriver.info;
+   renderer->window = window->id;
+   renderer->driverdata = rdata;
+
+   /* Set render acceleration flag in case it is accelerated */
+   if ((didata->caps & SDL_PHOTON_ACCELERATED)==SDL_PHOTON_ACCELERATED)
+   {
+      renderer->info.flags=SDL_RENDERER_ACCELERATED;
+   }
+   else
+   {
+      renderer->info.flags&=~(SDL_RENDERER_ACCELERATED);
+   }
+
+   rdata->window=window;
+
+   /* Check if upper level requested synchronization on vsync signal */
+   if ((flags & SDL_RENDERER_PRESENTVSYNC)==SDL_RENDERER_PRESENTVSYNC)
+   {
+       rdata->enable_vsync=SDL_TRUE;
+   }
+   else
+   {
+      rdata->enable_vsync=SDL_FALSE;
+   }
+
+   /* Check what buffer copy/flip scheme is requested */
+   rdata->surfaces_count=0;
+   if ((flags & SDL_RENDERER_SINGLEBUFFER)==SDL_RENDERER_SINGLEBUFFER)
+   {
+      if ((flags & SDL_RENDERER_PRESENTDISCARD)==SDL_RENDERER_PRESENTDISCARD)
+      {
+         renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD;
+      }
+      else
+      {
+         renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
+      }
+      rdata->surfaces_count=1;
+      rdata->surface_visible_idx=0;
+      rdata->surface_render_idx=0;
+   }
+   else
+   {
+      if ((flags & SDL_RENDERER_PRESENTFLIP2)==SDL_RENDERER_PRESENTFLIP2)
+      {
+         renderer->info.flags|=SDL_RENDERER_PRESENTFLIP2;
+         rdata->surfaces_count=2;
+         rdata->surface_visible_idx=0;
+         rdata->surface_render_idx=1;
+      }
+      else
+      {
+         if ((flags & SDL_RENDERER_PRESENTFLIP3)==SDL_RENDERER_PRESENTFLIP3)
+         {
+            renderer->info.flags|=SDL_RENDERER_PRESENTFLIP3;
+            rdata->surfaces_count=3;
+            rdata->surface_visible_idx=0;
+            rdata->surface_render_idx=1;
+         }
+         else
+         {
+            renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
+            rdata->surfaces_count=1;
+            rdata->surface_visible_idx=0;
+            rdata->surface_render_idx=0;
+         }
+      }
+   }
+
+   return renderer;
+}
+
+void photon_addrenderdriver(_THIS)
+{
+   uint32_t it;
+
+   for (it=0; it<_this->num_displays; it++)
+   {
+      SDL_AddRenderDriver(it, &photon_renderdriver);
+   }
+}
+
+/****************************************************************************/
+/* SDL render interface                                                     */
+/****************************************************************************/
+static int photon_displaymodechanged(SDL_Renderer* renderer)
+{
+   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
+
+   /* Remove all allocated surfaces, they are no more valid */
+
+   /* TODO: Add video mode change detection and new parameters detection */
+
+   return 0;
+}
+
+static int photon_activaterenderer(SDL_Renderer* renderer)
+{
+   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
+   SDL_VideoDisplay* display = SDL_GetDisplayFromWindow(rdata->window);
+   SDL_DisplayData* didata = (SDL_DisplayData*)display->driverdata;
+
+   return 0;
+}
+
+static int photon_createtexture(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+   SDL_RenderData* renderdata=(SDL_RenderData*)renderer->driverdata;
+   SDL_Window* window=SDL_GetWindowFromID(renderer->window);
+   SDL_VideoDisplay* display=SDL_GetDisplayFromWindow(window);
+   SDL_TextureData* tdata=NULL;
+
+   /* Allocate texture driver data */
+   tdata=(SDL_TextureData*)SDL_calloc(1, sizeof(SDL_TextureData));
+   if (tdata==NULL)
+   {
+      SDL_OutOfMemory();
+      return -1;
+   }
+
+   /* Set texture driver data */
+   texture->driverdata=tdata;
+
+}
+
+static int photon_querytexturepixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch)
+{
+}
+
+static int photon_settexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Color* colors, int firstcolor, int ncolors)
+{
+}
+
+static int photon_gettexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, SDL_Color* colors, int firstcolor, int ncolors)
+{
+}
+
+static int photon_settexturecolormod(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static int photon_settexturealphamod(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static int photon_settextureblendmode(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static int photon_settexturescalemode(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static int photon_updatetexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch)
+{
+}
+
+static int photon_locktexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int markDirty, void** pixels, int* pitch)
+{
+}
+
+static void photon_unlocktexture(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static void photon_dirtytexture(SDL_Renderer* renderer, SDL_Texture* texture, int numrects, const SDL_Rect* rects)
+{
+}
+
+static int photon_renderpoint(SDL_Renderer* renderer, int x, int y)
+{
+}
+
+static int photon_renderline(SDL_Renderer* renderer, int x1, int y1, int x2, int y2)
+{
+}
+
+static int photon_renderfill(SDL_Renderer* renderer, const SDL_Rect* rect)
+{
+}
+
+static int photon_rendercopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect)
+{
+}
+
+static void photon_renderpresent(SDL_Renderer* renderer)
+{
+}
+
+static void photon_destroytexture(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static void photon_destroyrenderer(SDL_Renderer* renderer)
+{
+   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
+   uint32_t it;
+
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/photon/SDL_photon_render.h	Tue Mar 17 03:24:22 2009 +0000
@@ -0,0 +1,53 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2009 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+
+    QNX Photon GUI SDL driver
+    Copyright (C) 2009 Mike Gorchak
+    (mike@malva.ua, lestat@i.com.ua)
+*/
+
+#ifndef __SDL_PHOTON_RENDER_H__
+#define __SDL_PHOTON_RENDER_H__
+
+#include "../SDL_sysvideo.h"
+
+#include <Ph.h>
+
+#define SDL_PHOTON_MAX_SURFACES 3
+
+typedef struct SDL_RenderData
+{
+   SDL_Window*        window;        /* SDL window type                    */
+   SDL_bool           enable_vsync;  /* VSYNC flip synchronization enable  */
+   uint32_t           surface_visible_idx; /* Index of visible surface     */
+   uint32_t           surface_render_idx;  /* Index of render surface      */
+   uint32_t           surfaces_count;      /* Amount of allocated surfaces */
+} SDL_RenderData;
+
+typedef struct SDL_TextureData
+{
+} SDL_TextureData;
+
+extern void photon_addrenderdriver(_THIS);
+
+#endif /* __SDL_PHOTON_RENDER_H__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/qnxgf/SDL_gf_pixelfmt.c	Sun Mar 15 15:50:18 2009 +0000
+++ b/src/video/qnxgf/SDL_gf_pixelfmt.c	Tue Mar 17 03:24:22 2009 +0000
@@ -18,6 +18,10 @@
 
     Sam Lantinga
     slouken@libsdl.org
+
+    QNX Graphics Framework SDL driver
+    Copyright (C) 2009 Mike Gorchak
+    (mike@malva.ua, lestat@i.com.ua)
 */
 
 #include "SDL_config.h"
@@ -166,3 +170,5 @@
 
    return SDL_PIXELFORMAT_UNKNOWN;
 }
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/qnxgf/SDL_gf_pixelfmt.h	Sun Mar 15 15:50:18 2009 +0000
+++ b/src/video/qnxgf/SDL_gf_pixelfmt.h	Tue Mar 17 03:24:22 2009 +0000
@@ -18,6 +18,10 @@
 
     Sam Lantinga
     slouken@libsdl.org
+
+    QNX Graphics Framework SDL driver
+    Copyright (C) 2009 Mike Gorchak
+    (mike@malva.ua, lestat@i.com.ua)
 */
 
 #ifndef __SDL_GF_PIXELFMT_H__
@@ -31,3 +35,5 @@
 uint32_t    qnxgf_gf_to_sdl_pixelformat(gf_format_t pixelfmt);
 
 #endif /* __SDL_GF_PIXELFMT_H__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/qnxgf/SDL_gf_render.c	Sun Mar 15 15:50:18 2009 +0000
+++ b/src/video/qnxgf/SDL_gf_render.c	Tue Mar 17 03:24:22 2009 +0000
@@ -18,6 +18,10 @@
 
     Sam Lantinga
     slouken@libsdl.org
+
+    QNX Graphics Framework SDL driver
+    Copyright (C) 2009 Mike Gorchak
+    (mike@malva.ua, lestat@i.com.ua)
 */
 
 #include "SDL_config.h"
@@ -28,19 +32,39 @@
 #include "SDL_video.h"
 
 #include "SDL_gf_render.h"
+#include "SDL_qnxgf.h"
 
-static SDL_Renderer* GF_CreateRenderer(SDL_Window* window, Uint32 flags)
+static SDL_Renderer* gf_createrenderer(SDL_Window* window, Uint32 flags);
+static int gf_displaymodechanged(SDL_Renderer* renderer);
+static int gf_activaterenderer(SDL_Renderer* renderer);
+static int gf_createtexture(SDL_Renderer* renderer, SDL_Texture* texture);
+static int gf_querytexturepixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch);
+static int gf_settexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Color* colors, int firstcolor, int ncolors);
+static int gf_gettexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, SDL_Color* colors, int firstcolor, int ncolors);
+static int gf_settexturecolormod(SDL_Renderer* renderer, SDL_Texture* texture);
+static int gf_settexturealphamod(SDL_Renderer* renderer, SDL_Texture* texture);
+static int gf_settextureblendmode(SDL_Renderer* renderer, SDL_Texture* texture);
+static int gf_settexturescalemode(SDL_Renderer* renderer, SDL_Texture* texture);
+static int gf_updatetexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch);
+static int gf_locktexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int markDirty, void** pixels, int* pitch);
+static void gf_unlocktexture(SDL_Renderer* renderer, SDL_Texture* texture);
+static void gf_dirtytexture(SDL_Renderer* renderer, SDL_Texture* texture, int numrects, const SDL_Rect* rects);
+static int gf_renderpoint(SDL_Renderer* renderer, int x, int y);
+static int gf_renderline(SDL_Renderer* renderer, int x1, int y1, int x2, int y2);
+static int gf_renderfill(SDL_Renderer* renderer, const SDL_Rect* rect);
+static int gf_rendercopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect);
+static void gf_renderpresent(SDL_Renderer* renderer);
+static void gf_destroytexture(SDL_Renderer* renderer, SDL_Texture* texture);
+static void gf_destroyrenderer(SDL_Renderer* renderer);
+
+SDL_RenderDriver gf_renderdriver=
 {
-}
-
-SDL_RenderDriver GF_RenderDriver=
-{
-    GF_CreateRenderer,
+    gf_createrenderer,
     {
        "qnxgf",
        (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
         SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
-        SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC |
+        SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
         SDL_RENDERER_ACCELERATED),
        (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
         SDL_TEXTUREMODULATE_ALPHA),
@@ -67,3 +91,301 @@
        0
     }
 };
+
+static SDL_Renderer* gf_createrenderer(SDL_Window* window, Uint32 flags)
+{
+   SDL_VideoDisplay* display = SDL_GetDisplayFromWindow(window);
+   SDL_DisplayData* didata = (SDL_DisplayData*)display->driverdata;
+   SDL_WindowData* wdata = (SDL_WindowData*)window->driverdata;
+   SDL_Renderer* renderer = NULL;
+   SDL_RenderData* rdata = NULL;
+   uint32_t it;
+   int32_t  jt;
+   int32_t  status;
+
+   /* Allocate new renderer structure */
+   renderer=(SDL_Renderer*)SDL_calloc(1, sizeof(SDL_Renderer));
+   if (renderer==NULL)
+   {
+      SDL_OutOfMemory();
+      return NULL;
+   }
+
+   /* Allocate renderer data */
+   rdata=(SDL_RenderData*)SDL_calloc(1, sizeof(SDL_RenderData));
+   if (rdata==NULL)
+   {
+      SDL_free(renderer);
+      SDL_OutOfMemory();
+      return NULL;
+   }
+
+   renderer->DisplayModeChanged=gf_displaymodechanged;
+   renderer->ActivateRenderer=gf_activaterenderer;
+   renderer->CreateTexture=gf_createtexture;
+   renderer->QueryTexturePixels=gf_querytexturepixels;
+   renderer->SetTexturePalette=gf_settexturepalette;
+   renderer->GetTexturePalette=gf_gettexturepalette;
+   renderer->SetTextureAlphaMod=gf_settexturealphamod;
+   renderer->SetTextureColorMod=gf_settexturecolormod;
+   renderer->SetTextureBlendMode=gf_settextureblendmode;
+   renderer->SetTextureScaleMode=gf_settexturescalemode;
+   renderer->UpdateTexture=gf_updatetexture;
+   renderer->LockTexture=gf_locktexture;
+   renderer->UnlockTexture=gf_unlocktexture;
+   renderer->DirtyTexture=gf_dirtytexture;
+   renderer->RenderPoint=gf_renderpoint;
+   renderer->RenderLine=gf_renderline;
+   renderer->RenderFill=gf_renderfill;
+   renderer->RenderCopy=gf_rendercopy;
+   renderer->RenderPresent = gf_renderpresent;
+   renderer->DestroyTexture = gf_destroytexture;
+   renderer->DestroyRenderer = gf_destroyrenderer;
+   renderer->info = gf_renderdriver.info;
+   renderer->window = window->id;
+   renderer->driverdata = rdata;
+
+   /* Set render acceleration flag in case it is accelerated */
+   if ((didata->caps & SDL_GF_ACCELERATED)==SDL_GF_ACCELERATED)
+   {
+      renderer->info.flags=SDL_RENDERER_ACCELERATED;
+   }
+   else
+   {
+      renderer->info.flags&=~(SDL_RENDERER_ACCELERATED);
+   }
+
+   rdata->window=window;
+
+   /* Check if upper level requested synchronization on vsync signal */
+   if ((flags & SDL_RENDERER_PRESENTVSYNC)==SDL_RENDERER_PRESENTVSYNC)
+   {
+       rdata->enable_vsync=SDL_TRUE;
+   }
+   else
+   {
+      rdata->enable_vsync=SDL_FALSE;
+   }
+
+   /* Check what buffer copy/flip scheme is requested */
+   rdata->surfaces_count=0;
+   if ((flags & SDL_RENDERER_SINGLEBUFFER)==SDL_RENDERER_SINGLEBUFFER)
+   {
+      if ((flags & SDL_RENDERER_PRESENTDISCARD)==SDL_RENDERER_PRESENTDISCARD)
+      {
+         renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD;
+      }
+      else
+      {
+         renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
+      }
+      rdata->surfaces_count=1;
+      rdata->surface_visible_idx=0;
+      rdata->surface_render_idx=0;
+   }
+   else
+   {
+      if ((flags & SDL_RENDERER_PRESENTFLIP2)==SDL_RENDERER_PRESENTFLIP2)
+      {
+         renderer->info.flags|=SDL_RENDERER_PRESENTFLIP2;
+         rdata->surfaces_count=2;
+         rdata->surface_visible_idx=0;
+         rdata->surface_render_idx=1;
+      }
+      else
+      {
+         if ((flags & SDL_RENDERER_PRESENTFLIP3)==SDL_RENDERER_PRESENTFLIP3)
+         {
+            renderer->info.flags|=SDL_RENDERER_PRESENTFLIP3;
+            rdata->surfaces_count=3;
+            rdata->surface_visible_idx=0;
+            rdata->surface_render_idx=1;
+         }
+         else
+         {
+            renderer->info.flags|=SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY;
+            rdata->surfaces_count=1;
+            rdata->surface_visible_idx=0;
+            rdata->surface_render_idx=0;
+         }
+      }
+   }
+
+   /* Create layer surfaces, which could be visible */
+   for (it=0; it<rdata->surfaces_count; it++)
+   {
+      /* TODO: add palette creation */
+      /*       do not waste surfaces when using GL ES */
+
+      /* Create displayable surfaces */
+      status=gf_surface_create_layer(&rdata->surface[it], &didata->layer, 1, 0,
+             didata->current_mode.w, didata->current_mode.h,
+             qnxgf_sdl_to_gf_pixelformat(didata->current_mode.format), NULL, 
+             GF_SURFACE_CREATE_2D_ACCESSIBLE);
+
+      if (status!=GF_ERR_OK)
+      {
+         /* Free already allocated surfaces */
+         for (jt=it-1; jt>0; jt--)
+         {
+            gf_surface_free(rdata->surface[jt]);
+         }
+         SDL_free(rdata);
+         SDL_free(renderer);
+         if (status==GF_ERR_MEM)
+         {
+            SDL_SetError("unsufficient free video memory");
+         }
+         else
+         {
+            SDL_SetError("error during displayable surface creation");
+         }
+         return NULL;
+      }
+
+      /* Get detailed information about allocated surface */
+      gf_surface_get_info(rdata->surface[it], &rdata->surface_info[it]);
+   }
+
+   return renderer;
+}
+
+void gf_addrenderdriver(_THIS)
+{
+   uint32_t it;
+
+   for (it=0; it<_this->num_displays; it++)
+   {
+      SDL_AddRenderDriver(it, &gf_renderdriver);
+   }
+}
+
+/****************************************************************************/
+/* SDL render interface                                                     */
+/****************************************************************************/
+static int gf_displaymodechanged(SDL_Renderer* renderer)
+{
+   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
+
+   /* Remove all allocated surfaces, they are no more valid */
+
+   /* TODO: Add video mode change detection and new parameters detection */
+
+   return 0;
+}
+
+static int gf_activaterenderer(SDL_Renderer* renderer)
+{
+   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
+   SDL_VideoDisplay* display = SDL_GetDisplayFromWindow(rdata->window);
+   SDL_DisplayData* didata = (SDL_DisplayData*)display->driverdata;
+
+   /* Setup current surface as visible */
+   gf_layer_set_surfaces(didata->layer, &rdata->surface[rdata->surface_visible_idx], 1);
+
+   /* Set visible surface when hardware in idle state */
+   gf_layer_update(didata->layer, GF_LAYER_UPDATE_NO_WAIT_IDLE);
+
+   return 0;
+}
+
+static int gf_createtexture(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+   SDL_RenderData* renderdata=(SDL_RenderData*)renderer->driverdata;
+   SDL_Window* window=SDL_GetWindowFromID(renderer->window);
+   SDL_VideoDisplay* display=SDL_GetDisplayFromWindow(window);
+   SDL_TextureData* tdata=NULL;
+
+   /* Allocate texture driver data */
+   tdata=(SDL_TextureData*)SDL_calloc(1, sizeof(SDL_TextureData));
+   if (tdata==NULL)
+   {
+      SDL_OutOfMemory();
+      return -1;
+   }
+
+   /* Set texture driver data */
+   texture->driverdata=tdata;
+
+}
+
+static int gf_querytexturepixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch)
+{
+}
+
+static int gf_settexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Color* colors, int firstcolor, int ncolors)
+{
+}
+
+static int gf_gettexturepalette(SDL_Renderer* renderer, SDL_Texture* texture, SDL_Color* colors, int firstcolor, int ncolors)
+{
+}
+
+static int gf_settexturecolormod(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static int gf_settexturealphamod(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static int gf_settextureblendmode(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static int gf_settexturescalemode(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static int gf_updatetexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch)
+{
+}
+
+static int gf_locktexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int markDirty, void** pixels, int* pitch)
+{
+}
+
+static void gf_unlocktexture(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static void gf_dirtytexture(SDL_Renderer* renderer, SDL_Texture* texture, int numrects, const SDL_Rect* rects)
+{
+}
+
+static int gf_renderpoint(SDL_Renderer* renderer, int x, int y)
+{
+}
+
+static int gf_renderline(SDL_Renderer* renderer, int x1, int y1, int x2, int y2)
+{
+}
+
+static int gf_renderfill(SDL_Renderer* renderer, const SDL_Rect* rect)
+{
+}
+
+static int gf_rendercopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect)
+{
+}
+
+static void gf_renderpresent(SDL_Renderer* renderer)
+{
+}
+
+static void gf_destroytexture(SDL_Renderer* renderer, SDL_Texture* texture)
+{
+}
+
+static void gf_destroyrenderer(SDL_Renderer* renderer)
+{
+   SDL_RenderData* rdata=(SDL_RenderData*)renderer->driverdata;
+   uint32_t it;
+
+   for (it=0; it<rdata->surfaces_count; it++)
+   {
+      gf_surface_free(rdata->surface[it]);
+   }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/qnxgf/SDL_gf_render.h	Sun Mar 15 15:50:18 2009 +0000
+++ b/src/video/qnxgf/SDL_gf_render.h	Tue Mar 17 03:24:22 2009 +0000
@@ -18,6 +18,10 @@
 
     Sam Lantinga
     slouken@libsdl.org
+
+    QNX Graphics Framework SDL driver
+    Copyright (C) 2009 Mike Gorchak
+    (mike@malva.ua, lestat@i.com.ua)
 */
 
 #ifndef __SDL_GF_RENDER_H__
@@ -27,4 +31,27 @@
 
 #include <gf/gf.h>
 
+#define SDL_GF_MAX_SURFACES 3
+
+typedef struct SDL_RenderData
+{
+   SDL_Window*        window;        /* SDL window type                    */
+   SDL_bool           enable_vsync;  /* VSYNC flip synchronization enable  */
+   gf_surface_t       surface[SDL_GF_MAX_SURFACES]; /* Surface handles     */
+   gf_surface_info_t  surface_info[SDL_GF_MAX_SURFACES]; /* Surface info   */
+   uint32_t           surface_visible_idx; /* Index of visible surface     */
+   uint32_t           surface_render_idx;  /* Index of render surface      */
+   uint32_t           surfaces_count;      /* Amount of allocated surfaces */
+} SDL_RenderData;
+
+typedef struct SDL_TextureData
+{
+   gf_surface_t       surface;
+   gf_surface_info_t  surface_info;
+} SDL_TextureData;
+
+extern void gf_addrenderdriver(_THIS);
+
 #endif /* __SDL_GF_RENDER_H__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/qnxgf/SDL_qnxgf.c	Sun Mar 15 15:50:18 2009 +0000
+++ b/src/video/qnxgf/SDL_qnxgf.c	Tue Mar 17 03:24:22 2009 +0000
@@ -18,6 +18,10 @@
 
     Sam Lantinga
     slouken@libsdl.org
+
+    QNX Graphics Framework SDL driver
+    Copyright (C) 2009 Mike Gorchak
+    (mike@malva.ua, lestat@i.com.ua)
 */
 
 #include "SDL_config.h"
@@ -30,6 +34,7 @@
 #include <gf/gf.h>
 
 #include "SDL_qnxgf.h"
+#include "SDL_gf_render.h"
 #include "SDL_gf_pixelfmt.h"
 
 /******************************************************************************/
@@ -62,7 +67,10 @@
    {0, 1280, 768, 60, NULL},   /* 1280x768 mode is 60Hz only               */
    {0, 1280, 800, 60, NULL},   /* 1280x800 mode is 60Hz only               */
    {0, 1280, 960, 60, NULL},   /* 1280x960 mode is 60Hz only               */
-   {0, 1280, 1024, 60, NULL},  /* 1280x1024 mode is 60Hz only              */
+   {0, 1280, 1024, 60, NULL},  /* 1280x1024 modes are 60Hz, 75Hz, 85Hz and */
+   {0, 1280, 1024, 75, NULL},  /* 100 Hz                                   */
+   {0, 1280, 1024, 85, NULL},  /*                                          */
+   {0, 1280, 1024, 100, NULL}, /*                                          */
    {0, 1400, 1050, 60, NULL},  /* 1400x1050 mode is 60Hz only              */
    {0, 1440, 900, 60, NULL},   /* 1440x900 mode is 60Hz only               */
    {0, 1440, 960, 60, NULL},   /* 1440x960 mode is 60Hz only               */
@@ -75,6 +83,69 @@
    {0,    0,    0,  0, NULL}   /* End of generic mode list                 */
 };
 
+/* Low level device graphics driver names, which they are reporting */
+GF_DeviceCaps gf_devicename[]=
+{
+   /* ATI Rage 128 graphics driver (devg-ati_rage128)      */
+   {"ati_rage128", SDL_GF_ACCELERATED},
+   /* Fujitsu Carmine graphics driver (devg-carmine.so)    */
+   {"carmine", SDL_GF_ACCELERATED},
+   /* C&T graphics driver (devg-chips.so)                  */
+   {"chips", SDL_GF_ACCELERATED},
+   /* Fujitsu Coral graphics driver (devg-coral.so)        */
+   {"coral", SDL_GF_ACCELERATED},
+   /* Intel integrated graphics driver (devg-extreme2.so)  */
+   {"extreme2", SDL_GF_ACCELERATED},
+   /* Unaccelerated FB driver (devg-flat.so)               */
+   {"flat", SDL_GF_UNACCELERATED},
+   /* NS Geode graphics driver (devg-geode.so)             */
+   {"geode", SDL_GF_ACCELERATED},
+   /* Geode LX graphics driver (devg-geodelx.so)           */
+   {"geodelx", SDL_GF_ACCELERATED},
+   /* Intel integrated graphics driver (devg-gma9xx.so)    */
+   {"gma", SDL_GF_ACCELERATED},
+   /* Intel integrated graphics driver (devg-i810.so)      */
+   {"i810", SDL_GF_ACCELERATED},
+   /* Intel integrated graphics driver (devg-i830.so)      */
+   {"i830", SDL_GF_ACCELERATED},
+   /* Geode LX graphics driver (devg-lx800.so)             */
+   {"lx800", SDL_GF_ACCELERATED},
+   /* Matrox Gxx graphics driver (devg-matroxg.so)         */
+   {"matroxg", SDL_GF_ACCELERATED},
+   /* Intel Poulsbo graphics driver (devg-poulsbo.so)      */
+   {"poulsbo", SDL_GF_ACCELERATED},
+   /* ATI Radeon driver (devg-radeon.so)                   */
+   {"radeon", SDL_GF_ACCELERATED},
+   /* ATI Rage driver (devg-rage.so)                       */
+   {"rage", SDL_GF_ACCELERATED},
+   /* S3 Savage graphics driver (devg-s3_savage.so)        */
+   {"s3_savage", SDL_GF_ACCELERATED},
+   /* SiS630 integrated graphics driver (devg-sis630.so)   */
+   {"sis630", SDL_GF_ACCELERATED},
+   /* PowerVR SGX 535 graphics driver (devg-poulsbo.so)    */
+   {"sgx", SDL_GF_ACCELERATED},
+   /* SM Voyager GX graphics driver (devg-smi5xx.so)       */
+   {"smi5xx", SDL_GF_ACCELERATED},
+   /* Silicon Motion graphics driver (devg-smi7xx.so)      */
+   {"smi7xx", SDL_GF_ACCELERATED},
+   /* SVGA unaccelerated gfx driver (devg-svga.so)         */
+   {"svga", SDL_GF_UNACCELERATED},
+   /* nVidia TNT graphics driver (devg-tnt.so)             */
+   {"tnt", SDL_GF_ACCELERATED},
+   /* VIA integrated graphics driver (devg-tvia.so)        */
+   {"tvia", SDL_GF_ACCELERATED},
+   /* VIA UniChrome graphics driver (devg-unichrome.so)    */
+   {"unichrome", SDL_GF_ACCELERATED},
+   /* VESA unaccelerated gfx driver (devg-vesa.so)         */
+   {"vesa", SDL_GF_UNACCELERATED},
+   /* VmWare graphics driver (devg-volari.so)              */
+   {"vmware", SDL_GF_ACCELERATED},
+   /* XGI XP10 graphics driver (devg-volari.so)            */
+   {"volari", SDL_GF_ACCELERATED},
+   /* End of list */
+   {NULL, 0x00000000}
+};
+
 /*****************************************************************************/
 /* SDL Video Device initialization functions                                 */
 /*****************************************************************************/
@@ -110,10 +181,8 @@
 
    if (device->driverdata!=NULL)
    {
-      SDL_free(device->driverdata);
       device->driverdata=NULL;
    }
-   SDL_free(device);
 }
 
 static SDL_VideoDevice* qnxgf_create(int devindex)
@@ -123,7 +192,7 @@
    int              status;
 
    /* Initialize SDL_VideoDevice structure */
-   device = (SDL_VideoDevice*)SDL_calloc(1, sizeof(SDL_VideoDevice));
+   device=(SDL_VideoDevice*)SDL_calloc(1, sizeof(SDL_VideoDevice));
    if (device==NULL)
    {
       SDL_OutOfMemory();
@@ -131,7 +200,7 @@
    }
 
    /* Initialize internal GF specific data */
-   gfdata = (SDL_VideoData*)SDL_calloc(1, sizeof(SDL_VideoData));
+   gfdata=(SDL_VideoData*)SDL_calloc(1, sizeof(SDL_VideoData));
    if (gfdata==NULL)
    {
       SDL_OutOfMemory();
@@ -212,6 +281,8 @@
 {
    SDL_VideoData* gfdata=(SDL_VideoData*)_this->driverdata;
    uint32_t it;
+   uint32_t jt;
+   char* override;
 
    /* Add each detected output to SDL */
    for (it=0; it<gfdata->gfdev_info.ndisplays; it++)
@@ -243,7 +314,7 @@
       {
          /* video initialization problem */
          SDL_free(didata);
-         SDL_SetError("Display query failed");
+         SDL_SetError("display query failed");
          return -1;
       }
 
@@ -253,17 +324,69 @@
       {
          /* video initialization problem */
          SDL_free(didata);
-         SDL_SetError("Couldn't not attach to display");
+         SDL_SetError("couldn't attach to display");
+         return -1;
+      }
+
+      /* Initialize status variables */
+      didata->layer_attached=SDL_FALSE;
+
+      /* Attach to main display layer */
+      status=gf_layer_attach(&didata->layer, didata->display, didata->display_info.main_layer_index, 0);
+      if (status!=GF_ERR_OK)
+      {
+         SDL_SetError("couldn't attach to main layer, it could be busy");
+
+         /* Failed to attach to main layer */
          return -1;
       }
 
+      /* Enable layer in case if hardware supports layer enable/disable */
+      gf_layer_enable(didata->layer);
+
+      /* Mark main display layer is attached */
+      didata->layer_attached=SDL_TRUE;
+
+      /* Copy device name for each display */
+      SDL_strlcpy(didata->description, gfdata->gfdev_info.description, SDL_VIDEO_GF_DEVICENAME_MAX-1);
+
+      /* Search device capabilities and possible workarounds */
+      jt=0;
+      do {
+         if (gf_devicename[jt].name==NULL)
+         {
+            break;
+         }
+         if (SDL_strncmp(gf_devicename[jt].name, didata->description, SDL_strlen(gf_devicename[jt].name))==0)
+         {
+            didata->caps=gf_devicename[jt].caps;
+         }
+         jt++;
+      } while(1);
+
+      /* Initialize display structure */
       SDL_zero(display);
       display.desktop_mode = current_mode;
       display.current_mode = current_mode;
       display.driverdata = didata;
+      didata->current_mode=current_mode;
       SDL_AddVideoDisplay(&display);
+
+      /* Check for environment variables which could override some SDL settings */
+      didata->custom_refresh=0;
+      override = SDL_getenv("SDL_VIDEO_GF_REFRESH_RATE");
+      if (override!=NULL)
+      {
+         if (SDL_sscanf(override, "%u", &didata->custom_refresh)!=1)
+         {
+            didata->custom_refresh=0;
+         }
+      }
    }
 
+   /* Add GF renderer to SDL */
+   gf_addrenderdriver(_this);
+
    /* video has been initialized successfully */
    return 1;
 }
@@ -273,6 +396,7 @@
    SDL_DisplayData* didata;
    uint32_t it;
 
+   /* SDL will restore our desktop mode on exit */
    for(it=0; it<_this->num_displays; it++)
    {
       didata=_this->displays[it].driverdata;
@@ -284,7 +408,7 @@
 
 void qnxgf_getdisplaymodes(_THIS)
 {
-   SDL_DisplayData* didata = (SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
    SDL_DisplayMode  mode;
    gf_modeinfo_t    modeinfo;
    uint32_t it=0;
@@ -358,25 +482,155 @@
 
 int qnxgf_setdisplaymode(_THIS, SDL_DisplayMode* mode)
 {
-   SDL_DisplayData* didata = (SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+   uint32_t refresh_rate=0;
    int result;
 
-   result=gf_display_set_mode(didata->display, mode->w, mode->h, mode->refresh_rate,
+   /* Current display dimensions and bpp are no more valid */
+   didata->current_mode.format=SDL_PIXELFORMAT_UNKNOWN;
+   didata->current_mode.w=0;
+   didata->current_mode.h=0;
+
+   /* Check if custom refresh rate requested */
+   if (didata->custom_refresh!=0)
+   {
+      refresh_rate=didata->custom_refresh;
+   }
+   else
+   {
+      refresh_rate=mode->refresh_rate;
+   }
+
+   /* Check if SDL GF driver needs to find appropriate refresh rate itself */
+   if (refresh_rate==0)
+   {
+      uint32_t it;
+      SDL_DisplayMode tempmode;
+
+      /* Clear display mode structure */
+      SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode));
+      tempmode.refresh_rate=0x0000FFFF;
+
+      /* Check if window width and height matches one of our modes */
+      for (it=0; it<SDL_CurrentDisplay.num_display_modes; it++)
+      {
+         if ((SDL_CurrentDisplay.display_modes[it].w==mode->w) &&
+             (SDL_CurrentDisplay.display_modes[it].h==mode->h) &&
+             (SDL_CurrentDisplay.display_modes[it].format==mode->format))
+         {
+            /* Find the lowest refresh rate available */
+            if (tempmode.refresh_rate>SDL_CurrentDisplay.display_modes[it].refresh_rate)
+            {
+               tempmode=SDL_CurrentDisplay.display_modes[it];
+            }
+         }
+      }
+      if (tempmode.refresh_rate!=0x0000FFFF)
+      {
+         refresh_rate=tempmode.refresh_rate;
+      }
+      else
+      {
+         /* Let video driver decide what to do with this */
+         refresh_rate=0;
+      }
+   }
+
+   /* Check if SDL GF driver needs to check custom refresh rate */
+   if (didata->custom_refresh!=0)
+   {
+      uint32_t it;
+      SDL_DisplayMode tempmode;
+
+      /* Clear display mode structure */
+      SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode));
+      tempmode.refresh_rate=0x0000FFFF;
+
+      /* Check if window width and height matches one of our modes */
+      for (it=0; it<SDL_CurrentDisplay.num_display_modes; it++)
+      {
+         if ((SDL_CurrentDisplay.display_modes[it].w==mode->w) &&
+             (SDL_CurrentDisplay.display_modes[it].h==mode->h) &&
+             (SDL_CurrentDisplay.display_modes[it].format==mode->format))
+         {
+            /* Find the lowest refresh rate available */
+            if (tempmode.refresh_rate>SDL_CurrentDisplay.display_modes[it].refresh_rate)
+            {
+               tempmode=SDL_CurrentDisplay.display_modes[it];
+            }
+
+            /* Check if requested refresh rate found */
+            if (refresh_rate==SDL_CurrentDisplay.display_modes[it].refresh_rate)
+            {
+               tempmode=SDL_CurrentDisplay.display_modes[it];
+               break;
+            }
+         }
+      }
+      if (tempmode.refresh_rate!=0x0000FFFF)
+      {
+         refresh_rate=tempmode.refresh_rate;
+      }
+      else
+      {
+         /* Let video driver decide what to do with this */
+         refresh_rate=0;
+      }
+   }
+
+   /* Detach layer before switch to new graphics mode */
+   if (didata->layer_attached==SDL_TRUE)
+   {
+      /* Disable layer if hardware supports this */
+      gf_layer_disable(didata->layer);
+
+      /* Detach from layer, free it for others */
+      gf_layer_detach(didata->layer);
+
+      /* Mark it as detached */
+      didata->layer_attached=SDL_FALSE;
+   }
+
+   /* Set new display video mode */
+   result=gf_display_set_mode(didata->display, mode->w, mode->h, refresh_rate,
                               qnxgf_sdl_to_gf_pixelformat(mode->format), 0);
    if (result!=GF_ERR_OK)
    {
       /* Display mode/resolution switch has been failed */
-      SDL_SetError("Mode is not supported by qnxgf driver");
+      SDL_SetError("mode is not supported by graphics driver");
       return -1;
    }
+   else
+   {
+      didata->current_mode=*mode;
+      didata->current_mode.refresh_rate=refresh_rate;
+   }
+
+   /* Attach to main display layer */
+   result=gf_layer_attach(&didata->layer, didata->display, didata->display_info.main_layer_index, 0);
+   if (result!=GF_ERR_OK)
+   {
+      SDL_SetError("couldn't attach to main layer, it could be busy");
+
+      /* Failed to attach to main displayable layer */
+      return -1;
+   }
+
+   /* Enable layer in case if hardware supports layer enable/disable */
+   gf_layer_enable(didata->layer);
+
+   /* Mark main display layer is attached */
+   didata->layer_attached=SDL_TRUE;
 
    return 0;
 }
 
 int qnxgf_setdisplaypalette(_THIS, SDL_Palette* palette)
 {
-   /* Palette must be set through the QNXGF renderer */
-   /* It connected to surface, part of it            */
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+
+   /* QNX GF doesn't have support for global palette changing, but we */
+   /* could store it for usage in future */
 
    /* Setting display palette operation has been failed */
    return -1;
@@ -384,7 +638,10 @@
 
 int qnxgf_getdisplaypalette(_THIS, SDL_Palette* palette)
 {
-   /* We can give to upper level palette, which it set before */
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+
+   /* We can't provide current palette settings and looks like SDL          */
+   /* do not call this function also, in such case this function returns -1 */
 
    /* Getting display palette operation has been failed */
    return -1;
@@ -392,12 +649,11 @@
 
 int qnxgf_setdisplaygammaramp(_THIS, Uint16* ramp)
 {
-   SDL_DisplayData* didata = (SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
    int status;
 
-   /* GF can set Color LUT independently for each color channel, but SDL */
-   /* uses combined gamma ramp, set it to each channel                   */
-   status=gf_display_set_color_lut16(didata->display, (uint16_t*)ramp, (uint16_t*)ramp, (uint16_t*)ramp);
+   /* Setup gamma ramp, for each color channel */
+   status=gf_display_set_color_lut16(didata->display, (uint16_t*)ramp, (uint16_t*)ramp+256, (uint16_t*)ramp+512);
    if (status!=GF_ERR_OK)
    {
       /* Setting display gamma ramp operation has been failed */
@@ -409,7 +665,8 @@
 
 int qnxgf_getdisplaygammaramp(_THIS, Uint16* ramp)
 {
-   /* We need to return previous gamma set */
+   /* TODO: We need to return previous gamma set           */
+   /*       Also we need some initial fake gamma to return */
 
    /* Getting display gamma ramp operation has been failed */
    return -1;
@@ -417,8 +674,82 @@
 
 int qnxgf_createwindow(_THIS, SDL_Window* window)
 {
-   /* Failed to create new window */
-   return -1;
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+   SDL_WindowData*  wdata;
+
+   /* QNX GF supports fullscreen window modes only */
+   if ((window->flags & SDL_WINDOW_FULLSCREEN)!=SDL_WINDOW_FULLSCREEN)
+   {
+      uint32_t it;
+      SDL_DisplayMode mode;
+
+      /* Clear display mode structure */
+      SDL_memset(&mode, 0x00, sizeof(SDL_DisplayMode));
+      mode.refresh_rate=0x0000FFFF;
+
+      /* Check if window width and height matches one of our modes */
+      for (it=0; it<SDL_CurrentDisplay.num_display_modes; it++)
+      {
+         if ((SDL_CurrentDisplay.display_modes[it].w==window->w) &&
+             (SDL_CurrentDisplay.display_modes[it].h==window->h) &&
+             (SDL_CurrentDisplay.display_modes[it].format==SDL_CurrentDisplay.desktop_mode.format))
+         {
+            /* Find the lowest refresh rate available */
+            if (mode.refresh_rate>SDL_CurrentDisplay.display_modes[it].refresh_rate)
+            {
+               mode=SDL_CurrentDisplay.display_modes[it];
+            }
+         }
+      }
+
+      /* Check if end of display list has been reached */
+      if (mode.refresh_rate==0x0000FFFF)
+      {
+         SDL_SetError("desired video mode is not supported");
+
+         /* Failed to create new window */
+         return -1;
+      }
+      else
+      {
+         /* Tell to the caller that mode will be fullscreen */
+         window->flags|=SDL_WINDOW_FULLSCREEN;
+
+         /* Setup fullscreen mode, bpp used from desktop mode in this case */
+         qnxgf_setdisplaymode(_this, &mode);
+      }
+   }
+
+   /* Setup our own window decorations, which are depend on fullscreen mode */
+   window->flags|=SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS |
+                  SDL_WINDOW_MAXIMIZED | SDL_WINDOW_INPUT_GRABBED |
+                  SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS;
+   window->flags&=~(SDL_WINDOW_RESIZABLE | SDL_WINDOW_MINIMIZED);
+
+   /* Ignore any window position settings */
+   window->x=SDL_WINDOWPOS_UNDEFINED;
+   window->y=SDL_WINDOWPOS_UNDEFINED;
+
+   /* Allocate window internal data */
+   wdata=(SDL_WindowData*)SDL_calloc(1, sizeof(SDL_WindowData));
+   if (wdata==NULL)
+   {
+      SDL_OutOfMemory();
+      return -1;
+   }
+
+   /* Setup driver data for this window */
+   window->driverdata=wdata;
+
+   /* Check if window must support OpenGL ES rendering */
+   if ((window->flags & SDL_WINDOW_OPENGL)==SDL_WINDOW_OPENGL)
+   {
+      /* Mark this window as OpenGL ES compatible */
+      wdata->uses_gles=SDL_TRUE;
+   }
+
+   /* Window has been successfully created */
+   return 0;
 }
 
 int qnxgf_createwindowfrom(_THIS, SDL_Window* window, const void* data)
@@ -473,7 +804,12 @@
 
 void qnxgf_destroywindow(_THIS, SDL_Window* window)
 {
-   printf("qnxgf_destroywindow()\n");
+   SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
+   SDL_WindowData*  wdata=(SDL_WindowData*)window->driverdata;
+
+   if (wdata!=NULL)
+   {
+   }
 }
 
 /*****************************************************************************/
@@ -481,13 +817,16 @@
 /*****************************************************************************/
 SDL_bool qnxgf_getwindowwminfo(_THIS, SDL_Window* window, struct SDL_SysWMinfo* info)
 {
-   if (info->version.major <= SDL_MAJOR_VERSION)
+   /* QNX GF do not operates at window level, this means we are have no */
+   /* Window Manager available, no specific data in SDL_SysWMinfo too   */
+
+   if (info->version.major<=SDL_MAJOR_VERSION)
    {
       return SDL_TRUE;
    }
    else
    {
-      SDL_SetError("Application not compiled with SDL %d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+      SDL_SetError("application not compiled with SDL %d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
       return SDL_FALSE;
    }
 
--- a/src/video/qnxgf/SDL_qnxgf.h	Sun Mar 15 15:50:18 2009 +0000
+++ b/src/video/qnxgf/SDL_qnxgf.h	Tue Mar 17 03:24:22 2009 +0000
@@ -18,6 +18,10 @@
 
     Sam Lantinga
     slouken@libsdl.org
+
+    QNX Graphics Framework SDL driver
+    Copyright (C) 2009 Mike Gorchak
+    (mike@malva.ua, lestat@i.com.ua)
 */
 
 #ifndef __SDL_QNXGF_H__
@@ -34,12 +38,38 @@
    SDL_bool      gfinitialized;      /* GF device initialization status      */
 } SDL_VideoData;
 
+#define SDL_VIDEO_GF_DEVICENAME_MAX 257
+
 typedef struct SDL_DisplayData
 {
-   gf_display_info_t display_info;   /* GF display information               */
-   gf_display_t      display;        /* GF display handle                    */
+   gf_display_info_t display_info;     /* GF display information             */
+   gf_display_t      display;          /* GF display handle                  */
+   uint32_t          custom_refresh;   /* Custom refresh rate for all modes  */
+   SDL_DisplayMode   current_mode;     /* Current video mode                 */
+   uint8_t           description[SDL_VIDEO_GF_DEVICENAME_MAX];
+                                       /* Device description                 */
+   uint32_t          caps;             /* Device capabilities                */
+   SDL_bool          layer_attached;   /* Layer attach status                */
+   gf_layer_t        layer;            /* Graphics layer to which attached   */
 } SDL_DisplayData;
 
+typedef struct SDL_WindowData
+{
+   SDL_bool     uses_gles;           /* if true window must support OpenGL ES*/
+} SDL_WindowData;
+
+/****************************************************************************/
+/* Low level GF graphics driver capabilities                                */
+/****************************************************************************/
+typedef struct GF_DeviceCaps
+{
+   uint8_t* name;
+   uint32_t caps;
+} GF_DeviceCaps;
+
+#define SDL_GF_UNACCELERATED         0x00000000
+#define SDL_GF_ACCELERATED           0x00000001
+
 /****************************************************************************/
 /* SDL_VideoDevice functions declaration                                    */
 /****************************************************************************/
@@ -89,3 +119,5 @@
 void qnxgf_suspendscreensaver(_THIS);
 
 #endif /* __SDL_QNXGF_H__ */
+
+/* vi: set ts=4 sw=4 expandtab: */