Mercurial > sdl-ios-xcode
annotate src/video/qnxgf/SDL_qnxgf.c @ 4525:3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
In function GLES_RenderCopy() in SDL_renderer_gles.c:819 there is one memcpy()
that can be avoided if we're updating whole texture.
Because of that the SDL 1.3 in compatibility mode is working even slower than
software rendering in SDL 1.2.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 14 Jul 2010 07:31:35 -0700 |
parents | f7b03b6838cb |
children | be02be2ea897 |
rev | line source |
---|---|
3083
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
3697 | 3 Copyright (C) 1997-2010 Sam Lantinga |
3083
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
21 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
22 QNX Graphics Framework SDL driver |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
23 Copyright (C) 2009 Mike Gorchak |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
24 (mike@malva.ua, lestat@i.com.ua) |
3083
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 */ |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 #include "SDL_config.h" |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 #include "../SDL_sysvideo.h" |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
30 #include "SDL_version.h" |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
31 #include "SDL_syswm.h" |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
32 #include "SDL_loadso.h" |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
33 |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
34 /* Include QNX Graphics Framework declarations */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
35 #include <gf/gf.h> |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
36 |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
37 #include "SDL_qnxgf.h" |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
38 #include "SDL_gf_render.h" |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
39 #include "SDL_gf_pixelfmt.h" |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
40 #include "SDL_gf_opengles.h" |
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
41 #include "SDL_gf_input.h" |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
42 |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
43 /******************************************************************************/ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
44 /* SDL Generic video modes, which could provide GF */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
45 /* This is real pain in the ass. GF is just wrapper around a selected driver */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
46 /* some drivers could support double scan modes, like 320x200, 512x384, etc */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
47 /* but some drivers are not. Later we can distinguish one driver from another */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
48 /* Feel free to add any new custom graphics mode */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
49 /******************************************************************************/ |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
50 static const SDL_DisplayMode generic_mode[] = { |
3139 | 51 {0, 320, 200, 70, NULL}, /* 320x200 modes are 70Hz and 85Hz */ |
52 {0, 320, 200, 85, NULL}, | |
53 {0, 320, 240, 70, NULL}, /* 320x240 modes are 70Hz and 85Hz */ | |
54 {0, 320, 240, 85, NULL}, | |
55 {0, 400, 300, 60, NULL}, /* 400x300 mode is 60Hz only */ | |
56 {0, 480, 360, 60, NULL}, /* 480x360 mode is 60Hz only */ | |
57 {0, 512, 384, 60, NULL}, /* 512x384 modes are 60Hz and 70Hz */ | |
58 {0, 512, 384, 70, NULL}, | |
59 {0, 640, 480, 60, NULL}, /* 640x480 modes are 60Hz, 75Hz, 85Hz */ | |
60 {0, 640, 480, 75, NULL}, | |
61 {0, 640, 480, 85, NULL}, | |
62 {0, 800, 600, 60, NULL}, /* 800x600 modes are 60Hz, 75Hz, 85Hz */ | |
63 {0, 800, 600, 75, NULL}, | |
64 {0, 800, 600, 85, NULL}, | |
65 {0, 800, 480, 60, NULL}, /* 800x480 mode is 60Hz only */ | |
66 {0, 848, 480, 60, NULL}, /* 848x480 mode is 60Hz only */ | |
67 {0, 960, 600, 60, NULL}, /* 960x600 mode is 60Hz only */ | |
68 {0, 1024, 640, 60, NULL}, /* 1024x640 mode is 60Hz only */ | |
69 {0, 1024, 768, 60, NULL}, /* 1024x768 modes are 60Hz, 70Hz, 75Hz */ | |
70 {0, 1024, 768, 70, NULL}, | |
71 {0, 1024, 768, 75, NULL}, | |
72 {0, 1088, 612, 60, NULL}, /* 1088x612 mode is 60Hz only */ | |
73 {0, 1152, 864, 60, NULL}, /* 1152x864 modes are 60Hz, 70Hz, 72Hz */ | |
74 {0, 1152, 864, 70, NULL}, /* 75Hz and 85Hz */ | |
75 {0, 1152, 864, 72, NULL}, | |
76 {0, 1152, 864, 75, NULL}, | |
77 {0, 1152, 864, 85, NULL}, | |
78 {0, 1280, 720, 60, NULL}, /* 1280x720 mode is 60Hz only */ | |
79 {0, 1280, 768, 60, NULL}, /* 1280x768 mode is 60Hz only */ | |
80 {0, 1280, 800, 60, NULL}, /* 1280x800 mode is 60Hz only */ | |
81 {0, 1280, 960, 60, NULL}, /* 1280x960 mode is 60Hz only */ | |
82 {0, 1280, 1024, 60, NULL}, /* 1280x1024 modes are 60Hz, 75Hz, 85Hz and */ | |
83 {0, 1280, 1024, 75, NULL}, /* 100 Hz */ | |
84 {0, 1280, 1024, 85, NULL}, /* */ | |
85 {0, 1280, 1024, 100, NULL}, /* */ | |
86 {0, 1360, 768, 60, NULL}, /* 1360x768 mode is 60Hz only */ | |
87 {0, 1400, 1050, 60, NULL}, /* 1400x1050 mode is 60Hz only */ | |
88 {0, 1440, 900, 60, NULL}, /* 1440x900 mode is 60Hz only */ | |
89 {0, 1440, 960, 60, NULL}, /* 1440x960 mode is 60Hz only */ | |
90 {0, 1600, 900, 60, NULL}, /* 1600x900 mode is 60Hz only */ | |
91 {0, 1600, 1024, 60, NULL}, /* 1600x1024 mode is 60Hz only */ | |
92 {0, 1600, 1200, 60, NULL}, /* 1600x1200 mode is 60Hz only */ | |
93 {0, 1680, 1050, 60, NULL}, /* 1680x1050 mode is 60Hz only */ | |
94 {0, 1920, 1080, 60, NULL}, /* 1920x1080 mode is 60Hz only */ | |
95 {0, 1920, 1200, 60, NULL}, /* 1920x1200 mode is 60Hz only */ | |
96 {0, 1920, 1440, 60, NULL}, /* 1920x1440 mode is 60Hz only */ | |
97 {0, 2048, 1536, 60, NULL}, /* 2048x1536 mode is 60Hz only */ | |
98 {0, 2048, 1080, 60, NULL}, /* 2048x1080 mode is 60Hz only */ | |
99 {0, 0, 0, 0, NULL} /* End of generic mode list */ | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
100 }; |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
101 |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
102 /* Low level device graphics driver names, which they are reporting */ |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
103 static const GF_DeviceCaps gf_devicename[] = { |
3139 | 104 /* ATI Rage 128 graphics driver (devg-ati_rage128) */ |
105 {"ati_rage128", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
106 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
107 /* Fujitsu Carmine graphics driver (devg-carmine.so) */ | |
108 {"carmine", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
109 SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
110 /* C&T graphics driver (devg-chips.so) */ | |
111 {"chips", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
112 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
113 /* Fujitsu Coral graphics driver (devg-coral.so) */ | |
114 {"coral", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
115 SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
116 /* Intel integrated graphics driver (devg-extreme2.so) */ | |
117 {"extreme2", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
118 SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
119 /* Unaccelerated FB driver (devg-flat.so) */ | |
120 {"flat", SDL_GF_UNACCELERATED | SDL_GF_LOWRESOLUTION | | |
121 SDL_GF_UNACCELERATED_3D | SDL_GF_NOVIDEOMEMORY}, | |
122 /* NS Geode graphics driver (devg-geode.so) */ | |
123 {"geode", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
124 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
125 /* Geode LX graphics driver (devg-geodelx.so) */ | |
126 {"geodelx", SDL_GF_ACCELERATED | SDL_GF_LOWRESOLUTION | | |
127 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
128 /* Intel integrated graphics driver (devg-gma9xx.so) */ | |
129 {"gma", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
130 SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
131 /* Intel integrated graphics driver (devg-i810.so) */ | |
132 {"i810", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
133 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
134 /* Intel integrated graphics driver (devg-i830.so) */ | |
135 {"i830", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
136 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
137 /* Geode LX graphics driver (devg-lx800.so) */ | |
138 {"lx800", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
139 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
140 /* Matrox Gxx graphics driver (devg-matroxg.so) */ | |
141 {"matroxg", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
142 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
143 /* Intel Poulsbo graphics driver (devg-poulsbo.so) */ | |
144 {"poulsbo", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
145 SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
146 /* ATI Radeon driver (devg-radeon.so) */ | |
147 {"radeon", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
148 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
149 /* ATI Rage driver (devg-rage.so) */ | |
150 {"rage", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
151 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
152 /* S3 Savage graphics driver (devg-s3_savage.so) */ | |
153 {"s3_savage", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
154 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
155 /* SiS630 integrated graphics driver (devg-sis630.so) */ | |
156 {"sis630", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
157 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
158 /* PowerVR SGX 535 graphics driver (devg-poulsbo.so) */ | |
159 {"sgx", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
160 SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
161 /* SM Voyager GX graphics driver (devg-smi5xx.so) */ | |
162 {"smi5xx", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
163 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
164 /* Silicon Motion graphics driver (devg-smi7xx.so) */ | |
165 {"smi7xx", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
166 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
167 /* SVGA unaccelerated gfx driver (devg-svga.so) */ | |
168 {"svga", SDL_GF_UNACCELERATED | SDL_GF_LOWRESOLUTION | | |
169 SDL_GF_UNACCELERATED_3D | SDL_GF_NOVIDEOMEMORY}, | |
170 /* nVidia TNT graphics driver (devg-tnt.so) */ | |
171 {"tnt", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
172 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
173 /* VIA integrated graphics driver (devg-tvia.so) */ | |
174 {"tvia", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
175 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
176 /* VIA UniChrome graphics driver (devg-unichrome.so) */ | |
177 {"unichrome", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | |
178 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
179 /* VESA unaccelerated gfx driver (devg-vesa.so) */ | |
180 {"vesa", SDL_GF_UNACCELERATED | SDL_GF_LOWRESOLUTION | | |
181 SDL_GF_UNACCELERATED_3D | SDL_GF_NOVIDEOMEMORY}, | |
182 /* VmWare graphics driver (devg-volari.so) */ | |
183 {"vmware", SDL_GF_ACCELERATED | SDL_GF_LOWRESOLUTION | | |
184 SDL_GF_UNACCELERATED_3D | SDL_GF_NOVIDEOMEMORY}, | |
185 /* XGI XP10 graphics driver (devg-volari.so) */ | |
186 {"volari", SDL_GF_ACCELERATED | SDL_GF_LOWRESOLUTION | | |
187 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | |
188 /* End of list */ | |
189 {NULL, 0x00000000} | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
190 }; |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
191 |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
192 /*****************************************************************************/ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
193 /* SDL Video Device initialization functions */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
194 /*****************************************************************************/ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
195 |
3139 | 196 static int |
197 qnxgf_available(void) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
198 { |
3139 | 199 gf_dev_t gfdev; |
200 gf_dev_info_t gfdev_info; | |
201 int status; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
202 |
3139 | 203 /* Try to attach to graphics device driver */ |
204 status = gf_dev_attach(&gfdev, GF_DEVICE_INDEX(0), &gfdev_info); | |
205 if (status != GF_ERR_OK) { | |
206 return 0; | |
207 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
208 |
3139 | 209 /* Detach from graphics device driver for now */ |
210 gf_dev_detach(gfdev); | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
211 |
3139 | 212 return 1; |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
213 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
214 |
3139 | 215 static void |
216 qnxgf_destroy(SDL_VideoDevice * device) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
217 { |
3139 | 218 SDL_VideoData *gfdata = (SDL_VideoData *) device->driverdata; |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
219 |
3139 | 220 /* Detach from graphics device driver, if it was initialized */ |
221 if (gfdata->gfinitialized != SDL_FALSE) { | |
222 gf_dev_detach(gfdata->gfdev); | |
223 gfdata->gfdev = NULL; | |
224 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
225 |
3139 | 226 if (device->driverdata != NULL) { |
227 device->driverdata = NULL; | |
228 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
229 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
230 |
3139 | 231 static SDL_VideoDevice * |
232 qnxgf_create(int devindex) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
233 { |
3139 | 234 SDL_VideoDevice *device; |
235 SDL_VideoData *gfdata; | |
236 int status; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
237 |
3139 | 238 /* Initialize SDL_VideoDevice structure */ |
239 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); | |
240 if (device == NULL) { | |
241 SDL_OutOfMemory(); | |
242 return NULL; | |
243 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
244 |
3139 | 245 /* Initialize internal GF specific data */ |
246 gfdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); | |
247 if (gfdata == NULL) { | |
248 SDL_OutOfMemory(); | |
249 SDL_free(device); | |
250 return NULL; | |
251 } | |
252 device->driverdata = gfdata; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
253 |
3461
87182c69e080
Deinitialization fixes, in case if QNXGF driver is not initialized properly.
Mike Gorchak <lestat@i.com.ua>
parents:
3412
diff
changeset
|
254 /* By default GF is not initialized */ |
87182c69e080
Deinitialization fixes, in case if QNXGF driver is not initialized properly.
Mike Gorchak <lestat@i.com.ua>
parents:
3412
diff
changeset
|
255 gfdata->gfinitialized = SDL_FALSE; |
87182c69e080
Deinitialization fixes, in case if QNXGF driver is not initialized properly.
Mike Gorchak <lestat@i.com.ua>
parents:
3412
diff
changeset
|
256 |
3139 | 257 /* Try to attach to graphics device driver */ |
258 status = | |
259 gf_dev_attach(&gfdata->gfdev, GF_DEVICE_INDEX(devindex), | |
260 &gfdata->gfdev_info); | |
261 if (status != GF_ERR_OK) { | |
262 SDL_OutOfMemory(); | |
263 SDL_free(gfdata); | |
264 SDL_free(device); | |
265 return NULL; | |
266 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
267 |
3139 | 268 if (gfdata->gfdev_info.description == NULL) { |
269 gf_dev_detach(gfdata->gfdev); | |
270 SDL_SetError("GF: Failed to initialize graphics driver"); | |
271 return NULL; | |
272 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
273 |
3139 | 274 /* Setup amount of available displays and current display */ |
275 device->num_displays = 0; | |
276 device->current_display = 0; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
277 |
3139 | 278 /* Setup device shutdown function */ |
279 gfdata->gfinitialized = SDL_TRUE; | |
280 device->free = qnxgf_destroy; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
281 |
3139 | 282 /* Setup all functions which we can handle */ |
283 device->VideoInit = qnxgf_videoinit; | |
284 device->VideoQuit = qnxgf_videoquit; | |
285 device->GetDisplayModes = qnxgf_getdisplaymodes; | |
286 device->SetDisplayMode = qnxgf_setdisplaymode; | |
287 device->SetDisplayPalette = qnxgf_setdisplaypalette; | |
288 device->GetDisplayPalette = qnxgf_getdisplaypalette; | |
289 device->SetDisplayGammaRamp = qnxgf_setdisplaygammaramp; | |
290 device->GetDisplayGammaRamp = qnxgf_getdisplaygammaramp; | |
291 device->CreateWindow = qnxgf_createwindow; | |
292 device->CreateWindowFrom = qnxgf_createwindowfrom; | |
293 device->SetWindowTitle = qnxgf_setwindowtitle; | |
294 device->SetWindowIcon = qnxgf_setwindowicon; | |
295 device->SetWindowPosition = qnxgf_setwindowposition; | |
296 device->SetWindowSize = qnxgf_setwindowsize; | |
297 device->ShowWindow = qnxgf_showwindow; | |
298 device->HideWindow = qnxgf_hidewindow; | |
299 device->RaiseWindow = qnxgf_raisewindow; | |
300 device->MaximizeWindow = qnxgf_maximizewindow; | |
301 device->MinimizeWindow = qnxgf_minimizewindow; | |
302 device->RestoreWindow = qnxgf_restorewindow; | |
303 device->SetWindowGrab = qnxgf_setwindowgrab; | |
304 device->DestroyWindow = qnxgf_destroywindow; | |
305 device->GetWindowWMInfo = qnxgf_getwindowwminfo; | |
306 device->GL_LoadLibrary = qnxgf_gl_loadlibrary; | |
307 device->GL_GetProcAddress = qnxgf_gl_getprocaddres; | |
308 device->GL_UnloadLibrary = qnxgf_gl_unloadlibrary; | |
309 device->GL_CreateContext = qnxgf_gl_createcontext; | |
310 device->GL_MakeCurrent = qnxgf_gl_makecurrent; | |
311 device->GL_SetSwapInterval = qnxgf_gl_setswapinterval; | |
312 device->GL_GetSwapInterval = qnxgf_gl_getswapinterval; | |
313 device->GL_SwapWindow = qnxgf_gl_swapwindow; | |
314 device->GL_DeleteContext = qnxgf_gl_deletecontext; | |
315 device->PumpEvents = qnxgf_pumpevents; | |
316 device->SuspendScreenSaver = qnxgf_suspendscreensaver; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
317 |
3139 | 318 return device; |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
319 } |
3083
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 |
3139 | 321 VideoBootStrap qnxgf_bootstrap = { |
322 "qnxgf", | |
323 "SDL QNX Graphics Framework (GF) video driver", | |
324 qnxgf_available, | |
325 qnxgf_create | |
3083
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 }; |
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
328 /*****************************************************************************/ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
329 /* SDL Video and Display initialization/handling functions */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
330 /*****************************************************************************/ |
3139 | 331 int |
332 qnxgf_videoinit(_THIS) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
333 { |
3139 | 334 SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; |
335 uint32_t it; | |
336 uint32_t jt; | |
337 char *override; | |
338 int32_t status; | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
339 |
3139 | 340 /* By default GF uses buffer swap on vsync */ |
341 gfdata->swapinterval = 1; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
342 |
3139 | 343 /* Add each detected output to SDL */ |
344 for (it = 0; it < gfdata->gfdev_info.ndisplays; it++) { | |
345 SDL_VideoDisplay display; | |
346 SDL_DisplayMode current_mode; | |
347 SDL_DisplayData *didata; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
348 |
3139 | 349 didata = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData)); |
350 if (didata == NULL) { | |
351 /* memory allocation problem */ | |
352 SDL_OutOfMemory(); | |
353 return -1; | |
354 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
355 |
3139 | 356 /* Set default cursor settings, maximum 128x128 cursor */ |
357 didata->cursor_visible = SDL_FALSE; | |
358 didata->cursor.type = GF_CURSOR_BITMAP; | |
359 didata->cursor.hotspot.x = 0; | |
360 didata->cursor.hotspot.y = 0; | |
361 didata->cursor.cursor.bitmap.w = SDL_VIDEO_GF_MAX_CURSOR_SIZE; | |
362 didata->cursor.cursor.bitmap.h = SDL_VIDEO_GF_MAX_CURSOR_SIZE; | |
363 didata->cursor.cursor.bitmap.stride = | |
364 (didata->cursor.cursor.bitmap.w + 7) / (sizeof(uint8_t) * 8); | |
365 didata->cursor.cursor.bitmap.color0 = 0x00000000; | |
366 didata->cursor.cursor.bitmap.color1 = 0x00000000; | |
367 didata->cursor.cursor.bitmap.image0 = | |
368 SDL_calloc(sizeof(uint8_t), | |
369 (didata->cursor.cursor.bitmap.w + | |
370 7) * didata->cursor.cursor.bitmap.h / | |
371 (sizeof(uint8_t) * 8)); | |
372 if (didata->cursor.cursor.bitmap.image0 == NULL) { | |
373 SDL_free(didata); | |
374 SDL_OutOfMemory(); | |
375 return -1; | |
376 } | |
377 didata->cursor.cursor.bitmap.image1 = | |
378 SDL_calloc(sizeof(uint8_t), | |
379 (didata->cursor.cursor.bitmap.w + | |
380 7) * didata->cursor.cursor.bitmap.h / | |
381 (sizeof(uint8_t) * 8)); | |
382 if (didata->cursor.cursor.bitmap.image1 == NULL) { | |
383 SDL_OutOfMemory(); | |
384 SDL_free((void *) didata->cursor.cursor.bitmap.image0); | |
385 SDL_free(didata); | |
386 return -1; | |
387 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
388 |
3139 | 389 /* Query current display settings */ |
390 status = gf_display_query(gfdata->gfdev, it, &didata->display_info); | |
391 if (status == GF_ERR_OK) { | |
392 SDL_zero(current_mode); | |
393 current_mode.w = didata->display_info.xres; | |
394 current_mode.h = didata->display_info.yres; | |
395 current_mode.refresh_rate = didata->display_info.refresh; | |
396 current_mode.format = | |
397 qnxgf_gf_to_sdl_pixelformat(didata->display_info.format); | |
398 current_mode.driverdata = NULL; | |
399 } else { | |
400 /* video initialization problem */ | |
401 SDL_free((void *) didata->cursor.cursor.bitmap.image0); | |
402 SDL_free((void *) didata->cursor.cursor.bitmap.image1); | |
403 SDL_free(didata); | |
404 SDL_SetError("GF: Display query failed"); | |
405 return -1; | |
406 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
407 |
3139 | 408 /* Attach GF to selected display */ |
409 status = gf_display_attach(&didata->display, gfdata->gfdev, it, NULL); | |
410 if (status != GF_ERR_OK) { | |
411 /* video initialization problem */ | |
412 SDL_free((void *) didata->cursor.cursor.bitmap.image0); | |
413 SDL_free((void *) didata->cursor.cursor.bitmap.image1); | |
414 SDL_free(didata); | |
415 SDL_SetError("GF: Couldn't attach to display"); | |
416 return -1; | |
417 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
418 |
3139 | 419 /* Initialize status variables */ |
420 didata->layer_attached = SDL_FALSE; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
421 |
3139 | 422 /* Attach to main display layer */ |
423 status = | |
424 gf_layer_attach(&didata->layer, didata->display, | |
425 didata->display_info.main_layer_index, 0); | |
426 if (status != GF_ERR_OK) { | |
427 /* Failed to attach to main layer */ | |
428 SDL_free((void *) didata->cursor.cursor.bitmap.image0); | |
429 SDL_free((void *) didata->cursor.cursor.bitmap.image1); | |
430 SDL_free(didata); | |
431 SDL_SetError | |
432 ("GF: Couldn't attach to main layer, it could be busy"); | |
433 return -1; | |
434 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
435 |
3139 | 436 /* Mark main display layer is attached */ |
437 didata->layer_attached = SDL_TRUE; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
438 |
3139 | 439 /* Set layer source and destination viewport */ |
440 gf_layer_set_src_viewport(didata->layer, 0, 0, current_mode.w - 1, | |
441 current_mode.h - 1); | |
442 gf_layer_set_dst_viewport(didata->layer, 0, 0, current_mode.w - 1, | |
443 current_mode.h - 1); | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
444 |
3139 | 445 /* Create main visible on display surface */ |
446 status = gf_surface_create_layer(&didata->surface[0], &didata->layer, | |
447 1, 0, current_mode.w, current_mode.h, | |
448 qnxgf_sdl_to_gf_pixelformat | |
449 (current_mode.format), NULL, | |
450 GF_SURFACE_CREATE_2D_ACCESSIBLE | | |
451 GF_SURFACE_CREATE_3D_ACCESSIBLE | | |
452 GF_SURFACE_CREATE_SHAREABLE); | |
453 if (status != GF_ERR_OK) { | |
454 gf_layer_disable(didata->layer); | |
455 gf_layer_detach(didata->layer); | |
456 didata->layer_attached = SDL_FALSE; | |
457 SDL_free((void *) didata->cursor.cursor.bitmap.image0); | |
458 SDL_free((void *) didata->cursor.cursor.bitmap.image1); | |
459 SDL_free(didata); | |
460 SDL_SetError("GF: Can't create main layer surface at init (%d)\n", | |
461 status); | |
462 return -1; | |
463 } | |
464 | |
465 /* Set just created surface as main visible on the layer */ | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
466 // gf_layer_set_surfaces(didata->layer, &didata->surface[0], 1); |
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
467 |
3139 | 468 /* Update layer parameters */ |
469 status = gf_layer_update(didata->layer, GF_LAYER_UPDATE_NO_WAIT_IDLE); | |
470 if (status != GF_ERR_OK) { | |
471 /* Free allocated surface */ | |
472 gf_surface_free(didata->surface[0]); | |
473 didata->surface[0] = NULL; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
474 |
3139 | 475 /* Disable and detach from layer */ |
476 gf_layer_disable(didata->layer); | |
477 gf_layer_detach(didata->layer); | |
478 didata->layer_attached = SDL_FALSE; | |
479 SDL_free((void *) didata->cursor.cursor.bitmap.image0); | |
480 SDL_free((void *) didata->cursor.cursor.bitmap.image1); | |
481 SDL_free(didata); | |
482 SDL_SetError("GF: Can't update layer parameters\n"); | |
483 return -1; | |
484 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
485 |
3139 | 486 /* Enable layer in case if hardware supports layer enable/disable */ |
487 gf_layer_enable(didata->layer); | |
488 | |
489 /* Copy device name for each display */ | |
490 SDL_strlcpy(didata->description, gfdata->gfdev_info.description, | |
491 SDL_VIDEO_GF_DEVICENAME_MAX - 1); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
492 |
3139 | 493 /* Search device capabilities and possible workarounds */ |
494 jt = 0; | |
495 do { | |
496 if (gf_devicename[jt].name == NULL) { | |
497 break; | |
498 } | |
499 if (SDL_strncmp | |
500 (gf_devicename[jt].name, didata->description, | |
501 SDL_strlen(gf_devicename[jt].name)) == 0) { | |
502 didata->caps = gf_devicename[jt].caps; | |
503 } | |
504 jt++; | |
505 } while (1); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
506 |
3139 | 507 /* Initialize display structure */ |
508 SDL_zero(display); | |
509 display.desktop_mode = current_mode; | |
510 display.current_mode = current_mode; | |
511 display.driverdata = didata; | |
512 didata->current_mode = current_mode; | |
513 SDL_AddVideoDisplay(&display); | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
514 |
3139 | 515 /* Check for environment variables which could override some SDL settings */ |
516 didata->custom_refresh = 0; | |
517 override = SDL_getenv("SDL_VIDEO_GF_REFRESH_RATE"); | |
518 if (override != NULL) { | |
519 if (SDL_sscanf(override, "%u", &didata->custom_refresh) != 1) { | |
520 didata->custom_refresh = 0; | |
521 } | |
522 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
523 |
3139 | 524 /* Get all display modes for this display */ |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
525 qnxgf_getdisplaymodes(_this, display); |
3139 | 526 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
527 |
3139 | 528 /* Add GF renderer to SDL */ |
529 gf_addrenderdriver(_this); | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
530 |
3139 | 531 /* Add GF input devices */ |
532 status = gf_addinputdevices(_this); | |
533 if (status != 0) { | |
534 /* SDL error is set by gf_addinputdevices() function */ | |
535 return -1; | |
536 } | |
537 | |
538 /* video has been initialized successfully */ | |
539 return 1; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
540 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
541 |
3139 | 542 void |
543 qnxgf_videoquit(_THIS) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
544 { |
3461
87182c69e080
Deinitialization fixes, in case if QNXGF driver is not initialized properly.
Mike Gorchak <lestat@i.com.ua>
parents:
3412
diff
changeset
|
545 SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; |
3139 | 546 SDL_DisplayData *didata = NULL; |
547 uint32_t it; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
548 |
3461
87182c69e080
Deinitialization fixes, in case if QNXGF driver is not initialized properly.
Mike Gorchak <lestat@i.com.ua>
parents:
3412
diff
changeset
|
549 /* Check if GF was initialized before */ |
87182c69e080
Deinitialization fixes, in case if QNXGF driver is not initialized properly.
Mike Gorchak <lestat@i.com.ua>
parents:
3412
diff
changeset
|
550 if ((gfdata == NULL) || (gfdata->gfinitialized != SDL_TRUE)) |
87182c69e080
Deinitialization fixes, in case if QNXGF driver is not initialized properly.
Mike Gorchak <lestat@i.com.ua>
parents:
3412
diff
changeset
|
551 { |
87182c69e080
Deinitialization fixes, in case if QNXGF driver is not initialized properly.
Mike Gorchak <lestat@i.com.ua>
parents:
3412
diff
changeset
|
552 /* If not, do not deinitialize */ |
87182c69e080
Deinitialization fixes, in case if QNXGF driver is not initialized properly.
Mike Gorchak <lestat@i.com.ua>
parents:
3412
diff
changeset
|
553 return; |
87182c69e080
Deinitialization fixes, in case if QNXGF driver is not initialized properly.
Mike Gorchak <lestat@i.com.ua>
parents:
3412
diff
changeset
|
554 } |
87182c69e080
Deinitialization fixes, in case if QNXGF driver is not initialized properly.
Mike Gorchak <lestat@i.com.ua>
parents:
3412
diff
changeset
|
555 |
3139 | 556 /* Stop collecting mouse events */ |
557 hiddi_disable_mouse(); | |
558 /* Delete GF input devices */ | |
559 gf_delinputdevices(_this); | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
560 |
3139 | 561 /* SDL will restore old desktop mode on exit */ |
562 for (it = 0; it < _this->num_displays; it++) { | |
563 didata = _this->displays[it].driverdata; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
564 |
3139 | 565 /* Free cursor image */ |
566 if (didata->cursor.cursor.bitmap.image0 != NULL) { | |
567 SDL_free((void *) didata->cursor.cursor.bitmap.image0); | |
568 didata->cursor.cursor.bitmap.image0 = NULL; | |
569 } | |
570 if (didata->cursor.cursor.bitmap.image1 != NULL) { | |
571 SDL_free((void *) didata->cursor.cursor.bitmap.image1); | |
572 didata->cursor.cursor.bitmap.image1 = NULL; | |
573 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
574 |
3139 | 575 /* Free main surface */ |
576 if (didata->surface[0] != NULL) { | |
577 gf_surface_free(didata->surface[0]); | |
578 didata->surface[0] = NULL; | |
579 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
580 |
3139 | 581 /* Free back surface */ |
582 if (didata->surface[1] != NULL) { | |
583 gf_surface_free(didata->surface[1]); | |
584 didata->surface[1] = NULL; | |
585 } | |
586 | |
587 /* Free second back surface */ | |
588 if (didata->surface[2] != NULL) { | |
589 gf_surface_free(didata->surface[2]); | |
590 didata->surface[2] = NULL; | |
591 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
592 |
3139 | 593 /* Detach layer before quit */ |
594 if (didata->layer_attached == SDL_TRUE) { | |
595 /* Disable layer if hardware supports this */ | |
596 gf_layer_disable(didata->layer); | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
597 |
3139 | 598 /* Detach from layer, free it for others */ |
599 gf_layer_detach(didata->layer); | |
600 didata->layer = NULL; | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
601 |
3139 | 602 /* Mark it as detached */ |
603 didata->layer_attached = SDL_FALSE; | |
604 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
605 |
3139 | 606 /* Detach from selected display */ |
607 gf_display_detach(didata->display); | |
608 didata->display = NULL; | |
609 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
610 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
611 |
3139 | 612 void |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
613 qnxgf_getdisplaymodes(_THIS, SDL_VideoDisplay * display) |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
614 { |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
615 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
3139 | 616 SDL_DisplayMode mode; |
617 gf_modeinfo_t modeinfo; | |
618 uint32_t it = 0; | |
619 uint32_t jt = 0; | |
620 uint32_t kt = 0; | |
621 int status; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
622 |
3139 | 623 do { |
624 status = gf_display_query_mode(didata->display, it, &modeinfo); | |
625 if (status == GF_ERR_OK) { | |
626 /* Parsing current mode */ | |
627 if ((modeinfo.flags & GF_MODE_GENERIC) == GF_MODE_GENERIC) { | |
628 /* This mode is generic, so we can add to SDL our resolutions */ | |
629 /* Only pixel format is fixed, refresh rate could be any */ | |
630 jt = 0; | |
631 do { | |
632 if (generic_mode[jt].w == 0) { | |
633 break; | |
634 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
635 |
3139 | 636 /* Check if driver do not supports doublescan video modes */ |
637 if ((didata->caps & SDL_GF_LOWRESOLUTION) != | |
638 SDL_GF_LOWRESOLUTION) { | |
639 if (generic_mode[jt].w < 640) { | |
640 jt++; | |
641 continue; | |
642 } | |
643 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
644 |
3139 | 645 mode.w = generic_mode[jt].w; |
646 mode.h = generic_mode[jt].h; | |
647 mode.refresh_rate = generic_mode[jt].refresh_rate; | |
648 mode.format = | |
649 qnxgf_gf_to_sdl_pixelformat(modeinfo.primary_format); | |
650 mode.driverdata = NULL; | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
651 SDL_AddDisplayMode(display, &mode); |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
652 |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
653 /* If mode is RGBA8888, add the same mode as RGBx888 */ |
3186 | 654 if (modeinfo.primary_format == GF_FORMAT_BGRA8888) { |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
655 mode.w = generic_mode[jt].w; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
656 mode.h = generic_mode[jt].h; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
657 mode.refresh_rate = generic_mode[jt].refresh_rate; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
658 mode.format = SDL_PIXELFORMAT_RGB888; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
659 mode.driverdata = NULL; |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
660 SDL_AddDisplayMode(display, &mode); |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
661 } |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
662 /* If mode is RGBA1555, add the same mode as RGBx555 */ |
3186 | 663 if (modeinfo.primary_format == GF_FORMAT_PACK_ARGB1555) { |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
664 mode.w = generic_mode[jt].w; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
665 mode.h = generic_mode[jt].h; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
666 mode.refresh_rate = generic_mode[jt].refresh_rate; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
667 mode.format = SDL_PIXELFORMAT_RGB555; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
668 mode.driverdata = NULL; |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
669 SDL_AddDisplayMode(display, &mode); |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
670 } |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
671 |
3139 | 672 jt++; |
673 } while (1); | |
674 } else { | |
675 /* Add this display mode as is in case if it is non-generic */ | |
676 /* But go through the each refresh rate, supported by gf */ | |
677 jt = 0; | |
678 do { | |
679 if (modeinfo.refresh[jt] != 0) { | |
680 mode.w = modeinfo.xres; | |
681 mode.h = modeinfo.yres; | |
682 mode.refresh_rate = modeinfo.refresh[jt]; | |
683 mode.format = | |
684 qnxgf_gf_to_sdl_pixelformat(modeinfo. | |
685 primary_format); | |
686 mode.driverdata = NULL; | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
687 SDL_AddDisplayMode(display, &mode); |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
688 |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
689 /* If mode is RGBA8888, add the same mode as RGBx888 */ |
3186 | 690 if (modeinfo.primary_format == GF_FORMAT_BGRA8888) { |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
691 mode.w = modeinfo.xres; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
692 mode.h = modeinfo.yres; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
693 mode.refresh_rate = modeinfo.refresh[jt]; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
694 mode.format = SDL_PIXELFORMAT_RGB888; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
695 mode.driverdata = NULL; |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
696 SDL_AddDisplayMode(display, &mode); |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
697 } |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
698 /* If mode is RGBA1555, add the same mode as RGBx555 */ |
3186 | 699 if (modeinfo.primary_format == |
700 GF_FORMAT_PACK_ARGB1555) { | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
701 mode.w = modeinfo.xres; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
702 mode.h = modeinfo.yres; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
703 mode.refresh_rate = modeinfo.refresh[jt]; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
704 mode.format = SDL_PIXELFORMAT_RGB555; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
705 mode.driverdata = NULL; |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
706 SDL_AddDisplayMode(display, &mode); |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
707 } |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
708 |
3139 | 709 jt++; |
710 } else { | |
711 break; | |
712 } | |
713 } while (1); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
714 } |
3139 | 715 } else { |
716 if (status == GF_ERR_PARM) { | |
717 /* out of available modes, all are listed */ | |
718 break; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
719 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
720 |
3139 | 721 /* Error occured during mode listing */ |
722 break; | |
723 } | |
724 it++; | |
725 } while (1); | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
726 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
727 |
3139 | 728 int |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
729 qnxgf_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
730 { |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
731 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
3139 | 732 uint32_t refresh_rate = 0; |
733 int status; | |
734 | |
735 /* Current display dimensions and bpp are no more valid */ | |
736 didata->current_mode.format = SDL_PIXELFORMAT_UNKNOWN; | |
737 didata->current_mode.w = 0; | |
738 didata->current_mode.h = 0; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
739 |
3139 | 740 /* Check if custom refresh rate requested */ |
741 if (didata->custom_refresh != 0) { | |
742 refresh_rate = didata->custom_refresh; | |
743 } else { | |
744 refresh_rate = mode->refresh_rate; | |
745 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
746 |
3139 | 747 /* Check if SDL GF driver needs to find appropriate refresh rate itself */ |
748 if (refresh_rate == 0) { | |
749 uint32_t it; | |
750 SDL_DisplayMode tempmode; | |
751 | |
752 /* Clear display mode structure */ | |
753 SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode)); | |
754 tempmode.refresh_rate = 0x0000FFFF; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
755 |
3139 | 756 /* Check if window width and height matches one of our modes */ |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
757 for (it = 0; it < display->num_display_modes; it++) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
758 if ((display->display_modes[it].w == mode->w) && |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
759 (display->display_modes[it].h == mode->h) && |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
760 (display->display_modes[it].format == mode->format)) |
3139 | 761 { |
762 /* Find the lowest refresh rate available */ | |
763 if (tempmode.refresh_rate > | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
764 display->display_modes[it].refresh_rate) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
765 tempmode = display->display_modes[it]; |
3139 | 766 } |
767 } | |
768 } | |
769 if (tempmode.refresh_rate != 0x0000FFFF) { | |
770 refresh_rate = tempmode.refresh_rate; | |
771 } else { | |
772 /* Let video driver decide what to do with this */ | |
773 refresh_rate = 0; | |
774 } | |
775 } | |
776 | |
777 /* Check if SDL GF driver needs to check custom refresh rate */ | |
778 if (didata->custom_refresh != 0) { | |
779 uint32_t it; | |
780 SDL_DisplayMode tempmode; | |
781 | |
782 /* Clear display mode structure */ | |
783 SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode)); | |
784 tempmode.refresh_rate = 0x0000FFFF; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
785 |
3139 | 786 /* Check if window width and height matches one of our modes */ |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
787 for (it = 0; it < display->num_display_modes; it++) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
788 if ((display->display_modes[it].w == mode->w) && |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
789 (display->display_modes[it].h == mode->h) && |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
790 (display->display_modes[it].format == mode->format)) |
3139 | 791 { |
792 /* Find the lowest refresh rate available */ | |
793 if (tempmode.refresh_rate > | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
794 display->display_modes[it].refresh_rate) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
795 tempmode = display->display_modes[it]; |
3139 | 796 } |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
797 |
3139 | 798 /* Check if requested refresh rate found */ |
799 if (refresh_rate == | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
800 display->display_modes[it].refresh_rate) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
801 tempmode = display->display_modes[it]; |
3139 | 802 break; |
803 } | |
804 } | |
805 } | |
806 if (tempmode.refresh_rate != 0x0000FFFF) { | |
807 refresh_rate = tempmode.refresh_rate; | |
808 } else { | |
809 /* Let video driver decide what to do with this */ | |
810 refresh_rate = 0; | |
811 } | |
812 } | |
813 | |
814 /* Free main surface */ | |
815 if (didata->surface[0] != NULL) { | |
816 gf_surface_free(didata->surface[0]); | |
817 didata->surface[0] = NULL; | |
818 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
819 |
3139 | 820 /* Free back surface */ |
821 if (didata->surface[1] != NULL) { | |
822 gf_surface_free(didata->surface[1]); | |
823 didata->surface[1] = NULL; | |
824 } | |
825 | |
826 /* Free second back surface */ | |
827 if (didata->surface[2] != NULL) { | |
828 gf_surface_free(didata->surface[2]); | |
829 didata->surface[2] = NULL; | |
830 } | |
831 | |
832 /* Detach layer before switch to new graphics mode */ | |
833 if (didata->layer_attached == SDL_TRUE) { | |
834 /* Disable layer if hardware supports this */ | |
835 gf_layer_disable(didata->layer); | |
836 | |
837 /* Detach from layer, free it for others */ | |
838 gf_layer_detach(didata->layer); | |
839 | |
840 /* Mark it as detached */ | |
841 didata->layer_attached = SDL_FALSE; | |
842 } | |
843 | |
844 /* Set new display video mode */ | |
845 status = | |
846 gf_display_set_mode(didata->display, mode->w, mode->h, refresh_rate, | |
847 qnxgf_sdl_to_gf_pixelformat(mode->format), 0); | |
848 if (status != GF_ERR_OK) { | |
849 /* Display mode/resolution switch has been failed */ | |
850 SDL_SetError("GF: Mode is not supported by graphics driver"); | |
851 return -1; | |
852 } else { | |
853 didata->current_mode = *mode; | |
854 didata->current_mode.refresh_rate = refresh_rate; | |
855 } | |
856 | |
857 /* Attach to main display layer */ | |
858 status = | |
859 gf_layer_attach(&didata->layer, didata->display, | |
860 didata->display_info.main_layer_index, 0); | |
861 if (status != GF_ERR_OK) { | |
862 SDL_SetError("GF: Couldn't attach to main layer, it could be busy"); | |
863 | |
864 /* Failed to attach to main displayable layer */ | |
865 return -1; | |
866 } | |
867 | |
868 /* Mark main display layer is attached */ | |
869 didata->layer_attached = SDL_TRUE; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
870 |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
871 /* Set layer source and destination viewports */ |
3139 | 872 gf_layer_set_src_viewport(didata->layer, 0, 0, mode->w - 1, mode->h - 1); |
873 gf_layer_set_dst_viewport(didata->layer, 0, 0, mode->w - 1, mode->h - 1); | |
874 | |
875 /* Create main visible on display surface */ | |
876 status = | |
877 gf_surface_create_layer(&didata->surface[0], &didata->layer, 1, 0, | |
878 mode->w, mode->h, | |
879 qnxgf_sdl_to_gf_pixelformat(mode->format), | |
880 NULL, | |
881 GF_SURFACE_CREATE_2D_ACCESSIBLE | | |
882 GF_SURFACE_CREATE_3D_ACCESSIBLE | | |
883 GF_SURFACE_CREATE_SHAREABLE); | |
884 if (status != GF_ERR_OK) { | |
885 gf_layer_disable(didata->layer); | |
886 gf_layer_detach(didata->layer); | |
887 didata->layer_attached = SDL_FALSE; | |
888 SDL_SetError | |
889 ("GF: Can't create main layer surface at modeswitch (%d)\n", | |
890 status); | |
891 return -1; | |
892 } | |
893 | |
894 /* Set just created surface as main visible on the layer */ | |
895 gf_layer_set_surfaces(didata->layer, &didata->surface[0], 1); | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
896 |
3139 | 897 /* Update layer parameters */ |
898 status = gf_layer_update(didata->layer, GF_LAYER_UPDATE_NO_WAIT_IDLE); | |
899 if (status != GF_ERR_OK) { | |
900 /* Free main surface */ | |
901 gf_surface_free(didata->surface[0]); | |
902 didata->surface[0] = NULL; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
903 |
3139 | 904 /* Detach layer */ |
905 gf_layer_disable(didata->layer); | |
906 gf_layer_detach(didata->layer); | |
907 didata->layer_attached = SDL_FALSE; | |
908 SDL_SetError("GF: Can't update layer parameters\n"); | |
909 return -1; | |
910 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
911 |
3139 | 912 /* Restore cursor if it was visible */ |
913 if (didata->cursor_visible == SDL_TRUE) { | |
914 gf_cursor_set(didata->display, 0, &didata->cursor); | |
915 gf_cursor_enable(didata->display, 0); | |
916 } | |
917 | |
918 /* Enable layer in case if hardware supports layer enable/disable */ | |
919 gf_layer_enable(didata->layer); | |
920 | |
921 return 0; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
922 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
923 |
3139 | 924 int |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
925 qnxgf_setdisplaypalette(_THIS, SDL_VideoDisplay * display, SDL_Palette * palette) |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
926 { |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
927 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
3139 | 928 |
929 /* QNX GF doesn't have support for global palette changing, but we */ | |
930 /* could store it for usage in future */ | |
931 | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
932 SDL_Unsupported(); |
3139 | 933 return -1; |
934 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
935 |
3139 | 936 int |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
937 qnxgf_getdisplaypalette(_THIS, SDL_VideoDisplay * display, SDL_Palette * palette) |
3139 | 938 { |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
939 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
3139 | 940 |
941 /* We can't provide current palette settings and looks like SDL */ | |
942 /* do not call this function also, in such case this function returns -1 */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
943 |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
944 SDL_Unsupported(); |
3139 | 945 return -1; |
946 } | |
947 | |
948 int | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
949 qnxgf_setdisplaygammaramp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp) |
3139 | 950 { |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
951 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
3139 | 952 int status; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
953 |
3139 | 954 /* Setup gamma ramp, for each color channel */ |
955 status = | |
956 gf_display_set_color_lut16(didata->display, (uint16_t *) ramp, | |
957 (uint16_t *) ramp + 256, | |
958 (uint16_t *) ramp + 512); | |
959 if (status != GF_ERR_OK) { | |
960 /* Setting display gamma ramp operation has been failed */ | |
961 return -1; | |
962 } | |
963 | |
964 return 0; | |
965 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
966 |
3139 | 967 int |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
968 qnxgf_getdisplaygammaramp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp) |
3139 | 969 { |
970 /* TODO: We need to return previous gamma set */ | |
971 /* Also we need some initial fake gamma to return */ | |
972 | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
973 SDL_Unsupported(); |
3139 | 974 return -1; |
975 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
976 |
3139 | 977 int |
978 qnxgf_createwindow(_THIS, SDL_Window * window) | |
979 { | |
980 SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
981 SDL_VideoDisplay *display = window->display; |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
982 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
3139 | 983 SDL_WindowData *wdata; |
984 int32_t status; | |
985 | |
986 /* QNX GF supports fullscreen window modes only */ | |
987 if ((window->flags & SDL_WINDOW_FULLSCREEN) != SDL_WINDOW_FULLSCREEN) { | |
988 uint32_t it; | |
989 SDL_DisplayMode mode; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
990 |
3139 | 991 /* Clear display mode structure */ |
992 SDL_memset(&mode, 0x00, sizeof(SDL_DisplayMode)); | |
993 mode.refresh_rate = 0x0000FFFF; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
994 |
3139 | 995 /* Check if window width and height matches one of our modes */ |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
996 for (it = 0; it < display->num_display_modes; it++) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
997 if ((display->display_modes[it].w == window->w) && |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
998 (display->display_modes[it].h == window->h) && |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
999 (display->display_modes[it].format == |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
1000 display->desktop_mode.format)) { |
3139 | 1001 /* Find the lowest refresh rate available */ |
1002 if (mode.refresh_rate > | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
1003 display->display_modes[it].refresh_rate) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3461
diff
changeset
|
1004 mode = display->display_modes[it]; |
3139 | 1005 } |
1006 } | |
1007 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1008 |
3139 | 1009 /* Check if end of display list has been reached */ |
1010 if (mode.refresh_rate == 0x0000FFFF) { | |
1011 SDL_SetError("GF: Desired video mode is not supported"); | |
1012 | |
1013 /* Failed to create new window */ | |
1014 return -1; | |
1015 } else { | |
1016 /* Tell to the caller that mode will be fullscreen */ | |
1017 window->flags |= SDL_WINDOW_FULLSCREEN; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1018 |
3139 | 1019 /* Setup fullscreen mode, bpp used from desktop mode in this case */ |
1020 status = qnxgf_setdisplaymode(_this, &mode); | |
1021 if (status != 0) { | |
1022 /* Failed to swith fullscreen video mode */ | |
1023 return -1; | |
1024 } | |
1025 } | |
1026 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1027 |
3139 | 1028 /* Setup our own window decorations and states, which are depend on fullscreen mode */ |
1029 window->flags |= SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS | | |
1030 SDL_WINDOW_MAXIMIZED | SDL_WINDOW_INPUT_GRABBED | | |
1031 SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS; | |
1032 window->flags &= ~(SDL_WINDOW_RESIZABLE | SDL_WINDOW_MINIMIZED); | |
1033 | |
1034 /* Ignore any window position settings */ | |
1035 window->x = SDL_WINDOWPOS_UNDEFINED; | |
1036 window->y = SDL_WINDOWPOS_UNDEFINED; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1037 |
3139 | 1038 /* Allocate window internal data */ |
1039 wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); | |
1040 if (wdata == NULL) { | |
1041 SDL_OutOfMemory(); | |
1042 return -1; | |
1043 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1044 |
3139 | 1045 /* Setup driver data for this window */ |
1046 window->driverdata = wdata; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1047 |
3139 | 1048 /* Check if window must support OpenGL ES rendering */ |
1049 if ((window->flags & SDL_WINDOW_OPENGL) == SDL_WINDOW_OPENGL) { | |
1050 #if defined(SDL_VIDEO_OPENGL_ES) | |
1051 EGLBoolean initstatus; | |
1052 | |
1053 /* Mark this window as OpenGL ES compatible */ | |
1054 wdata->uses_gles = SDL_TRUE; | |
1055 | |
1056 /* Create connection to OpenGL ES */ | |
1057 if (gfdata->egldisplay == EGL_NO_DISPLAY) { | |
1058 gfdata->egldisplay = eglGetDisplay(gfdata->gfdev); | |
1059 if (gfdata->egldisplay == EGL_NO_DISPLAY) { | |
1060 SDL_SetError("GF: Can't get connection to OpenGL ES"); | |
1061 return -1; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1062 } |
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1063 |
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1064 /* Initialize OpenGL ES library, ignore EGL version */ |
3139 | 1065 initstatus = eglInitialize(gfdata->egldisplay, NULL, NULL); |
1066 if (initstatus != EGL_TRUE) { | |
1067 SDL_SetError("GF: Can't init OpenGL ES library"); | |
1068 return -1; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1069 } |
3139 | 1070 } |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1071 |
3139 | 1072 /* Increment GL ES reference count usage */ |
1073 gfdata->egl_refcount++; | |
1074 #else | |
1075 SDL_SetError("GF: OpenGL ES support is not compiled in"); | |
1076 return -1; | |
1077 #endif /* SDL_VIDEO_OPENGL_ES */ | |
1078 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1079 |
3139 | 1080 /* Enable mouse event collecting */ |
1081 hiddi_enable_mouse(); | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1082 |
3139 | 1083 /* By default last created window got a input focus */ |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
1084 SDL_SetKeyboardFocus(0, window); |
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
1085 SDL_SetMouseFocus(0, window); |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1086 |
3139 | 1087 /* Window has been successfully created */ |
1088 return 0; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1089 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1090 |
3139 | 1091 int |
1092 qnxgf_createwindowfrom(_THIS, SDL_Window * window, const void *data) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1093 { |
3139 | 1094 /* Failed to create window from another window */ |
1095 return -1; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1096 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1097 |
3139 | 1098 void |
1099 qnxgf_setwindowtitle(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1100 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1101 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1102 |
3139 | 1103 void |
1104 qnxgf_setwindowicon(_THIS, SDL_Window * window, SDL_Surface * icon) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1105 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1106 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1107 |
3139 | 1108 void |
1109 qnxgf_setwindowposition(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1110 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1111 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1112 |
3139 | 1113 void |
1114 qnxgf_setwindowsize(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1115 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1116 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1117 |
3139 | 1118 void |
1119 qnxgf_showwindow(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1120 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1121 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1122 |
3139 | 1123 void |
1124 qnxgf_hidewindow(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1125 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1126 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1127 |
3139 | 1128 void |
1129 qnxgf_raisewindow(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1130 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1131 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1132 |
3139 | 1133 void |
1134 qnxgf_maximizewindow(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1135 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1136 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1137 |
3139 | 1138 void |
1139 qnxgf_minimizewindow(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1140 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1141 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1142 |
3139 | 1143 void |
1144 qnxgf_restorewindow(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1145 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1146 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1147 |
3139 | 1148 void |
1149 qnxgf_setwindowgrab(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1150 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1151 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1152 |
3139 | 1153 void |
1154 qnxgf_destroywindow(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1155 { |
3139 | 1156 SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; |
1157 SDL_DisplayData *didata = | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
1158 (SDL_DisplayData *) window->display->driverdata; |
3139 | 1159 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1160 |
3139 | 1161 if (wdata != NULL) { |
1162 #if defined(SDL_VIDEO_OPENGL_ES) | |
1163 /* Destroy OpenGL ES surface if it was created */ | |
1164 if (wdata->gles_surface != EGL_NO_SURFACE) { | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1165 eglDestroySurface(gfdata->egldisplay, wdata->gles_surface); |
3139 | 1166 } |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1167 |
3139 | 1168 /* Free any 3D target if it was created before */ |
1169 if (wdata->target_created == SDL_TRUE) { | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1170 gf_3d_target_free(wdata->target); |
3139 | 1171 wdata->target_created == SDL_FALSE; |
1172 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1173 |
3139 | 1174 gfdata->egl_refcount--; |
1175 if (gfdata->egl_refcount == 0) { | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1176 /* Terminate connection to OpenGL ES */ |
3139 | 1177 if (gfdata->egldisplay != EGL_NO_DISPLAY) { |
1178 eglTerminate(gfdata->egldisplay); | |
1179 gfdata->egldisplay = EGL_NO_DISPLAY; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1180 } |
3139 | 1181 } |
1182 #endif /* SDL_VIDEO_OPENGL_ES */ | |
1183 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1184 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1185 |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1186 /*****************************************************************************/ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1187 /* SDL Window Manager function */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1188 /*****************************************************************************/ |
3139 | 1189 SDL_bool |
1190 qnxgf_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1191 { |
3139 | 1192 /* QNX GF do not operates at window level, this means we are have no */ |
1193 /* Window Manager available, no specific data in SDL_SysWMinfo too */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1194 |
3139 | 1195 if (info->version.major <= SDL_MAJOR_VERSION) { |
1196 return SDL_TRUE; | |
1197 } else { | |
1198 SDL_SetError("Application not compiled with SDL %d.%d\n", | |
1199 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); | |
1200 return SDL_FALSE; | |
1201 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1202 |
3139 | 1203 /* Failed to get window manager information */ |
1204 return SDL_FALSE; | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1205 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1206 |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1207 /*****************************************************************************/ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1208 /* SDL OpenGL/OpenGL ES functions */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1209 /*****************************************************************************/ |
3139 | 1210 int |
1211 qnxgf_gl_loadlibrary(_THIS, const char *path) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1212 { |
3139 | 1213 #if defined(SDL_VIDEO_OPENGL_ES) |
1214 /* Check if OpenGL ES library is specified for GF driver */ | |
1215 if (path == NULL) { | |
1216 path = SDL_getenv("SDL_OPENGL_LIBRARY"); | |
1217 if (path == NULL) { | |
1218 path = SDL_getenv("SDL_OPENGLES_LIBRARY"); | |
1219 } | |
1220 } | |
1221 | |
1222 /* Check if default library loading requested */ | |
1223 if (path == NULL) { | |
1224 /* Already linked with GF library which provides egl* subset of */ | |
1225 /* functions, use Common profile of OpenGL ES library by default */ | |
1226 path = "/usr/lib/libGLES_CM.so.1"; | |
1227 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1228 |
3139 | 1229 /* Load dynamic library */ |
1230 _this->gl_config.dll_handle = SDL_LoadObject(path); | |
1231 if (!_this->gl_config.dll_handle) { | |
1232 /* Failed to load new GL ES library */ | |
1233 SDL_SetError("GF: Failed to locate OpenGL ES library"); | |
1234 return -1; | |
1235 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1236 |
3139 | 1237 /* Store OpenGL ES library path and name */ |
1238 SDL_strlcpy(_this->gl_config.driver_path, path, | |
1239 SDL_arraysize(_this->gl_config.driver_path)); | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1240 |
3139 | 1241 /* New OpenGL ES library is loaded */ |
1242 return 0; | |
1243 #else | |
1244 SDL_SetError("GF: OpenGL ES support is not compiled in"); | |
1245 return -1; | |
1246 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1247 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1248 |
3139 | 1249 void * |
1250 qnxgf_gl_getprocaddres(_THIS, const char *proc) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1251 { |
3139 | 1252 #if defined(SDL_VIDEO_OPENGL_ES) |
1253 void *function_address; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1254 |
3139 | 1255 /* Try to get function address through the egl interface */ |
1256 function_address = eglGetProcAddress(proc); | |
1257 if (function_address != NULL) { | |
1258 return function_address; | |
1259 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1260 |
3139 | 1261 /* Then try to get function in the OpenGL ES library */ |
1262 if (_this->gl_config.dll_handle) { | |
1263 function_address = | |
1264 SDL_LoadFunction(_this->gl_config.dll_handle, proc); | |
1265 if (function_address != NULL) { | |
1266 return function_address; | |
1267 } | |
1268 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1269 |
3139 | 1270 /* Add emulated OpenGL ES 1.1 functions */ |
1271 if (SDL_strcmp(proc, "glTexParameteri") == 0) { | |
1272 return glTexParameteri; | |
1273 } | |
1274 if (SDL_strcmp(proc, "glTexParameteriv") == 0) { | |
1275 return glTexParameteriv; | |
1276 } | |
1277 if (SDL_strcmp(proc, "glColor4ub") == 0) { | |
1278 return glColor4ub; | |
1279 } | |
1280 | |
1281 /* Failed to get GL ES function address pointer */ | |
1282 SDL_SetError("GF: Cannot locate OpenGL ES function name"); | |
1283 return NULL; | |
1284 #else | |
1285 SDL_SetError("GF: OpenGL ES support is not compiled in"); | |
1286 return NULL; | |
1287 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1288 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1289 |
3139 | 1290 void |
1291 qnxgf_gl_unloadlibrary(_THIS) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1292 { |
3139 | 1293 #if defined(SDL_VIDEO_OPENGL_ES) |
1294 /* Unload OpenGL ES library */ | |
1295 if (_this->gl_config.dll_handle) { | |
1296 SDL_UnloadObject(_this->gl_config.dll_handle); | |
1297 _this->gl_config.dll_handle = NULL; | |
1298 } | |
1299 #else | |
1300 SDL_SetError("GF: OpenGL ES support is not compiled in"); | |
1301 return; | |
1302 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1303 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1304 |
3139 | 1305 SDL_GLContext |
1306 qnxgf_gl_createcontext(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1307 { |
3139 | 1308 #if defined(SDL_VIDEO_OPENGL_ES) |
1309 SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; | |
1310 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; | |
1311 SDL_DisplayData *didata = | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
1312 (SDL_DisplayData *) window->display->driverdata; |
3139 | 1313 EGLBoolean status; |
1314 int32_t gfstatus; | |
1315 EGLint configs; | |
1316 uint32_t surfaces; | |
1317 uint32_t attr_pos; | |
1318 EGLint attr_value; | |
1319 EGLint cit; | |
1320 | |
1321 /* Choose buffeingr scheme */ | |
1322 if (!_this->gl_config.double_buffer) { | |
1323 surfaces = 1; | |
1324 } else { | |
1325 surfaces = 2; | |
1326 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1327 |
3139 | 1328 /* If driver has no support of video memory allocation, then */ |
1329 /* disable double buffering, use single buffer present copy */ | |
1330 if ((didata->caps & SDL_GF_VIDEOMEMORY) != SDL_GF_VIDEOMEMORY) { | |
1331 surfaces = 1; | |
1332 } | |
1333 | |
1334 /* Free main surface */ | |
1335 if (didata->surface[0] != NULL) { | |
1336 gf_surface_free(didata->surface[0]); | |
1337 didata->surface[0] = NULL; | |
1338 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1339 |
3139 | 1340 /* Free back surface */ |
1341 if (didata->surface[1] != NULL) { | |
1342 gf_surface_free(didata->surface[1]); | |
1343 didata->surface[1] = NULL; | |
1344 } | |
3116
b17f1ae7ad66
Added support for single buffering, if double buffering is not available.
Mike Gorchak <lestat@i.com.ua>
parents:
3109
diff
changeset
|
1345 |
3139 | 1346 /* Free second back surface */ |
1347 if (didata->surface[2] != NULL) { | |
1348 gf_surface_free(didata->surface[2]); | |
1349 didata->surface[2] = NULL; | |
1350 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1351 |
3139 | 1352 /* Detach layer before switch to new graphics mode */ |
1353 if (didata->layer_attached == SDL_TRUE) { | |
1354 /* Disable layer if hardware supports this */ | |
1355 gf_layer_disable(didata->layer); | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1356 |
3139 | 1357 /* Detach from layer, free it for others */ |
1358 gf_layer_detach(didata->layer); | |
1359 | |
1360 /* Mark it as detached */ | |
1361 didata->layer_attached = SDL_FALSE; | |
1362 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1363 |
3139 | 1364 /* Attach to main display layer */ |
1365 gfstatus = | |
1366 gf_layer_attach(&didata->layer, didata->display, | |
1367 didata->display_info.main_layer_index, 0); | |
1368 if (gfstatus != GF_ERR_OK) { | |
1369 SDL_SetError("GF: Couldn't attach to main layer, it could be busy"); | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1370 |
3139 | 1371 /* Failed to attach to main displayable layer */ |
1372 return NULL; | |
1373 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1374 |
3139 | 1375 /* Mark main display layer is attached */ |
1376 didata->layer_attached = SDL_TRUE; | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1377 |
3139 | 1378 /* Set layer source and destination viewport */ |
1379 gf_layer_set_src_viewport(didata->layer, 0, 0, didata->current_mode.w - 1, | |
1380 didata->current_mode.h - 1); | |
1381 gf_layer_set_dst_viewport(didata->layer, 0, 0, didata->current_mode.w - 1, | |
1382 didata->current_mode.h - 1); | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1383 |
3139 | 1384 /* Create main visible on display surface */ |
1385 gfstatus = | |
1386 gf_surface_create_layer(&didata->surface[0], &didata->layer, 1, 0, | |
1387 didata->current_mode.w, | |
1388 didata->current_mode.h, | |
1389 qnxgf_sdl_to_gf_pixelformat(didata-> | |
1390 current_mode. | |
1391 format), NULL, | |
1392 GF_SURFACE_CREATE_2D_ACCESSIBLE | | |
1393 GF_SURFACE_CREATE_3D_ACCESSIBLE | | |
1394 GF_SURFACE_CREATE_SHAREABLE); | |
1395 if (gfstatus != GF_ERR_OK) { | |
1396 gf_layer_disable(didata->layer); | |
1397 gf_layer_detach(didata->layer); | |
1398 didata->layer_attached = SDL_FALSE; | |
1399 SDL_SetError("GF: Can't create main layer surface at glctx (%d)\n", | |
1400 gfstatus); | |
1401 return NULL; | |
1402 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1403 |
3139 | 1404 /* Set just created surface as main visible on the layer */ |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1405 // gf_layer_set_surfaces(didata->layer, &didata->surface[0], 1); |
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1406 |
3139 | 1407 if (surfaces > 1) { |
1408 /* Create back display surface */ | |
1409 gfstatus = | |
1410 gf_surface_create_layer(&didata->surface[1], &didata->layer, 1, 0, | |
1411 didata->current_mode.w, | |
1412 didata->current_mode.h, | |
1413 qnxgf_sdl_to_gf_pixelformat(didata-> | |
1414 current_mode. | |
1415 format), NULL, | |
1416 GF_SURFACE_CREATE_2D_ACCESSIBLE | | |
1417 GF_SURFACE_CREATE_3D_ACCESSIBLE | | |
1418 GF_SURFACE_CREATE_SHAREABLE); | |
1419 if (gfstatus != GF_ERR_OK) { | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1420 gf_surface_free(didata->surface[0]); |
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1421 gf_layer_disable(didata->layer); |
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1422 gf_layer_detach(didata->layer); |
3139 | 1423 didata->layer_attached = SDL_FALSE; |
1424 SDL_SetError | |
1425 ("GF: Can't create main layer surface at glctx (%d)\n", | |
1426 gfstatus); | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1427 return NULL; |
3139 | 1428 } |
1429 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1430 |
3139 | 1431 /* Update layer parameters */ |
1432 gfstatus = gf_layer_update(didata->layer, GF_LAYER_UPDATE_NO_WAIT_IDLE); | |
1433 if (gfstatus != GF_ERR_OK) { | |
1434 /* Free main and back surfaces */ | |
1435 gf_surface_free(didata->surface[1]); | |
1436 didata->surface[1] = NULL; | |
1437 gf_surface_free(didata->surface[0]); | |
1438 didata->surface[0] = NULL; | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1439 |
3139 | 1440 /* Detach layer */ |
1441 gf_layer_disable(didata->layer); | |
1442 gf_layer_detach(didata->layer); | |
1443 didata->layer_attached = SDL_FALSE; | |
1444 SDL_SetError("GF: Can't update layer parameters\n"); | |
1445 return NULL; | |
1446 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1447 |
3139 | 1448 /* Enable layer in case if hardware supports layer enable/disable */ |
1449 gf_layer_enable(didata->layer); | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1450 |
3139 | 1451 /* Prepare attributes list to pass them to OpenGL ES */ |
1452 attr_pos = 0; | |
1453 wdata->gles_attributes[attr_pos++] = EGL_NATIVE_VISUAL_ID; | |
1454 wdata->gles_attributes[attr_pos++] = | |
1455 qnxgf_sdl_to_gf_pixelformat(didata->current_mode.format); | |
1456 wdata->gles_attributes[attr_pos++] = EGL_RED_SIZE; | |
1457 wdata->gles_attributes[attr_pos++] = _this->gl_config.red_size; | |
1458 wdata->gles_attributes[attr_pos++] = EGL_GREEN_SIZE; | |
1459 wdata->gles_attributes[attr_pos++] = _this->gl_config.green_size; | |
1460 wdata->gles_attributes[attr_pos++] = EGL_BLUE_SIZE; | |
1461 wdata->gles_attributes[attr_pos++] = _this->gl_config.blue_size; | |
1462 wdata->gles_attributes[attr_pos++] = EGL_ALPHA_SIZE; | |
1463 if (_this->gl_config.alpha_size) { | |
1464 wdata->gles_attributes[attr_pos++] = _this->gl_config.alpha_size; | |
1465 } else { | |
1466 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1467 } | |
3412
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1468 |
3139 | 1469 wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE; |
3412
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1470 if (_this->gl_config.depth_size) { |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1471 wdata->gles_attributes[attr_pos++] = _this->gl_config.depth_size; |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1472 } else { |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1473 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1474 } |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1475 |
3139 | 1476 if (_this->gl_config.buffer_size) { |
1477 wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE; | |
1478 wdata->gles_attributes[attr_pos++] = _this->gl_config.buffer_size; | |
1479 } | |
1480 if (_this->gl_config.stencil_size) { | |
1481 wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; | |
3412
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1482 wdata->gles_attributes[attr_pos++] = _this->gl_config.stencil_size; |
3139 | 1483 } |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1484 |
3139 | 1485 /* Set number of samples in multisampling */ |
1486 if (_this->gl_config.multisamplesamples) { | |
1487 wdata->gles_attributes[attr_pos++] = EGL_SAMPLES; | |
1488 wdata->gles_attributes[attr_pos++] = | |
1489 _this->gl_config.multisamplesamples; | |
1490 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1491 |
3139 | 1492 /* Multisample buffers, OpenGL ES 1.0 spec defines 0 or 1 buffer */ |
1493 if (_this->gl_config.multisamplebuffers) { | |
1494 wdata->gles_attributes[attr_pos++] = EGL_SAMPLE_BUFFERS; | |
1495 wdata->gles_attributes[attr_pos++] = | |
1496 _this->gl_config.multisamplebuffers; | |
1497 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1498 |
3139 | 1499 /* Finish attributes list */ |
1500 wdata->gles_attributes[attr_pos] = EGL_NONE; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1501 |
3139 | 1502 /* Request first suitable framebuffer configuration */ |
1503 status = eglChooseConfig(gfdata->egldisplay, wdata->gles_attributes, | |
1504 wdata->gles_configs, SDL_VIDEO_GF_OPENGLES_CONFS, | |
1505 &configs); | |
1506 if (status != EGL_TRUE) { | |
1507 SDL_SetError("GF: Can't find closest configuration for OpenGL ES"); | |
1508 return NULL; | |
1509 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1510 |
3139 | 1511 /* Check if nothing has been found, try "don't care" settings */ |
1512 if (configs == 0) { | |
1513 int32_t it; | |
1514 int32_t jt; | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1515 static const GLint depthbits[4] = { 32, 24, 16, EGL_DONT_CARE }; |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1516 |
3139 | 1517 for (it = 0; it < 4; it++) { |
1518 for (jt = 16; jt >= 0; jt--) { | |
1519 /* Don't care about color buffer bits, use what exist */ | |
1520 /* Replace previous data set with EGL_DONT_CARE */ | |
1521 attr_pos = 0; | |
1522 wdata->gles_attributes[attr_pos++] = EGL_NATIVE_VISUAL_ID; | |
1523 wdata->gles_attributes[attr_pos++] = | |
1524 qnxgf_sdl_to_gf_pixelformat(didata->current_mode.format); | |
1525 wdata->gles_attributes[attr_pos++] = EGL_RED_SIZE; | |
1526 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1527 wdata->gles_attributes[attr_pos++] = EGL_GREEN_SIZE; | |
1528 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1529 wdata->gles_attributes[attr_pos++] = EGL_BLUE_SIZE; | |
1530 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1531 wdata->gles_attributes[attr_pos++] = EGL_ALPHA_SIZE; | |
1532 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1533 wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE; | |
1534 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1535 |
3139 | 1536 /* Try to find requested or smallest depth */ |
1537 if (_this->gl_config.depth_size) { | |
1538 wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE; | |
1539 wdata->gles_attributes[attr_pos++] = depthbits[it]; | |
1540 } else { | |
1541 wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE; | |
1542 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1543 } | |
1544 | |
1545 if (_this->gl_config.stencil_size) { | |
1546 wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; | |
1547 wdata->gles_attributes[attr_pos++] = jt; | |
1548 } else { | |
1549 wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; | |
1550 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1551 |
3139 | 1552 /* exit from stencil loop */ |
1553 jt = 0; | |
1554 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1555 |
3139 | 1556 /* Don't care about antialiasing */ |
1557 wdata->gles_attributes[attr_pos++] = EGL_SAMPLES; | |
1558 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1559 wdata->gles_attributes[attr_pos++] = EGL_SAMPLE_BUFFERS; | |
1560 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1561 wdata->gles_attributes[attr_pos] = EGL_NONE; | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1562 |
3139 | 1563 /* Request first suitable framebuffer configuration */ |
1564 status = | |
1565 eglChooseConfig(gfdata->egldisplay, | |
1566 wdata->gles_attributes, | |
1567 wdata->gles_configs, | |
1568 SDL_VIDEO_GF_OPENGLES_CONFS, &configs); | |
1569 if (status != EGL_TRUE) { | |
1570 SDL_SetError | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1571 ("GF: Can't find closest configuration for OpenGL ES"); |
3139 | 1572 return NULL; |
1573 } | |
1574 if (configs != 0) { | |
1575 break; | |
1576 } | |
1577 } | |
1578 if (configs != 0) { | |
1579 break; | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1580 } |
3139 | 1581 } |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1582 |
3139 | 1583 /* No available configs */ |
1584 if (configs == 0) { | |
3186 | 1585 SDL_SetError("GF: Can't find any configuration for OpenGL ES"); |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1586 return NULL; |
3139 | 1587 } |
1588 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1589 |
3139 | 1590 /* Initialize config index */ |
1591 wdata->gles_config = 0; | |
1592 | |
1593 /* Now check each configuration to find out the best */ | |
1594 for (cit = 0; cit < configs; cit++) { | |
1595 uint32_t stencil_found; | |
1596 uint32_t depth_found; | |
3412
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1597 EGLint cur_depth; |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1598 EGLint cur_stencil; |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1599 |
3139 | 1600 stencil_found = 0; |
1601 depth_found = 0; | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1602 |
3139 | 1603 if (_this->gl_config.stencil_size) { |
1604 status = | |
1605 eglGetConfigAttrib(gfdata->egldisplay, | |
1606 wdata->gles_configs[cit], EGL_STENCIL_SIZE, | |
3412
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1607 &cur_stencil); |
3139 | 1608 if (status == EGL_TRUE) { |
1609 if (attr_value != 0) { | |
1610 stencil_found = 1; | |
1611 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1612 } |
3139 | 1613 } else { |
1614 stencil_found = 1; | |
1615 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1616 |
3139 | 1617 if (_this->gl_config.depth_size) { |
1618 status = | |
1619 eglGetConfigAttrib(gfdata->egldisplay, | |
1620 wdata->gles_configs[cit], EGL_DEPTH_SIZE, | |
3412
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1621 &cur_depth); |
3139 | 1622 if (status == EGL_TRUE) { |
1623 if (attr_value != 0) { | |
1624 depth_found = 1; | |
1625 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1626 } |
3139 | 1627 } else { |
1628 depth_found = 1; | |
1629 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1630 |
3139 | 1631 /* Exit from loop if found appropriate configuration */ |
1632 if ((depth_found != 0) && (stencil_found != 0)) { | |
3412
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1633 /* Store last satisfied configuration id */ |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1634 wdata->gles_config = cit; |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1635 |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1636 if (cur_depth==_this->gl_config.depth_size) |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1637 { |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1638 /* Exact match on depth bits */ |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1639 if (!_this->gl_config.stencil_size) |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1640 { |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1641 /* Stencil is not required */ |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1642 break; |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1643 } |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1644 else |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1645 { |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1646 if (cur_stencil==_this->gl_config.stencil_size) |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1647 { |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1648 /* Exact match on stencil bits */ |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1649 break; |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1650 } |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1651 } |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1652 } |
3139 | 1653 } |
1654 } | |
1655 | |
3412
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1656 /* If best could not be found, use first or last satisfied */ |
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1657 if ((cit == configs) && (wdata->gles_config==0)) { |
3139 | 1658 cit = 0; |
3412
fe9c8a5cab51
Fixes in GLES configuration selection.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1659 wdata->gles_config = cit; |
3139 | 1660 } |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1661 |
3139 | 1662 /* Create OpenGL ES context */ |
1663 wdata->gles_context = | |
1664 eglCreateContext(gfdata->egldisplay, | |
1665 wdata->gles_configs[wdata->gles_config], | |
1666 EGL_NO_CONTEXT, NULL); | |
1667 if (wdata->gles_context == EGL_NO_CONTEXT) { | |
1668 SDL_SetError("GF: OpenGL ES context creation has been failed"); | |
1669 return NULL; | |
1670 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1671 |
3139 | 1672 /* Free any 3D target if it was created before */ |
1673 if (wdata->target_created == SDL_TRUE) { | |
1674 gf_3d_target_free(wdata->target); | |
1675 wdata->target_created == SDL_FALSE; | |
1676 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1677 |
3139 | 1678 /* Create surface(s) target for OpenGL ES */ |
1679 gfstatus = | |
1680 gf_3d_target_create(&wdata->target, didata->layer, | |
1681 &didata->surface[0], surfaces, | |
1682 didata->current_mode.w, didata->current_mode.h, | |
1683 qnxgf_sdl_to_gf_pixelformat(didata->current_mode. | |
1684 format)); | |
1685 if (gfstatus != GF_ERR_OK) { | |
1686 /* Destroy just created context */ | |
1687 eglDestroyContext(gfdata->egldisplay, wdata->gles_context); | |
1688 wdata->gles_context = EGL_NO_CONTEXT; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1689 |
3139 | 1690 /* Mark 3D target as unallocated */ |
1691 wdata->target_created = SDL_FALSE; | |
1692 SDL_SetError("GF: OpenGL ES target could not be created"); | |
1693 return NULL; | |
1694 } else { | |
1695 wdata->target_created = SDL_TRUE; | |
1696 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1697 |
3139 | 1698 /* Create target rendering surface on whole screen */ |
1699 wdata->gles_surface = | |
1700 eglCreateWindowSurface(gfdata->egldisplay, | |
1701 wdata->gles_configs[wdata->gles_config], | |
1702 wdata->target, NULL); | |
1703 if (wdata->gles_surface == EGL_NO_SURFACE) { | |
1704 /* Destroy 3d target */ | |
1705 gf_3d_target_free(wdata->target); | |
1706 wdata->target_created = SDL_FALSE; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1707 |
3139 | 1708 /* Destroy OpenGL ES context */ |
1709 eglDestroyContext(gfdata->egldisplay, wdata->gles_context); | |
1710 wdata->gles_context = EGL_NO_CONTEXT; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1711 |
3139 | 1712 SDL_SetError("GF: OpenGL ES surface could not be created"); |
1713 return NULL; | |
1714 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1715 |
3139 | 1716 /* Make just created context current */ |
1717 status = | |
1718 eglMakeCurrent(gfdata->egldisplay, wdata->gles_surface, | |
1719 wdata->gles_surface, wdata->gles_context); | |
1720 if (status != EGL_TRUE) { | |
1721 /* Destroy OpenGL ES surface */ | |
1722 eglDestroySurface(gfdata->egldisplay, wdata->gles_surface); | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1723 |
3139 | 1724 /* Destroy 3d target */ |
1725 gf_3d_target_free(wdata->target); | |
1726 wdata->target_created = SDL_FALSE; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1727 |
3139 | 1728 /* Destroy OpenGL ES context */ |
1729 eglDestroyContext(gfdata->egldisplay, wdata->gles_context); | |
1730 wdata->gles_context = EGL_NO_CONTEXT; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1731 |
3139 | 1732 /* Failed to set current GL ES context */ |
1733 SDL_SetError("GF: Can't set OpenGL ES context on creation"); | |
1734 return NULL; | |
1735 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1736 |
3139 | 1737 /* Setup into SDL internals state of OpenGL ES: */ |
1738 /* it is accelerated or not */ | |
1739 if ((didata->caps & SDL_GF_ACCELERATED_3D) == SDL_GF_ACCELERATED_3D) { | |
1740 _this->gl_config.accelerated = 1; | |
1741 } else { | |
1742 _this->gl_config.accelerated = 0; | |
1743 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1744 |
3139 | 1745 /* Always clear stereo enable, since OpenGL ES do not supports stereo */ |
1746 _this->gl_config.stereo = 0; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1747 |
3139 | 1748 /* Get back samples and samplebuffers configurations. Rest framebuffer */ |
1749 /* parameters could be obtained through the OpenGL ES API */ | |
1750 status = | |
1751 eglGetConfigAttrib(gfdata->egldisplay, | |
1752 wdata->gles_configs[wdata->gles_config], | |
1753 EGL_SAMPLES, &attr_value); | |
1754 if (status == EGL_TRUE) { | |
1755 _this->gl_config.multisamplesamples = attr_value; | |
1756 } | |
1757 status = | |
1758 eglGetConfigAttrib(gfdata->egldisplay, | |
1759 wdata->gles_configs[wdata->gles_config], | |
1760 EGL_SAMPLE_BUFFERS, &attr_value); | |
1761 if (status == EGL_TRUE) { | |
1762 _this->gl_config.multisamplebuffers = attr_value; | |
1763 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1764 |
3139 | 1765 /* Get back stencil and depth buffer sizes */ |
1766 status = | |
1767 eglGetConfigAttrib(gfdata->egldisplay, | |
1768 wdata->gles_configs[wdata->gles_config], | |
1769 EGL_DEPTH_SIZE, &attr_value); | |
1770 if (status == EGL_TRUE) { | |
1771 _this->gl_config.depth_size = attr_value; | |
1772 } | |
1773 status = | |
1774 eglGetConfigAttrib(gfdata->egldisplay, | |
1775 wdata->gles_configs[wdata->gles_config], | |
1776 EGL_STENCIL_SIZE, &attr_value); | |
1777 if (status == EGL_TRUE) { | |
1778 _this->gl_config.stencil_size = attr_value; | |
1779 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1780 |
3139 | 1781 /* Restore cursor if it was visible */ |
1782 if (didata->cursor_visible == SDL_TRUE) { | |
1783 gf_cursor_set(didata->display, 0, &didata->cursor); | |
1784 gf_cursor_enable(didata->display, 0); | |
1785 } | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1786 |
3139 | 1787 /* GL ES context was successfully created */ |
1788 return wdata->gles_context; | |
1789 #else | |
1790 SDL_SetError("GF: OpenGL ES support is not compiled in"); | |
1791 return NULL; | |
1792 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1793 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1794 |
3139 | 1795 int |
1796 qnxgf_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1797 { |
3139 | 1798 #if defined(SDL_VIDEO_OPENGL_ES) |
1799 SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; | |
1800 SDL_WindowData *wdata; | |
1801 EGLBoolean status; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1802 |
3139 | 1803 if ((window == NULL) && (context == NULL)) { |
1804 status = | |
1805 eglMakeCurrent(gfdata->egldisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, | |
1806 EGL_NO_CONTEXT); | |
1807 if (status != EGL_TRUE) { | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1808 /* Failed to set current GL ES context */ |
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1809 SDL_SetError("GF: Can't set OpenGL ES context"); |
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1810 return -1; |
3139 | 1811 } |
1812 } else { | |
1813 wdata = (SDL_WindowData *) window->driverdata; | |
1814 status = | |
1815 eglMakeCurrent(gfdata->egldisplay, wdata->gles_surface, | |
1816 wdata->gles_surface, wdata->gles_context); | |
1817 if (status != EGL_TRUE) { | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1818 /* Failed to set current GL ES context */ |
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1819 SDL_SetError("GF: Can't set OpenGL ES context"); |
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1820 return -1; |
3139 | 1821 } |
1822 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1823 |
3139 | 1824 return 0; |
1825 #else | |
1826 SDL_SetError("GF: OpenGL ES support is not compiled in"); | |
1827 return -1; | |
1828 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1829 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1830 |
3139 | 1831 int |
1832 qnxgf_gl_setswapinterval(_THIS, int interval) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1833 { |
3139 | 1834 #if defined(SDL_VIDEO_OPENGL_ES) |
1835 SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; | |
1836 EGLBoolean status; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1837 |
3139 | 1838 /* Check if OpenGL ES connection has been initialized */ |
1839 if (gfdata->egldisplay != EGL_NO_DISPLAY) { | |
1840 /* Set swap OpenGL ES interval */ | |
1841 status = eglSwapInterval(gfdata->egldisplay, interval); | |
1842 if (status == EGL_TRUE) { | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1843 /* Return success to upper level */ |
3139 | 1844 gfdata->swapinterval = interval; |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1845 return 0; |
3139 | 1846 } |
1847 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1848 |
3139 | 1849 /* Failed to set swap interval */ |
1850 SDL_SetError("GF: Cannot set swap interval"); | |
1851 return -1; | |
1852 #else | |
1853 SDL_SetError("GF: OpenGL ES support is not compiled in"); | |
1854 return -1; | |
1855 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1856 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1857 |
3139 | 1858 int |
1859 qnxgf_gl_getswapinterval(_THIS) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1860 { |
3139 | 1861 #if defined(SDL_VIDEO_OPENGL_ES) |
1862 SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1863 |
3139 | 1864 /* Return default swap interval value */ |
1865 return gfdata->swapinterval; | |
1866 #else | |
1867 SDL_SetError("GF: OpenGL ES support is not compiled in"); | |
1868 return -1; | |
1869 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1870 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1871 |
3139 | 1872 void |
1873 qnxgf_gl_swapwindow(_THIS, SDL_Window * window) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1874 { |
3139 | 1875 #if defined(SDL_VIDEO_OPENGL_ES) |
1876 SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; | |
1877 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1878 |
3139 | 1879 /* Finish all drawings */ |
1880 glFinish(); | |
3109
7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
1881 |
3139 | 1882 /* Swap buffers */ |
1883 eglSwapBuffers(gfdata->egldisplay, wdata->gles_surface); | |
1884 #else | |
1885 SDL_SetError("GF: OpenGL ES support is not compiled in"); | |
1886 return; | |
1887 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1888 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1889 |
3139 | 1890 void |
1891 qnxgf_gl_deletecontext(_THIS, SDL_GLContext context) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1892 { |
3139 | 1893 #if defined(SDL_VIDEO_OPENGL_ES) |
1894 SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; | |
1895 EGLBoolean status; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1896 |
3139 | 1897 /* Check if OpenGL ES connection has been initialized */ |
1898 if (gfdata->egldisplay != EGL_NO_DISPLAY) { | |
1899 if (context != EGL_NO_CONTEXT) { | |
1900 status = eglDestroyContext(gfdata->egldisplay, context); | |
1901 if (status != EGL_TRUE) { | |
1902 /* Error during OpenGL ES context destroying */ | |
1903 SDL_SetError("GF: OpenGL ES context destroy error"); | |
1904 return; | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1905 } |
3139 | 1906 } |
1907 } | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3092
diff
changeset
|
1908 |
3139 | 1909 return; |
1910 #else | |
1911 SDL_SetError("GF: OpenGL ES support is not compiled in"); | |
1912 return; | |
1913 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1914 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1915 |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1916 /*****************************************************************************/ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1917 /* SDL Event handling function */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1918 /*****************************************************************************/ |
3139 | 1919 void |
1920 qnxgf_pumpevents(_THIS) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1921 { |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1922 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1923 |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1924 /*****************************************************************************/ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1925 /* SDL screen saver related functions */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1926 /*****************************************************************************/ |
3139 | 1927 void |
1928 qnxgf_suspendscreensaver(_THIS) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1929 { |
3139 | 1930 /* There is no screensaver in pure console, it may exist when running */ |
1931 /* GF under Photon, but I do not know, how to disable screensaver */ | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1932 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3083
diff
changeset
|
1933 |
3083
0bc41e0361d3
Date: Mon, 2 Mar 2009 16:27:42 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1934 /* vi: set ts=4 sw=4 expandtab: */ |