annotate libvo/vo_syncfb.c @ 18119:e1a6874c7308

1.240: Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV). 1.239: -ao pcm:fast suboption for faster-than-realtime dumping 1.238: the title of this window was not localized
author kraymer
date Sun, 16 Apr 2006 20:05:35 +0000
parents fd51fd1ff231
children a107276371a8
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 // How many MegaBytes of RAM is on your G200/G400 card?
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 #define RAM_SIZE 16
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 * video_out_syncfb.c
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 * Copyright (C) Aaron Holtzman - Aug 1999
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 * mpeg2dec is free software; you can redistribute it and/or modify
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 * the Free Software Foundation; either version 2, or (at your option)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 * any later version.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 * mpeg2dec is distributed in the hope that it will be useful,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 * GNU General Public License for more details.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 * along with GNU Make; see the file COPYING. If not, write to
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
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
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 #include <string.h>
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
31 #include <errno.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 #include <sys/ioctl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 #include <unistd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 #include <fcntl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 #include <sys/mman.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 #include <linux/videodev.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 #include "drivers/syncfb/syncfb.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44
354
7de9e48c83a5 memcpy() moved mmx.h -> fastmemcpy.h
arpi_esp
parents: 350
diff changeset
45 #include "fastmemcpy.h"
350
601822cc8c52 applied MMX2 memcpy() patch by Nick Kurshev
arpi_esp
parents: 31
diff changeset
46
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7124
diff changeset
47 static vo_info_t info =
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 "Matrox G200/G400 Synchronous framebuffer (/dev/syncfb)",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 "syncfb",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 "Matthias Oelmann <mao@well.com>",
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
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7124
diff changeset
55 LIBVO_EXTERN(syncfb)
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7124
diff changeset
56
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 /* deinterlacing on? looks only good in 50 Hz(PAL) or 60 Hz(NTSC) modes */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 static int vo_conf_deinterlace = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 /* 72/75 Hz Monitor frequency for progressive output */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 static int vo_conf_cinemode = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
64 static syncfb_config_t _config;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 static syncfb_capability_t sfb_caps;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 static syncfb_buffer_info_t bufinfo;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 static uint_8 *vid_data;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 static uint_8 *frame_mem;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 static int debug_skip_first = 250;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 static int dbg_singleframe = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 static int conf_palette;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 static int f;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 it seems that mpeg2dec never calls
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 draw_frame, so i could not test it....
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 write_frame_YUV422(uint_8 *y,uint_8 *cr, uint_8 *cb)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 uint_8 *crp, *cbp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 uint_32 *dest32;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 uint_32 bespitch,h,w;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
94 bespitch = _config.src_pitch;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 dest32 = (uint_32 *)vid_data;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
97 for(h=0; h < _config.src_height/2; h++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 cbp = cb;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 crp = cr;
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
101 for(w=0; w < _config.src_width/2; w++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 *dest32++ = (*y) + ((*cr)<<8) + ((*(y+1))<<16) + ((*cb)<<24);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 y++; y++; cb++; cr++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 }
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
106 dest32 += (bespitch - _config.src_width) / 2;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
108 for(w=0; w < _config.src_width/2; w++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 *dest32++ = (*y) + ((*crp)<<8) + ((*(y+1))<<16) + ((*cbp)<<24);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 y++; y++; cbp++; crp++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 }
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
113 dest32 += (bespitch - _config.src_width) / 2;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 write_frame_YUV420P2(uint_8 *y,uint_8 *cr, uint_8 *cb)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 uint_8 *dest, *tmp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 uint_32 bespitch,h,w;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
124 bespitch = _config.src_pitch;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 dest = frame_mem + bufinfo.offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
127 for(h=0; h < _config.src_height; h++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 {
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
129 memcpy(dest, y, _config.src_width);
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
130 y += _config.src_width;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 dest += bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 dest = frame_mem + bufinfo.offset_p2;
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
135 for(h=0; h < _config.src_height/2; h++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 tmp = dest;
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
138 for(w=0; w < _config.src_width/2; w++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 *tmp++ = *cr++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 *tmp++ = *cb++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 dest += bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 write_frame_YUV420P3(uint_8 *y,uint_8 *cr, uint_8 *cb)
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
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 write_slice_YUV420P2(uint_8 *y,uint_8 *cr, uint_8 *cb,uint_32 slice_num)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155 uint_8 *dest, *tmp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 uint_32 bespitch,h,w;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
158 bespitch = _config.src_pitch;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 dest = frame_mem + bufinfo.offset + (bespitch * 16 * slice_num);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 for(h=0; h < 16; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 {
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
163 memcpy(dest, y, _config.src_width);
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
164 y += _config.src_width;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 dest += bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 dest = frame_mem + bufinfo.offset_p2 + (bespitch * 16 * slice_num) /2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 for(h=0; h < 8; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 tmp = dest;
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
172 for(w=0; w < _config.src_width/2; w++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 *tmp++ = *cr++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 *tmp++ = *cb++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 dest += bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 write_slice_YUV420P3(uint_8 *y,uint_8 *cr, uint_8 *cb,int stride[],uint_32 ypos,uint_32 xsize,uint_32 ysize)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 uint_8 *dest;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 uint_32 bespitch,h;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
187 bespitch = _config.src_pitch;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 dest = frame_mem + bufinfo.offset + (bespitch * ypos);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 for(h=0; h < ysize; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 memcpy(dest, y, xsize);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 y += stride[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 dest += bespitch;
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 xsize/=2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 ysize/=2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 dest = frame_mem + bufinfo.offset_p2 + (bespitch * ypos)/4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 for(h=0; h < ysize; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 memcpy(dest, cr, xsize);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 cr += stride[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 dest += bespitch/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 dest = frame_mem + bufinfo.offset_p3 + (bespitch * ypos)/4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 for(h=0; h < ysize; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 memcpy(dest, cb, xsize);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 cb += stride[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 dest += bespitch/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 write_slice_YUV422(uint_8 *y,uint_8 *cr, uint_8 *cb,uint_32 slice_num)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 uint_8 *crp, *cbp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 uint_32 *dest32;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 uint_32 bespitch,h,w;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
228 bespitch = _config.src_pitch;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 dest32 = (uint_32 *)(vid_data + (bespitch * 16 * slice_num) * 2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 for(h=0; h < 8; h++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 cbp = cb;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 crp = cr;
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
235 for(w=0; w < _config.src_width/2; w++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 *dest32++ = (*y) + ((*cr)<<8) + ((*(y+1))<<16) + ((*cb)<<24);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238 y++; y++; cb++; cr++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 }
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
240 dest32 += (bespitch - _config.src_width) / 2;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
242 for(w=0; w < _config.src_width/2; w++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 *dest32++ = (*y) + ((*crp)<<8) + ((*(y+1))<<16) + ((*cbp)<<24);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 y++; y++; cbp++; crp++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 }
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
247 dest32 += (bespitch - _config.src_width) / 2;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251 //static uint32_t draw_slice(uint8_t *src[], uint32_t slice_num)
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
252 static int
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 if ( vid_data == NULL ) return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258 write_slice_YUV420P3(src[0],src[1], src[2],stride,y,w,h);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 //printf("sorry, not syncfb/draw_slice() implemented yet...\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262 #if 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 if ( conf_palette == VIDEO_PALETTE_YUV422 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265 write_slice_YUV422(src[0],src[1], src[2],slice_num);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 } else if ( conf_palette == VIDEO_PALETTE_YUV420P2 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 write_slice_YUV420P2(src[0],src[1], src[2],slice_num);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 } else if ( conf_palette == VIDEO_PALETTE_YUV420P3 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269 write_slice_YUV420P3(src[0],src[1], src[2],slice_num);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 614
diff changeset
276 static void draw_osd(void)
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 614
diff changeset
277 {
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 614
diff changeset
278 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
280 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281 flip_page(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
282 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
284 // memset(frame_mem + bufinfo.offset_p2, 0x80, _config.src_width*config.src_height);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285 ioctl(f,SYNCFB_COMMIT_BUFFER,&bufinfo);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287 if ( dbg_singleframe ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288 if ( debug_skip_first == 0 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 printf( "Press 'anykey' for field 1\n" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 getchar();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291 ioctl(f,SYNCFB_VBI,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294 if ( debug_skip_first > 0 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 debug_skip_first--;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 // debug_skip_first = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 if ( debug_skip_first == 0 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298 ioctl(f,SYNCFB_VBI,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 ioctl(f,SYNCFB_VBI,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300 ioctl(f,SYNCFB_VBI,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 if ( debug_skip_first == 0 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305 printf( "Press 'anykey' for field 2\n" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306 getchar();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 ioctl(f,SYNCFB_VBI,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 ioctl(f,SYNCFB_REQUEST_BUFFER,&bufinfo);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 if ( bufinfo.id == -1 ) printf( "Got buffer #%d\n", bufinfo.id );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 vid_data = (uint_8 *)(frame_mem + bufinfo.offset);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315 if ( bufinfo.id == -1 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316 //vid_data = frame_mem;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
317 vid_data = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319 // printf("Flip %d\n", bufinfo.offset);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
323 static int draw_frame(uint8_t *src[])
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 printf("DRAW FRAME!!!\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326 if ( conf_palette == VIDEO_PALETTE_YUV422 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 write_frame_YUV422(src[0],src[1], src[2]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 } else if ( conf_palette == VIDEO_PALETTE_YUV420P2 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 write_frame_YUV420P2(src[0],src[1], src[2]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330 } else if ( conf_palette == VIDEO_PALETTE_YUV420P3 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
331 write_frame_YUV420P3(src[0],src[1], src[2]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334 flip_page();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
337
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
338 static int
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339 query_format(uint32_t format)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341 switch(format){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 case IMGFMT_YV12:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343 // case IMGFMT_RGB|24:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344 // case IMGFMT_BGR|24:
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 8148
diff changeset
345 return VFCAP_CSP_SUPPORTED;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
348 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
350 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352 uint_32 frame_size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 f = open("/dev/syncfb",O_RDWR);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
356 if(f == -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
357 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
358 f = open("/dev/mga_vid",O_RDWR);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
359 if(f == -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
360 {
614
f83ec60bce49 fprintf(stderr converted to printf(
szabii
parents: 354
diff changeset
361 printf("Couldn't open /dev/syncfb or /dev/mga_vid\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362 return(-1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
366 if (ioctl(f,SYNCFB_GET_CAPS,&sfb_caps)) perror("Error in mga_vid_config ioctl");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 if (ioctl(f,SYNCFB_GET_CONFIG,&config)) perror("Error in mga_vid_config ioctl");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
368
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
369 if (sfb_caps.palettes & (1<<VIDEO_PALETTE_YUV420P3) ) {
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
370 _config.src_palette= VIDEO_PALETTE_YUV420P3;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
371 printf("using palette yuv420p3\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372 }else if ( sfb_caps.palettes & (1<<VIDEO_PALETTE_YUV420P2) ) {
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
373 _config.src_palette= VIDEO_PALETTE_YUV420P2;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
374 printf("using palette yuv420p2\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
375 } else if ( sfb_caps.palettes & (1<<VIDEO_PALETTE_YUV422) ) {
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
376 _config.src_palette= VIDEO_PALETTE_YUV422;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377 printf("using palette yuv422\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 } else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
379 printf("no supported palette found\n");
1633
742d9e286b5d exit->return
arpi
parents: 1501
diff changeset
380 return -1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
383 // _config.src_palette= VIDEO_PALETTE_YUV422;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385 if ( vo_conf_cinemode ) {
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
386 _config.default_repeat = 3;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
387 } else {
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
388 _config.default_repeat = 2;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
389 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
390
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
391 conf_palette = _config.src_palette;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 if ( vo_conf_deinterlace ) {
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
393 _config.syncfb_mode = SYNCFB_FEATURE_SCALE | SYNCFB_FEATURE_BLOCK_REQUEST | SYNCFB_FEATURE_DEINTERLACE;
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
394 _config.default_repeat = 1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
395 } else {
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
396 _config.syncfb_mode = SYNCFB_FEATURE_SCALE | SYNCFB_FEATURE_BLOCK_REQUEST;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
397 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
398
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
399 _config.fb_screen_size = (RAM_SIZE-4)*0x100000; //(1280 * 1024 * 32) / 8;
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
400 _config.src_width = width;
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
401 _config.src_height= height;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
403 _config.image_width = d_width;
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
404 _config.image_height= d_height;
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
405 //_config.image_width = 1024;
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
406 //_config.image_height= 576;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
407
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
408 _config.image_xorg= 0;
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
409 _config.image_yorg= 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
410
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
411
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
412 printf ("BES Sourcer size: %d x %d\n", width, height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
413
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
414 ioctl(f,SYNCFB_ON,0);
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
415 if (ioctl(f,SYNCFB_SET_CONFIG,&_config)) perror("Error in mga_vid_config ioctl");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
416
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
417 printf ("Framebuffer memory: %ld in %ld buffers\n", sfb_caps.memory_size, _config.buffers);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
418
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
419 frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
420 frame_mem = (uint_8*)mmap(0,sfb_caps.memory_size,PROT_WRITE,MAP_SHARED,f,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
421
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
422 printf( "Requesting first buffer #%d\n", bufinfo.id );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
423 ioctl(f,SYNCFB_REQUEST_BUFFER,&bufinfo);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
424 printf( "Got first buffer #%d\n", bufinfo.id );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
425
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
426
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
427 vid_data = (uint_8 *)(frame_mem + bufinfo.offset);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
428
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
429 //clear the buffer
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
430 // memset(frame_mem,0x80,frame_size*2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
431 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
432 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
433
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
434
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
435 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
436 uninit(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
437 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
438 if (ioctl(f,SYNCFB_OFF,0)) perror("Error in OFF ioctl");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
439
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
440 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
441
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
442 static void check_events(void)
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
443 {
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
444 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
445
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
446 static int preinit(const char *arg)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1633
diff changeset
447 {
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
448 if(arg)
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
449 {
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
450 printf("vo_syncfb: Unknown subdevice: %s\n",arg);
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
451 return ENOSYS;
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
452 }
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
453 return 0;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1633
diff changeset
454 }
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1633
diff changeset
455
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
456 static int control(uint32_t request, void *data, ...)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1633
diff changeset
457 {
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
458 switch (request) {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
459 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
460 return query_format(*((uint32_t*)data));
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
461 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
462 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1633
diff changeset
463 }