Mercurial > mplayer.hg
annotate libvo/vo_tdfxfb.c @ 6977:7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
author | pontscho |
---|---|
date | Sun, 11 Aug 2002 19:12:09 +0000 |
parents | 1972c3475d93 |
children | 3c84ee5e7da1 |
rev | line source |
---|---|
5567 | 1 /* Copyright (C) Mark Zealey, 2002, <mark@zealos.org>. Released under the terms |
2 * and conditions of the GPL. | |
1979 | 3 * |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
4 * 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
|
5 * 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
|
6 * 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
|
7 * 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
|
8 * I made. |
5567 | 9 * 09/04/02: Fixed a problem with changing the variables passed to draw_slice(). |
10 * Fixed DR support for YV12 et al. Added BGR support. Removed lots of dud code. | |
11 * 10/04/02: Changed the memcpy functions to mem2agpcpy.. should be a tad | |
12 * faster. | |
13 * 11/04/02: Added a compile option so you can watch the film with the console | |
14 * as the background, or not. | |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
15 * 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
|
16 * buffer. Added double-buffering. Supports hardware zoom/reduce zoom modes. |
5590 | 17 * 13/04/02: Misc cleanups of the code. |
1979 | 18 * |
5567 | 19 * Hints and tricks: |
20 * - Use -dr to get direct rendering | |
21 * - Use -vop 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
|
22 * - 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
|
23 * - 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
|
24 * - The driver supports both scaling and shrinking the image using the -x and |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
25 * -y options on the mplayer commandline. |
1979 | 26 */ |
27 | |
28 #include <stdio.h> | |
29 #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
|
30 #include <errno.h> |
5567 | 31 #include <sys/ioctl.h> |
32 #include <fcntl.h> | |
33 #include <sys/mman.h> | |
34 #include <linux/fb.h> | |
1979 | 35 |
36 #include "config.h" | |
5567 | 37 #include "fastmemcpy.h" |
1979 | 38 #include "video_out.h" |
39 #include "video_out_internal.h" | |
5567 | 40 #include "drivers/3dfx.h" |
1979 | 41 |
42 LIBVO_EXTERN(tdfxfb) | |
43 | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
44 static vo_info_t vo_info = |
1979 | 45 { |
5567 | 46 "3Dfx Banshee/Voodoo3/Voodoo5", |
1979 | 47 "tdfxfb", |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
48 "Mark Zealey <mark@zealos.org>" |
1979 | 49 "" |
50 }; | |
51 | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
52 /* Some registers on the card */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
53 #define S2S_STRECH_BLT 2 // BLT + Strech |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
54 #define S2S_IMMED (1 << 8) // Do it immediatly |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
55 #define S2S_ROP (0xCC << 24) // ??? |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
56 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
57 /* Stepping between the different YUV plane registers */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
58 #define YUV_STRIDE 1024 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
59 struct YUV_plane { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
60 char Y[0x0100000]; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
61 char U[0x0100000]; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
62 char V[0x0100000]; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
63 }; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
64 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
65 static int fd; |
1979 | 66 static struct fb_fix_screeninfo fb_finfo; |
67 static struct fb_var_screeninfo fb_vinfo; | |
5567 | 68 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
|
69 screenwidth, screenheight, screendepth, vidwidth, vidheight, vidx, vidy, |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
70 vid_voodoo_format, *vidpage, *hidpage, *inpage, vidpageoffset, |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
71 hidpageoffset, inpageoffset, *memBase0, *memBase1, fs, r_width, r_height; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
72 static volatile voodoo_io_reg *reg_IO; |
1979 | 73 static voodoo_2d_reg *reg_2d; |
74 static voodoo_yuv_reg *reg_YUV; | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
75 static struct YUV_plane *YUV; |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
76 static void (*alpha_func)(), (*alpha_func_double)(); |
1979 | 77 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
78 static uint32_t preinit(const char *arg) |
1979 | 79 { |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
80 char *name; |
1979 | 81 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
82 if(!(name = getenv("FRAMEBUFFER"))) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
83 name = "/dev/fb0"; |
1979 | 84 |
5567 | 85 if((fd = open(name, O_RDWR)) == -1) { |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
86 printf("tdfxfb: can't open %s: %s\n", name, strerror(errno)); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
87 return -1; |
1979 | 88 } |
89 | |
5567 | 90 if(ioctl(fd, FBIOGET_FSCREENINFO, &fb_finfo)) { |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
91 printf("tdfxfb: problem with FBITGET_FSCREENINFO ioctl: %s\n", |
1979 | 92 strerror(errno)); |
93 return -1; | |
94 } | |
95 | |
5567 | 96 if(ioctl(fd, FBIOGET_VSCREENINFO, &fb_vinfo)) { |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
97 printf("tdfxfb: problem with FBITGET_VSCREENINFO ioctl: %s\n", |
1979 | 98 strerror(errno)); |
99 return -1; | |
100 } | |
101 | |
5567 | 102 /* BANSHEE means any of the series aparently */ |
103 if (fb_finfo.accel != FB_ACCEL_3DFX_BANSHEE) { | |
104 printf("tdfxfb: This driver is only supports the 3Dfx Banshee," | |
105 " Voodoo3 and Voodoo 5\n"); | |
106 return -1; | |
1979 | 107 } |
108 | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
109 /* Open up a window to the hardware */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
110 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
|
111 MAP_SHARED, fd, 0); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
112 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
|
113 MAP_SHARED, fd, fb_finfo.smem_len); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
114 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
115 if((long)memBase0 == -1 || (long)memBase1 == -1) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
116 printf("tdfxfb: Couldn't map memory areas: %s\n", strerror(errno)); |
1979 | 117 return -1; |
118 } | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
119 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
120 /* Set up global pointers to the voodoo's regs */ |
5567 | 121 reg_IO = (void *)memBase0 + VOODOO_IO_REG_OFFSET; |
122 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
|
123 reg_YUV = (void *)memBase0 + VOODOO_YUV_REG_OFFSET; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
124 YUV = (void *)memBase0 + VOODOO_YUV_PLANE_OFFSET; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
125 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
126 return 0; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
127 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
128 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
129 static void uninit(void) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
130 { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
131 if(reg_IO) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
132 /* Restore the screen (Linux lives at 0) */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
133 reg_IO->vidDesktopStartAddr = 0; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
134 reg_IO = NULL; |
1979 | 135 } |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
136 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
137 /* And close our mess */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
138 if(memBase1) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
139 munmap(memBase1, fb_finfo.smem_len); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
140 memBase1 = NULL; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
141 } |
1979 | 142 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
143 if(memBase0) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
144 munmap(memBase0, fb_finfo.mmio_len); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
145 memBase0 = NULL; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
146 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
147 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
148 if(fd != -1) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
149 close(fd); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
150 fd = -1; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
151 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
152 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
153 |
5567 | 154 static void clear_screen() |
155 { | |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
156 if(vo_doublebuffering) { |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
157 memset(vidpage, 0, screenwidth * screenheight * screendepth); |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
158 memset(hidpage, 0, screenwidth * screenheight * screendepth); |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
159 } |
5567 | 160 } |
161 | |
162 /* Setup output screen dimensions etc */ | |
5590 | 163 static void setup_screen(uint32_t full) |
5567 | 164 { |
5590 | 165 fs = full; |
166 | |
167 if(fs) { /* Full screen */ | |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
168 double ratio = (double)in_width / in_height; |
5567 | 169 vidwidth = screenwidth; |
170 vidheight = screenheight; | |
171 | |
172 if(screenwidth / ratio <= screenheight) | |
173 vidheight = (double)screenwidth / ratio; | |
174 else | |
175 vidwidth = (double)screenheight * ratio; | |
176 | |
177 vidx = (screenwidth - vidwidth) / 2; | |
178 vidy = (screenheight - vidheight) / 2; | |
179 } else { /* Reset to normal size */ | |
5590 | 180 if(r_width > screenwidth || r_height > screenheight) |
181 printf("tdfxfb: your resolution is too small to display " | |
182 "the whole movie...\n"); | |
5567 | 183 |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
184 vidwidth = r_width; |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
185 vidheight = r_height; |
5590 | 186 vidx = vidy = 0; |
5567 | 187 } |
188 | |
189 clear_screen(); | |
190 } | |
191 | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
192 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, |
5590 | 193 uint32_t flags, char *title, uint32_t format, const vo_tune_info_t *info) |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
194 { |
1979 | 195 screenwidth = fb_vinfo.xres; |
196 screenheight = fb_vinfo.yres; | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
197 |
1979 | 198 in_width = width; |
199 in_height = height; | |
200 in_format = format; | |
201 | |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
202 r_width = d_width; |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
203 r_height = d_height; |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
204 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
205 /* Setup the screen for rendering to */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
206 switch(fb_vinfo.bits_per_pixel) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
207 case 16: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
208 screendepth = 2; |
5567 | 209 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
|
210 alpha_func_double = vo_draw_alpha_rgb16; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
211 break; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
212 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
213 case 24: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
214 screendepth = 3; |
5567 | 215 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
|
216 alpha_func_double = vo_draw_alpha_rgb24; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
217 break; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
218 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
219 case 32: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
220 screendepth = 4; |
5567 | 221 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
|
222 alpha_func_double = vo_draw_alpha_rgb32; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
223 break; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
224 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
225 default: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
226 printf("tdfxfb: %d bpp output is not supported\n", fb_vinfo.bits_per_pixel); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
227 return -1; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
228 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
229 |
5567 | 230 vid_voodoo_format |= screenwidth * screendepth; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
231 |
5567 | 232 /* Some defaults here */ |
233 in_voodoo_format = VOODOO_BLT_FORMAT_YUYV; | |
234 in_depth = 2; | |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
235 alpha_func = vo_draw_alpha_yuy2; |
5567 | 236 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
237 switch(in_format) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
238 case IMGFMT_YV12: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
239 case IMGFMT_I420: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
240 case IMGFMT_IYUV: |
5567 | 241 case IMGFMT_YUY2: |
242 break; | |
243 | |
244 case IMGFMT_BGR16: | |
245 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
|
246 alpha_func = vo_draw_alpha_rgb16; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
247 break; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
248 |
5567 | 249 case IMGFMT_BGR24: |
250 in_depth = 3; | |
251 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
|
252 alpha_func = vo_draw_alpha_rgb24; |
5567 | 253 break; |
254 | |
255 case IMGFMT_BGR32: | |
256 in_depth = 4; | |
257 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
|
258 alpha_func = vo_draw_alpha_rgb32; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
259 break; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
260 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
261 default: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
262 printf("tdfxfb: Eik! Something's wrong with control().\n"); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
263 return -1; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
264 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
265 |
5567 | 266 in_voodoo_format |= in_width * in_depth; |
1979 | 267 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
268 /* Linux lives in the first frame */ |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
269 if(vo_doublebuffering) { |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
270 vidpageoffset = screenwidth * screenheight * screendepth; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
271 hidpageoffset = vidpageoffset + screenwidth * screenheight * screendepth; |
5590 | 272 } else |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
273 vidpageoffset = hidpageoffset = 0; /* Console background */ |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
274 |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
275 inpageoffset = hidpageoffset + screenwidth * screenheight * screendepth; |
1979 | 276 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
277 if(inpageoffset + in_width * in_depth * in_height > fb_finfo.smem_len) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
278 printf("tdfxfb: Not enough video memory to play this movie. Try at a lower resolution\n"); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
279 return -1; |
1979 | 280 } |
281 | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
282 vidpage = (void *)memBase1 + (unsigned long)vidpageoffset; |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
283 hidpage = (void *)memBase1 + (unsigned long)hidpageoffset; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
284 inpage = (void *)memBase1 + (unsigned long)inpageoffset; |
1979 | 285 |
5590 | 286 setup_screen(flags & VOFLAG_FULLSCREEN); |
5567 | 287 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
288 memset(inpage, 0, in_width * in_height * in_depth); |
1979 | 289 |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
290 printf("tdfxfb: screen is %dx%d at %d bpp, in is %dx%d at %d bpp, norm is %dx%d\n", |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
291 screenwidth, screenheight, screendepth * 8, |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
292 in_width, in_height, in_depth * 8, |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
293 d_width, d_height); |
1979 | 294 |
295 return 0; | |
296 } | |
297 | |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
298 /* Double-buffering draw_alpha */ |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
299 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
|
300 unsigned char *srca, int stride) |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
301 { |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
302 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
|
303 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
|
304 } |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
305 |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
306 /* Single-buffering draw_alpha */ |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
307 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
|
308 unsigned char *srca, int stride) |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
309 { |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
310 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
|
311 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
|
312 } |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
313 |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
314 static void draw_osd(void) |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
315 { |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
316 if(!vo_doublebuffering) |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
317 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
|
318 } |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
319 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
320 /* Render onto the screen */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
321 static void flip_page(void) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
322 { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
323 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
|
324 int i = 0; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
325 |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
326 if(vo_doublebuffering) { |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
327 /* 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
|
328 uint32_t t = vidpageoffset; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
329 void *j = vidpage; |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
330 |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
331 vidpage = hidpage; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
332 hidpage = j; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
333 vidpageoffset = hidpageoffset; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
334 hidpageoffset = t; |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
335 } |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
336 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
337 reg_2d->commandExtra = 0; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
338 reg_2d->clip0Min = 0; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
339 reg_2d->clip0Max = 0xffffffff; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
340 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
341 reg_2d->srcBaseAddr = inpageoffset; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
342 reg_2d->srcXY = 0; |
5567 | 343 reg_2d->srcFormat = in_voodoo_format; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
344 reg_2d->srcSize = XYREG(in_width, in_height); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
345 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
346 reg_2d->dstBaseAddr = vidpageoffset; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
347 reg_2d->dstXY = XYREG(vidx, vidy); |
5567 | 348 reg_2d->dstFormat = vid_voodoo_format; |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
349 reg_2d->dstSize = XYREG(vidwidth, vidheight); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
350 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
|
351 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
352 /* 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
|
353 * sound corruption... */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
354 while((reg_IO->status & 0x1f) < 1) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
355 /* Wait */; |
1979 | 356 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
357 *((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
|
358 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
359 while(i < 3) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
360 if(!(reg_IO->status & STATUS_BUSY)) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
361 i++; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
362 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
363 /* Restore the old regs now */ |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
364 reg_2d->commandExtra = regs.commandExtra; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
365 reg_2d->clip0Min = regs.clip0Min; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
366 reg_2d->clip0Max = regs.clip0Max; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
367 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
368 reg_2d->srcBaseAddr = regs.srcBaseAddr; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
369 reg_2d->srcXY = regs.srcXY; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
370 reg_2d->srcFormat = regs.srcFormat; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
371 reg_2d->srcSize = regs.srcSize; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
372 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
373 reg_2d->dstBaseAddr = regs.dstBaseAddr; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
374 reg_2d->dstXY = regs.dstXY; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
375 reg_2d->dstFormat = regs.dstFormat; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
376 reg_2d->dstSize = regs.dstSize; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
377 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
378 reg_2d->command = 0; |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
379 |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
380 /* 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
|
381 if(vo_doublebuffering) |
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
382 vo_draw_text(vidwidth, vidheight, draw_alpha_double); |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
383 |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
384 /* And flip to the new buffer! */ |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
385 reg_IO->vidDesktopStartAddr = vidpageoffset; |
1979 | 386 } |
387 | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
388 static uint32_t draw_frame(uint8_t *src[]) |
1979 | 389 { |
5567 | 390 mem2agpcpy(inpage, src[0], in_width * in_depth * in_height); |
1979 | 391 return 0; |
392 } | |
393 | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
394 static uint32_t draw_slice(uint8_t *i[], int s[], int w, int h, int x, int y) |
1979 | 395 { |
5567 | 396 /* We want to render to the YUV to the input page + the location |
397 * of the stripes we're doing */ | |
398 reg_YUV->yuvBaseAddr = inpageoffset + in_width * in_depth * y + x; | |
399 reg_YUV->yuvStride = in_width * in_depth; | |
1979 | 400 |
5567 | 401 /* Put the YUV channels into the voodoos internal combiner unit |
402 * thingie */ | |
403 mem2agpcpy_pic(YUV->Y, i[0], s[0], h , YUV_STRIDE, s[0]); | |
404 mem2agpcpy_pic(YUV->U, i[1], s[1], h / 2, YUV_STRIDE, s[1]); | |
405 mem2agpcpy_pic(YUV->V, i[2], s[2], h / 2, YUV_STRIDE, s[2]); | |
1979 | 406 return 0; |
407 } | |
408 | |
5590 | 409 /* Attempt to start doing DR */ |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
410 static uint32_t get_image(mp_image_t *mpi) |
1979 | 411 { |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
412 static int enabled = 0; |
2350 | 413 |
5590 | 414 if(!enabled && mpi->flags & MP_IMGFLAG_READABLE) /* slow video ram */ |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
415 return VO_FALSE; |
2350 | 416 |
5567 | 417 switch(in_format) { |
418 case IMGFMT_YUY2: | |
419 case IMGFMT_BGR16: | |
420 case IMGFMT_BGR24: | |
421 case IMGFMT_BGR32: | |
422 mpi->planes[0] = (char *)inpage; | |
423 mpi->stride[0] = in_width * in_depth; | |
424 break; | |
425 | |
426 case IMGFMT_YV12: | |
427 case IMGFMT_I420: | |
428 case IMGFMT_IYUV: | |
429 if(!enabled) | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
430 if(!(mpi->flags & MP_IMGFLAG_ACCEPT_STRIDE)) |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
431 return VO_FALSE; |
2350 | 432 |
5567 | 433 mpi->planes[0] = YUV->Y; |
434 mpi->planes[1] = YUV->U; | |
435 mpi->planes[2] = YUV->V; | |
436 mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = YUV_STRIDE; | |
437 break; | |
2350 | 438 |
5567 | 439 default: |
440 return VO_FALSE; | |
441 } | |
442 | |
443 if(!enabled) { | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
444 printf("tdfxfb: get_image() SUCCESS -> Direct Rendering ENABLED\n"); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
445 enabled = 1; |
2350 | 446 } |
447 | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
448 mpi->width = in_width; |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
449 mpi->flags |= MP_IMGFLAG_DIRECT; |
1979 | 450 |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
451 return VO_TRUE; |
4352 | 452 } |
1979 | 453 |
4596 | 454 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 455 { |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
456 switch(request) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
457 case VOCTRL_GET_IMAGE: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
458 return get_image(data); |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
459 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
460 case VOCTRL_QUERY_FORMAT: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
461 switch(*((uint32_t*)data)) { |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
462 case IMGFMT_YV12: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
463 case IMGFMT_I420: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
464 case IMGFMT_IYUV: |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
465 case IMGFMT_YUY2: |
5567 | 466 case IMGFMT_BGR16: |
467 case IMGFMT_BGR24: | |
468 case IMGFMT_BGR32: | |
5579
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
469 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | |
2250b6ad5ad9
Some OSD and other random fixes. Added double buffering
mark
parents:
5567
diff
changeset
|
470 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
|
471 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
472 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
473 return 0; /* Not supported */ |
5567 | 474 |
475 case VOCTRL_FULLSCREEN: | |
5590 | 476 setup_screen(!fs); |
477 return 0; | |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
478 } |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
479 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
480 return VO_NOTIMPL; |
4352 | 481 } |
5540
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
482 |
80d8fed6e683
new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents:
4737
diff
changeset
|
483 /* Dummy funcs */ |
5580
6366586083bb
Added support for choosing weather to use double-buffering or single buffering
mark
parents:
5579
diff
changeset
|
484 static void check_events(void) {} |
5567 | 485 static const vo_info_t* get_info(void) { return &vo_info; } |