annotate libvo/mga_common.c @ 83:a765e3ddeb39

OSD added
author gabucino
date Sun, 11 Mar 2001 17:03:28 +0000
parents cdb2e30be421
children 6ad0715dfac8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 // mga_vid drawing functions
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
4 static int mga_next_frame=0;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
5
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
6 static mga_vid_config_t mga_vid_config;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
7 static uint8_t *vid_data, *frames[4];
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
8 static int f;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
9
47
9d68da5d8a9a vsync in mga/xmga
arpi_esp
parents: 31
diff changeset
10
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 write_frame_g200(uint8_t *y,uint8_t *cr, uint8_t *cb)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 uint8_t *dest;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 uint32_t bespitch,h,w;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 dest = vid_data;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 bespitch = (mga_vid_config.src_width + 31) & ~31;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 for(h=0; h < mga_vid_config.src_height; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 memcpy(dest, y, mga_vid_config.src_width);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 y += mga_vid_config.src_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 dest += bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 for(h=0; h < mga_vid_config.src_height/2; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 for(w=0; w < mga_vid_config.src_width/2; w++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 *dest++ = *cb++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 *dest++ = *cr++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 dest += bespitch - mga_vid_config.src_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 write_frame_g400(uint8_t *y,uint8_t *cr, uint8_t *cb)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 uint8_t *dest;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 uint32_t bespitch,h;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 dest = vid_data;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 bespitch = (mga_vid_config.src_width + 31) & ~31;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 for(h=0; h < mga_vid_config.src_height; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 memcpy(dest, y, mga_vid_config.src_width);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 y += mga_vid_config.src_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 dest += bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 for(h=0; h < mga_vid_config.src_height/2; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 memcpy(dest, cb, mga_vid_config.src_width/2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 cb += mga_vid_config.src_width/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 dest += bespitch/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 for(h=0; h < mga_vid_config.src_height/2; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 memcpy(dest, cr, mga_vid_config.src_width/2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 cr += mga_vid_config.src_width/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 dest += bespitch/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 //static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 //write_slice_g200(uint8_t *y,uint8_t *cr, uint8_t *cb,uint32_t slice_num)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 draw_slice_g200(uint8_t *image[], int stride[], int width,int height,int x,int y)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 uint8_t *src;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 uint8_t *src2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 uint8_t *dest;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 uint32_t bespitch,h,w;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 bespitch = (mga_vid_config.src_width + 31) & ~31;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 dest = vid_data + bespitch * y * x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 src = image[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 for(h=0; h < height; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 memcpy(dest, src, width);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 src += stride[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 dest += bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 width/=2;height/=2;x/=2;y/=2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 dest = vid_data + bespitch * mga_vid_config.src_height +
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 bespitch * y + 2*x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 src = image[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 src2 = image[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 for(h=0; h < height; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 for(w=0; w < width; w++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 dest[2*w+0] = src[w];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 dest[2*w+1] = src2[w];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 dest += bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 src += stride[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 src2+= stride[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 draw_slice_g400(uint8_t *image[], int stride[], int w,int h,int x,int y)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 uint8_t *src;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 uint8_t *dest;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 uint32_t bespitch,bespitch2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 bespitch = (mga_vid_config.src_width + 31) & ~31;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 bespitch2 = bespitch/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 dest = vid_data + bespitch * y + x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 src = image[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 for(i=0;i<h;i++){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124 memcpy(dest,src,w);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 src+=stride[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 dest += bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 w/=2;h/=2;x/=2;y/=2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 dest = vid_data + bespitch*mga_vid_config.src_height + bespitch2 * y + x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 src = image[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133 for(i=0;i<h;i++){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 memcpy(dest,src,w);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135 src+=stride[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 dest += bespitch2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 dest = vid_data + bespitch*mga_vid_config.src_height
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 + bespitch*mga_vid_config.src_height / 4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 + bespitch2 * y + x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 src = image[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 for(i=0;i<h;i++){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 memcpy(dest,src,w);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 src+=stride[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 dest += bespitch2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 static uint32_t
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 if (mga_vid_config.card_type == MGA_G200)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155 draw_slice_g200(src,stride,w,h,x,y);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 draw_slice_g400(src,stride,w,h,x,y);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 static void
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
162 vo_mga_flip_page(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 {
47
9d68da5d8a9a vsync in mga/xmga
arpi_esp
parents: 31
diff changeset
164
9d68da5d8a9a vsync in mga/xmga
arpi_esp
parents: 31
diff changeset
165 // printf("-- flip to %d --\n",mga_next_frame);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166
47
9d68da5d8a9a vsync in mga/xmga
arpi_esp
parents: 31
diff changeset
167 #if 1
9d68da5d8a9a vsync in mga/xmga
arpi_esp
parents: 31
diff changeset
168 ioctl(f,MGA_VID_FSEL,&mga_next_frame);
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
169 mga_next_frame=(mga_next_frame+1)%mga_vid_config.num_frames;
47
9d68da5d8a9a vsync in mga/xmga
arpi_esp
parents: 31
diff changeset
170 vid_data=frames[mga_next_frame];
9d68da5d8a9a vsync in mga/xmga
arpi_esp
parents: 31
diff changeset
171 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 write_frame_yuy2(uint8_t *y)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 uint8_t *dest;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 uint32_t bespitch,h;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 int len=2*mga_vid_config.src_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 dest = vid_data;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 bespitch = (mga_vid_config.src_width + 31) & ~31;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 // y+=2*mga_vid_config.src_width*mga_vid_config.src_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 for(h=0; h < mga_vid_config.src_height; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 // y -= 2*mga_vid_config.src_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 memcpy(dest, y, len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 y += len;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 dest += 2*bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 static uint32_t
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 draw_frame(uint8_t *src[])
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 if (mga_vid_config.format==MGA_VID_FORMAT_YUY2)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 write_frame_yuy2(src[0]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 if (mga_vid_config.card_type == MGA_G200)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 write_frame_g200(src[0], src[2], src[1]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 write_frame_g400(src[0], src[2], src[1]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 //flip_page();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 static uint32_t
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 query_format(uint32_t format)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 switch(format){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 case IMGFMT_YV12:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 case IMGFMT_YUY2:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 // case IMGFMT_RGB|24:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 // case IMGFMT_BGR|24:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
226 static int mga_init(){
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
227 char *frame_mem;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
228
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
229 mga_vid_config.num_frames=4;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
230 mga_vid_config.version=MGA_VID_VERSION;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
231 if (ioctl(f,MGA_VID_CONFIG,&mga_vid_config))
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
232 {
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
233 perror("Error in mga_vid_config ioctl");
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
234 return -1;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
235 }
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
236 ioctl(f,MGA_VID_ON,0);
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
237
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
238 frames[0] = (char*)mmap(0,mga_vid_config.frame_size*mga_vid_config.num_frames,PROT_WRITE,MAP_SHARED,f,0);
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
239 frames[1] = frames[0] + 1*mga_vid_config.frame_size;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
240 frames[2] = frames[0] + 2*mga_vid_config.frame_size;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
241 frames[3] = frames[0] + 3*mga_vid_config.frame_size;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
242 mga_next_frame = 0;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
243 vid_data = frames[mga_next_frame];
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
244
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
245 //clear the buffer
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
246 memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames);
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
247
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
248 return 0;
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
249
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
250 }
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
251