Mercurial > sdl-ios-xcode
annotate src/video/directfb/SDL_DirectFB_video.c @ 5246:189b1bdb7baf
Surfaces aren't in hardware memory anymore!
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 10 Feb 2011 05:10:05 -0800 |
parents | 164f20ba08eb |
children | 3a8a452b49f0 |
rev | line source |
---|---|
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
3697 | 3 Copyright (C) 1997-2010 Sam Lantinga |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
7 License as published by the Free Software Foundation; either |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
13 Lesser General Public License for more details. |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
19 Sam Lantinga |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1165
diff
changeset
|
20 slouken@libsdl.org |
728
5446a009107a
MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents:
546
diff
changeset
|
21 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
22 SDL1.3 DirectFB driver by couriersud@arcor.de |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
23 |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 */ |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
25 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
26 #include "SDL_DirectFB_video.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
27 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
28 #include "SDL_DirectFB_events.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
29 /* |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
30 * #include "SDL_DirectFB_gamma.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
31 * #include "SDL_DirectFB_keyboard.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
32 */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
33 #include "SDL_DirectFB_modes.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
34 #include "SDL_DirectFB_mouse.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
35 #include "SDL_DirectFB_opengl.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
36 #include "SDL_DirectFB_window.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
37 #include "SDL_DirectFB_WM.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
38 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
39 |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
40 #include "SDL_config.h" |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 /* DirectFB video driver implementation. |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 */ |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 #include <fcntl.h> |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 #include <unistd.h> |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 #include <sys/mman.h> |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 #include <directfb.h> |
1165
4fa705cdecb9
Date: Tue, 1 Nov 2005 02:51:09 +0000
Ryan C. Gordon <icculus@icculus.org>
parents:
1029
diff
changeset
|
50 #include <directfb_version.h> |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
51 #include <directfb_strings.h> |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 #include "SDL_video.h" |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 #include "SDL_mouse.h" |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
55 #include "../SDL_sysvideo.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
56 #include "../SDL_pixels_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
57 #include "../../events/SDL_events_c.h" |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 #include "SDL_DirectFB_video.h" |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 #include "SDL_DirectFB_events.h" |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
60 #include "SDL_DirectFB_render.h" |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
61 #include "SDL_DirectFB_mouse.h" |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
62 #include "SDL_DirectFB_shape.h" |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
63 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
64 |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
65 #include "SDL_DirectFB_dyn.h" |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
66 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
67 /* Initialization/Query functions */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
68 static int DirectFB_VideoInit(_THIS); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
69 static void DirectFB_VideoQuit(_THIS); |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
71 static int DirectFB_Available(void); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
72 static SDL_VideoDevice *DirectFB_CreateDevice(int devindex); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
73 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
74 VideoBootStrap DirectFB_bootstrap = { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
75 "directfb", "DirectFB", |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
76 DirectFB_Available, DirectFB_CreateDevice |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
77 }; |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
79 static const DirectFBSurfaceDrawingFlagsNames(drawing_flags); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
80 static const DirectFBSurfaceBlittingFlagsNames(blitting_flags); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
81 static const DirectFBAccelerationMaskNames(acceleration_mask); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
82 |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 /* DirectFB driver bootstrap functions */ |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
85 static int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
86 DirectFB_Available(void) |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 { |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
88 if (!SDL_DirectFB_LoadLibrary()) |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
89 return 0; |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
90 SDL_DirectFB_UnLoadLibrary(); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
91 return 1; |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 } |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
94 static void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
95 DirectFB_DeleteDevice(SDL_VideoDevice * device) |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 { |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
97 SDL_DirectFB_UnLoadLibrary(); |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
98 SDL_DFB_FREE(device->driverdata); |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
99 SDL_DFB_FREE(device); |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 } |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
102 static SDL_VideoDevice * |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
103 DirectFB_CreateDevice(int devindex) |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
105 SDL_VideoDevice *device; |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
107 if (!SDL_DirectFB_LoadLibrary()) |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
108 return NULL; |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
109 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
110 /* Initialize all variables that we clean on shutdown */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
111 SDL_DFB_ALLOC_CLEAR(device, sizeof(SDL_VideoDevice)); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
112 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
113 /* Set the function pointers */ |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
115 /* Set the function pointers */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
116 device->VideoInit = DirectFB_VideoInit; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
117 device->VideoQuit = DirectFB_VideoQuit; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
118 device->GetDisplayModes = DirectFB_GetDisplayModes; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
119 device->SetDisplayMode = DirectFB_SetDisplayMode; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
120 device->PumpEvents = DirectFB_PumpEventsWindow; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
121 device->CreateWindow = DirectFB_CreateWindow; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
122 device->CreateWindowFrom = DirectFB_CreateWindowFrom; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
123 device->SetWindowTitle = DirectFB_SetWindowTitle; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
124 device->SetWindowIcon = DirectFB_SetWindowIcon; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
125 device->SetWindowPosition = DirectFB_SetWindowPosition; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
126 device->SetWindowSize = DirectFB_SetWindowSize; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
127 device->ShowWindow = DirectFB_ShowWindow; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
128 device->HideWindow = DirectFB_HideWindow; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
129 device->RaiseWindow = DirectFB_RaiseWindow; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
130 device->MaximizeWindow = DirectFB_MaximizeWindow; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
131 device->MinimizeWindow = DirectFB_MinimizeWindow; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
132 device->RestoreWindow = DirectFB_RestoreWindow; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
133 device->SetWindowGrab = DirectFB_SetWindowGrab; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
134 device->DestroyWindow = DirectFB_DestroyWindow; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
135 device->GetWindowWMInfo = DirectFB_GetWindowWMInfo; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
136 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
137 #if SDL_DIRECTFB_OPENGL |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
138 device->GL_LoadLibrary = DirectFB_GL_LoadLibrary; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
139 device->GL_GetProcAddress = DirectFB_GL_GetProcAddress; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
140 device->GL_MakeCurrent = DirectFB_GL_MakeCurrent; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
141 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
142 device->GL_CreateContext = DirectFB_GL_CreateContext; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
143 device->GL_SetSwapInterval = DirectFB_GL_SetSwapInterval; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
144 device->GL_GetSwapInterval = DirectFB_GL_GetSwapInterval; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
145 device->GL_SwapWindow = DirectFB_GL_SwapWindow; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
146 device->GL_DeleteContext = DirectFB_GL_DeleteContext; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
147 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
148 #endif |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
150 /* Shaped window support */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
151 device->shape_driver.CreateShaper = DirectFB_CreateShaper; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
152 device->shape_driver.SetWindowShape = DirectFB_SetWindowShape; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
153 device->shape_driver.ResizeWindowShape = DirectFB_ResizeWindowShape; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
154 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
155 device->free = DirectFB_DeleteDevice; |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
156 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
157 return device; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
158 error: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
159 if (device) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
160 free(device); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
161 return (0); |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 } |
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
164 static void |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
165 DirectFB_DeviceInformation(IDirectFB * dfb) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
166 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
167 DFBGraphicsDeviceDescription desc; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
168 int n; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
169 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
170 dfb->GetDeviceDescription(dfb, &desc); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
171 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
172 SDL_DFB_LOG( "DirectFB Device Information\n"); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
173 SDL_DFB_LOG( "===========================\n"); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
174 SDL_DFB_LOG( "Name: %s\n", desc.name); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
175 SDL_DFB_LOG( "Vendor: %s\n", desc.vendor); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
176 SDL_DFB_LOG( "Driver Name: %s\n", desc.driver.name); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
177 SDL_DFB_LOG( "Driver Vendor: %s\n", desc.driver.vendor); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
178 SDL_DFB_LOG( "Driver Version: %d.%d\n", desc.driver.major, |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
179 desc.driver.minor); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
180 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
181 SDL_DFB_LOG( "\nVideo memoory: %d\n", desc.video_memory); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
182 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
183 SDL_DFB_LOG( "\nBlitting flags:\n"); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
184 for (n = 0; blitting_flags[n].flag; n++) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
185 if (desc.blitting_flags & blitting_flags[n].flag) |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
186 SDL_DFB_LOG( " %s\n", blitting_flags[n].name); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
187 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
188 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
189 SDL_DFB_LOG( "\nDrawing flags:\n"); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
190 for (n = 0; drawing_flags[n].flag; n++) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
191 if (desc.drawing_flags & drawing_flags[n].flag) |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
192 SDL_DFB_LOG( " %s\n", drawing_flags[n].name); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
193 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
194 |
4568 | 195 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
196 SDL_DFB_LOG( "\nAcceleration flags:\n"); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
197 for (n = 0; acceleration_mask[n].mask; n++) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
198 if (desc.acceleration_mask & acceleration_mask[n].mask) |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
199 SDL_DFB_LOG( " %s\n", acceleration_mask[n].name); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
200 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
201 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
202 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
203 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
204 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
205 static int readBoolEnv(const char *env_name, int def_val) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
206 { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
207 char *stemp; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
208 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
209 stemp = SDL_getenv(env_name); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
210 if (stemp) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
211 return atoi(stemp); |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
212 else |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
213 return def_val; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
214 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
215 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
216 static int |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
217 DirectFB_VideoInit(_THIS) |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
219 IDirectFB *dfb = NULL; |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
220 DFB_DeviceData *devdata = NULL; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
221 DFBResult ret; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
222 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
223 SDL_DFB_ALLOC_CLEAR(devdata, sizeof(*devdata)); |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
224 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
225 SDL_DFB_CHECKERR(DirectFBInit(NULL, NULL)); |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
226 |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
227 /* avoid switching to the framebuffer when we |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
228 * are running X11 */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
229 ret = readBoolEnv(DFBENV_USE_X11_CHECK , 1); |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
230 if (ret) { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
231 if (SDL_getenv("DISPLAY")) |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
232 DirectFBSetOption("system", "x11"); |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
233 else |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
234 DirectFBSetOption("disable-module", "x11input"); |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
235 } |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
236 |
4636 | 237 /* FIXME: Reenable as default once multi kbd/mouse interface is sorted out */ |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
238 devdata->use_linux_input = readBoolEnv(DFBENV_USE_LINUX_INPUT, 0); /* default: on */ |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
239 |
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
240 if (!devdata->use_linux_input) |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
241 { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
242 SDL_DFB_LOG("Disabling linxu input\n"); |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
243 DirectFBSetOption("disable-module", "linux_input"); |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
244 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
245 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
246 SDL_DFB_CHECKERR(DirectFBCreate(&dfb)); |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
248 DirectFB_DeviceInformation(dfb); |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
249 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
250 devdata->use_yuv_underlays = readBoolEnv(DFBENV_USE_YUV_UNDERLAY, 0); /* default: off */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
251 devdata->use_yuv_direct = readBoolEnv(DFBENV_USE_YUV_DIRECT, 0); /* default is off! */ |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
252 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
253 /* Create global Eventbuffer for axis events */ |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
254 if (devdata->use_linux_input) { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
255 SDL_DFB_CHECKERR(dfb->CreateInputEventBuffer(dfb, DICAPS_ALL, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
256 DFB_TRUE, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
257 &devdata->events)); |
2860
6ce28e5287e9
Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
258 } else { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
259 SDL_DFB_CHECKERR(dfb->CreateInputEventBuffer(dfb, DICAPS_AXES |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
260 /*DICAPS_ALL */ , |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
261 DFB_TRUE, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
262 &devdata->events)); |
2860
6ce28e5287e9
Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
263 } |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
265 /* simple window manager support */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
266 devdata->has_own_wm = readBoolEnv(DFBENV_USE_WM, 0); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
267 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
268 devdata->initialized = 1; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
269 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
270 devdata->dfb = dfb; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
271 devdata->firstwin = NULL; |
4636 | 272 devdata->grabbed_window = NULL; |
464
1c4be4a16410
Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
273 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
274 _this->driverdata = devdata; |
464
1c4be4a16410
Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
275 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
276 DirectFB_InitModes(_this); |
464
1c4be4a16410
Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
277 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
278 #if SDL_DIRECTFB_OPENGL |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
279 DirectFB_GL_Initialize(_this); |
1165
4fa705cdecb9
Date: Tue, 1 Nov 2005 02:51:09 +0000
Ryan C. Gordon <icculus@icculus.org>
parents:
1029
diff
changeset
|
280 #endif |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
282 DirectFB_InitMouse(_this); |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2259
diff
changeset
|
283 DirectFB_InitKeyboard(_this); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
284 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
285 return 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
286 |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
288 error: |
2998
d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2860
diff
changeset
|
289 SDL_DFB_FREE(devdata); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
290 SDL_DFB_RELEASE(dfb); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
291 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
292 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
293 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
294 static void |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
295 DirectFB_VideoQuit(_THIS) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
296 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
297 DFB_DeviceData *devdata = (DFB_DeviceData *) _this->driverdata; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1777
diff
changeset
|
298 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
299 DirectFB_QuitModes(_this); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
300 DirectFB_QuitKeyboard(_this); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
301 DirectFB_QuitMouse(_this); |
728
5446a009107a
MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents:
546
diff
changeset
|
302 |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
303 devdata->events->Reset(devdata->events); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
304 SDL_DFB_RELEASE(devdata->events); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
305 SDL_DFB_RELEASE(devdata->dfb); |
728
5446a009107a
MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents:
546
diff
changeset
|
306 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
307 #if SDL_DIRECTFB_OPENGL |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2735
diff
changeset
|
308 DirectFB_GL_Shutdown(_this); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
309 #endif |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
310 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
311 devdata->initialized = 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
2113
diff
changeset
|
312 } |
5202
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
313 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
314 /* DirectFB driver general support functions */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
315 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
316 static const struct { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
317 DFBSurfacePixelFormat dfb; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
318 Uint32 sdl; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
319 } pixelformat_tab[] = |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
320 { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
321 { DSPF_RGB32, SDL_PIXELFORMAT_RGB888 }, /* 24 bit RGB (4 byte, nothing@24, red 8@16, green 8@8, blue 8@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
322 { DSPF_ARGB, SDL_PIXELFORMAT_ARGB8888 }, /* 32 bit ARGB (4 byte, alpha 8@24, red 8@16, green 8@8, blue 8@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
323 { DSPF_RGB16, SDL_PIXELFORMAT_RGB565 }, /* 16 bit RGB (2 byte, red 5@11, green 6@5, blue 5@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
324 { DSPF_RGB332, SDL_PIXELFORMAT_RGB332 }, /* 8 bit RGB (1 byte, red 3@5, green 3@2, blue 2@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
325 { DSPF_ARGB4444, SDL_PIXELFORMAT_ARGB4444 }, /* 16 bit ARGB (2 byte, alpha 4@12, red 4@8, green 4@4, blue 4@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
326 { DSPF_ARGB1555, SDL_PIXELFORMAT_ARGB1555 }, /* 16 bit ARGB (2 byte, alpha 1@15, red 5@10, green 5@5, blue 5@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
327 { DSPF_RGB24, SDL_PIXELFORMAT_RGB24 }, /* 24 bit RGB (3 byte, red 8@16, green 8@8, blue 8@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
328 { DSPF_RGB444, SDL_PIXELFORMAT_RGB444 }, /* 16 bit RGB (2 byte, nothing @12, red 4@8, green 4@4, blue 4@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
329 { DSPF_YV12, SDL_PIXELFORMAT_YV12 }, /* 12 bit YUV (8 bit Y plane followed by 8 bit quarter size V/U planes) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
330 { DSPF_I420,SDL_PIXELFORMAT_IYUV }, /* 12 bit YUV (8 bit Y plane followed by 8 bit quarter size U/V planes) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
331 { DSPF_YUY2, SDL_PIXELFORMAT_YUY2 }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains CbYCrY [31:0]) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
332 { DSPF_UYVY, SDL_PIXELFORMAT_UYVY }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains YCbYCr [31:0]) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
333 { DSPF_RGB555, SDL_PIXELFORMAT_RGB555 }, /* 16 bit RGB (2 byte, nothing @15, red 5@10, green 5@5, blue 5@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
334 #if (ENABLE_LUT8) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
335 { DSPF_LUT8, SDL_PIXELFORMAT_INDEX8 }, /* 8 bit LUT (8 bit color and alpha lookup from palette) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
336 #endif |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
337 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
338 #if (DFB_VERSION_ATLEAST(1,2,0)) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
339 { DSPF_BGR555, SDL_PIXELFORMAT_BGR555 }, /* 16 bit BGR (2 byte, nothing @15, blue 5@10, green 5@5, red 5@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
340 #else |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
341 { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR555 }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
342 #endif |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
343 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
344 /* Pfff ... nonmatching formats follow */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
345 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
346 { DSPF_ALUT44, SDL_PIXELFORMAT_UNKNOWN }, /* 8 bit ALUT (1 byte, alpha 4@4, color lookup 4@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
347 { DSPF_A8, SDL_PIXELFORMAT_UNKNOWN }, /* 8 bit alpha (1 byte, alpha 8@0), e.g. anti-aliased glyphs */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
348 { DSPF_AiRGB, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit ARGB (4 byte, inv. alpha 8@24, red 8@16, green 8@8, blue 8@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
349 { DSPF_A1, SDL_PIXELFORMAT_UNKNOWN }, /* 1 bit alpha (1 byte/ 8 pixel, most significant bit used first) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
350 { DSPF_NV12, SDL_PIXELFORMAT_UNKNOWN }, /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CbCr [15:0] plane) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
351 { DSPF_NV16, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit YUV (8 bit Y plane followed by one 16 bit half width CbCr [15:0] plane) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
352 { DSPF_ARGB2554, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit ARGB (2 byte, alpha 2@14, red 5@9, green 5@4, blue 4@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
353 { DSPF_NV21, SDL_PIXELFORMAT_UNKNOWN }, /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CrCb [15:0] plane) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
354 { DSPF_AYUV, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit AYUV (4 byte, alpha 8@24, Y 8@16, Cb 8@8, Cr 8@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
355 { DSPF_A4, SDL_PIXELFORMAT_UNKNOWN }, /* 4 bit alpha (1 byte/ 2 pixel, more significant nibble used first) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
356 { DSPF_ARGB1666, SDL_PIXELFORMAT_UNKNOWN }, /* 1 bit alpha (3 byte/ alpha 1@18, red 6@16, green 6@6, blue 6@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
357 { DSPF_ARGB6666, SDL_PIXELFORMAT_UNKNOWN }, /* 6 bit alpha (3 byte/ alpha 6@18, red 6@16, green 6@6, blue 6@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
358 { DSPF_RGB18, SDL_PIXELFORMAT_UNKNOWN }, /* 6 bit RGB (3 byte/ red 6@16, green 6@6, blue 6@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
359 { DSPF_LUT2, SDL_PIXELFORMAT_UNKNOWN }, /* 2 bit LUT (1 byte/ 4 pixel, 2 bit color and alpha lookup from palette) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
360 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
361 #if (DFB_VERSION_ATLEAST(1,3,0)) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
362 { DSPF_RGBA4444, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit RGBA (2 byte, red 4@12, green 4@8, blue 4@4, alpha 4@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
363 #endif |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
364 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
365 #if (DFB_VERSION_ATLEAST(1,4,3)) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
366 { DSPF_RGBA5551, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit RGBA (2 byte, red 5@11, green 5@6, blue 5@1, alpha 1@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
367 { DSPF_YUV444P, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit full YUV planar (8 bit Y plane followed by an 8 bit Cb and an 8 bit Cr plane) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
368 { DSPF_ARGB8565, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit ARGB (3 byte, alpha 8@16, red 5@11, green 6@5, blue 5@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
369 { DSPF_AVYU, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit AVYU 4:4:4 (4 byte, alpha 8@24, Cr 8@16, Y 8@8, Cb 8@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
370 { DSPF_VYU, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit VYU 4:4:4 (3 byte, Cr 8@16, Y 8@8, Cb 8@0) */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
371 #endif |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
372 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
373 { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX1LSB }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
374 { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX1MSB }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
375 { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX4LSB }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
376 { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX4MSB }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
377 { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR24 }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
378 { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR888 }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
379 { DSPF_UNKNOWN, SDL_PIXELFORMAT_RGBA8888 }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
380 { DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR8888 }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
381 { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGRA8888 }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
382 { DSPF_UNKNOWN, SDL_PIXELFORMAT_ARGB2101010 }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
383 { DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR4444 }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
384 { DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR1555 }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
385 { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR565 }, |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
386 { DSPF_UNKNOWN, SDL_PIXELFORMAT_YVYU }, /**< Packed mode: Y0+V0+Y1+U0 (1 pla */ |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
387 }; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
388 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
389 Uint32 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
390 DirectFB_DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
391 { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
392 int i; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
393 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
394 for (i=0; pixelformat_tab[i].dfb != DSPF_UNKNOWN; i++) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
395 if (pixelformat_tab[i].dfb == pixelformat) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
396 { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
397 return pixelformat_tab[i].sdl; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
398 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
399 return SDL_PIXELFORMAT_UNKNOWN; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
400 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
401 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
402 DFBSurfacePixelFormat |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
403 DirectFB_SDLToDFBPixelFormat(Uint32 format) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
404 { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
405 int i; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
406 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
407 for (i=0; pixelformat_tab[i].dfb != DSPF_UNKNOWN; i++) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
408 if (pixelformat_tab[i].sdl == format) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
409 { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
410 return pixelformat_tab[i].dfb; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
411 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
412 return DSPF_UNKNOWN; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
413 } |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
414 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
415 void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo* ri) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
416 { |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
417 int i, j; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
418 |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
419 for (i=0, j=0; pixelformat_tab[i].dfb != DSPF_UNKNOWN; i++) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
420 if (pixelformat_tab[i].sdl != SDL_PIXELFORMAT_UNKNOWN) |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
421 ri->texture_formats[j++] = pixelformat_tab[i].sdl; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
422 ri->num_texture_formats = j; |
164f20ba08eb
Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents:
4636
diff
changeset
|
423 } |