Commit 4d78fdce authored by Sam Lantinga's avatar Sam Lantinga

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.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403558
parent 65fa3414
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.
......@@ -664,6 +664,7 @@ SDL_SetFullscreenDisplayMode(const SDL_DisplayMode * mode)
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 @@ SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags)
/* 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;
......
......@@ -18,12 +18,22 @@
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;
static int photon_available(void)
......@@ -56,14 +66,301 @@ static void photon_destroy(SDL_VideoDevice* device)
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: */
/*
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: */
This diff is collapsed.
/*
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: */
......@@ -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 @@ uint32_t qnxgf_gf_to_sdl_pixelformat(gf_format_t pixelfmt)
return SDL_PIXELFORMAT_UNKNOWN;
}
/* vi: set ts=4 sw=4 expandtab: */
......@@ -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 @@ gf_format_t qnxgf_sdl_to_gf_pixelformat(uint32_t pixelfmt);
uint32_t qnxgf_gf_to_sdl_pixelformat(gf_format_t pixelfmt);
#endif /* __SDL_GF_PIXELFMT_H__ */
/* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
......@@ -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: */
This diff is collapsed.
......@@ -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 @@ typedef struct SDL_VideoData
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 */
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_pumpevents(_THIS);
void qnxgf_suspendscreensaver(_THIS);
#endif /* __SDL_QNXGF_H__ */
/* vi: set ts=4 sw=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment