annotate src/video/directfb/SDL_DirectFB_modes.c @ 2993:2fad80c77c17

Technically more correct
author Sam Lantinga <slouken@libsdl.org>
date Sun, 04 Jan 2009 19:26:50 +0000
parents 99210400e8b9
children 8f4ed5ec2b06
rev   line source
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
2859
99210400e8b9 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 2841
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #include "SDL_config.h"
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #include "SDL_DirectFB_video.h"
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #define DFB_MAX_MODES 200
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 struct scn_callback_t
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 int numscreens;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 DFBScreenID screenid[DFB_MAX_SCREENS];
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 DFBDisplayLayerID gralayer[DFB_MAX_SCREENS];
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 DFBDisplayLayerID vidlayer[DFB_MAX_SCREENS];
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 int aux; /* auxiliary integer for callbacks */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 };
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 struct modes_callback_t
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 int nummodes;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 SDL_DisplayMode *modelist;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 };
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 static int
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat, Uint32 * fmt)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 switch (pixelformat) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 case DSPF_ALUT44:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 *fmt = SDL_PIXELFORMAT_INDEX4LSB;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 break;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 case DSPF_LUT8:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 *fmt = SDL_PIXELFORMAT_INDEX8;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 break;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 case DSPF_RGB332:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 *fmt = SDL_PIXELFORMAT_RGB332;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 break;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 case DSPF_ARGB4444:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 *fmt = SDL_PIXELFORMAT_ARGB4444;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 break;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 case SDL_PIXELFORMAT_ARGB1555:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 *fmt = SDL_PIXELFORMAT_ARGB1555;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 break;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 case DSPF_RGB16:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 *fmt = SDL_PIXELFORMAT_RGB565;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 break;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 case DSPF_RGB24:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 *fmt = SDL_PIXELFORMAT_RGB24;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 break;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 case DSPF_RGB32:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 *fmt = SDL_PIXELFORMAT_RGB888;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 break;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 case DSPF_ARGB:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 *fmt = SDL_PIXELFORMAT_ARGB8888;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 break;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 case DSPF_YV12:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 *fmt = SDL_PIXELFORMAT_YV12;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 break; /* Planar mode: Y + V + U (3 planes) */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 case DSPF_I420:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 *fmt = SDL_PIXELFORMAT_IYUV;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 break; /* Planar mode: Y + U + V (3 planes) */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 case DSPF_YUY2:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 *fmt = SDL_PIXELFORMAT_YUY2;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 break; /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 case DSPF_UYVY:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 *fmt = SDL_PIXELFORMAT_UYVY;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 break; /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 default:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 return 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 static DFBSurfacePixelFormat
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 SDLToDFBPixelFormat(Uint32 format)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 switch (format) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 case SDL_PIXELFORMAT_INDEX4LSB:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 return DSPF_ALUT44;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 case SDL_PIXELFORMAT_INDEX8:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 return DSPF_LUT8;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 case SDL_PIXELFORMAT_RGB332:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 return DSPF_RGB332;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 case SDL_PIXELFORMAT_RGB555:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 return DSPF_ARGB1555;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 case SDL_PIXELFORMAT_ARGB4444:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 return DSPF_ARGB4444;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 case SDL_PIXELFORMAT_ARGB1555:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 return DSPF_ARGB1555;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 case SDL_PIXELFORMAT_RGB565:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 return DSPF_RGB16;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 case SDL_PIXELFORMAT_RGB24:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 return DSPF_RGB24;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 case SDL_PIXELFORMAT_RGB888:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 return DSPF_RGB32;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 case SDL_PIXELFORMAT_ARGB8888:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 return DSPF_ARGB;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 case SDL_PIXELFORMAT_YV12:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 return DSPF_YV12; /* Planar mode: Y + V + U (3 planes) */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 case SDL_PIXELFORMAT_IYUV:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 return DSPF_I420; /* Planar mode: Y + U + V (3 planes) */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 case SDL_PIXELFORMAT_YUY2:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 return DSPF_YUY2; /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 case SDL_PIXELFORMAT_UYVY:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 return DSPF_UYVY; /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 case SDL_PIXELFORMAT_YVYU:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 return DSPF_UNKNOWN; /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 case SDL_PIXELFORMAT_INDEX1LSB:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 return DSPF_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 case SDL_PIXELFORMAT_INDEX1MSB:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 return DSPF_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 case SDL_PIXELFORMAT_INDEX4MSB:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 return DSPF_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 case SDL_PIXELFORMAT_RGB444:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 return DSPF_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 case SDL_PIXELFORMAT_BGR24:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 return DSPF_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 case SDL_PIXELFORMAT_BGR888:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 return DSPF_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 case SDL_PIXELFORMAT_RGBA8888:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 return DSPF_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 case SDL_PIXELFORMAT_ABGR8888:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 return DSPF_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 case SDL_PIXELFORMAT_BGRA8888:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 return DSPF_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 case SDL_PIXELFORMAT_ARGB2101010:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 return DSPF_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 default:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 return DSPF_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 static DFBEnumerationResult
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 EnumModesCallback(int width, int height, int bpp, void *data)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 struct modes_callback_t *modedata = (struct modes_callback_t *) data;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 SDL_DisplayMode mode;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 mode.w = width;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 mode.h = height;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 mode.refresh_rate = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 mode.driverdata = NULL;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 mode.format = SDL_PIXELFORMAT_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 if (modedata->nummodes < DFB_MAX_MODES) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 modedata->modelist[modedata->nummodes++] = mode;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 SDL_DFB_DEBUG("w %d h %d bpp %d\n", width, height, bpp);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 return DFENUM_OK;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 static DFBEnumerationResult
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 cbScreens(DFBScreenID screen_id, DFBScreenDescription desc,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 void *callbackdata)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 struct scn_callback_t *devdata = (struct scn_callback_t *) callbackdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 devdata->screenid[devdata->numscreens++] = screen_id;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 return DFENUM_OK;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 DFBEnumerationResult
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182 cbLayers(DFBDisplayLayerID layer_id, DFBDisplayLayerDescription desc,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 void *callbackdata)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185 struct scn_callback_t *devdata = (struct scn_callback_t *) callbackdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 if (desc.caps & DLCAPS_SURFACE) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 if ((desc.type & DLTF_GRAPHICS) && (desc.type & DLTF_VIDEO)) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 if (devdata->vidlayer[devdata->aux] == -1)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190 devdata->vidlayer[devdata->aux] = layer_id;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 } else if (desc.type & DLTF_GRAPHICS) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 if (devdata->gralayer[devdata->aux] == -1)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 devdata->gralayer[devdata->aux] = layer_id;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196 return DFENUM_OK;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 static void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 CheckSetDisplayMode(_THIS, DFB_DisplayData * data, SDL_DisplayMode * mode)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 SDL_DFB_DEVICEDATA(_this);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 DFBDisplayLayerConfig config;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 DFBDisplayLayerConfigFlags failed;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 int ret;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 SDL_DFB_CHECKERR(data->layer->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 config.width = mode->w;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 config.height = mode->h;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 config.pixelformat = SDLToDFBPixelFormat(mode->format);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 if (devdata->use_yuv_underlays) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 config.flags |= DLCONF_OPTIONS;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 config.options = DLOP_ALPHACHANNEL;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 failed = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 data->layer->TestConfiguration(data->layer, &config, &failed);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 SDL_DFB_CHECKERR(data->layer->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220 SetCooperativeLevel(data->layer, DLSCL_SHARED));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 if (failed == 0)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 SDL_AddDisplayMode(_this->current_display, mode);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 else
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224 SDL_DFB_DEBUG("Mode %d x %d not available: %x\n", mode->w, mode->h,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 failed);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227 return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 error:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229 return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 DirectFB_InitModes(_THIS)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 SDL_DFB_DEVICEDATA(_this);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 IDirectFBDisplayLayer *layer = NULL;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 SDL_VideoDisplay display;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 DFB_DisplayData *dispdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 SDL_DisplayMode mode;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 #if (DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 DFBCardCapabilities caps;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242 #else
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 DFBGraphicsDeviceDescription caps;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 #endif
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 DFBDisplayLayerConfig dlc;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 struct scn_callback_t *screencbdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248 int tcw[DFB_MAX_SCREENS];
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 int tch[DFB_MAX_SCREENS];
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 int i;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 DFBResult ret;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 SDL_DFB_CALLOC(screencbdata, 1, sizeof(*screencbdata));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255 screencbdata->numscreens = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 for (i = 0; i < DFB_MAX_SCREENS; i++) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258 screencbdata->gralayer[i] = -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
259 screencbdata->vidlayer[i] = -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262 SDL_DFB_CHECKERR(devdata->dfb->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
263 EnumScreens(devdata->dfb, &cbScreens, screencbdata));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 for (i = 0; i < screencbdata->numscreens; i++) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 IDirectFBScreen *screen;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
268 SDL_DFB_CHECKERR(devdata->dfb->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269 GetScreen(devdata->dfb, screencbdata->screenid[i],
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
270 &screen));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272 screencbdata->aux = i;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
273 SDL_DFB_CHECKERR(screen->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274 EnumDisplayLayers(screen, &cbLayers, screencbdata));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275 #if (DIRECTFB_MAJOR_VERSION >= 1)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
276 screen->GetSize(screen, &tcw[i], &tch[i]);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
277 #else
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278 /* FIXME: this is only used to center windows
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
279 * Should be done otherwise, e.g. get surface from layer
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
280 */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
281 tcw[i] = 800;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 tch[i] = 600;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283 #endif
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284 screen->Release(screen);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
286
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 /* Query card capabilities */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289 devdata->dfb->GetDeviceDescription(devdata->dfb, &caps);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
290
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291 SDL_DFB_DEBUG("SDL directfb video driver - %s %s\n", __DATE__, __TIME__);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
292 SDL_DFB_DEBUG("Using %s (%s) driver.\n", caps.name, caps.vendor);
2815
e759ad5e6f43 Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
293 SDL_DFB_DEBUG("Found %d screens\n", screencbdata->numscreens);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
294
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295 for (i = 0; i < screencbdata->numscreens; i++) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296 SDL_DFB_CHECKERR(devdata->dfb->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 GetDisplayLayer(devdata->dfb,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298 screencbdata->gralayer[i], &layer));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
299
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
300 SDL_DFB_CHECKERR(layer->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301 SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 layer->EnableCursor(layer, 1);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303 SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 if (devdata->use_yuv_underlays) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 dlc.pixelformat = DSPF_ARGB;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
308 dlc.options = DLOP_ALPHACHANNEL;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
309
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
310 ret = layer->SetConfiguration(layer, &dlc);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311 if (ret) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312 /* try AiRGB if the previous failed */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313 dlc.pixelformat = DSPF_AiRGB;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 ret = layer->SetConfiguration(layer, &dlc);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
316 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
317
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318 /* Query layer configuration to determine the current mode and pixelformat */
2815
e759ad5e6f43 Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
319 dlc.flags = DLCONF_ALL;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 layer->GetConfiguration(layer, &dlc);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
321
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
322 if (DFBToSDLPixelFormat(dlc.pixelformat, &mode.format) != 0) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
323 SDL_DFB_ERR("Unknown dfb pixelformat %x !\n", dlc.pixelformat);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
324 goto error;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
325 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
326
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
327 mode.w = dlc.width;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
328 mode.h = dlc.height;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
329 mode.refresh_rate = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
330 mode.driverdata = NULL;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
331
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
332 SDL_DFB_CALLOC(dispdata, 1, sizeof(*dispdata));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
333
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
334 dispdata->layer = layer;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335 dispdata->pixelformat = dlc.pixelformat;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 dispdata->cw = tcw[i];
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
337 dispdata->ch = tch[i];
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
338
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
339 /* YUV - Video layer */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 dispdata->vidID = screencbdata->vidlayer[i];
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
342 dispdata->vidIDinuse = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
343
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
344 SDL_zero(display);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
345
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
346 display.desktop_mode = mode;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
347 display.current_mode = mode;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
348 display.driverdata = dispdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
349
2815
e759ad5e6f43 Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
350 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2)
2841
483f85e35a1a Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2815
diff changeset
351 dlc.flags =
483f85e35a1a Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2815
diff changeset
352 DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT |
483f85e35a1a Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2815
diff changeset
353 DLCONF_OPTIONS;
483f85e35a1a Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2815
diff changeset
354 ret = layer->SetConfiguration(layer, &dlc);
483f85e35a1a Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2815
diff changeset
355 #endif
2815
e759ad5e6f43 Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
356
e759ad5e6f43 Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
357 SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED));
e759ad5e6f43 Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
358
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
359 SDL_AddVideoDisplay(&display);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
360 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361 SDL_DFB_FREE(screencbdata);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
362 return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
363 error:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364 /* FIXME: Cleanup not complete, Free existing displays */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
365 SDL_DFB_FREE(dispdata);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
366 SDL_DFB_RELEASE(layer);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
367 return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
368 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
369
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
370 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371 DirectFB_GetDisplayModes(_THIS)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
372 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
373 SDL_DFB_DEVICEDATA(_this);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
374 DFB_DisplayData *dispdata =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
375 (DFB_DisplayData *) SDL_CurrentDisplay.driverdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
376 SDL_DisplayMode mode;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
377 struct modes_callback_t data;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
378 int i;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
379 int ret;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
380
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
381 data.nummodes = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
382 /* Enumerate the available fullscreen modes */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
383 SDL_DFB_CALLOC(data.modelist, DFB_MAX_MODES, sizeof(SDL_DisplayMode));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
384 SDL_DFB_CHECKERR(devdata->dfb->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
385 EnumVideoModes(devdata->dfb, EnumModesCallback, &data));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
386
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
387 for (i = 0; i < data.nummodes; ++i) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
388 mode = data.modelist[i];
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
389
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390 mode.format = SDL_PIXELFORMAT_ARGB8888;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
391 CheckSetDisplayMode(_this, dispdata, &mode);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392 mode.format = SDL_PIXELFORMAT_RGB888;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393 CheckSetDisplayMode(_this, dispdata, &mode);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
394 mode.format = SDL_PIXELFORMAT_RGB24;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
395 CheckSetDisplayMode(_this, dispdata, &mode);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
396 mode.format = SDL_PIXELFORMAT_RGB565;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397 CheckSetDisplayMode(_this, dispdata, &mode);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
398 mode.format = SDL_PIXELFORMAT_INDEX8;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399 CheckSetDisplayMode(_this, dispdata, &mode);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
401 SDL_DFB_FREE(data.modelist);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
402 return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
403 error:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
404 SDL_DFB_FREE(data.modelist);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
405 return;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
406 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
407
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
408 int
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
409 DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
410 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
411 /*
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
412 * FIXME: video mode switch is currently broken for 1.2.0
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
413 *
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
414 */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
415
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
416 SDL_DFB_DEVICEDATA(_this);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
417 DFB_DisplayData *data = (DFB_DisplayData *) SDL_CurrentDisplay.driverdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
418 DFBDisplayLayerConfig config, rconfig;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
419 DFBDisplayLayerConfigFlags fail = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
420 DFBResult ret;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
421
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
422 SDL_DFB_CHECKERR(data->layer->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
423 SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
424
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
425 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
426 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
427 if (mode->format != SDL_PIXELFORMAT_UNKNOWN) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
428 config.flags |= DLCONF_PIXELFORMAT;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
429 config.pixelformat = SDLToDFBPixelFormat(mode->format);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
430 data->pixelformat = config.pixelformat;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
431 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
432 config.width = mode->w;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
433 config.height = mode->h;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
434
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
435 if (devdata->use_yuv_underlays) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
436 config.flags |= DLCONF_OPTIONS;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
437 config.options = DLOP_ALPHACHANNEL;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
438 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
439
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
440 data->layer->TestConfiguration(data->layer, &config, &fail);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
441
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
442 if (fail &
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
443 (DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_OPTIONS))
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
444 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
445 SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
446 mode->format);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
447 return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
448 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
449
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
450 SDL_DFB_DEBUG("Trace\n");
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
451 config.flags &= ~fail;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
452 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
2815
e759ad5e6f43 Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
453 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2)
e759ad5e6f43 Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
454 /* Need to call this twice ! */
e759ad5e6f43 Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
455 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
e759ad5e6f43 Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
456 //SDL_DFB_CHECKERR(data->layer->SetSourceRectangle(data->layer, 0, 0, config.width, config.height));
e759ad5e6f43 Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
457 #endif
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
458
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
459 /* Double check */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
460 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
461 SDL_DFB_CHECKERR(data->layer->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
462 SetCooperativeLevel(data->layer, DLSCL_SHARED));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
463
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
464 if ((config.width != rconfig.width) ||
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
465 (config.height != rconfig.height) ||
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
466 ((mode->format != SDL_PIXELFORMAT_UNKNOWN)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
467 && (config.pixelformat != rconfig.pixelformat))) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
468 SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
469 mode->format);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
470 return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
471 }
2841
483f85e35a1a Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2815
diff changeset
472
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
473 data->pixelformat = rconfig.pixelformat;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
474 data->cw = config.width;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
475 data->ch = config.height;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
476 SDL_CurrentDisplay.current_mode = *mode;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
477
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
478 return 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
479 error:
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
480 return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
481 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
482
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
483 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
484 DirectFB_QuitModes(_THIS)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
485 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
486 DFB_DeviceData *devdata = (DFB_DeviceData *) _this->driverdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
487 SDL_DisplayMode tmode;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
488 DFBResult ret;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
489 int i;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
490
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
491 SDL_SelectVideoDisplay(0);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
492
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
493 SDL_GetDesktopDisplayMode(&tmode);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
494 tmode.format = SDL_PIXELFORMAT_UNKNOWN;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
495 DirectFB_SetDisplayMode(_this, &tmode);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
496
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
497 SDL_GetDesktopDisplayMode(&tmode);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
498 DirectFB_SetDisplayMode(_this, &tmode);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
499
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
500 for (i = 0; i < SDL_GetNumVideoDisplays(); i++) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
501 DFB_DisplayData *dispdata =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
502 (DFB_DisplayData *) _this->displays[i].driverdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
503
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
504 if (dispdata->layer) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
505 SDL_DFB_CHECK(dispdata->layer->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
506 SetCooperativeLevel(dispdata->layer,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
507 DLSCL_ADMINISTRATIVE));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
508 SDL_DFB_CHECK(dispdata->layer->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
509 SetCursorOpacity(dispdata->layer, 0x00));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
510 SDL_DFB_CHECK(dispdata->layer->
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
511 SetCooperativeLevel(dispdata->layer, DLSCL_SHARED));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
512 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
513
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
514 SDL_DFB_RELEASE(dispdata->layer);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
515 SDL_DFB_RELEASE(dispdata->vidlayer);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
516
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
517 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
518 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
519
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
520 /* vi: set ts=4 sw=4 expandtab: */