19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL - Simple DirectMedia Layer 39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Copyright (C) 1997-2012 Sam Lantinga 49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is free software; you can redistribute it and/or 69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall modify it under the terms of the GNU Library General Public 79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License as published by the Free Software Foundation; either 89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall version 2 of the License, or (at your option) any later version. 99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is distributed in the hope that it will be useful, 119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall but WITHOUT ANY WARRANTY; without even the implied warranty of 129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Library General Public License for more details. 149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall You should have received a copy of the GNU Library General Public 169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License along with this library; if not, write to the Free 179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Sam Lantinga 209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall slouken@libsdl.org 219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/ 229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_config.h" 239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef __SDL_PH_VIDEO_H__ 259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define __SDL_PH_VIDEO_H__ 269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_mouse.h" 289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "../SDL_sysvideo.h" 299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <sys/neutrino.h> 319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <Ph.h> 339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <Pt.h> 349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <photon/Pg.h> 359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <photon/PdDirect.h> 369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_VIDEO_OPENGL 389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #if (_NTO_VERSION < 630) 399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #include <photon/PdGL.h> 409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #else 419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #include <GL/qnxgl.h> 429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #include <GL/GLPh.h> 439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #endif /* 6.3.0 */ 449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* SDL_VIDEO_OPENGL */ 459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Hidden "this" pointer for the video functions */ 479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define _THIS SDL_VideoDevice* this 489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define PH_OGL_MAX_ATTRIBS 32 509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDLPH_PAL_NONE 0x00000000L 529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDLPH_PAL_EMULATE 0x00000001L 539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDLPH_PAL_SYSTEM 0x00000002L 549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef struct 569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char* Y; 589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char* V; 599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char* U; 609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} FRAMEDATA; 619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Mask values for SDL_ReallocFormat() */ 639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstruct ColourMasks 649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 red; 669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 green; 679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 blue; 689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 alpha; 699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 bpp; 709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Private display data */ 739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstruct SDL_PrivateVideoData 749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PgDisplaySettings_t mode_settings; 769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PtWidget_t *Window; /* used to handle input events */ 779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PhImage_t *image; /* used to display image */ 789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_VIDEO_OPENGL 799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #if (_NTO_VERSION < 630) 809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PdOpenGLContext_t* OGLContext; /* OpenGL context */ 819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall void* OGLBuffers; /* OpenGL buffers (unused) */ 829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #else 839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall qnxglc_t* OGLContext; /* OpenGL context for the 6.3 */ 849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall qnxgl_bufs_t* OGLBuffers; /* OpenGL buffers for the 6.3 */ 859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #endif /* 630 */ 869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 OGLFlags; /* OpenGL flags */ 889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 OGLBPP; /* OpenGL bpp */ 899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* SDL_VIDEO_OPENGL */ 909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PgColor_t savedpal[_Pg_MAX_PALETTE]; 919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PgColor_t syspalph[_Pg_MAX_PALETTE]; 929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall struct 949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PdDirectContext_t* direct_context; 969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PdOffscreenContext_t* offscreen_context; 979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PdOffscreenContext_t* offscreen_backcontext; 989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PhDrawContext_t* oldDC; 999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall uint8_t* dc_ptr; 1009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char* CurrentFrameData; 1019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char* FrameData0; 1029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char* FrameData1; 1039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 current; 1049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 flags; 1059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } ocimage; 1069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PgHWCaps_t graphics_card_caps; /* Graphics card caps at the moment of start */ 1089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PgVideoModeInfo_t desktop_mode; /* Current desktop video mode information */ 1099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int old_video_mode; /* Stored mode before fullscreen switch */ 1109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int old_refresh_rate; /* Stored refresh rate befor fullscreen switch */ 1119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int mouse_relative; 1139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall WMcursor* BlankCursor; 1149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall uint32_t videomode_emulatemode; 1159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 visualbpp; /* current visual bpp */ 1179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 desktopbpp; /* bpp of desktop at the moment of start */ 1189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 desktoppal; /* palette mode emulation or system */ 1199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int currently_fullscreen; 1219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int currently_hided; /* 1 - window hided (minimazed), 0 - normal */ 1229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int currently_maximized; /* 1 - window hided (minimazed), 0 - normal */ 1239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall PhEvent_t* event; 1259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Overlay* overlay; 1269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 1279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define mode_settings (this->hidden->mode_settings) 1299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define window (this->hidden->Window) 1309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_Image (this->hidden->image) 1319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define OCImage (this->hidden->ocimage) 1329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define old_video_mode (this->hidden->old_video_mode) 1339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define old_refresh_rate (this->hidden->old_refresh_rate) 1349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define graphics_card_caps (this->hidden->graphics_card_caps) 1359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define desktopbpp (this->hidden->desktopbpp) 1369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define visualbpp (this->hidden->visualbpp) 1379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define desktoppal (this->hidden->desktoppal) 1389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define savedpal (this->hidden->savedpal) 1399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define syspalph (this->hidden->syspalph) 1409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define currently_fullscreen (this->hidden->currently_fullscreen) 1419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define currently_hided (this->hidden->currently_hided) 1429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define currently_maximized (this->hidden->currently_maximized) 1439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define phevent (this->hidden->event) 1449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define current_overlay (this->hidden->overlay) 1459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define desktop_mode (this->hidden->desktop_mode) 1469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define mouse_relative (this->hidden->mouse_relative) 1479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_BlankCursor (this->hidden->BlankCursor) 1489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define videomode_emulatemode (this->hidden->videomode_emulatemode) 1499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_VIDEO_OPENGL 1519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define oglctx (this->hidden->OGLContext) 1529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define oglbuffers (this->hidden->OGLBuffers) 1539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define oglflags (this->hidden->OGLFlags) 1549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define oglbpp (this->hidden->OGLBPP) 1559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* SDL_VIDEO_OPENGL */ 1569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* __SDL_PH_VIDEO_H__ */ 158