Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
1934 lines (1695 loc) · 69.5 KB

SDL_qnxgf.c

File metadata and controls

1934 lines (1695 loc) · 69.5 KB
 
Apr 26, 2001
Apr 26, 2001
1
2
/*
SDL - Simple DirectMedia Layer
Dec 8, 2008
Dec 8, 2008
3
Copyright (C) 1997-2009 Sam Lantinga
Apr 26, 2001
Apr 26, 2001
4
5
This library is free software; you can redistribute it and/or
Feb 1, 2006
Feb 1, 2006
6
modify it under the terms of the GNU Lesser General Public
Apr 26, 2001
Apr 26, 2001
7
License as published by the Free Software Foundation; either
Feb 1, 2006
Feb 1, 2006
8
version 2.1 of the License, or (at your option) any later version.
Apr 26, 2001
Apr 26, 2001
9
10
11
12
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Feb 1, 2006
Feb 1, 2006
13
Lesser General Public License for more details.
Apr 26, 2001
Apr 26, 2001
14
Feb 1, 2006
Feb 1, 2006
15
16
17
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Apr 26, 2001
Apr 26, 2001
18
19
Sam Lantinga
Dec 14, 2001
Dec 14, 2001
20
slouken@libsdl.org
Mar 17, 2009
Mar 17, 2009
21
22
23
24
QNX Graphics Framework SDL driver
Copyright (C) 2009 Mike Gorchak
(mike@malva.ua, lestat@i.com.ua)
Apr 26, 2001
Apr 26, 2001
25
*/
Aug 30, 2003
Aug 30, 2003
26
Mar 3, 2009
Mar 3, 2009
27
#include "SDL_config.h"
Apr 26, 2001
Apr 26, 2001
28
Mar 3, 2009
Mar 3, 2009
29
#include "../SDL_sysvideo.h"
Mar 4, 2009
Mar 4, 2009
30
31
#include "SDL_version.h"
#include "SDL_syswm.h"
Mar 24, 2009
Mar 24, 2009
32
#include "SDL_loadso.h"
Mar 4, 2009
Mar 4, 2009
33
34
35
36
37
/* Include QNX Graphics Framework declarations */
#include <gf/gf.h>
#include "SDL_qnxgf.h"
Mar 17, 2009
Mar 17, 2009
38
#include "SDL_gf_render.h"
Mar 4, 2009
Mar 4, 2009
39
#include "SDL_gf_pixelfmt.h"
Apr 28, 2009
Apr 28, 2009
40
41
#include "SDL_gf_opengles.h"
#include "SDL_gf_input.h"
Mar 4, 2009
Mar 4, 2009
42
43
44
45
46
47
48
49
/******************************************************************************/
/* SDL Generic video modes, which could provide GF */
/* This is real pain in the ass. GF is just wrapper around a selected driver */
/* some drivers could support double scan modes, like 320x200, 512x384, etc */
/* but some drivers are not. Later we can distinguish one driver from another */
/* Feel free to add any new custom graphics mode */
/******************************************************************************/
Jun 10, 2009
Jun 10, 2009
50
static const SDL_DisplayMode generic_mode[] = {
May 23, 2009
May 23, 2009
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{0, 320, 200, 70, NULL}, /* 320x200 modes are 70Hz and 85Hz */
{0, 320, 200, 85, NULL},
{0, 320, 240, 70, NULL}, /* 320x240 modes are 70Hz and 85Hz */
{0, 320, 240, 85, NULL},
{0, 400, 300, 60, NULL}, /* 400x300 mode is 60Hz only */
{0, 480, 360, 60, NULL}, /* 480x360 mode is 60Hz only */
{0, 512, 384, 60, NULL}, /* 512x384 modes are 60Hz and 70Hz */
{0, 512, 384, 70, NULL},
{0, 640, 480, 60, NULL}, /* 640x480 modes are 60Hz, 75Hz, 85Hz */
{0, 640, 480, 75, NULL},
{0, 640, 480, 85, NULL},
{0, 800, 600, 60, NULL}, /* 800x600 modes are 60Hz, 75Hz, 85Hz */
{0, 800, 600, 75, NULL},
{0, 800, 600, 85, NULL},
{0, 800, 480, 60, NULL}, /* 800x480 mode is 60Hz only */
{0, 848, 480, 60, NULL}, /* 848x480 mode is 60Hz only */
{0, 960, 600, 60, NULL}, /* 960x600 mode is 60Hz only */
{0, 1024, 640, 60, NULL}, /* 1024x640 mode is 60Hz only */
{0, 1024, 768, 60, NULL}, /* 1024x768 modes are 60Hz, 70Hz, 75Hz */
{0, 1024, 768, 70, NULL},
{0, 1024, 768, 75, NULL},
{0, 1088, 612, 60, NULL}, /* 1088x612 mode is 60Hz only */
{0, 1152, 864, 60, NULL}, /* 1152x864 modes are 60Hz, 70Hz, 72Hz */
{0, 1152, 864, 70, NULL}, /* 75Hz and 85Hz */
{0, 1152, 864, 72, NULL},
{0, 1152, 864, 75, NULL},
{0, 1152, 864, 85, NULL},
{0, 1280, 720, 60, NULL}, /* 1280x720 mode is 60Hz only */
{0, 1280, 768, 60, NULL}, /* 1280x768 mode is 60Hz only */
{0, 1280, 800, 60, NULL}, /* 1280x800 mode is 60Hz only */
{0, 1280, 960, 60, NULL}, /* 1280x960 mode is 60Hz only */
{0, 1280, 1024, 60, NULL}, /* 1280x1024 modes are 60Hz, 75Hz, 85Hz and */
{0, 1280, 1024, 75, NULL}, /* 100 Hz */
{0, 1280, 1024, 85, NULL}, /* */
{0, 1280, 1024, 100, NULL}, /* */
{0, 1360, 768, 60, NULL}, /* 1360x768 mode is 60Hz only */
{0, 1400, 1050, 60, NULL}, /* 1400x1050 mode is 60Hz only */
{0, 1440, 900, 60, NULL}, /* 1440x900 mode is 60Hz only */
{0, 1440, 960, 60, NULL}, /* 1440x960 mode is 60Hz only */
{0, 1600, 900, 60, NULL}, /* 1600x900 mode is 60Hz only */
{0, 1600, 1024, 60, NULL}, /* 1600x1024 mode is 60Hz only */
{0, 1600, 1200, 60, NULL}, /* 1600x1200 mode is 60Hz only */
{0, 1680, 1050, 60, NULL}, /* 1680x1050 mode is 60Hz only */
{0, 1920, 1080, 60, NULL}, /* 1920x1080 mode is 60Hz only */
{0, 1920, 1200, 60, NULL}, /* 1920x1200 mode is 60Hz only */
{0, 1920, 1440, 60, NULL}, /* 1920x1440 mode is 60Hz only */
{0, 2048, 1536, 60, NULL}, /* 2048x1536 mode is 60Hz only */
{0, 2048, 1080, 60, NULL}, /* 2048x1080 mode is 60Hz only */
{0, 0, 0, 0, NULL} /* End of generic mode list */
Mar 4, 2009
Mar 4, 2009
100
101
};
Mar 17, 2009
Mar 17, 2009
102
/* Low level device graphics driver names, which they are reporting */
Jun 10, 2009
Jun 10, 2009
103
static const GF_DeviceCaps gf_devicename[] = {
May 23, 2009
May 23, 2009
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/* ATI Rage 128 graphics driver (devg-ati_rage128) */
{"ati_rage128", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Fujitsu Carmine graphics driver (devg-carmine.so) */
{"carmine", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* C&T graphics driver (devg-chips.so) */
{"chips", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Fujitsu Coral graphics driver (devg-coral.so) */
{"coral", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Intel integrated graphics driver (devg-extreme2.so) */
{"extreme2", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Unaccelerated FB driver (devg-flat.so) */
{"flat", SDL_GF_UNACCELERATED | SDL_GF_LOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_NOVIDEOMEMORY},
/* NS Geode graphics driver (devg-geode.so) */
{"geode", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Geode LX graphics driver (devg-geodelx.so) */
{"geodelx", SDL_GF_ACCELERATED | SDL_GF_LOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Intel integrated graphics driver (devg-gma9xx.so) */
{"gma", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Intel integrated graphics driver (devg-i810.so) */
{"i810", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Intel integrated graphics driver (devg-i830.so) */
{"i830", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Geode LX graphics driver (devg-lx800.so) */
{"lx800", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Matrox Gxx graphics driver (devg-matroxg.so) */
{"matroxg", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Intel Poulsbo graphics driver (devg-poulsbo.so) */
{"poulsbo", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* ATI Radeon driver (devg-radeon.so) */
{"radeon", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* ATI Rage driver (devg-rage.so) */
{"rage", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* S3 Savage graphics driver (devg-s3_savage.so) */
{"s3_savage", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* SiS630 integrated graphics driver (devg-sis630.so) */
{"sis630", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* PowerVR SGX 535 graphics driver (devg-poulsbo.so) */
{"sgx", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_ACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* SM Voyager GX graphics driver (devg-smi5xx.so) */
{"smi5xx", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* Silicon Motion graphics driver (devg-smi7xx.so) */
{"smi7xx", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* SVGA unaccelerated gfx driver (devg-svga.so) */
{"svga", SDL_GF_UNACCELERATED | SDL_GF_LOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_NOVIDEOMEMORY},
/* nVidia TNT graphics driver (devg-tnt.so) */
{"tnt", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* VIA integrated graphics driver (devg-tvia.so) */
{"tvia", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* VIA UniChrome graphics driver (devg-unichrome.so) */
{"unichrome", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* VESA unaccelerated gfx driver (devg-vesa.so) */
{"vesa", SDL_GF_UNACCELERATED | SDL_GF_LOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_NOVIDEOMEMORY},
/* VmWare graphics driver (devg-volari.so) */
{"vmware", SDL_GF_ACCELERATED | SDL_GF_LOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_NOVIDEOMEMORY},
/* XGI XP10 graphics driver (devg-volari.so) */
{"volari", SDL_GF_ACCELERATED | SDL_GF_LOWRESOLUTION |
SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY},
/* End of list */
{NULL, 0x00000000}
Mar 17, 2009
Mar 17, 2009
190
191
};
Mar 4, 2009
Mar 4, 2009
192
193
194
195
/*****************************************************************************/
/* SDL Video Device initialization functions */
/*****************************************************************************/
May 23, 2009
May 23, 2009
196
197
static int
qnxgf_available(void)
Mar 4, 2009
Mar 4, 2009
198
{
May 23, 2009
May 23, 2009
199
200
201
gf_dev_t gfdev;
gf_dev_info_t gfdev_info;
int status;
Mar 4, 2009
Mar 4, 2009
202
May 23, 2009
May 23, 2009
203
204
205
206
207
/* Try to attach to graphics device driver */
status = gf_dev_attach(&gfdev, GF_DEVICE_INDEX(0), &gfdev_info);
if (status != GF_ERR_OK) {
return 0;
}
Mar 4, 2009
Mar 4, 2009
208
May 23, 2009
May 23, 2009
209
210
/* Detach from graphics device driver for now */
gf_dev_detach(gfdev);
Mar 4, 2009
Mar 4, 2009
211
May 23, 2009
May 23, 2009
212
return 1;
Mar 4, 2009
Mar 4, 2009
213
214
}
May 23, 2009
May 23, 2009
215
216
static void
qnxgf_destroy(SDL_VideoDevice * device)
Mar 4, 2009
Mar 4, 2009
217
{
May 23, 2009
May 23, 2009
218
219
220
221
222
223
224
225
226
227
228
SDL_VideoData *gfdata = (SDL_VideoData *) device->driverdata;
/* Detach from graphics device driver, if it was initialized */
if (gfdata->gfinitialized != SDL_FALSE) {
gf_dev_detach(gfdata->gfdev);
gfdata->gfdev = NULL;
}
if (device->driverdata != NULL) {
device->driverdata = NULL;
}
Mar 4, 2009
Mar 4, 2009
229
230
}
May 23, 2009
May 23, 2009
231
232
static SDL_VideoDevice *
qnxgf_create(int devindex)
Mar 4, 2009
Mar 4, 2009
233
{
May 23, 2009
May 23, 2009
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
SDL_VideoDevice *device;
SDL_VideoData *gfdata;
int status;
/* Initialize SDL_VideoDevice structure */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
if (device == NULL) {
SDL_OutOfMemory();
return NULL;
}
/* Initialize internal GF specific data */
gfdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
if (gfdata == NULL) {
SDL_OutOfMemory();
SDL_free(device);
return NULL;
}
device->driverdata = gfdata;
Nov 20, 2009
Nov 20, 2009
254
255
256
/* By default GF is not initialized */
gfdata->gfinitialized = SDL_FALSE;
May 23, 2009
May 23, 2009
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/* Try to attach to graphics device driver */
status =
gf_dev_attach(&gfdata->gfdev, GF_DEVICE_INDEX(devindex),
&gfdata->gfdev_info);
if (status != GF_ERR_OK) {
SDL_OutOfMemory();
SDL_free(gfdata);
SDL_free(device);
return NULL;
}
if (gfdata->gfdev_info.description == NULL) {
gf_dev_detach(gfdata->gfdev);
SDL_SetError("GF: Failed to initialize graphics driver");
return NULL;
}
/* Setup amount of available displays and current display */
device->num_displays = 0;
device->current_display = 0;
/* Setup device shutdown function */
gfdata->gfinitialized = SDL_TRUE;
device->free = qnxgf_destroy;
/* Setup all functions which we can handle */
device->VideoInit = qnxgf_videoinit;
device->VideoQuit = qnxgf_videoquit;
device->GetDisplayModes = qnxgf_getdisplaymodes;
device->SetDisplayMode = qnxgf_setdisplaymode;
device->SetDisplayPalette = qnxgf_setdisplaypalette;
device->GetDisplayPalette = qnxgf_getdisplaypalette;
device->SetDisplayGammaRamp = qnxgf_setdisplaygammaramp;
device->GetDisplayGammaRamp = qnxgf_getdisplaygammaramp;
device->CreateWindow = qnxgf_createwindow;
device->CreateWindowFrom = qnxgf_createwindowfrom;
device->SetWindowTitle = qnxgf_setwindowtitle;
device->SetWindowIcon = qnxgf_setwindowicon;
device->SetWindowPosition = qnxgf_setwindowposition;
device->SetWindowSize = qnxgf_setwindowsize;
device->ShowWindow = qnxgf_showwindow;
device->HideWindow = qnxgf_hidewindow;
device->RaiseWindow = qnxgf_raisewindow;
device->MaximizeWindow = qnxgf_maximizewindow;
device->MinimizeWindow = qnxgf_minimizewindow;
device->RestoreWindow = qnxgf_restorewindow;
device->SetWindowGrab = qnxgf_setwindowgrab;
device->DestroyWindow = qnxgf_destroywindow;
device->GetWindowWMInfo = qnxgf_getwindowwminfo;
device->GL_LoadLibrary = qnxgf_gl_loadlibrary;
device->GL_GetProcAddress = qnxgf_gl_getprocaddres;
device->GL_UnloadLibrary = qnxgf_gl_unloadlibrary;
device->GL_CreateContext = qnxgf_gl_createcontext;
device->GL_MakeCurrent = qnxgf_gl_makecurrent;
device->GL_SetSwapInterval = qnxgf_gl_setswapinterval;
device->GL_GetSwapInterval = qnxgf_gl_getswapinterval;
device->GL_SwapWindow = qnxgf_gl_swapwindow;
device->GL_DeleteContext = qnxgf_gl_deletecontext;
device->PumpEvents = qnxgf_pumpevents;
device->SuspendScreenSaver = qnxgf_suspendscreensaver;
return device;
Mar 4, 2009
Mar 4, 2009
319
}
Apr 26, 2001
Apr 26, 2001
320
May 23, 2009
May 23, 2009
321
322
323
324
325
VideoBootStrap qnxgf_bootstrap = {
"qnxgf",
"SDL QNX Graphics Framework (GF) video driver",
qnxgf_available,
qnxgf_create
Mar 3, 2009
Mar 3, 2009
326
};
Aug 30, 2003
Aug 30, 2003
327
Mar 4, 2009
Mar 4, 2009
328
329
330
/*****************************************************************************/
/* SDL Video and Display initialization/handling functions */
/*****************************************************************************/
May 23, 2009
May 23, 2009
331
332
int
qnxgf_videoinit(_THIS)
Mar 4, 2009
Mar 4, 2009
333
{
May 23, 2009
May 23, 2009
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
uint32_t it;
uint32_t jt;
char *override;
int32_t status;
/* By default GF uses buffer swap on vsync */
gfdata->swapinterval = 1;
/* Add each detected output to SDL */
for (it = 0; it < gfdata->gfdev_info.ndisplays; it++) {
SDL_VideoDisplay display;
SDL_DisplayMode current_mode;
SDL_DisplayData *didata;
didata = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
if (didata == NULL) {
/* memory allocation problem */
SDL_OutOfMemory();
return -1;
}
/* Set default cursor settings, maximum 128x128 cursor */
didata->cursor_visible = SDL_FALSE;
didata->cursor.type = GF_CURSOR_BITMAP;
didata->cursor.hotspot.x = 0;
didata->cursor.hotspot.y = 0;
didata->cursor.cursor.bitmap.w = SDL_VIDEO_GF_MAX_CURSOR_SIZE;
didata->cursor.cursor.bitmap.h = SDL_VIDEO_GF_MAX_CURSOR_SIZE;
didata->cursor.cursor.bitmap.stride =
(didata->cursor.cursor.bitmap.w + 7) / (sizeof(uint8_t) * 8);
didata->cursor.cursor.bitmap.color0 = 0x00000000;
didata->cursor.cursor.bitmap.color1 = 0x00000000;
didata->cursor.cursor.bitmap.image0 =
SDL_calloc(sizeof(uint8_t),
(didata->cursor.cursor.bitmap.w +
7) * didata->cursor.cursor.bitmap.h /
(sizeof(uint8_t) * 8));
if (didata->cursor.cursor.bitmap.image0 == NULL) {
SDL_free(didata);
SDL_OutOfMemory();
return -1;
}
didata->cursor.cursor.bitmap.image1 =
SDL_calloc(sizeof(uint8_t),
(didata->cursor.cursor.bitmap.w +
7) * didata->cursor.cursor.bitmap.h /
(sizeof(uint8_t) * 8));
if (didata->cursor.cursor.bitmap.image1 == NULL) {
SDL_OutOfMemory();
SDL_free((void *) didata->cursor.cursor.bitmap.image0);
SDL_free(didata);
return -1;
}
/* Query current display settings */
status = gf_display_query(gfdata->gfdev, it, &didata->display_info);
if (status == GF_ERR_OK) {
SDL_zero(current_mode);
current_mode.w = didata->display_info.xres;
current_mode.h = didata->display_info.yres;
current_mode.refresh_rate = didata->display_info.refresh;
current_mode.format =
qnxgf_gf_to_sdl_pixelformat(didata->display_info.format);
current_mode.driverdata = NULL;
} else {
/* video initialization problem */
SDL_free((void *) didata->cursor.cursor.bitmap.image0);
SDL_free((void *) didata->cursor.cursor.bitmap.image1);
SDL_free(didata);
SDL_SetError("GF: Display query failed");
return -1;
}
/* Attach GF to selected display */
status = gf_display_attach(&didata->display, gfdata->gfdev, it, NULL);
if (status != GF_ERR_OK) {
/* video initialization problem */
SDL_free((void *) didata->cursor.cursor.bitmap.image0);
SDL_free((void *) didata->cursor.cursor.bitmap.image1);
SDL_free(didata);
SDL_SetError("GF: Couldn't attach to display");
return -1;
}
/* Initialize status variables */
didata->layer_attached = SDL_FALSE;
/* Attach to main display layer */
status =
gf_layer_attach(&didata->layer, didata->display,
didata->display_info.main_layer_index, 0);
if (status != GF_ERR_OK) {
/* Failed to attach to main layer */
SDL_free((void *) didata->cursor.cursor.bitmap.image0);
SDL_free((void *) didata->cursor.cursor.bitmap.image1);
SDL_free(didata);
SDL_SetError
("GF: Couldn't attach to main layer, it could be busy");
return -1;
}
/* Mark main display layer is attached */
didata->layer_attached = SDL_TRUE;
/* Set layer source and destination viewport */
gf_layer_set_src_viewport(didata->layer, 0, 0, current_mode.w - 1,
current_mode.h - 1);
gf_layer_set_dst_viewport(didata->layer, 0, 0, current_mode.w - 1,
current_mode.h - 1);
/* Create main visible on display surface */
status = gf_surface_create_layer(&didata->surface[0], &didata->layer,
1, 0, current_mode.w, current_mode.h,
qnxgf_sdl_to_gf_pixelformat
(current_mode.format), NULL,
GF_SURFACE_CREATE_2D_ACCESSIBLE |
GF_SURFACE_CREATE_3D_ACCESSIBLE |
GF_SURFACE_CREATE_SHAREABLE);
if (status != GF_ERR_OK) {
gf_layer_disable(didata->layer);
gf_layer_detach(didata->layer);
didata->layer_attached = SDL_FALSE;
SDL_free((void *) didata->cursor.cursor.bitmap.image0);
SDL_free((void *) didata->cursor.cursor.bitmap.image1);
SDL_free(didata);
SDL_SetError("GF: Can't create main layer surface at init (%d)\n",
status);
return -1;
}
/* Set just created surface as main visible on the layer */
Apr 28, 2009
Apr 28, 2009
466
467
// gf_layer_set_surfaces(didata->layer, &didata->surface[0], 1);
May 23, 2009
May 23, 2009
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
/* Update layer parameters */
status = gf_layer_update(didata->layer, GF_LAYER_UPDATE_NO_WAIT_IDLE);
if (status != GF_ERR_OK) {
/* Free allocated surface */
gf_surface_free(didata->surface[0]);
didata->surface[0] = NULL;
/* Disable and detach from layer */
gf_layer_disable(didata->layer);
gf_layer_detach(didata->layer);
didata->layer_attached = SDL_FALSE;
SDL_free((void *) didata->cursor.cursor.bitmap.image0);
SDL_free((void *) didata->cursor.cursor.bitmap.image1);
SDL_free(didata);
SDL_SetError("GF: Can't update layer parameters\n");
return -1;
}
/* Enable layer in case if hardware supports layer enable/disable */
gf_layer_enable(didata->layer);
/* Copy device name for each display */
SDL_strlcpy(didata->description, gfdata->gfdev_info.description,
SDL_VIDEO_GF_DEVICENAME_MAX - 1);
/* Search device capabilities and possible workarounds */
jt = 0;
do {
if (gf_devicename[jt].name == NULL) {
break;
}
if (SDL_strncmp
(gf_devicename[jt].name, didata->description,
SDL_strlen(gf_devicename[jt].name)) == 0) {
didata->caps = gf_devicename[jt].caps;
}
jt++;
} while (1);
/* Initialize display structure */
SDL_zero(display);
display.desktop_mode = current_mode;
display.current_mode = current_mode;
display.driverdata = didata;
didata->current_mode = current_mode;
SDL_AddVideoDisplay(&display);
/* Check for environment variables which could override some SDL settings */
didata->custom_refresh = 0;
override = SDL_getenv("SDL_VIDEO_GF_REFRESH_RATE");
if (override != NULL) {
if (SDL_sscanf(override, "%u", &didata->custom_refresh) != 1) {
didata->custom_refresh = 0;
}
}
/* Get all display modes for this display */
Dec 1, 2009
Dec 1, 2009
525
qnxgf_getdisplaymodes(_this, display);
May 23, 2009
May 23, 2009
526
527
528
529
530
531
532
533
534
535
536
537
538
539
}
/* Add GF renderer to SDL */
gf_addrenderdriver(_this);
/* Add GF input devices */
status = gf_addinputdevices(_this);
if (status != 0) {
/* SDL error is set by gf_addinputdevices() function */
return -1;
}
/* video has been initialized successfully */
return 1;
Mar 4, 2009
Mar 4, 2009
540
541
}
May 23, 2009
May 23, 2009
542
543
void
qnxgf_videoquit(_THIS)
Mar 4, 2009
Mar 4, 2009
544
{
Nov 20, 2009
Nov 20, 2009
545
SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
May 23, 2009
May 23, 2009
546
547
548
SDL_DisplayData *didata = NULL;
uint32_t it;
Nov 20, 2009
Nov 20, 2009
549
550
551
552
553
554
555
/* Check if GF was initialized before */
if ((gfdata == NULL) || (gfdata->gfinitialized != SDL_TRUE))
{
/* If not, do not deinitialize */
return;
}
May 23, 2009
May 23, 2009
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
/* Stop collecting mouse events */
hiddi_disable_mouse();
/* Delete GF input devices */
gf_delinputdevices(_this);
/* SDL will restore old desktop mode on exit */
for (it = 0; it < _this->num_displays; it++) {
didata = _this->displays[it].driverdata;
/* Free cursor image */
if (didata->cursor.cursor.bitmap.image0 != NULL) {
SDL_free((void *) didata->cursor.cursor.bitmap.image0);
didata->cursor.cursor.bitmap.image0 = NULL;
}
if (didata->cursor.cursor.bitmap.image1 != NULL) {
SDL_free((void *) didata->cursor.cursor.bitmap.image1);
didata->cursor.cursor.bitmap.image1 = NULL;
}
/* Free main surface */
if (didata->surface[0] != NULL) {
gf_surface_free(didata->surface[0]);
didata->surface[0] = NULL;
}
/* Free back surface */
if (didata->surface[1] != NULL) {
gf_surface_free(didata->surface[1]);
didata->surface[1] = NULL;
}
/* Free second back surface */
if (didata->surface[2] != NULL) {
gf_surface_free(didata->surface[2]);
didata->surface[2] = NULL;
}
/* Detach layer before quit */
if (didata->layer_attached == SDL_TRUE) {
/* Disable layer if hardware supports this */
gf_layer_disable(didata->layer);
/* Detach from layer, free it for others */
gf_layer_detach(didata->layer);
didata->layer = NULL;
/* Mark it as detached */
didata->layer_attached = SDL_FALSE;
}
/* Detach from selected display */
gf_display_detach(didata->display);
didata->display = NULL;
}
Mar 4, 2009
Mar 4, 2009
610
611
}
May 23, 2009
May 23, 2009
612
void
Dec 1, 2009
Dec 1, 2009
613
qnxgf_getdisplaymodes(_THIS, SDL_VideoDisplay * display)
Mar 4, 2009
Mar 4, 2009
614
{
Dec 1, 2009
Dec 1, 2009
615
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
May 23, 2009
May 23, 2009
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
SDL_DisplayMode mode;
gf_modeinfo_t modeinfo;
uint32_t it = 0;
uint32_t jt = 0;
uint32_t kt = 0;
int status;
do {
status = gf_display_query_mode(didata->display, it, &modeinfo);
if (status == GF_ERR_OK) {
/* Parsing current mode */
if ((modeinfo.flags & GF_MODE_GENERIC) == GF_MODE_GENERIC) {
/* This mode is generic, so we can add to SDL our resolutions */
/* Only pixel format is fixed, refresh rate could be any */
jt = 0;
do {
if (generic_mode[jt].w == 0) {
break;
}
/* Check if driver do not supports doublescan video modes */
if ((didata->caps & SDL_GF_LOWRESOLUTION) !=
SDL_GF_LOWRESOLUTION) {
if (generic_mode[jt].w < 640) {
jt++;
continue;
}
}
mode.w = generic_mode[jt].w;
mode.h = generic_mode[jt].h;
mode.refresh_rate = generic_mode[jt].refresh_rate;
mode.format =
qnxgf_gf_to_sdl_pixelformat(modeinfo.primary_format);
mode.driverdata = NULL;
Dec 1, 2009
Dec 1, 2009
651
SDL_AddDisplayMode(display, &mode);
May 23, 2009
May 23, 2009
652
Jun 10, 2009
Jun 10, 2009
653
/* If mode is RGBA8888, add the same mode as RGBx888 */
Jun 10, 2009
Jun 10, 2009
654
if (modeinfo.primary_format == GF_FORMAT_BGRA8888) {
Jun 10, 2009
Jun 10, 2009
655
656
657
658
659
mode.w = generic_mode[jt].w;
mode.h = generic_mode[jt].h;
mode.refresh_rate = generic_mode[jt].refresh_rate;
mode.format = SDL_PIXELFORMAT_RGB888;
mode.driverdata = NULL;
Dec 1, 2009
Dec 1, 2009
660
SDL_AddDisplayMode(display, &mode);
Jun 10, 2009
Jun 10, 2009
661
662
}
/* If mode is RGBA1555, add the same mode as RGBx555 */
Jun 10, 2009
Jun 10, 2009
663
if (modeinfo.primary_format == GF_FORMAT_PACK_ARGB1555) {
Jun 10, 2009
Jun 10, 2009
664
665
666
667
668
mode.w = generic_mode[jt].w;
mode.h = generic_mode[jt].h;
mode.refresh_rate = generic_mode[jt].refresh_rate;
mode.format = SDL_PIXELFORMAT_RGB555;
mode.driverdata = NULL;
Dec 1, 2009
Dec 1, 2009
669
SDL_AddDisplayMode(display, &mode);
Jun 10, 2009
Jun 10, 2009
670
671
}
May 23, 2009
May 23, 2009
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
jt++;
} while (1);
} else {
/* Add this display mode as is in case if it is non-generic */
/* But go through the each refresh rate, supported by gf */
jt = 0;
do {
if (modeinfo.refresh[jt] != 0) {
mode.w = modeinfo.xres;
mode.h = modeinfo.yres;
mode.refresh_rate = modeinfo.refresh[jt];
mode.format =
qnxgf_gf_to_sdl_pixelformat(modeinfo.
primary_format);
mode.driverdata = NULL;
Dec 1, 2009
Dec 1, 2009
687
SDL_AddDisplayMode(display, &mode);
Jun 10, 2009
Jun 10, 2009
688
689
/* If mode is RGBA8888, add the same mode as RGBx888 */
Jun 10, 2009
Jun 10, 2009
690
if (modeinfo.primary_format == GF_FORMAT_BGRA8888) {
Jun 10, 2009
Jun 10, 2009
691
692
693
694
695
mode.w = modeinfo.xres;
mode.h = modeinfo.yres;
mode.refresh_rate = modeinfo.refresh[jt];
mode.format = SDL_PIXELFORMAT_RGB888;
mode.driverdata = NULL;
Dec 1, 2009
Dec 1, 2009
696
SDL_AddDisplayMode(display, &mode);
Jun 10, 2009
Jun 10, 2009
697
698
}
/* If mode is RGBA1555, add the same mode as RGBx555 */
Jun 10, 2009
Jun 10, 2009
699
700
if (modeinfo.primary_format ==
GF_FORMAT_PACK_ARGB1555) {
Jun 10, 2009
Jun 10, 2009
701
702
703
704
705
mode.w = modeinfo.xres;
mode.h = modeinfo.yres;
mode.refresh_rate = modeinfo.refresh[jt];
mode.format = SDL_PIXELFORMAT_RGB555;
mode.driverdata = NULL;
Dec 1, 2009
Dec 1, 2009
706
SDL_AddDisplayMode(display, &mode);
Jun 10, 2009
Jun 10, 2009
707
708
}
May 23, 2009
May 23, 2009
709
710
711
712
713
714
715
716
717
718
719
jt++;
} else {
break;
}
} while (1);
}
} else {
if (status == GF_ERR_PARM) {
/* out of available modes, all are listed */
break;
}
Mar 4, 2009
Mar 4, 2009
720
May 23, 2009
May 23, 2009
721
722
723
724
725
/* Error occured during mode listing */
break;
}
it++;
} while (1);
Mar 4, 2009
Mar 4, 2009
726
727
}
May 23, 2009
May 23, 2009
728
int
Dec 1, 2009
Dec 1, 2009
729
qnxgf_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
Mar 4, 2009
Mar 4, 2009
730
{
Dec 1, 2009
Dec 1, 2009
731
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
May 23, 2009
May 23, 2009
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
uint32_t refresh_rate = 0;
int status;
/* Current display dimensions and bpp are no more valid */
didata->current_mode.format = SDL_PIXELFORMAT_UNKNOWN;
didata->current_mode.w = 0;
didata->current_mode.h = 0;
/* Check if custom refresh rate requested */
if (didata->custom_refresh != 0) {
refresh_rate = didata->custom_refresh;
} else {
refresh_rate = mode->refresh_rate;
}
/* Check if SDL GF driver needs to find appropriate refresh rate itself */
if (refresh_rate == 0) {
uint32_t it;
SDL_DisplayMode tempmode;
/* Clear display mode structure */
SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode));
tempmode.refresh_rate = 0x0000FFFF;
/* Check if window width and height matches one of our modes */
Dec 1, 2009
Dec 1, 2009
757
758
759
760
for (it = 0; it < display->num_display_modes; it++) {
if ((display->display_modes[it].w == mode->w) &&
(display->display_modes[it].h == mode->h) &&
(display->display_modes[it].format == mode->format))
Mar 17, 2009
Mar 17, 2009
761
{
May 23, 2009
May 23, 2009
762
763
/* Find the lowest refresh rate available */
if (tempmode.refresh_rate >
Dec 1, 2009
Dec 1, 2009
764
765
display->display_modes[it].refresh_rate) {
tempmode = display->display_modes[it];
May 23, 2009
May 23, 2009
766
}
Mar 17, 2009
Mar 17, 2009
767
}
May 23, 2009
May 23, 2009
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
}
if (tempmode.refresh_rate != 0x0000FFFF) {
refresh_rate = tempmode.refresh_rate;
} else {
/* Let video driver decide what to do with this */
refresh_rate = 0;
}
}
/* Check if SDL GF driver needs to check custom refresh rate */
if (didata->custom_refresh != 0) {
uint32_t it;
SDL_DisplayMode tempmode;
/* Clear display mode structure */
SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode));
tempmode.refresh_rate = 0x0000FFFF;
/* Check if window width and height matches one of our modes */
Dec 1, 2009
Dec 1, 2009
787
788
789
790
for (it = 0; it < display->num_display_modes; it++) {
if ((display->display_modes[it].w == mode->w) &&
(display->display_modes[it].h == mode->h) &&
(display->display_modes[it].format == mode->format))
Mar 17, 2009
Mar 17, 2009
791
{
May 23, 2009
May 23, 2009
792
793
/* Find the lowest refresh rate available */
if (tempmode.refresh_rate >
Dec 1, 2009
Dec 1, 2009
794
795
display->display_modes[it].refresh_rate) {
tempmode = display->display_modes[it];
May 23, 2009
May 23, 2009
796
797
798
799
}
/* Check if requested refresh rate found */
if (refresh_rate ==
Dec 1, 2009
Dec 1, 2009
800
801
display->display_modes[it].refresh_rate) {
tempmode = display->display_modes[it];
May 23, 2009
May 23, 2009
802
803
break;
}
Mar 17, 2009
Mar 17, 2009
804
}
May 23, 2009
May 23, 2009
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
}
if (tempmode.refresh_rate != 0x0000FFFF) {
refresh_rate = tempmode.refresh_rate;
} else {
/* Let video driver decide what to do with this */
refresh_rate = 0;
}
}
/* Free main surface */
if (didata->surface[0] != NULL) {
gf_surface_free(didata->surface[0]);
didata->surface[0] = NULL;
}
/* Free back surface */
if (didata->surface[1] != NULL) {
gf_surface_free(didata->surface[1]);
didata->surface[1] = NULL;
}
/* Free second back surface */
if (didata->surface[2] != NULL) {
gf_surface_free(didata->surface[2]);
didata->surface[2] = NULL;
}
/* Detach layer before switch to new graphics mode */
if (didata->layer_attached == SDL_TRUE) {
/* Disable layer if hardware supports this */
gf_layer_disable(didata->layer);
/* Detach from layer, free it for others */
gf_layer_detach(didata->layer);
/* Mark it as detached */
didata->layer_attached = SDL_FALSE;
}
/* Set new display video mode */
status =
gf_display_set_mode(didata->display, mode->w, mode->h, refresh_rate,
qnxgf_sdl_to_gf_pixelformat(mode->format), 0);
if (status != GF_ERR_OK) {
/* Display mode/resolution switch has been failed */
SDL_SetError("GF: Mode is not supported by graphics driver");
return -1;
} else {
didata->current_mode = *mode;
didata->current_mode.refresh_rate = refresh_rate;
}
/* Attach to main display layer */
status =
gf_layer_attach(&didata->layer, didata->display,
didata->display_info.main_layer_index, 0);
if (status != GF_ERR_OK) {
SDL_SetError("GF: Couldn't attach to main layer, it could be busy");
/* Failed to attach to main displayable layer */
return -1;
}
/* Mark main display layer is attached */
didata->layer_attached = SDL_TRUE;
Jun 10, 2009
Jun 10, 2009
871
/* Set layer source and destination viewports */
May 23, 2009
May 23, 2009
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
gf_layer_set_src_viewport(didata->layer, 0, 0, mode->w - 1, mode->h - 1);
gf_layer_set_dst_viewport(didata->layer, 0, 0, mode->w - 1, mode->h - 1);
/* Create main visible on display surface */
status =
gf_surface_create_layer(&didata->surface[0], &didata->layer, 1, 0,
mode->w, mode->h,
qnxgf_sdl_to_gf_pixelformat(mode->format),
NULL,
GF_SURFACE_CREATE_2D_ACCESSIBLE |
GF_SURFACE_CREATE_3D_ACCESSIBLE |
GF_SURFACE_CREATE_SHAREABLE);
if (status != GF_ERR_OK) {
gf_layer_disable(didata->layer);
gf_layer_detach(didata->layer);
didata->layer_attached = SDL_FALSE;
SDL_SetError
("GF: Can't create main layer surface at modeswitch (%d)\n",
status);
return -1;
}
/* Set just created surface as main visible on the layer */
gf_layer_set_surfaces(didata->layer, &didata->surface[0], 1);
/* Update layer parameters */
status = gf_layer_update(didata->layer, GF_LAYER_UPDATE_NO_WAIT_IDLE);
if (status != GF_ERR_OK) {
/* Free main surface */
gf_surface_free(didata->surface[0]);
didata->surface[0] = NULL;
/* Detach layer */
gf_layer_disable(didata->layer);
gf_layer_detach(didata->layer);
didata->layer_attached = SDL_FALSE;
SDL_SetError("GF: Can't update layer parameters\n");
return -1;
}
/* Restore cursor if it was visible */
if (didata->cursor_visible == SDL_TRUE) {
gf_cursor_set(didata->display, 0, &didata->cursor);
gf_cursor_enable(didata->display, 0);
}
/* Enable layer in case if hardware supports layer enable/disable */
gf_layer_enable(didata->layer);
return 0;
Mar 4, 2009
Mar 4, 2009
922
923
}
May 23, 2009
May 23, 2009
924
int
Dec 1, 2009
Dec 1, 2009
925
qnxgf_setdisplaypalette(_THIS, SDL_VideoDisplay * display, SDL_Palette * palette)
Mar 4, 2009
Mar 4, 2009
926
{
Dec 1, 2009
Dec 1, 2009
927
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
Mar 17, 2009
Mar 17, 2009
928
May 23, 2009
May 23, 2009
929
930
/* QNX GF doesn't have support for global palette changing, but we */
/* could store it for usage in future */
Mar 4, 2009
Mar 4, 2009
931
Dec 1, 2009
Dec 1, 2009
932
SDL_Unsupported();
May 23, 2009
May 23, 2009
933
return -1;
Mar 4, 2009
Mar 4, 2009
934
935
}
May 23, 2009
May 23, 2009
936
int
Dec 1, 2009
Dec 1, 2009
937
qnxgf_getdisplaypalette(_THIS, SDL_VideoDisplay * display, SDL_Palette * palette)
Mar 4, 2009
Mar 4, 2009
938
{
Dec 1, 2009
Dec 1, 2009
939
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
Mar 17, 2009
Mar 17, 2009
940
May 23, 2009
May 23, 2009
941
942
/* We can't provide current palette settings and looks like SDL */
/* do not call this function also, in such case this function returns -1 */
Mar 4, 2009
Mar 4, 2009
943
Dec 1, 2009
Dec 1, 2009
944
SDL_Unsupported();
May 23, 2009
May 23, 2009
945
return -1;
Mar 4, 2009
Mar 4, 2009
946
947
}
May 23, 2009
May 23, 2009
948
int
Dec 1, 2009
Dec 1, 2009
949
qnxgf_setdisplaygammaramp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp)
Mar 4, 2009
Mar 4, 2009
950
{
Dec 1, 2009
Dec 1, 2009
951
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
May 23, 2009
May 23, 2009
952
953
954
955
956
957
958
959
960
961
962
963
964
int status;
/* Setup gamma ramp, for each color channel */
status =
gf_display_set_color_lut16(didata->display, (uint16_t *) ramp,
(uint16_t *) ramp + 256,
(uint16_t *) ramp + 512);
if (status != GF_ERR_OK) {
/* Setting display gamma ramp operation has been failed */
return -1;
}
return 0;
Mar 4, 2009
Mar 4, 2009
965
966
}
May 23, 2009
May 23, 2009
967
int
Dec 1, 2009
Dec 1, 2009
968
qnxgf_getdisplaygammaramp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp)
Mar 4, 2009
Mar 4, 2009
969
{
May 23, 2009
May 23, 2009
970
971
/* TODO: We need to return previous gamma set */
/* Also we need some initial fake gamma to return */
Mar 4, 2009
Mar 4, 2009
972
Dec 1, 2009
Dec 1, 2009
973
SDL_Unsupported();
May 23, 2009
May 23, 2009
974
return -1;
Mar 4, 2009
Mar 4, 2009
975
976
}
May 23, 2009
May 23, 2009
977
978
int
qnxgf_createwindow(_THIS, SDL_Window * window)
Mar 4, 2009
Mar 4, 2009
979
{
May 23, 2009
May 23, 2009
980
SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
Jan 21, 2010
Jan 21, 2010
981
SDL_VideoDisplay *display = window->display;
Dec 1, 2009
Dec 1, 2009
982
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
May 23, 2009
May 23, 2009
983
984
985
986
987
988
989
990
991
992
993
994
995
SDL_WindowData *wdata;
int32_t status;
/* QNX GF supports fullscreen window modes only */
if ((window->flags & SDL_WINDOW_FULLSCREEN) != SDL_WINDOW_FULLSCREEN) {
uint32_t it;
SDL_DisplayMode mode;
/* Clear display mode structure */
SDL_memset(&mode, 0x00, sizeof(SDL_DisplayMode));
mode.refresh_rate = 0x0000FFFF;
/* Check if window width and height matches one of our modes */
Dec 1, 2009
Dec 1, 2009
996
997
998
999
1000
for (it = 0; it < display->num_display_modes; it++) {
if ((display->display_modes[it].w == window->w) &&
(display->display_modes[it].h == window->h) &&
(display->display_modes[it].format ==
display->desktop_mode.format)) {