annotate src/video/ps3/SDL_ps3video.h @ 4396:f5d3f7fa071d SDL-1.2

1.2 pulseaudio: make some function pointers static.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 17 Jan 2010 05:17:59 +0000
parents 3b8ac3d311a2
children
rev   line source
4165
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 * SDL - Simple DirectMedia Layer
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 * CELL BE Support for PS3 Framebuffer
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 * Copyright (C) 2008, 2009 International Business Machines Corporation
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 *
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 * This library is free software; you can redistribute it and/or modify it
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 * under the terms of the GNU Lesser General Public License as published
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 * by the Free Software Foundation; either version 2.1 of the License, or
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9 * (at your option) any later version.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 *
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 * This library is distributed in the hope that it will be useful, but
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14 * Lesser General Public License for more details.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 *
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 * License along with this library; if not, write to the Free Software
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 * USA
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 *
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 * Martin Lowinski <lowinski [at] de [dot] ibm [ibm] com>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 * Dirk Herrendoerfer <d.herrendoerfer [at] de [dot] ibm [dot] com>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 * SPE code based on research by:
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 * Rene Becker
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 * Thimo Emmerich
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #include "SDL_config.h"
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #include "../SDL_sysvideo.h"
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include "SDL_mouse.h"
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #include "SDL_mutex.h"
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include "spulibs/spu_common.h"
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #include <libspe2.h>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include <pthread.h>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 #include <linux/types.h>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 #include <linux/fb.h>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 #include <asm/ps3fb.h>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 #include <linux/vt.h>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 #include <termios.h>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 #ifndef _SDL_ps3video_h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 #define _SDL_ps3video_h
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 /* Debugging
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 * 0: No debug messages
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 * 1: Video debug messages
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 * 2: SPE debug messages
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 * 3: Memory adresses
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 #define DEBUG_LEVEL 0
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 #ifdef DEBUG_LEVEL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 #define deprintf( level, fmt, args... ) \
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 do \
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 { \
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 if ( (unsigned)(level) <= DEBUG_LEVEL ) \
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 { \
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 fprintf( stdout, fmt, ##args ); \
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 fflush( stdout ); \
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 } \
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 } while ( 0 )
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 #else
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 #define deprintf( level, fmt, args... )
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 #endif
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 /* Framebuffer device */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 #define PS3_DEV_FB "/dev/fb0"
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 /* Hidden "this" pointer for the video functions */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 #define _THIS SDL_VideoDevice * this
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 /* SPU thread data */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 typedef struct spu_data {
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 spe_context_ptr_t ctx;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 pthread_t thread;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 spe_program_handle_t program;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 char * program_name;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 unsigned int booted;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 unsigned int keepalive;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 unsigned int entry;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 int error_code;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 void * argp;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 } spu_data_t;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 /* Private video driver data needed for Cell support */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 struct SDL_PrivateVideoData
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 {
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 const char * const fb_dev_name; /* FB-device name */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 int fb_dev_fd; /* Descriptor-handle for fb_dev_name */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 uint8_t * frame_buffer; /* mmap'd access to fbdev */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 /* SPE threading stuff */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 spu_data_t * fb_thread_data;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 spu_data_t * scaler_thread_data;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 spu_data_t * converter_thread_data;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 /* screeninfo (from linux/fb.h) */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 struct fb_fix_screeninfo fb_finfo;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 struct fb_var_screeninfo fb_vinfo;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 struct fb_var_screeninfo fb_orig_vinfo;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 /* screeninfo (from asm/ps3fb.h) */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 struct ps3fb_ioctl_res res;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 unsigned int double_buffering;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 uint32_t real_width; // real width of screen
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 uint32_t real_height; // real height of screen
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 uint32_t s_fb_pixel_size; // 32: 4 24: 3 16: 2 15: 2
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 uint32_t fb_bits_per_pixel; // 32: 32 24: 24 16: 16 15: 15
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 uint32_t config_count;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 uint32_t s_input_line_length; // precalculated: input_width * fb_pixel_size
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 uint32_t s_bounded_input_width; // width of input (bounded by writeable width)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 uint32_t s_bounded_input_height;// height of input (bounded by writeable height)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 uint32_t s_bounded_input_width_offset; // offset from the left side (used for centering)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 uint32_t s_bounded_input_height_offset; // offset from the upper side (used for centering)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 uint32_t s_writeable_width; // width of screen which is writeable
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 uint32_t s_writeable_height; // height of screen which is writeable
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 uint8_t * s_center[2]; // where to begin writing our image (centered?)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 uint32_t s_center_index;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 volatile void * s_pixels __attribute__((aligned(128)));
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 /* Framebuffer data */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 volatile struct fb_writer_parms_t * fb_parms __attribute__((aligned(128)));
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 };
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 #define fb_dev_name (this->hidden->fb_dev_name)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 #define fb_dev_fd (this->hidden->fb_dev_fd)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 #define frame_buffer (this->hidden->frame_buffer)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 #define fb_thread_data (this->hidden->fb_thread_data)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 #define scaler_thread_data (this->hidden->scaler_thread_data)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 #define converter_thread_data (this->hidden->converter_thread_data)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 #define fb_parms (this->hidden->fb_parms)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 #define SDL_nummodes (this->hidden->SDL_nummodes)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 #define SDL_modelist (this->hidden->SDL_modelist)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 #define SDL_videomode (this->hidden->SDL_videomode)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 #define fb_finfo (this->hidden->fb_finfo)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 #define fb_vinfo (this->hidden->fb_vinfo)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 #define fb_orig_vinfo (this->hidden->fb_orig_vinfo)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 #define res (this->hidden->res)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 #define double_buffering (this->hidden->double_buffering)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 #define real_width (this->hidden->real_width)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 #define real_height (this->hidden->real_height)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 #define s_fb_pixel_size (this->hidden->s_fb_pixel_size)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 #define fb_bits_per_pixel (this->hidden->fb_bits_per_pixel)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 #define config_count (this->hidden->config_count)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 #define s_input_line_length (this->hidden->s_input_line_length)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 #define s_bounded_input_width (this->hidden->s_bounded_input_width)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 #define s_bounded_input_height (this->hidden->s_bounded_input_height)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 #define s_bounded_input_width_offset (this->hidden->s_bounded_input_width_offset)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 #define s_bounded_input_height_offset (this->hidden->s_bounded_input_height_offset)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 #define s_writeable_width (this->hidden->s_writeable_width)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 #define s_writeable_height (this->hidden->s_writeable_height)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 #define s_center (this->hidden->s_center)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 #define s_center_index (this->hidden->s_center_index)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 #define s_pixels (this->hidden->s_pixels)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 #endif /* _SDL_ps3video_h */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165