Mercurial > mplayer.hg
annotate libvo/vo_tdfxfb.c @ 34387:0ba85cad4c7e
Add audio CD playback support to the X11/GTK GUI.
(The Win32 GUI already had this support. Add missing - although already
used - user event evPlayCD here as well as internal event ivSetCDTrack
- although it's unused - for consistency.)
author | ib |
---|---|
date | Sat, 31 Dec 2011 12:38:52 +0000 |
parents | 786d1187960d |
children |
rev | line source |
---|---|
27509
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
1 /* |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
2 * copyright (C) 2002 Mark Zealey <mark@zealos.org> |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
3 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
4 * This file is part of MPlayer. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
5 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
6 * MPlayer is free software; you can redistribute it and/or modify |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
9 * (at your option) any later version. |
1979 | 10 * |
27509
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
11 * MPlayer is distributed in the hope that it will be useful, |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
14 * GNU General Public License for more details. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
15 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
16 * You should have received a copy of the GNU General Public License along |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
19 */ |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
20 |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
21 /* |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
22 * 30/03/02: An almost total rewrite, added DR support and support for modes |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
23 * other than 16bpp. Fixed the crash when playing multiple files |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
24 * 07/04/02: Fixed DR support, added YUY2 support, fixed OSD stuff. |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
25 * 08/04/02: Fixed a wierd sound corruption problem caused by some optomizations |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
26 * I made. |
5567 | 27 * 09/04/02: Fixed a problem with changing the variables passed to draw_slice(). |
28 * Fixed DR support for YV12 et al. Added BGR support. Removed lots of dud code. | |
29 * 10/04/02: Changed the memcpy functions to mem2agpcpy.. should be a tad | |
30 * faster. | |
31 * 11/04/02: Added a compile option so you can watch the film with the console | |
32 * as the background, or not. | |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
33 * 13/04/02: Fix rough OSD stuff by rendering it straight onto the output |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
34 * buffer. Added double-buffering. Supports hardware zoom/reduce zoom modes. |
5590 | 35 * 13/04/02: Misc cleanups of the code. |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
7708
diff
changeset
|
36 * 22/10/02: Added geometry support to it |
1979 | 37 * |
5567 | 38 * Hints and tricks: |
39 * - Use -dr to get direct rendering | |
11261 | 40 * - Use -vf yuy2 to get yuy2 rendering, *MUCH* faster than yv12 |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
41 * - To get a black background and nice smooth OSD, use -double |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
42 * - To get the console as a background, but with scaled OSD, use -nodouble |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
43 * - The driver supports both scaling and shrinking the image using the -x and |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
7708
diff
changeset
|
44 * -y options on the mplayer commandline. Also repositioning via the -geometry |
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
7708
diff
changeset
|
45 * option. |
1979 | 46 */ |
47 | |
48 #include <stdio.h> | |
49 #include <stdlib.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
|
50 #include <errno.h> |
7708 | 51 #include <string.h> |
52 #include <unistd.h> | |
5567 | 53 #include <sys/ioctl.h> |
54 #include <fcntl.h> | |
55 #include <sys/mman.h> | |
56 #include <linux/fb.h> | |
1979 | 57 |
58 #include "config.h" | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
59 #include "mp_msg.h" |
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
60 #include "help_mp.h" |
5567 | 61 #include "fastmemcpy.h" |
1979 | 62 #include "video_out.h" |
63 #include "video_out_internal.h" | |
5567 | 64 #include "drivers/3dfx.h" |
7708 | 65 #include "aspect.h" |
32467 | 66 #include "sub/sub.h" |
1979 | 67 |
25216 | 68 static const vo_info_t info = |
1979 | 69 { |
5567 | 70 "3Dfx Banshee/Voodoo3/Voodoo5", |
1979 | 71 "tdfxfb", |
7708 | 72 "Mark Zealey <mark@zealos.org>", |
1979 | 73 "" |
74 }; | |
75 | |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
76 const LIBVO_EXTERN(tdfxfb) |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8123
diff
changeset
|
77 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
78 /* Some registers on the card */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
79 #define S2S_STRECH_BLT 2 // BLT + Strech |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
80 #define S2S_IMMED (1 << 8) // Do it immediatly |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
81 #define S2S_ROP (0xCC << 24) // ??? |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
82 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
83 /* Stepping between the different YUV plane registers */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
84 #define YUV_STRIDE 1024 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
85 struct YUV_plane { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
86 char Y[0x0100000]; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
87 char U[0x0100000]; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
88 char V[0x0100000]; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
89 }; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
90 |
7708 | 91 static int fd = -1; |
1979 | 92 static struct fb_fix_screeninfo fb_finfo; |
93 static struct fb_var_screeninfo fb_vinfo; | |
5567 | 94 static uint32_t in_width, in_height, in_format, in_depth, in_voodoo_format, |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
95 screenwidth, screenheight, screendepth, vidwidth, vidheight, vidx, vidy, |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
96 vid_voodoo_format, *vidpage, *hidpage, *inpage, vidpageoffset, |
7708 | 97 hidpageoffset, inpageoffset, *memBase0 = NULL, *memBase1 = NULL, r_width, r_height; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
98 static volatile voodoo_io_reg *reg_IO; |
11129
9a941857969a
I found that the tdfxfb video output driver doesn't work when compiled with
attila
parents:
9521
diff
changeset
|
99 static volatile voodoo_2d_reg *reg_2d; |
1979 | 100 static voodoo_yuv_reg *reg_YUV; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
101 static struct YUV_plane *YUV; |
33845
786d1187960d
libvo: extend alpha_func function pointers with parameter type declaration
diego
parents:
33305
diff
changeset
|
102 static void (*alpha_func)(int, int, unsigned char*, unsigned char*, int, unsigned char*, int), |
786d1187960d
libvo: extend alpha_func function pointers with parameter type declaration
diego
parents:
33305
diff
changeset
|
103 (*alpha_func_double)(int, int, unsigned char*, unsigned char*, int, unsigned char*, int); |
1979 | 104 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
11261
diff
changeset
|
105 static int preinit(const char *arg) |
1979 | 106 { |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
107 char *name; |
1979 | 108 |
7708 | 109 if(arg) |
110 name = (char*)arg; | |
111 else if(!(name = getenv("FRAMEBUFFER"))) | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
112 name = "/dev/fb0"; |
1979 | 113 |
5567 | 114 if((fd = open(name, O_RDWR)) == -1) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
115 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_CantOpen, name, strerror(errno)); |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
116 return -1; |
1979 | 117 } |
118 | |
5567 | 119 if(ioctl(fd, FBIOGET_FSCREENINFO, &fb_finfo)) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
120 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_ProblemWithFbitgetFscreenInfo, |
1979 | 121 strerror(errno)); |
7708 | 122 close(fd); |
123 fd = -1; | |
1979 | 124 return -1; |
125 } | |
126 | |
5567 | 127 if(ioctl(fd, FBIOGET_VSCREENINFO, &fb_vinfo)) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
128 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_ProblemWithFbitgetVscreenInfo, |
1979 | 129 strerror(errno)); |
7708 | 130 close(fd); |
131 fd = -1; | |
1979 | 132 return -1; |
133 } | |
134 | |
5567 | 135 /* BANSHEE means any of the series aparently */ |
136 if (fb_finfo.accel != FB_ACCEL_3DFX_BANSHEE) { | |
18335 | 137 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_ThisDriverOnlySupports); |
7708 | 138 close(fd); |
139 fd = -1; | |
5567 | 140 return -1; |
1979 | 141 } |
142 | |
7708 | 143 // Check the depth now as config() musn't fail |
144 switch(fb_vinfo.bits_per_pixel) { | |
145 case 16: | |
146 case 24: | |
147 case 32: | |
148 break; // Ok | |
149 default: | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
150 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_OutputIsNotSupported, fb_vinfo.bits_per_pixel); |
7708 | 151 close(fd); |
152 fd = -1; | |
153 return -1; | |
154 } | |
155 | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
156 /* Open up a window to the hardware */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
157 memBase1 = mmap(0, fb_finfo.smem_len, PROT_READ | PROT_WRITE, |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
158 MAP_SHARED, fd, 0); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
159 memBase0 = mmap(0, fb_finfo.mmio_len, PROT_READ | PROT_WRITE, |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
160 MAP_SHARED, fd, fb_finfo.smem_len); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
161 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
162 if((long)memBase0 == -1 || (long)memBase1 == -1) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
163 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_CouldntMapMemoryAreas, strerror(errno)); |
7708 | 164 if((long)memBase0 != -1) |
165 munmap(memBase0, fb_finfo.smem_len); | |
166 if((long)memBase1 != -1) | |
167 munmap(memBase1, fb_finfo.smem_len); | |
168 memBase0 = memBase1 = NULL; | |
1979 | 169 return -1; |
170 } | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
171 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
172 /* Set up global pointers to the voodoo's regs */ |
5567 | 173 reg_IO = (void *)memBase0 + VOODOO_IO_REG_OFFSET; |
174 reg_2d = (void *)memBase0 + VOODOO_2D_REG_OFFSET; | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
175 reg_YUV = (void *)memBase0 + VOODOO_YUV_REG_OFFSET; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
176 YUV = (void *)memBase0 + VOODOO_YUV_PLANE_OFFSET; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
177 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
178 return 0; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
179 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
180 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
181 static void uninit(void) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
182 { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
183 if(reg_IO) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
184 /* Restore the screen (Linux lives at 0) */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
185 reg_IO->vidDesktopStartAddr = 0; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
186 reg_IO = NULL; |
1979 | 187 } |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
188 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
189 /* And close our mess */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
190 if(memBase1) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
191 munmap(memBase1, fb_finfo.smem_len); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
192 memBase1 = NULL; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
193 } |
1979 | 194 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
195 if(memBase0) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
196 munmap(memBase0, fb_finfo.mmio_len); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
197 memBase0 = NULL; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
198 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
199 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
200 if(fd != -1) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
201 close(fd); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
202 fd = -1; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
203 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
204 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
205 |
29212
eda346733b8c
Add missing 'void' to parameterless function declarations.
diego
parents:
27509
diff
changeset
|
206 static void clear_screen(void) |
5567 | 207 { |
7137
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
208 /* There needs to be some sort of delay here or else things seriously |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
209 * screw up. Causes the image to not be the right size on screen if |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
210 * this isn't like this. A printf before the memset call also seems to |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
211 * work, but this made more sense since it actually checks the status of |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
212 * the card. |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
213 */ |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
214 if(vo_doublebuffering) { |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
215 /* first wait for the card to be ready, do not try to write |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
216 * every time - alex */ |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
217 do {} while((reg_IO->status & 0x1f) < 1); |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
218 memset(vidpage, 0, screenwidth * screenheight * screendepth); |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
219 memset(hidpage, 0, screenwidth * screenheight * screendepth); |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
220 } |
5567 | 221 } |
222 | |
223 /* Setup output screen dimensions etc */ | |
5590 | 224 static void setup_screen(uint32_t full) |
5567 | 225 { |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
7708
diff
changeset
|
226 aspect(&vidwidth, &vidheight, full ? A_ZOOM : A_NOZOOM); |
9517 | 227 |
9521 | 228 geometry(&vidx, &vidy, &vidwidth, &vidheight, screenwidth, screenheight); |
7708 | 229 vo_fs = full; |
5567 | 230 clear_screen(); |
231 } | |
232 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
11261
diff
changeset
|
233 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
7117
diff
changeset
|
234 uint32_t flags, char *title, uint32_t format) |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
235 { |
1979 | 236 screenwidth = fb_vinfo.xres; |
237 screenheight = fb_vinfo.yres; | |
7708 | 238 aspect_save_screenres(fb_vinfo.xres,fb_vinfo.yres); |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
239 |
1979 | 240 in_width = width; |
241 in_height = height; | |
242 in_format = format; | |
7708 | 243 aspect_save_orig(width,height); |
1979 | 244 |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
245 r_width = d_width; |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
246 r_height = d_height; |
7708 | 247 aspect_save_prescale(d_width,d_height); |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
248 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
249 /* Setup the screen for rendering to */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
250 switch(fb_vinfo.bits_per_pixel) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
251 case 16: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
252 screendepth = 2; |
5567 | 253 vid_voodoo_format = VOODOO_BLT_FORMAT_16; |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
254 alpha_func_double = vo_draw_alpha_rgb16; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
255 break; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
256 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
257 case 24: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
258 screendepth = 3; |
5567 | 259 vid_voodoo_format = VOODOO_BLT_FORMAT_24; |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
260 alpha_func_double = vo_draw_alpha_rgb24; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
261 break; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
262 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
263 case 32: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
264 screendepth = 4; |
5567 | 265 vid_voodoo_format = VOODOO_BLT_FORMAT_32; |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
266 alpha_func_double = vo_draw_alpha_rgb32; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
267 break; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
268 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
269 default: |
18260
51588cd0dca5
fix printf->mp_msg transition, 10l to Reynaldo and/or Attila
rathann
parents:
18234
diff
changeset
|
270 mp_msg(MSGT_VO, MSGL_ERR, MSGTR_LIBVO_TDFXFB_BppOutputIsNotSupported, fb_vinfo.bits_per_pixel); |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
271 return -1; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
272 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
273 |
5567 | 274 vid_voodoo_format |= screenwidth * screendepth; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
275 |
5567 | 276 /* Some defaults here */ |
277 in_voodoo_format = VOODOO_BLT_FORMAT_YUYV; | |
278 in_depth = 2; | |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
279 alpha_func = vo_draw_alpha_yuy2; |
5567 | 280 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
281 switch(in_format) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
282 case IMGFMT_YV12: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
283 case IMGFMT_I420: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
284 case IMGFMT_IYUV: |
5567 | 285 case IMGFMT_YUY2: |
286 break; | |
7708 | 287 case IMGFMT_UYVY: |
288 in_voodoo_format = VOODOO_BLT_FORMAT_UYVY; | |
289 break; | |
5567 | 290 case IMGFMT_BGR16: |
291 in_voodoo_format = VOODOO_BLT_FORMAT_16; | |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
292 alpha_func = vo_draw_alpha_rgb16; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
293 break; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
294 |
5567 | 295 case IMGFMT_BGR24: |
296 in_depth = 3; | |
297 in_voodoo_format = VOODOO_BLT_FORMAT_24; | |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
298 alpha_func = vo_draw_alpha_rgb24; |
5567 | 299 break; |
300 | |
301 case IMGFMT_BGR32: | |
302 in_depth = 4; | |
303 in_voodoo_format = VOODOO_BLT_FORMAT_32; | |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
304 alpha_func = vo_draw_alpha_rgb32; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
305 break; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
306 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
307 default: |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
308 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_SomethingIsWrongWithControl); |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
309 return -1; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
310 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
311 |
5567 | 312 in_voodoo_format |= in_width * in_depth; |
1979 | 313 |
7137
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
314 /* Linux lives in the first frame */ |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
315 if(vo_doublebuffering) { |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
316 vidpageoffset = screenwidth * screenheight * screendepth; |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
317 hidpageoffset = vidpageoffset + screenwidth * screenheight * screendepth; |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
318 } else |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
319 vidpageoffset = hidpageoffset = 0; /* Console background */ |
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
320 |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
321 |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
322 inpageoffset = hidpageoffset + screenwidth * screenheight * screendepth; |
1979 | 323 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
324 if(inpageoffset + in_width * in_depth * in_height > fb_finfo.smem_len) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
325 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_NotEnoughVideoMemoryToPlay); |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
326 return -1; |
1979 | 327 } |
328 | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
329 vidpage = (void *)memBase1 + (unsigned long)vidpageoffset; |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
330 hidpage = (void *)memBase1 + (unsigned long)hidpageoffset; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
331 inpage = (void *)memBase1 + (unsigned long)inpageoffset; |
1979 | 332 |
5590 | 333 setup_screen(flags & VOFLAG_FULLSCREEN); |
5567 | 334 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
335 memset(inpage, 0, in_width * in_height * in_depth); |
1979 | 336 |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
337 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXFB_ScreenIs, |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
338 screenwidth, screenheight, screendepth * 8, |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
339 in_width, in_height, in_depth * 8, |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
340 d_width, d_height); |
1979 | 341 |
342 return 0; | |
343 } | |
344 | |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
345 /* Double-buffering draw_alpha */ |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
346 static void draw_alpha_double(int x, int y, int w, int h, unsigned char *src, |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
347 unsigned char *srca, int stride) |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
348 { |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
349 char *dst = (char *)vidpage + ((y + vidy) * screenwidth + x + vidx) * screendepth; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
350 alpha_func_double(w, h, src, srca, stride, dst, screenwidth * screendepth); |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
351 } |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
352 |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
353 /* Single-buffering draw_alpha */ |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
354 static void draw_alpha(int x, int y, int w, int h, unsigned char *src, |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
355 unsigned char *srca, int stride) |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
356 { |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
357 char *dst = (char *)inpage + (y * in_width + x) * in_depth; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
358 alpha_func(w, h, src, srca, stride, dst, in_width * in_depth); |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
359 } |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
360 |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
361 static void draw_osd(void) |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
362 { |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
363 if(!vo_doublebuffering) |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
364 vo_draw_text(in_width, in_height, draw_alpha); |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
365 } |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
366 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
367 /* Render onto the screen */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
368 static void flip_page(void) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
369 { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
370 voodoo_2d_reg regs = *reg_2d; /* Copy the regs */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
371 int i = 0; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
372 |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
373 if(vo_doublebuffering) { |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
374 /* Flip to an offscreen buffer for rendering */ |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
375 uint32_t t = vidpageoffset; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
376 void *j = vidpage; |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
377 |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
378 vidpage = hidpage; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
379 hidpage = j; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
380 vidpageoffset = hidpageoffset; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
381 hidpageoffset = t; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
382 } |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
383 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
384 reg_2d->commandExtra = 0; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
385 reg_2d->clip0Min = 0; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
386 reg_2d->clip0Max = 0xffffffff; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
387 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
388 reg_2d->srcBaseAddr = inpageoffset; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
389 reg_2d->srcXY = 0; |
5567 | 390 reg_2d->srcFormat = in_voodoo_format; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
391 reg_2d->srcSize = XYREG(in_width, in_height); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
392 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
393 reg_2d->dstBaseAddr = vidpageoffset; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
394 reg_2d->dstXY = XYREG(vidx, vidy); |
5567 | 395 reg_2d->dstFormat = vid_voodoo_format; |
7137
9a44c38d388c
Fixed some breakages of single-buffer rendering of tdfx
mark
parents:
7124
diff
changeset
|
396 reg_2d->dstSize = XYREG(vidwidth, vidheight); |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
397 reg_2d->command = S2S_STRECH_BLT | S2S_IMMED | S2S_ROP; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
398 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
399 /* Wait for the command to finish (If we don't do this, we get wierd |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
400 * sound corruption... */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
401 while((reg_IO->status & 0x1f) < 1) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
402 /* Wait */; |
1979 | 403 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
404 *((volatile uint32_t *)((uint32_t *)reg_IO + COMMAND_3D)) = COMMAND_3D_NOP; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
405 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
406 while(i < 3) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
407 if(!(reg_IO->status & STATUS_BUSY)) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
408 i++; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
409 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
410 /* Restore the old regs now */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
411 reg_2d->commandExtra = regs.commandExtra; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
412 reg_2d->clip0Min = regs.clip0Min; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
413 reg_2d->clip0Max = regs.clip0Max; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
414 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
415 reg_2d->srcBaseAddr = regs.srcBaseAddr; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
416 reg_2d->srcXY = regs.srcXY; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
417 reg_2d->srcFormat = regs.srcFormat; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
418 reg_2d->srcSize = regs.srcSize; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
419 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
420 reg_2d->dstBaseAddr = regs.dstBaseAddr; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
421 reg_2d->dstXY = regs.dstXY; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
422 reg_2d->dstFormat = regs.dstFormat; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
423 reg_2d->dstSize = regs.dstSize; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
424 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
425 reg_2d->command = 0; |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
426 |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
427 /* Render any text onto this buffer */ |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
428 if(vo_doublebuffering) |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
429 vo_draw_text(vidwidth, vidheight, draw_alpha_double); |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
430 |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
431 /* And flip to the new buffer! */ |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
432 reg_IO->vidDesktopStartAddr = vidpageoffset; |
1979 | 433 } |
434 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
11261
diff
changeset
|
435 static int draw_frame(uint8_t *src[]) |
1979 | 436 { |
5567 | 437 mem2agpcpy(inpage, src[0], in_width * in_depth * in_height); |
1979 | 438 return 0; |
439 } | |
440 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
11261
diff
changeset
|
441 static int draw_slice(uint8_t *i[], int s[], int w, int h, int x, int y) |
1979 | 442 { |
5567 | 443 /* We want to render to the YUV to the input page + the location |
444 * of the stripes we're doing */ | |
445 reg_YUV->yuvBaseAddr = inpageoffset + in_width * in_depth * y + x; | |
446 reg_YUV->yuvStride = in_width * in_depth; | |
1979 | 447 |
5567 | 448 /* Put the YUV channels into the voodoos internal combiner unit |
449 * thingie */ | |
450 mem2agpcpy_pic(YUV->Y, i[0], s[0], h , YUV_STRIDE, s[0]); | |
451 mem2agpcpy_pic(YUV->U, i[1], s[1], h / 2, YUV_STRIDE, s[1]); | |
452 mem2agpcpy_pic(YUV->V, i[2], s[2], h / 2, YUV_STRIDE, s[2]); | |
1979 | 453 return 0; |
454 } | |
455 | |
5590 | 456 /* Attempt to start doing DR */ |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
457 static uint32_t get_image(mp_image_t *mpi) |
1979 | 458 { |
2350 | 459 |
7708 | 460 if(mpi->flags & MP_IMGFLAG_READABLE) |
461 return VO_FALSE; | |
462 if(mpi->type == MP_IMGTYPE_STATIC && vo_doublebuffering) | |
463 return VO_FALSE; | |
464 if(mpi->type > MP_IMGTYPE_TEMP) | |
465 return VO_FALSE; // TODO ?? | |
2350 | 466 |
5567 | 467 switch(in_format) { |
468 case IMGFMT_YUY2: | |
469 case IMGFMT_BGR16: | |
470 case IMGFMT_BGR24: | |
471 case IMGFMT_BGR32: | |
7708 | 472 case IMGFMT_UYVY: |
5567 | 473 mpi->planes[0] = (char *)inpage; |
474 mpi->stride[0] = in_width * in_depth; | |
475 break; | |
476 | |
477 case IMGFMT_YV12: | |
478 case IMGFMT_I420: | |
479 case IMGFMT_IYUV: | |
7708 | 480 if(!(mpi->flags & MP_IMGFLAG_ACCEPT_STRIDE) && mpi->w != YUV_STRIDE) |
481 return VO_FALSE; | |
5567 | 482 mpi->planes[0] = YUV->Y; |
483 mpi->planes[1] = YUV->U; | |
484 mpi->planes[2] = YUV->V; | |
485 mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = YUV_STRIDE; | |
7708 | 486 reg_YUV->yuvBaseAddr = inpageoffset; |
487 reg_YUV->yuvStride = in_width * in_depth; | |
5567 | 488 break; |
2350 | 489 |
5567 | 490 default: |
491 return VO_FALSE; | |
492 } | |
493 | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
494 mpi->width = in_width; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
495 mpi->flags |= MP_IMGFLAG_DIRECT; |
1979 | 496 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
497 return VO_TRUE; |
4352 | 498 } |
1979 | 499 |
33305
ddb45e9443ec
Remove the variable arguments from the libvo control() functions.
iive
parents:
32467
diff
changeset
|
500 static int control(uint32_t request, void *data) |
4352 | 501 { |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
502 switch(request) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
503 case VOCTRL_GET_IMAGE: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
504 return get_image(data); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
505 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
506 case VOCTRL_QUERY_FORMAT: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
507 switch(*((uint32_t*)data)) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
508 case IMGFMT_YV12: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
509 case IMGFMT_I420: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
510 case IMGFMT_IYUV: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
511 case IMGFMT_YUY2: |
7708 | 512 case IMGFMT_UYVY: |
5567 | 513 case IMGFMT_BGR16: |
514 case IMGFMT_BGR24: | |
515 case IMGFMT_BGR32: | |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
516 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
517 VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
518 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
519 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
520 return 0; /* Not supported */ |
5567 | 521 |
522 case VOCTRL_FULLSCREEN: | |
7708 | 523 setup_screen(!vo_fs); |
5590 | 524 return 0; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
525 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
526 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
527 return VO_NOTIMPL; |
4352 | 528 } |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
529 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
530 /* Dummy funcs */ |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
531 static void check_events(void) {} |